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

dolt_clone stored procedure #3745

Merged
merged 36 commits into from Jul 25, 2022
Merged

dolt_clone stored procedure #3745

merged 36 commits into from Jul 25, 2022

Conversation

zachmu
Copy link
Member

@zachmu zachmu commented Jul 1, 2022

Adds support for a new dolt_clone() stored procedure.

Removes most of the use of os.Chdir (except for in test code and one or two dolt-cli-only spots).

Doc Updates: dolthub/docs#804

@zachmu zachmu marked this pull request as ready for review July 14, 2022 21:59
@zachmu zachmu requested review from fulghum and removed request for andy-wm-arthur July 14, 2022 22:00
@zachmu
Copy link
Member Author

zachmu commented Jul 14, 2022

This needs tests but I'm not going to get to them before taking off on vacation. I'm putting it up for review because Jennifer has already merged some of these changes into her own branch, so it seems wise to get it checked in before it diverges too much. I can write bats tests when I'm back in town.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jul 14, 2022 via email

@zachmu
Copy link
Member Author

zachmu commented Jul 14, 2022

Actually did add a bats test, but it needs more

@fulghum
Copy link
Contributor

fulghum commented Jul 19, 2022

I'll start digging into this one, review, and add some more tests so we can unblock Jennifer's dolt_remote change.

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. I noticed a couple spots where some error handling is needed. I'll flesh out the BATS tests a little more and fill in the error handling, then get this merged in and add some docs.

…sn't a direct CLI command (and would cause SQL command usage to print); cleaning up whitespace.
… a copy instead of modifying the original struct, like their docs describe.
@@ -212,6 +215,87 @@ func (p DoltDatabaseProvider) CreateDatabase(ctx *sql.Context, name string) erro
return dsess.AddDB(ctx, dbstate)
}

// CloneDatabaseFromRemote implements DoltDatabaseProvider interface
func (p DoltDatabaseProvider) CloneDatabaseFromRemote(ctx *sql.Context, dbName, branch, remoteName, remoteUrl string, remoteParams map[string]string) error {
p.mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially a loooong time to be holding a lock! I think this is okay for v1, since dolt_clone() will not be frequently used, but it would be good to follow up and shrink down the code that executes with this lock.

Copy link
Contributor

@andy-wm-arthur andy-wm-arthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fulghum fulghum merged commit 8e8ae20 into main Jul 25, 2022
@Hydrocharged Hydrocharged deleted the zachmu/clone branch October 13, 2022 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants