@@ -112,8 +112,16 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
112
112
return true ;
113
113
});
114
114
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
+ }
117
125
118
126
// Wait for the first "reshuffle" request (samples will be already collected on the first level)
119
127
// and reboot the scheme shard to verify that its intermediate state is persisted correctly.
@@ -126,7 +134,6 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
126
134
TBlockEvents<TEvSchemeShard::TEvModifySchemeTransaction> level1Blocker (runtime, [&](auto & ev) {
127
135
const auto & record = ev->Get ()->Record ;
128
136
if (record.GetTransaction (0 ).GetOperationType () == NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable) {
129
- txId = record.GetTxId ();
130
137
return true ;
131
138
}
132
139
return false ;
@@ -188,7 +195,7 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
188
195
auto descr = TestGetBuildIndex (runtime, tenantSchemeShard, " /MyRoot/ServerLessDB" , buildIndexId);
189
196
UNIT_ASSERT_VALUES_EQUAL (descr.GetIndexBuild ().GetState (), Ydb::Table::IndexBuildState::STATE_DONE);
190
197
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 " ;
192
199
193
200
UNIT_ASSERT_NO_DIFF (meteringMessages, meteringData);
194
201
0 commit comments