Skip to content

Commit aa0ec2e

Browse files
committed
fix SS split test
1 parent d26249c commit aa0ec2e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

ydb/core/tx/datashard/datashard__stats.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class TTableStatsCoroBuilder : public TActorCoroImpl, private IPages {
167167
LOG_DEBUG_S(GetActorContext(), NKikimrServices::TX_DATASHARD, "BuildStats result at datashard " << TabletId << ", for tableId " << TableId
168168
<< ": RowCount " << ev->Stats.RowCount << ", DataSize " << ev->Stats.DataSize.Size << ", IndexSize " << ev->Stats.IndexSize.Size << ", PartCount " << ev->PartCount
169169
<< (ev->PartOwners.size() > 1 || ev->PartOwners.size() == 1 && *ev->PartOwners.begin() != TabletId ? ", with borrowed parts" : "")
170-
<< ", LoadedSize " << PagesSize << ", " << NFmt::Do(*Spent));
170+
<< ", LoadedSize " << PagesSize << ", " << NFmt::Do(*Spent) << ", HistogramKeys " << ev->Stats.DataSizeHistogram.size());
171171

172172
Send(ReplyTo, ev.Release());
173173

ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ static bool IsIntegerType(NScheme::TTypeInfo type) {
3131
}
3232

3333
TSerializedCellVec ChooseSplitKeyByHistogram(const NKikimrTableStats::THistogram& histogram, const TConstArrayRef<NScheme::TTypeInfo> &keyColumnTypes) {
34+
// Note: actually its histogram keys count, not buckets count
3435
ui64 bucketsCount = histogram.BucketsSize();
35-
ui64 idxLo = bucketsCount * 0.33;
36-
ui64 idxMed = bucketsCount * 0.5;
37-
ui64 idxHi = bucketsCount * 0.66;
36+
ui64 idxLo = bucketsCount / 3;
37+
ui64 idxMed = bucketsCount / 2;
38+
ui64 idxHi = bucketsCount * 2 / 3;
3839

3940
TSerializedCellVec keyLo(histogram.GetBuckets(idxLo).GetKey());
4041
TSerializedCellVec keyMed(histogram.GetBuckets(idxMed).GetKey());
@@ -298,7 +299,8 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
298299
<< " for pathId " << tableId
299300
<< " state '" << DatashardStateName(rec.GetShardState()).data() << "'"
300301
<< " dataSize " << dataSize
301-
<< " rowCount " << rowCount);
302+
<< " rowCount " << rowCount
303+
<< " dataSizeHistogram buckets " << rec.GetTableStats().GetDataSizeHistogram().BucketsSize());
302304

303305
if (!Self->Tables.contains(tableId))
304306
return true;
@@ -349,6 +351,7 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
349351
} else {
350352
// Choose number of parts and split boundaries
351353
const auto& histogram = rec.GetTableStats().GetDataSizeHistogram();
354+
// TODO: split with 1 key in histogram when no FlatIndex
352355
if (histogram.BucketsSize() < 2) {
353356
return true;
354357
}

ydb/core/tx/schemeshard/ut_split_merge/ut_split_merge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSplitBySizeTest) {
107107
UNIT_ASSERT_VALUES_EQUAL(err, "");
108108
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
109109
};
110-
for (ui64 key = 0; key < 1000; ++key) {
110+
for (ui64 key = 0; key < 1200; ++key) {
111111
fnWriteRow(TTestTxConfig::FakeHiveTablets, key* 1'000'000);
112112
}
113113

0 commit comments

Comments
 (0)