-
-
Notifications
You must be signed in to change notification settings - Fork 555
Add plumbing command for manually creating commit #9142
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
Conversation
5ddcbf7
to
b18122e
Compare
@nicktobey DOLT
|
@coffeegoddd DOLT
|
… it work entirely at the filesystem level. This guarantees that an unauthenticated SQL user can't use the procedure to edit branches (whereas anyone with CLI access is assumed to already have filesystem (and thus admin) access anyway.)
da961f6
to
eedaa78
Compare
@nicktobey DOLT
|
…admin command that accesses the storage directly.
@nicktobey DOLT
|
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.
Looks like there is some dead code in there. Drop it and ship it!
// Thus, we must update the root hash before the command finishes, or else changes will not be persisted. | ||
type CreateCommitCmd struct{} | ||
|
||
func generateCreateCommitSQL(cliCtx cli.CliContext, apr *argparser.ArgParseResults) (query string, params []interface{}, err error) { |
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.
generateCreateCommitSQL is dead code now, right?
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.
Fixed.
// RequiresRepo should return false if this interface is implemented, and the command does not have the requirement | ||
// that it be run from within a data repository directory | ||
func (cmd CreateCommitCmd) RequiresRepo() bool { | ||
return false |
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.
Seems like it does.
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.
Fixed
@nicktobey DOLT
|
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
dolt admin createchunk
is a set of undocumented commands for manually writing chunks into the chunkstore. They're a useful tool for writing tests, fixing repos that somehow get into an unexpected state, and hacking on Dolt in ways that the higher-level commands don't support.dolt admin createchunk commit
is the first such command; it creates a commit chunk and prints the new commit hash to standard output.I picked
createchunk commit
to implement first because it already has utility: it can be used to flatten commit history. Dolt already allows flattening commit history viadolt rebase
, but this method introduces a lot of overhead: it walks the commit history to build the rebase table, then walks it again to apply the rebase. For large histories (the kind of histories you might want to squash to save space), this is unacceptably slow.With this command, flattening a history can be done with
dolt admin createchunk commit --root "$rootValueHash" --desc "flattened history" --parents "refs/internal/create" --branch "$branchname" --force
The
--branch
flag causes the named branch to point to the newly created commit. This flag is mandatory when using the CLI, because the chunk journal is required to end with a root hash and chunks are only flushed to the chunk journal when there's a new root hash.