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

Make DROP/CREATE DATABASE pluggable #7381

Merged
merged 27 commits into from
Mar 11, 2021
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b7400d4
Start of making CREATE DATABASE pluggable
systay Jan 26, 2021
f85d458
use more restrictive type
systay Jan 26, 2021
768719e
use simpler API for the CREATE DB API
systay Jan 26, 2021
9d200e1
Merge remote-tracking branch 'upstream/master' into create-database
systay Feb 22, 2021
668b66f
make it possible to do both create and drop using a plugin
systay Feb 22, 2021
80b184f
adressed PR review
systay Mar 2, 2021
b324b06
Merge remote-tracking branch 'upstream/master' into create-database
systay Mar 2, 2021
7e776c8
[wip] refactored lots of things
systay Mar 3, 2021
cd26ee2
code refactor
harshit-gangal Mar 3, 2021
02e49ce
e2e test fir dbddl plugin
harshit-gangal Mar 3, 2021
a429c60
[wip] implement the dbddl primitive
systay Mar 3, 2021
90b697d
implemented more of the primitive
systay Mar 3, 2021
a32812c
Merge remote-tracking branch 'upstream/master' into create-database
systay Mar 3, 2021
6657063
fix the primitive on create db and implement drop db
harshit-gangal Mar 4, 2021
c77f7c5
e2e test for drop db
harshit-gangal Mar 4, 2021
73eb606
fix dbdddl plugin unit test
harshit-gangal Mar 4, 2021
c8569f0
dbddl: code refactor
harshit-gangal Mar 4, 2021
295f848
added comments to dbddl
harshit-gangal Mar 4, 2021
10daa0e
added comments directive to set query timeout in db ddl primitive
harshit-gangal Mar 4, 2021
131c5f9
added timeout test
harshit-gangal Mar 5, 2021
9a33429
drop database to wait for vschema to be updated
harshit-gangal Mar 8, 2021
afd6e57
fix plan test
harshit-gangal Mar 9, 2021
6a92f2d
on drop database call, check if keyspace is removed from vschema
harshit-gangal Mar 9, 2021
06da2d7
check resolve destination for drop database to see if keyspace is not…
harshit-gangal Mar 10, 2021
00bf410
Merge branch 'master' of github.com:vitessio/vitess into create-database
harshit-gangal Mar 11, 2021
e762d58
make sure to not return error when things worked
systay Mar 11, 2021
6a7f295
watch vschema in drop database to confirm that the keyspace is no lon…
harshit-gangal Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use more restrictive type
Signed-off-by: Andres Taylor <[email protected]>
systay committed Jan 26, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit f85d458062fc4643a432d55a5a7fca6958fd1b07
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/create_database_pluggable.go
Original file line number Diff line number Diff line change
@@ -24,13 +24,13 @@ import (
)

// PlanFunc is the function signature that you need to implement to add a custom CREATE DATABASE handler
type PlanFunc = func(stmt sqlparser.Statement, vschema ContextVSchema) (engine.Primitive, error)
type PlanFunc = func(stmt *sqlparser.CreateDatabase, vschema ContextVSchema) (engine.Primitive, error)

var databaseCreator = defaultCreateDatabase

//goland:noinspection GoVarAndConstTypeMayBeOmitted
var _ PlanFunc = databaseCreator

func defaultCreateDatabase(stmt sqlparser.Statement, vschema ContextVSchema) (engine.Primitive, error) {
func defaultCreateDatabase(_ *sqlparser.CreateDatabase, _ ContextVSchema) (engine.Primitive, error) {
return nil, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "create database not allowed")
}
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/create_database_pluggable_test.go
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ func TestCreateDB(t *testing.T) {

// setting custom behaviour for CREATE DATABASE
s := &engine.SingleRow{}
databaseCreator = func(stmt sqlparser.Statement, vschema ContextVSchema) (engine.Primitive, error) {
databaseCreator = func(stmt *sqlparser.CreateDatabase, vschema ContextVSchema) (engine.Primitive, error) {
return s, nil
}