-
Notifications
You must be signed in to change notification settings - Fork 39
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
chop: offline event log truncation #165
Conversation
This code has now been tested successfully on fake ships, two comets, and my own planet Additionally, since chopping one's pier leaves a backup event log file behind (and pilots may indeed chop their piers multiple times throughout its life), we also had the idea to include an |
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 looks good to me.
e6dd08e
to
5657e7e
Compare
004b3b2
to
a3f5e32
Compare
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.
Thanks for churning this out so quickly. The overall work looks great, but I have a number of comments and questions on small details.
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 code is clear and makes sense. I've noted a few spots where we'll need more/better error handling:
Here's an example output @joemfb:
|
all comments addressed
chop
urbit chop <pier>
implements a simple, offline event log truncation1 tool.chop
gracefully stops the given pier (if running), backs up the current snapshot to<pier>/.urb/bhk
, makes sure a current snapshot exists (i.e., is fully written to disk inchk/*.bin
with no existing patch files), reads the metadata and the last event from the pier's event log, initializes a fresh event log in the<pier>/.urb/log/chop
directory, writes the metadata and last event from the original log into the fresh one, renames the original event log to<pier>/.urb/log/chop/data_<first>_<last>.mdb.bak
wherefirst
andlast
are the first and last event numbers from the event log, and exits.Pilots are then free to move, archive, or delete their
.bak
event log file, resume normal operation of their ship, and enjoy the many benefits of lowered disk pressure and any reductions in associated hosting costs.I've tested
chop
successfully on my own planet~mastyr-bottec
(multiple times), three different comets (all fresh), and multitudes of fake galaxies.Resolves #122.
Note:
knit
, which is the "undo" button forchop
, is being implemented in its own PR #184.Footnotes
https://roadmap.urbit.org/project/event-log-truncation ↩