Skip to content
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

Provide an easy command for "Rollback to commit" #2343

Open
itaiad200 opened this issue Aug 10, 2021 · 8 comments
Open

Provide an easy command for "Rollback to commit" #2343

itaiad200 opened this issue Aug 10, 2021 · 8 comments
Labels
area/API Improvements or additions to the API area/lakectl Issues related to lakeFS' command line interface (lakectl) contributor good first issue Good for newcomers improvement no stale Using this label will prevent items from being marked as stale team/versioning-engine Team versioning engine

Comments

@itaiad200
Copy link
Contributor

Current Status
We have 2 commands that can be used to achieve rollback to a last known good commit.

  1. Reset: Undo changes in staging (Can be filtered by all/prefix/object).
  2. 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 with example-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.
@itaiad200 itaiad200 added area/API Improvements or additions to the API area/lakectl Issues related to lakeFS' command line interface (lakectl) improvement contributor labels Aug 10, 2021
@nopcoder
Copy link
Contributor

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".

@guy-har
Copy link
Contributor

guy-har commented Aug 10, 2021

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.

@ozkatz
Copy link
Collaborator

ozkatz commented Aug 10, 2021

I think we have the correct data model to structure this nicely.

Here's a suggestion:

  1. Add a reflog, so the action is reversible (lakectl reflog #2321) - this is already something we agreed was a good idea anyway
  2. 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..)
  3. 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)

@johnnyaug
Copy link
Contributor

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.

@nopcoder nopcoder added the team/versioning-engine Team versioning engine label Mar 16, 2022
Copy link

github-actions bot commented Nov 1, 2023

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.

@github-actions github-actions bot added the stale label Nov 1, 2023
@itaiad200
Copy link
Contributor Author

@N-o-Z notice this issue

@N-o-Z
Copy link
Member

N-o-Z commented Nov 2, 2023

@N-o-Z notice this issue

Lol, good catch of the new workflow 😂

Copy link

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.

@github-actions github-actions bot added the stale label Feb 12, 2024
@N-o-Z N-o-Z added no stale Using this label will prevent items from being marked as stale and removed stale labels Feb 12, 2024
@arielshaqed arielshaqed added the good first issue Good for newcomers label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API Improvements or additions to the API area/lakectl Issues related to lakeFS' command line interface (lakectl) contributor good first issue Good for newcomers improvement no stale Using this label will prevent items from being marked as stale team/versioning-engine Team versioning engine
Projects
None yet
Development

No branches or pull requests

7 participants