Skip to content

Commit 59d6f53

Browse files
[yugabyte#27576] Docdb: Reduce PgIndexBackfill test PhantomIdxEntry/1 flakiness
Summary: PgIndexBackfillReadCommittedBlockIndislive.PhantomIdxEntry/1 is flaky and fails about 7/30 times sporadically. This is due to a DML running right after Create Index, that may run into a "schema version mismatch". Add a retry around the DML to make the test less flaky. Jira: DB-17139 Test Plan: Jenkins: test regex: PgIndexBackfillReadCommittedBlockIndislive.PhantomIdxEntry/1 yb_build.sh release --cxx-test pg_index_backfill-test --gtest_filter PgIndexBackfillReadCommittedBlockIndislive.PhantomIdxEntry/1 --clang19 -n 30 --tp 3 Before this change, on master: 7 / 30 failures Before yugabyte@e01d18c: 7 / 30 failures, so does not appear to be caused by that diff. After this diff: 0 / 30 Reviewers: jason, hsunder Reviewed By: jason, hsunder Subscribers: ybase, yql Differential Revision: https://phorge.dev.yugabyte.com/D44674
1 parent 3771229 commit 59d6f53

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/yb/yql/pgwrapper/pg_index_backfill-test.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,17 @@ TEST_P(PgIndexBackfillReadCommittedBlockIndislive, PhantomIdxEntry) {
23842384
ASSERT_OK(cluster_->SetFlagOnTServers("ysql_yb_test_block_index_phase", "indisready"));
23852385
ASSERT_OK(WaitForIndexStateFlags(index_live_flags, kIndexName));
23862386
LOG(INFO) << "Update record by newer txn";
2387-
ASSERT_OK(conn_->ExecuteFormat("UPDATE $0 SET t = 'b' WHERE i = $1", kTableName, 2));
2387+
ASSERT_OK(LoggedWaitFor(
2388+
[this]() -> Result<bool> {
2389+
auto s = conn_->ExecuteFormat("UPDATE $0 SET t = 'b' WHERE i = $1", kTableName, 2);
2390+
if (s.ok()) {
2391+
return true;
2392+
}
2393+
SCHECK_STR_CONTAINS(s.message().ToBuffer(), "schema version mismatch");
2394+
return false;
2395+
},
2396+
RegularBuildVsSanitizers(10s, 30s),
2397+
"wait for DML to succeed, ignoring potential schema version mismatch"));
23882398
LOG(INFO) << "Update record by older txn";
23892399
ASSERT_OK(other_conn.ExecuteFormat("UPDATE $0 SET t = 'c' WHERE i = $1", kTableName, 2));
23902400
ASSERT_OK(other_conn.Execute("COMMIT"));

0 commit comments

Comments
 (0)