You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#28317] YSQL: Start transactions with correct locality in AcquireObjectLocks RPC handler
Summary:
Given the following transaction:
```sql
BEGIN;
INSERT INTO global_table ...;
COMMIT;
```
Without object locking, the first RPC of this transaction is the Perform. This sets
force_global_transaction in PgPerformOptionsPB based on the force_global_transaction GUC, and
also contains tablespace oids from which we are able to decide the correct locality to start
the transaction as (region-local, tablespace-local(tablespace), global).
But with object locking, the first RPC is to acquire an object lock, and this RPC today does not set
force_global_transaction, nor does it have any tablespace information. Instead, we just always
start as region-local, and then later promoted to global during the Perform RPC as needed.
Without object locking, we mask the latency of the CREATED heartbeat by use of the transaction pool,
but with object locking, we cannot mask the latency of the PROMOTED heartbeat, so this results in an
extra global roundtrip for global transactions.
Additionally, in the context of #11268, it also means that every transaction will be promoted to
global when tablespace locality is used, since region-local cannot promote to any tablespace-local,
and there is also no good default tablespace-local to use instead.
This is also the cause of several geo-partitioning unit tests failure when object locking is
enabled, for exactly the above reasons.
This revision passes force_global_transaction and tablespace oid for AcquireObjectLocks RPCs. This
information is then used to start transactions (if needed) under the appropriate locality.
**Upgrade/Downgrade safety**
N/A, only modifies protobufs for local TS <=> PG communication.
Jira: DB-17999
Test Plan:
Jenkins
Also see D47261 for Jenkins run with object locking on.
Reviewers: myang
Reviewed By: myang
Subscribers: bkolagani, yql, ybase
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D47260
0 commit comments