Skip to content

2024.2.6.0-b7

@pao214 pao214 tagged this 14 Aug 18:18
Summary:
Original commit: f44910ad6bc833d45be48ec514f63bdff70a1063 / D40043
### Context

DEFERRABLE as a transaction characteristic has completely different semantics in YugabyteDB compared to PostgreSQL.

In PostgreSQL, DEFERRABLE is used for SERIALIZABLE READ ONLY transactions that should not be aborted by its optimistic concurrency control.

In contrast, YugabyteDB does not use an optimistic approach for SERIALIZABLE isolation. However, YugabyteDB redefines DEFERRABLE to wait out the assumed maximum clock skew (max_clock_skew_usec, 500ms by default).

### Issue

Users sometimes set transaction characteristics as SERIALIZABLE READ ONLY DEFERRABLE to avoid read restart errors when latency is not important. However, users are forced into using READ ONLY. DEFERRABLE can already be used along with other isolation levels in YugabyteDB.

### Approach

Add deferred option to yb_read_after_commit_visibility. This has the same semantics as YugabyteDB's DEFERRABLE transaction characteristic, except it is not limited by READ ONLY.

NOTE: Read time is not deferred for fast path transactions. This is because fast path transactions do not run conflict resolution on regular DB. Therefore, they need to pick read time after taking the in-memory locks on the node hosting the tablet. Not deferring for fast path writes is a valid approach because no read restart errors are expected.

Jira: DB-14078

Test Plan:
Jenkins

1. PgReadAfterCommitVisibility tests

```
./yb_build.sh --cxx-test pg_read_after_commit_visibility-test
```

a. Add a test for updating value rather than the key (fast path transaction).
b. Add tests for yb_read_after_commit_visibility=deferred

2. Concurrent Fast Path Inserts

```
./yb_build.sh --java-test TestPgRegressWaitQueues
```

3. Read Time Changes

```
./yb_build.sh --cxx-test pg_read_time-test
```

a. Change SELECT FOR UPDATE to pick the read time at pg client.
b. Add read time tests for yb_read_after_commit_visibility=deferred.

4. Run Jenkins tests with deferred as default.

Reviewers: pjain, smishra

Reviewed By: pjain

Subscribers: smishra, yql, ybase

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