Skip to content

2.27.0.0-b267

@dr0pdb dr0pdb tagged this 26 Jun 06:25
Summary:
This revision allows executing DDL statements within a txn block with READ COMMITTED isolation level in the transactional DDL feature.

This revision introduces two modes for DDLs in RC isolation:
1. Transactional DDL mode: DDLs will be executed as part of the explicit txn block. Conflicts received in DDLs will not be retried.
2. Separate DDL mode: When `yb_read_committed_ddl_txn_disabled` is enabled, DDLs in RC will execute in autonomous transaction i.e. similar to if transactional DDL feature itself was disabled.

To keep the logic simple, we are introducing a function `YBIsDdlTransactionBlockEnabled` which encapsulates the above logic.

In order to disallow retries on DDLs, we need to detect if we are executing a DDL. We already detect DDLs in YbGetDdlMode, so we just remember the outcome in `ddl_transaction_state.is_top_level_ddl_active`. Once the DDL has executed, we reset the value back to false. This is done immediately after the DDL execution because not all statements end up calling YbGetDdlMode, so it must be cleared as part of the DDL execution itself.
Jira: DB-17316

Test Plan:
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressIsolationWithTxnDdl'
./yb_build.sh --cxx-test pgwrapper_pg_ddl_transaction-test --gtest_filter PgDdlTransactionTest.TestReadCommittedTxnDdlDisabled
./yb_build.sh --java-test 'org.yb.pgsql.TestDdlTransactionBlocks'

Reviewers: pjain, myang

Reviewed By: pjain, myang

Subscribers: yql, pjain

Differential Revision: https://phorge.dev.yugabyte.com/D44939
Assets 2
Loading