Skip to content

Commit 9e830ec

Browse files
vitalifkunga
authored andcommitted
Fix flapping test VectorIndexBuildTest::BaseCase (#19146) (#19253)
1 parent 637353f commit 9e830ec

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ydb/core/tx/schemeshard/ut_index_build/ut_vector_index_build.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,16 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
112112
return true;
113113
});
114114

115-
AsyncBuildVectorIndex(runtime, ++txId, tenantSchemeShard, "/MyRoot/ServerLessDB", "/MyRoot/ServerLessDB/Table", "index1", "embedding");
116-
ui64 buildIndexId = txId;
115+
// Build vector index with max_shards_in_flight(1) to guarantee deterministic meteringData
116+
ui64 buildIndexId = ++txId;
117+
{
118+
auto sender = runtime.AllocateEdgeActor();
119+
auto request = CreateBuildIndexRequest(buildIndexId, "/MyRoot/ServerLessDB", "/MyRoot/ServerLessDB/Table", TBuildIndexConfig{
120+
"index1", NKikimrSchemeOp::EIndexTypeGlobalVectorKmeansTree, {"embedding"}, {}
121+
});
122+
request->Record.MutableSettings()->set_max_shards_in_flight(1);
123+
ForwardToTablet(runtime, tenantSchemeShard, sender, request);
124+
}
117125

118126
// Wait for the first "reshuffle" request (samples will be already collected on the first level)
119127
// and reboot the scheme shard to verify that its intermediate state is persisted correctly.
@@ -126,7 +134,6 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
126134
TBlockEvents<TEvSchemeShard::TEvModifySchemeTransaction> level1Blocker(runtime, [&](auto& ev) {
127135
const auto& record = ev->Get()->Record;
128136
if (record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable) {
129-
txId = record.GetTxId();
130137
return true;
131138
}
132139
return false;
@@ -188,7 +195,7 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
188195
auto descr = TestGetBuildIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB", buildIndexId);
189196
UNIT_ASSERT_VALUES_EQUAL(descr.GetIndexBuild().GetState(), Ydb::Table::IndexBuildState::STATE_DONE);
190197

191-
const TString meteringData = R"({"usage":{"start":0,"quantity":433,"finish":0,"unit":"request_unit","type":"delta"},"tags":{},"id":"109-72075186233409549-2-0-0-0-0-611-609-11032-11108","cloud_id":"CLOUD_ID_VAL","source_wt":0,"source_id":"sless-docapi-ydb-ss","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.requests.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})""\n";
198+
const TString meteringData = R"({"usage":{"start":1,"quantity":433,"finish":1,"unit":"request_unit","type":"delta"},"tags":{},"id":"109-72075186233409549-2-0-0-0-0-611-609-11032-11108","cloud_id":"CLOUD_ID_VAL","source_wt":1,"source_id":"sless-docapi-ydb-ss","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.requests.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})""\n";
192199

193200
UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData);
194201

0 commit comments

Comments
 (0)