Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[YSQL] Creating a table can cause a constraint violation on pg_class_oid_index. #1962
With version 184.108.40.206, I've hit occasional (~1:10 runs) issues creating YSQL tables during Jepsen tests. For instance, the append test creates a single table like so:
... which is executed in a global lock, so only one client should be acting at a time. Sometimes, but not always, this can throw:
which suggests to me that there might be some sort of double-allocation of OIDs possible during table creation--Postgres mailing lists suggest this might be due to OID overflow or filesystem corruption, but I doubt either of those is at play here. Since we create a fresh cluster every time, I wonder if there might be some sort of table initialization code that's running concurrently with our table creation, and the two can occasionally race? Not sure!
For full logs, see 20190802T132514.000-0400.zip.
To reproduce this, try Jepsen 23dbb5e78725318c35d07dcc6d727ebb3ab7a3e7, and run something like
I've only hit this once, after a handful of runs, so I'm not sure how frequent a problem it is yet. I'll post back if I see it again!
changed the title
Creating a table can cause a constraint violation on pg_class_oid_index.
Aug 2, 2019
This happens because our SQL DDL statements are not transactional. I see this in the logs:
So postgres system tables were updated but there was a master leader change and so create table never completed successfully. When client retries request on a new leader, we see the duplicate key error.
Related issue about transactional DDLs: #1383