lakeFS
lakeFS copied to clipboard
Provide an easy command for "Rollback to commit"
Current Status We have 2 commands that can be used to achieve rollback to a last known good commit.
- Reset: Undo changes in staging (Can be filtered by all/prefix/object).
- Revert: Given a commit, record a new commit to reverse the effect of this commit.
If a user simply wants to move the HEAD of the branch to a specific commit, she needs to first revert uncommitted, then traverse the tree (in the right reversed order!) and apply revert on all commits along the way (and account for merges, which are trickier).
Desired Status
lakectl branch rollback lakefs://example-repo/example-branch <commithash>
will clear the staging area of example-branch
and point the HEAD of it to <commithash>
.
- Concern: Some commits are now dangling and hard to find if the user mistakenly used this command.
Possible solution: Use tags, tag the previous HEAD of
example-branch
withexample-branch-rollback-<time>
, so that it's easier to undo such operations. Commits are still dangling and could be picked up by retention (with garbage collection rules), but that is expected and the grace period for such actions is determined by the user.
Agree the functionality is important - having a way to force my branch state to a specific point in time. Regarding the terminology, it looks like reset hard or specific flag in rollback so the user will understand that this time commits can be "lost".
I Agree, We must have this functionality. We should be careful with erasing staging though, It can't be restored. Maybe something like requiring some approval in case staging isn't empty or using a dedicated flag.
I think we have the correct data model to structure this nicely.
Here's a suggestion:
- Add a reflog, so the action is reversible (#2321) - this is already something we agreed was a good idea anyway
- Add the ability to "stash" the set of staged changes - since they are already decoupled from the branch pointer using a staging token, this should be easy (famous last words, I know..)
- allow changing the branch pointer to any commit hash or ref the user desires, as long as they are no staged changes.. if stashing/unstashing is O(1), I think this makes sense.
The benefit is that with these 3 steps, it becomes reversible. I can stash my changes, rollback, and then undo both by rolling-forward (?) to the original newer commit, and then un-stashing the staged changes.
Edit: Since rollback
doesn't fit the functionality (i.e. I can move the branch pointer either forward or sideways, to commits the branch was never at, perhaps we need a more descriptive name for this)
Absolutely needed functionality.
I strongly suggest not introducing the term "rollback". I would add this to the reset
command and require a --hard
flag - similar to git.
This issue is now marked as stale after 90 days of inactivity, and will be closed soon. To keep it, mark it with the "no stale" label.
@N-o-Z notice this issue
@N-o-Z notice this issue
Lol, good catch of the new workflow 😂
This issue is now marked as stale after 90 days of inactivity, and will be closed soon. To keep it, mark it with the "no stale" label.