Skip to content

Commit 1c2dbea

Browse files
committed
Do not force Sample+Reshuffle on the first level (#19154) (#20132)
1 parent 9a76a7a commit 1c2dbea

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,6 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil
821821

822822
void AddGlobalShardsForCurrentParent(TIndexBuildInfo& buildInfo) {
823823
Y_ENSURE(NoShardsAdded(buildInfo));
824-
if (buildInfo.KMeans.Parent == 0) {
825-
AddAllShards(buildInfo);
826-
return;
827-
}
828824
auto it = buildInfo.Cluster2Shards.lower_bound(buildInfo.KMeans.Parent);
829825
Y_ENSURE(it != buildInfo.Cluster2Shards.end());
830826
if (it->second.Shards.size() > 1) {

ydb/core/tx/schemeshard/schemeshard_info_types.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,13 +2215,12 @@ void TIndexBuildInfo::SerializeToProto([[maybe_unused]] TSchemeShard* ss, NKikim
22152215
}
22162216

22172217
void TIndexBuildInfo::AddParent(const TSerializedTableRange& range, TShardIdx shard) {
2218-
if (KMeans.Parent == 0) {
2219-
// For Parent == 0 only single kmeans needed, so there is only two options:
2220-
// 1. It fits entirely in the single shard => local kmeans for single shard
2221-
// 2. It doesn't fit entirely in the single shard => global kmeans for all shards
2222-
return;
2223-
}
2224-
const auto [parentFrom, parentTo] = KMeans.RangeToBorders(range);
2218+
// For Parent == 0 only single kmeans needed, so there are two options:
2219+
// 1. It fits entirely in the single shard => local kmeans for single shard
2220+
// 2. It doesn't fit entirely in the single shard => global kmeans for all shards
2221+
const auto [parentFrom, parentTo] = KMeans.Parent == 0
2222+
? std::pair<NTableIndex::TClusterId, NTableIndex::TClusterId>{0, 0}
2223+
: KMeans.RangeToBorders(range);
22252224
// TODO(mbkkt) We can make it more granular
22262225

22272226
// the new range does not intersect with other ranges, just add it with 1 shard

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,10 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
387387
}
388388

389389
// Wait and check Filling state:
390-
TBlockEvents<TEvDataShard::TEvSampleKResponse> sampleKBlocker(runtime, [&](const auto&) {
390+
TBlockEvents<TEvDataShard::TEvLocalKMeansResponse> localKBlocker(runtime, [&](const auto&) {
391391
return true;
392392
});
393-
runtime.WaitFor("sampleK", [&]{ return sampleKBlocker.size(); });
394-
sampleKBlocker.Stop().Unblock();
393+
runtime.WaitFor("localK", [&]{ return localKBlocker.size(); });
395394
{
396395
auto buildIndexOperations = TestListBuildIndex(runtime, tenantSchemeShard, "/MyRoot/CommonDB");
397396
UNIT_ASSERT_VALUES_EQUAL(buildIndexOperations.EntriesSize(), 1);
@@ -406,6 +405,7 @@ Y_UNIT_TEST_SUITE (VectorIndexBuildTest) {
406405
NLs::PathExist,
407406
NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateWriteOnly)});
408407
}
408+
localKBlocker.Stop().Unblock();
409409

410410
// Wait Done state:
411411
env.TestWaitNotification(runtime, buildIndexTx, tenantSchemeShard);

0 commit comments

Comments
 (0)