-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overlay-tree: allow resumable runs #233
Conversation
var ( | ||
dbKeyOverlayTransitionStarted = []byte("overlay-transition-started") | ||
dbKeyOverlayTransitionEnded = []byte("overlay-transition-ended") | ||
translatedRootPrefix = []byte("translated-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the db key prefix for saving the root translation table.
fdb.translatedRoots[fdb.translationIndex] = trans | ||
fdb.origRoots[fdb.translationIndex] = orig | ||
fdb.translationIndex = (fdb.translationIndex + 1) % len(fdb.translatedRoots) | ||
fdb.diskdb.Put(append(translatedRootPrefix, orig.Bytes()...), trans.Bytes()) | ||
log.Info("Saved translation", "originRoot", orig.Bytes(), "translatedRoot", trans.Bytes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of writing to the map, we save into the database.
I left an extra log-info since it can help a bit after when something doesn't work.
if err != nil { | ||
return common.Hash{} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically speaking, this is equivalent to before. If Get
returns err=leveldb.NotFound
it returns common.Hash{}
as before.
There's an extra border-case here if the err
is related to a disk error. Very low chance for now to care about, but that needs bubbling some error in the chain. Not sure if this code will stay for long, but we can properly handle and clean up after.
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
df2db38
to
9eec7ab
Compare
See #440 |
This PR attempts to collect all needed changes to allow to resume a run of an overlay tree chain importing:
started
andended
markers.The goal is to allow:
There's a reasonable chance that something else might be missing or needs to be fixed in this branch, since I've confirmed that as is it doesn't fully work reading the right snapshot on the second run.
Note that this PR is targeting
reenable-snapshots
as expected.