Skip to content

Commit a7ef68a

Browse files
committed
[#28868] ASH: Fix flaky test PgAshTest.TestTServerMetadataSerializer
Summary: This diff fixes flaky test PgAshTest.TestTServerMetadataSerializer in release builds. The test was likely flaky because the inserts happen too quickly in release builds and there was not enough time to sample. Changing the test to use a long insert will fix this. The number of values to insert will depend on the build type i.e. 100000 rows on debug builds and 10000000 rows on release builds. Jira: DB-18586 Test Plan: Jenkins: test regex: .*TestTServerMetadataSerializer.* ./yb_build.sh release --cxx-test pg_ash-test --gtest_filter PgAshTest.TestTServerMetadataSerializer -n 10 Reviewers: ishan.chhangani Reviewed By: ishan.chhangani Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D47418
1 parent 8bdc738 commit a7ef68a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "yb/ash/wait_state.h"
1414

1515
#include "yb/util/backoff_waiter.h"
16+
#include "yb/util/debug.h"
1617
#include "yb/util/test_thread_holder.h"
1718

1819
#include "yb/yql/pgwrapper/libpq_test_base.h"
@@ -859,9 +860,8 @@ TEST_F(PgAshTest, TestTServerMetadataSerializer) {
859860
static constexpr auto kTableName = "test_table";
860861

861862
ASSERT_OK(conn_->Execute(Format("CREATE TABLE $0 (k INT PRIMARY KEY, v INT)", kTableName)));
862-
for (int i = 0; i < 1000; ++i) {
863-
ASSERT_OK(conn_->Execute(Format("INSERT INTO $0 VALUES ($1, $1)", kTableName, i)));
864-
}
863+
ASSERT_OK(conn_->Execute(Format("INSERT INTO $0 SELECT i, i FROM generate_series($1, $2) AS i",
864+
kTableName, 1, (kIsDebug ? 100000 : 10000000))));
865865

866866
auto query_id = ASSERT_RESULT(conn_->FetchRow<int64_t>(
867867
"SELECT queryid FROM pg_stat_statements WHERE query LIKE 'INSERT INTO%'"));

0 commit comments

Comments
 (0)