remove vm copy context detection hack
stack tracing is slow.
This commit is contained in:
parent
2b03316cd9
commit
6f58fdcb22
@ -5,8 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@ -246,17 +244,14 @@ func (s *SplitStore) Has(c cid.Cid) (bool, error) {
|
|||||||
// -- the vm uses this check to avoid duplicate writes on Copy.
|
// -- the vm uses this check to avoid duplicate writes on Copy.
|
||||||
// When we have options in the API (or something better), the vm can explicitly signal
|
// When we have options in the API (or something better), the vm can explicitly signal
|
||||||
// that this is an implicit Write.
|
// that this is an implicit Write.
|
||||||
vmCtx := s.isVMCopyContext()
|
s.trackWrite(c)
|
||||||
if vmCtx {
|
|
||||||
s.trackWrite(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// also make sure the object is considered live during compaction in case we have already
|
// also make sure the object is considered live during compaction in case we have already
|
||||||
// flushed pending writes and started compaction.
|
// flushed pending writes and started compaction.
|
||||||
// when within vm copy context, dags will be recursively referenced.
|
// when within vm copy context, dags will be recursively referenced.
|
||||||
// in case of a race with purge, this will return a track error, which we can use to
|
// in case of a race with purge, this will return a track error, which we can use to
|
||||||
// signal to the vm that the object is not fully present.
|
// signal to the vm that the object is not fully present.
|
||||||
err = s.trackTxnRef(c, vmCtx)
|
err = s.trackTxnRef(c, true)
|
||||||
if xerrors.Is(err, errMissingObject) {
|
if xerrors.Is(err, errMissingObject) {
|
||||||
// we failed to recursively protect the object because some inner object has been purged;
|
// we failed to recursively protect the object because some inner object has been purged;
|
||||||
// signal to the VM to copy.
|
// signal to the VM to copy.
|
||||||
@ -631,11 +626,6 @@ func (s *SplitStore) flushPendingWrites(locked bool) {
|
|||||||
s.debug.LogWriteMany(s.curTs, cids, epoch)
|
s.debug.LogWriteMany(s.curTs, cids, epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SplitStore) isVMCopyContext() bool {
|
|
||||||
sk := string(debug.Stack())
|
|
||||||
return strings.Contains(sk, "filecoin-project/lotus/chain/vm.Copy")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SplitStore) trackTxnRef(c cid.Cid, recursive bool) error {
|
func (s *SplitStore) trackTxnRef(c cid.Cid, recursive bool) error {
|
||||||
if s.txnProtect == nil {
|
if s.txnProtect == nil {
|
||||||
// not compacting
|
// not compacting
|
||||||
|
Loading…
Reference in New Issue
Block a user