Skip to content

sql: allow BEGIN READ WRITE#16348

Merged
madelynnblue merged 1 commit intocockroachdb:release-1.0from
madelynnblue:begin-read-write
Jun 6, 2017
Merged

sql: allow BEGIN READ WRITE#16348
madelynnblue merged 1 commit intocockroachdb:release-1.0from
madelynnblue:begin-read-write

Conversation

@madelynnblue
Copy link
Copy Markdown
Contributor

lib/pq recently added support for the Go 1.8 txn options, which
include a field for read only/write transactions. In the default
(read write) case, the string "READ WRITE" is added to the BEGIN
statement. Add workaround support for this syntax by ignoring it,
since it doesn't change anything. A complete fix for this will be
added to the master branch later.

See #16309

cc @cockroachdb/release

@madelynnblue madelynnblue requested review from knz and tamird June 6, 2017 03:12
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@tamird
Copy link
Copy Markdown
Contributor

tamird commented Jun 6, 2017

Can you bump lib/pq and add a test that exercises this through txn options?


Reviewed 4 of 4 files at r1.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

Yes a test with the new libpq which motivated this change would be nice.

LGTM otherwise.


Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


pkg/sql/parser/sql.y, line 2311 at r1 (raw file):

opt_read_write:
  READ WRITE {}

Does "READ ONLY" require the server to respond an error when writing? If not (it is only advisory), we could support it too.


Comments from Reviewable

@madelynnblue
Copy link
Copy Markdown
Contributor Author

I think adding support for READ ONLY in a patch release is a bad idea because it's more than just a syntax change. I don't know how it behaves, but don't want to investigate for this. The only thing this PR is attempting to address is Go users using the master branch of lib/pq and trying to connect to cockroach 1.0 and failing because of our lack of READ WRITE syntax support. Anything beyond that will go into our master branch as a more general fix.

I'll update lib/pq, but that means making a vendored/release-1.0 branch in the vendored repo so the ref doesn't get GCd. We don't have a process around that so I guess I'll just go for it, agreed?

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

Aw I hadn't seen this was a 1.0.x fix. Yes, this should merge as-is.

@madelynnblue
Copy link
Copy Markdown
Contributor Author

Do you think it should merge as-is without the associated lib/pq update? I do. I think a lib/pq update should go into the master branch when this issue is fixed there. Thoughts @tamird?

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

I am slightly against updating the pq dep in 1.0.x. The only part of cockroachdb that uses this is the CLI shell, and this does not use these options.

@tamird
Copy link
Copy Markdown
Contributor

tamird commented Jun 6, 2017 via email

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

Tamir, asking the right questions :-)

@madelynnblue
Copy link
Copy Markdown
Contributor Author

Because the full fix is much larger: https://github.com/mjibson/cockroach/commit/31d27670854c76e8dedace725f9ab9f160c8de63

and make take a few days to merge, and I want this fix in 1.0.2. This is similar to a PR merged yesterday (#16335) where the 1.0 PR was a 3 line change, and the full fix was much larger.

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

@mjibson I am ok with this PR as a reduced form of the larger commit, however I do think the larger commit should already have a PR open and that you refer to that other PR here (or in the commit message). This will help tracking the relationship down the line.

Also I see you do support the syntax READ ONLY in the larger commit, if only to error out as being not supported. I think you can do the same here using a grammar rule READ ONLY { return unsupported(...) }.

@bdarnell
Copy link
Copy Markdown
Contributor

bdarnell commented Jun 6, 2017

LGTM. I agree that we shouldn't mess with deps in the release branch and shouldn't add READ ONLY support in a patch release. It would be nice to make it an "unimplemented" error instead of a syntax error, though.

lib/pq recently added support for the Go 1.8 txn options, which
include a field for read only/write transactions. In the default
(read write) case, the string "READ WRITE" is added to the BEGIN
statement. Add workaround support for this syntax by ignoring it,
since it doesn't change anything. A complete fix for this will be
added to the master branch later.

See #16309
@madelynnblue
Copy link
Copy Markdown
Contributor Author

Updated to return unimplemented on READ ONLY.

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 6, 2017

:lgtm:


Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


Comments from Reviewable

@madelynnblue madelynnblue merged commit 9a9106d into cockroachdb:release-1.0 Jun 6, 2017
@madelynnblue madelynnblue deleted the begin-read-write branch June 6, 2017 21:50
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.

5 participants