Skip to content

Commit

Permalink
chore: debug failed action
Browse files Browse the repository at this point in the history
  • Loading branch information
will@2012 committed Jun 19, 2024
1 parent 6f666bd commit c7849cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion internal/build/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands")
// MustRun executes the given command and exits the host process for
// any error.
func MustRun(cmd *exec.Cmd) {
fmt.Println(">>>", printArgs(cmd.Args))
fmt.Println("start_cmd >>>", printArgs(cmd.Args))
if !*DryRunFlag {
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
fmt.Println("return_err >>>", err)
log.Fatal(err)
}
}
Expand Down
52 changes: 26 additions & 26 deletions trie/triedb/pathdb/difflayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,32 +256,32 @@ func (dl *diffLayer) node(owner common.Hash, path []byte, hash common.Hash, dept
// Node implements the layer interface, retrieving the trie node blob with the
// provided node information. No error will be returned if the node is not found.
func (dl *diffLayer) Node(owner common.Hash, path []byte, hash common.Hash) ([]byte, error) {
if n := dl.cache.Get(hash); n != nil {
// The query from the hash map is fastpath,
// avoiding recursive query of 128 difflayers.
diffHashCacheHitMeter.Mark(1)
diffHashCacheReadMeter.Mark(int64(len(n.Blob)))
return n.Blob, nil
}
diffHashCacheMissMeter.Mark(1)

persistLayer := dl.originDiskLayer()
if persistLayer != nil {
blob, err := persistLayer.Node(owner, path, hash)
if err != nil {
// This is a bad case with a very low probability.
// r/w the difflayer cache and r/w the disklayer are not in the same lock,
// so in extreme cases, both reading the difflayer cache and reading the disklayer may fail, eg, disklayer is stale.
// In this case, fallback to the original 128-layer recursive difflayer query path.
diffHashCacheSlowPathMeter.Mark(1)
log.Debug("Retry difflayer due to query origin failed", "owner", owner, "path", path, "hash", hash.String(), "error", err)
return dl.node(owner, path, hash, 0)
} else { // This is the fastpath.
return blob, nil
}
}
diffHashCacheSlowPathMeter.Mark(1)
log.Debug("Retry difflayer due to origin is nil", "owner", owner, "path", path, "hash", hash.String())
//if n := dl.cache.Get(hash); n != nil {
// // The query from the hash map is fastpath,
// // avoiding recursive query of 128 difflayers.
// diffHashCacheHitMeter.Mark(1)
// diffHashCacheReadMeter.Mark(int64(len(n.Blob)))
// return n.Blob, nil
//}
//diffHashCacheMissMeter.Mark(1)
//
//persistLayer := dl.originDiskLayer()
//if persistLayer != nil {
// blob, err := persistLayer.Node(owner, path, hash)
// if err != nil {
// // This is a bad case with a very low probability.
// // r/w the difflayer cache and r/w the disklayer are not in the same lock,
// // so in extreme cases, both reading the difflayer cache and reading the disklayer may fail, eg, disklayer is stale.
// // In this case, fallback to the original 128-layer recursive difflayer query path.
// diffHashCacheSlowPathMeter.Mark(1)
// log.Debug("Retry difflayer due to query origin failed", "owner", owner, "path", path, "hash", hash.String(), "error", err)
// return dl.node(owner, path, hash, 0)
// } else { // This is the fastpath.
// return blob, nil
// }
//}
//diffHashCacheSlowPathMeter.Mark(1)
//log.Debug("Retry difflayer due to origin is nil", "owner", owner, "path", path, "hash", hash.String())
return dl.node(owner, path, hash, 0)
}

Expand Down

0 comments on commit c7849cc

Please sign in to comment.