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

sql: rollback disallowing statements following schema change #15511

Merged
merged 2 commits into from
Apr 30, 2017

Conversation

vivekmenezes
Copy link
Contributor

rolls back #15339 #14368 for the most part and #14619 partially.

We used a very big hammer to prevent some statements from
following a schema change. This was done to reduce surprises
but it ended up introducing more surprises. ORMs and schema
migration tools depends on multiple schema changes executing
in the same transaction.

fixes #15269

@vivekmenezes vivekmenezes requested a review from knz April 29, 2017 02:31
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@petermattis
Copy link
Collaborator

:lgtm:

Given that we're reverting something that seemed like a useful change, I think we should document somewhere in the code why we need to support the current behavior (i.e. because of ORM compatibility). A quick scan of the code didn't reveal a great place. Perhaps a comment associated with one of the tests being re-added.

Also, my pedantic side notes that this change doesn't allow executing multiple schema changes in a transaction (as noted in the commit message), only "staging" multiple schema changes.

Lastly, the way we handle schema changes is different than Postgres. We should review the documentation in this area and make sure the differences are clear.


Review status: 0 of 6 files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@vivekmenezes
Copy link
Contributor Author

I've changed the commit to say "staging" multiple schema changes and have also added a test
case for the multiple schema change transaction including running an INSERT on an auxiliary table
in the same transaction. which covers #15297


Review status: 0 of 6 files reviewed at latest revision, all discussions resolved, some commit checks pending.


Comments from Reviewable

rolls back cockroachdb#15339 cockroachdb#14368 for the most part and cockroachdb#14619 partially.

We used a very big hammer to prevent some statements from
following a schema change. This was done to reduce surprises
but it ended up introducing more surprises. ORMs and schema
migration tools depend on multiple schema changes being
staged in the same transaction.

fixes cockroachdb#15269
@petermattis
Copy link
Collaborator

:lgtm:


Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


pkg/sql/schema_changer_test.go, line 1919 at r2 (raw file):

			`INSERT INTO t.origin VALUES ('c', 'd')`, ``},
		// Support multiple schema changes for ORMs: #15269
		// Support insert into another table after schema changes: 15297

For consistency: s/15297/#15297/g


Comments from Reviewable

the test also includes an insert into an auxiliary table in the
same transaction as a way to record the schema change transaction.

fixes cockroachdb#15297
@vivekmenezes
Copy link
Contributor Author

Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion.


pkg/sql/schema_changer_test.go, line 1919 at r2 (raw file):

Previously, petermattis (Peter Mattis) wrote…

For consistency: s/15297/#15297/g

Done.


Comments from Reviewable

@vivekmenezes vivekmenezes merged commit 3af1ee6 into cockroachdb:master Apr 30, 2017
@vivekmenezes vivekmenezes deleted the nakama branch April 30, 2017 00:02
@bdarnell
Copy link
Contributor

For release note purposes, what are the new rules for schema changes in transactions?


Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


Comments from Reviewable

@vivekmenezes
Copy link
Contributor Author

vivekmenezes commented May 1, 2017 via email

@petermattis
Copy link
Collaborator

Cc @jseldess (in case you weren't already paying attention).

@jseldess
Copy link
Contributor

jseldess commented May 1, 2017

Thanks, @petermattis. So to summarize, it's now safe to say that multiple schema changes, or a schema change followed by non-schema changing statements, are allowed within a single transaction, with the above exceptions?

@petermattis
Copy link
Collaborator

@vivekmenezes ?

@vivekmenezes
Copy link
Contributor Author

Yes those three issues are the only known outstanding issues. We can't promise to fix them in 1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nakama server cannot apply migrations with beta-20170420
5 participants