-
Notifications
You must be signed in to change notification settings - Fork 99
Cockroach upgrade #1318
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
Closed
Closed
Cockroach upgrade #1318
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c92eead
upgrade crdb to the latest regular release
sinisaos 3b8e6bf
remove cockroach_upgrade branch from CI
sinisaos 6f33b8a
settings applied to the current transaction only
sinisaos 7878492
Merge branch 'piccolo-orm:master' into cockroach_upgrade
sinisaos 5be8d40
Merge branch 'piccolo-orm:master' into cockroach_upgrade
sinisaos 3e9300d
make changes to transaction and atomic
sinisaos a420277
remove postgres password
sinisaos f19e3be
Merge branch 'piccolo-orm:master' into cockroach_upgrade
sinisaos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there some way of setting
autocommit_before_ddl = offfor all sessions, so we don't have to do it for each connection?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.
That's a good point, but CockroachDB doesn't have a built-in setting to globally configure
autocommit_before_ddlfor all connections by default. We have two options:get_new_connection()like the code in this PR which works because it runs right when Piccolo acquires a usable session, just before transactions and migrations.initargument.I hope that makes sense.
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.
Could you run it immediately after creating the transaction which wraps the migration code?
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.
CockroachDB requires that
autocommit_before_ddlbe set before a transaction exists, so we cannot set it after the transaction is created.Correct:
Wrong:
We can’t make
SET autocommit before ddl = offapply to all sessions globally, because it’s a session variable, not a cluster setting. I haven't found any other way other than overridingget_new_connectionbecause that sets the session variable before the transaction and DDL. That's the only way I can pass this transaction tests. If you have a better way, feel free to close this PR.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.
If this PR is merged, this PR can also be merged because that PR works without issues with this PR changes (works with the latest Cockroach regular release
v25.4.2)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.
Have you found another way to do this?
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.
@sinisaos I was thinking of having an argument for
transactionsandAtomicwhich can be used to turn this behaviour on or off (off by default), and we turn it on for migrations and thoseAtomictests.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.
@dantownsend Do you have something like this in mind? If
autocommit_before_ddlisNone(orTrue), the Cockroach defaults apply, otherwise we disable it.cockroach_engine
Of course, we also need to modify the tests where we want to disable the default behavior.
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.
Yes, I think something like that, but I'll double check tomorrow.
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.
@dantownsend I made another commit where I made small changes (the default is always
Falsefor bothtransactionandatomicso we don't have to change the tests) that you can easily try out. I hope that's better.