Skip to content

Commit e89f69a

Browse files
committed
[#29197] YSQL: fix TestConflictAbortViaOldHeartbeatBeforeNewHeartbeat
Summary: Read inside serializable transaction in the `WarmupTablespaceCache` helper function introduces extra delay in `asan`/`tsan` in several unit test (these tests add additional delay in distributed txn for testing purposes via GFlags). As a result units test are executed for a long time and also may fail due to timing issue. The fix is to make a read from default transaction (read committed or repeatable read) which doesn't use distributed transaction for read operations. Jira: DB-18960 Test Plan: Jenkins Reviewers: esheng, bkolagani, #db-approvers Reviewed By: bkolagani, #db-approvers Subscribers: svc_phabricator, yql Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D48049
1 parent dda564a commit e89f69a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/yb/yql/pgwrapper/geo_transactions_test_base.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,10 @@ Result<std::vector<TabletId>> GeoTransactionsTestBase::GetStatusTablets(
388388

389389
Status GeoTransactionsTestBase::WarmupTablespaceCache(
390390
pgwrapper::PGConn& conn, std::string_view table) {
391-
// Force tablespace information into cache. Since SERIALIZABLE replicates reads, this also
392-
// serves to ensure transaction is not reused (for object locking enabled cases).
393-
RETURN_NOT_OK(conn.StartTransaction(IsolationLevel::SERIALIZABLE_ISOLATION));
394-
RETURN_NOT_OK(conn.FetchFormat("SELECT * FROM $0 LIMIT 1", table));
395-
return conn.RollbackTransaction();
391+
// Force tablespace information into cache.
392+
// The purpose of ROLLBACK is to to ensure that in case object locking is enabled YB txn
393+
// will not be reused.
394+
return conn.ExecuteFormat("BEGIN;SELECT * FROM $0 LIMIT 1;ROLLBACK", table);
396395
}
397396

398397
} // namespace yb::client

0 commit comments

Comments
 (0)