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

[YSQL] Table already exists when creating tables with HikariCP #1333

Closed
m-iancu opened this issue May 8, 2019 · 1 comment
Closed

[YSQL] Table already exists when creating tables with HikariCP #1333

m-iancu opened this issue May 8, 2019 · 1 comment
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)
Milestone

Comments

@m-iancu
Copy link
Contributor

m-iancu commented May 8, 2019

Running DDLs from multiple threads/nodes can lead to catalog version mismatch.
But internally retrying is not reliable for DDLs because system tables are not (yet) transactional. Therefore retrying can lead to the table already exists error.

@m-iancu m-iancu added this to the v2.0 milestone May 8, 2019
@m-iancu m-iancu self-assigned this May 8, 2019
@kmuthukk kmuthukk added the area/ysql Yugabyte SQL (YSQL) label May 9, 2019
@ndeodhar
Copy link
Contributor

@georgeklees To clarify: Currently, YB client retries any requests that time out. Retrying is not reliable for DDLs, so as a first step, we should avoid retrying DDL requests in YB client.

yugabyte-ci pushed a commit that referenced this issue Jul 8, 2019
Summary:
Currently, all simple YSQL queries are considered for retry if they fail, but [issue #1333](#1333)
explains that this is unsafe for DDL commands, as they modify system tables which don't yet have
transaction support. This patch detects the command and only considers retry for the four known DML
requests that are supported (`DELETE`, `INSERT`, `SELECT`, `UPDATE`).

Test Plan:
Open two independent `ysqlsh` sessions. In the first one do `CREATE TABLE a(id int primary key)`
and wait for a few seconds. Then in the second one do `CREATE TABLE b(id int primary key)`. It should result
in the error `ERROR:  Catalog Version Mismatch: A DDL occurred while processing this query. Try Again.`

Reviewers: mihnea, neha

Reviewed By: mihnea, neha

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D6851
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
None yet
Development

No branches or pull requests

4 participants