Skip to content

Commit

Permalink
[#15009] CDCSDK: Fix for the flaky test CDCSDKYsqlTest.TestCDCSDKMetr…
Browse files Browse the repository at this point in the history
…icsTwoTablesSingleStream

Summary: This diff fixes the flakiness of CDCSDKYsqlTest.TestCDCSDKMetricsTwoTablesSingleStream. The flakiness was due to a flag cdc_state_checkpoint_update_interval_ms which was set to zero, because of which in some cases getChanges call was trying to retrieve intents whose "Apply" record's OpId was lesser than the checkpoint.

Test Plan:
Jenkins: test regex: .*TestCDCSDKMetrics.*
Ran the test multiple times on dev server

Reviewers: skumar, vkushwaha, rvenkatesh, sdash, abharadwaj

Reviewed By: sdash, abharadwaj

Subscribers: ycdcxcluster

Differential Revision: https://phabricator.dev.yugabyte.com/D21143
  • Loading branch information
Sumukh Phalgaonkar committed Nov 16, 2022
1 parent 095a386 commit 47dec92
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ent/src/yb/integration-tests/cdcsdk_ysql-test.cc
Expand Up @@ -6875,7 +6875,6 @@ TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestCDCSDKChangeEventCountMetric)
TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestCDCSDKMetricsTwoTablesSingleStream)) {
FLAGS_update_metrics_interval_ms = 1;
FLAGS_update_min_cdc_indices_interval_secs = 1;
FLAGS_cdc_state_checkpoint_update_interval_ms = 0;
ASSERT_OK(SetUpWithParams(1, 1, false));

const uint32_t num_tablets = 1;
Expand Down Expand Up @@ -6912,22 +6911,20 @@ TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestCDCSDKMetricsTwoTablesSingleS
tserver->rpc_server()->TEST_service_pool("yb.cdc.CDCService")->TEST_get_service().get());

int64_t current_traffic_sent_bytes = 0;
vector<GetChangesResponsePB> change_resp(num_tables);
vector<std::shared_ptr<cdc::CDCSDKTabletMetrics>> metrics(num_tables);
uint32_t total_record_size = 0;
int64_t total_traffic_sent = 0;
uint64_t total_change_event_count = 0;


for (uint32_t idx = 0; idx < num_tables; idx++) {
ASSERT_OK(
WriteRowsHelper(1, 50, &test_cluster_, true, 2, (kTableName + table_suffix[idx]).c_str()));
ASSERT_OK(test_client()->FlushTables(
{table[idx].table_id()}, /* add_indexes = */ false, /* timeout_secs = */ 30,
/* is_compaction = */ false));
}

vector<GetChangesResponsePB> change_resp(num_tables);
vector<std::shared_ptr<cdc::CDCSDKTabletMetrics>> metrics(num_tables);
uint32_t total_record_size = 0;
int64_t total_traffic_sent = 0;
uint64_t total_change_event_count = 0;

for (uint32_t idx = 0; idx < num_tables; idx++) {
change_resp[idx] = ASSERT_RESULT(GetChangesFromCDC(stream_id, tablets[idx]));
total_record_size += change_resp[idx].cdc_sdk_proto_records_size();

Expand Down

0 comments on commit 47dec92

Please sign in to comment.