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] Make system catalog tables transactional #1383

Closed
robertpang opened this issue May 15, 2019 · 3 comments
Closed

[YSQL] Make system catalog tables transactional #1383

robertpang opened this issue May 15, 2019 · 3 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature
Milestone

Comments

@robertpang
Copy link
Contributor

Currently for implementation reasons system catalog tables are non-transactional. There has been a case where a client reads the tables in an inconsistent state while loading the sys catalog cache, leading to FATAL error. We should make the tables transactional to avoid such issues. This change can also make it easy to rollback sys catalog table changes in case of a failed DDL operation.

@robertpang robertpang added kind/enhancement This is an enhancement of an existing feature area/ysql Yugabyte SQL (YSQL) labels May 15, 2019
@ndeodhar ndeodhar added this to the v2.0 milestone May 15, 2019
@mbautin
Copy link
Collaborator

mbautin commented Jun 19, 2019

Some initial things I'm noticing trying to implement this:

  • Switching the main sys catalog table to be transactional works, at least on the surface. We still have to specify transaction_participant_context and transaction_coordinator_context in sys_catalog.cc.
  • We need to flip postgres sys catalog tables to be transactional.
  • We need to create the txn status table earlier in the CreateTable handler implementation in catalog_manager.cc so it is ready by the time we start sending DML to postgres sys catalog tables.
  • To create the transaction status table, at least one tserver needs to be up (in the RF=1 case). Might need to wait for tserver to start before the master starts running initdb.
  • Alternatively, we could allow the sys catalog tablet to also act as a transaction status tablet for transactions involving sys catalog tables.

@mbautin mbautin self-assigned this Jun 19, 2019
@mbautin
Copy link
Collaborator

mbautin commented Jun 19, 2019

Also, our buffering operations needed to be disabled because it is currently not supported for transactional tables.

WIP patch: https://gist.githubusercontent.com/mbautin/db313ed7eae0c81a8dc12ff620c00706/raw
Log (fails on trying to create the second table, need to figure out if we're missing a commit): https://gist.githubusercontent.com/mbautin/69a884cee447402836a1a67905ce0967/raw

Also as another idea we should probably running initdb in non-transactional mode for speed.

@ndeodhar
Copy link
Contributor

ndeodhar commented Jun 5, 2020

Fixed as part of #3108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants