Skip to content

Commit d1c89e9

Browse files
committed
clean up
1 parent 30faf2e commit d1c89e9

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

ydb/core/tablet_flat/flat_part_charge_btree_index.h

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ class TChargeBTreeIndex : public ICharge {
7373
endRowId++; // current interface accepts inclusive row2 bound
7474
Y_ABORT_UNLESS(beginRowId < endRowId);
7575

76-
Cerr << "Do " << " " << beginRowId << " " << endRowId << Endl;
77-
7876
bool ready = true;
79-
bool chargeGroups = true; // false value means that beginRowId, endRowId are invalid and shouldn't be used
77+
bool chargeGroups = bool(Groups); // false value means that beginRowId, endRowId are invalid and shouldn't be used
8078

8179
Y_UNUSED(itemsLimit);
8280
Y_UNUSED(bytesLimit);
@@ -154,18 +152,16 @@ class TChargeBTreeIndex : public ICharge {
154152
};
155153

156154
const auto tryHandleDataPage = [&](TChildState child) -> bool {
157-
if (child.PageId == key1PageId || child.PageId == key2PageId) {
155+
if (chargeGroups && (child.PageId == key1PageId || child.PageId == key2PageId)) {
158156
const auto page = TryGetDataPage(child.PageId, { });
159157
if (page) { // update beginRowId, endRowId
160158
auto data = NPage::TDataPage(page);
161159
if (child.PageId == key1PageId) {
162160
TRowId key1RowId = data.BaseRow() + data.LookupKey(key1, Scheme.Groups[0], ESeek::Lower, &keyDefaults).Off();
163-
Cerr << "key1RowId " << key1RowId << Endl;
164161
beginRowId = Max(beginRowId, key1RowId);
165162
}
166163
if (child.PageId == key2PageId) {
167164
TRowId key2RowId = data.BaseRow() + data.LookupKey(key2, Scheme.Groups[0], ESeek::Upper, &keyDefaults).Off();
168-
Cerr << "key2RowId " << key2RowId << Endl;
169165
endRowId = Min(endRowId, key2RowId);
170166
}
171167
return true;
@@ -218,10 +214,8 @@ class TChargeBTreeIndex : public ICharge {
218214
endRowId++; // current interface accepts inclusive row1 bound
219215
Y_ABORT_UNLESS(beginRowId < endRowId);
220216

221-
Cerr << "DoReverse " << " " << beginRowId << " " << endRowId << Endl;
222-
223217
bool ready = true;
224-
bool chargeGroups = true; // false value means that beginRowId, endRowId are invalid and shouldn't be used
218+
bool chargeGroups = bool(Groups); // false value means that beginRowId, endRowId are invalid and shouldn't be used
225219

226220
Y_UNUSED(itemsLimit);
227221
Y_UNUSED(bytesLimit);
@@ -272,18 +266,16 @@ class TChargeBTreeIndex : public ICharge {
272266
TRecIdx pos = node.SeekReverse(ESeek::Lower, key1, Scheme.Groups[0].ColsKeyIdx, &keyDefaults);
273267
key1PageId = node.GetShortChild(pos).PageId;
274268
endRowId = Min(endRowId, node.GetShortChild(pos).RowCount); // move endRowId - 1 to the last key <= key1
275-
Cerr << "End " << endRowId << " " << node.GetShortChild(pos).RowCount << Endl;
276-
// ??? v
277-
if (pos && node.GetShortChild(pos - 1).RowCount >= endRowId) {
278-
chargeGroups = false; // key1 is after current slice
279-
}
280269
}
281270
if (child.PageId == key2PageId) {
282271
TRecIdx pos = node.Seek(ESeek::Lower, key2, Scheme.Groups[0].ColsKeyIdx, &keyDefaults);
283272
key2PageId = node.GetShortChild(pos).PageId;
284273
if (pos) {
285274
beginRowId = Max(beginRowId, node.GetShortChild(pos - 1).RowCount - 1); // move beginRowId to the last key < key2
286-
}
275+
if (node.GetShortChild(pos - 1).RowCount >= endRowId) {
276+
chargeGroups = false; // key2 is after current slice
277+
}
278+
}
287279
}
288280
return true;
289281
} else { // skip unloaded page rows
@@ -301,15 +293,14 @@ class TChargeBTreeIndex : public ICharge {
301293
};
302294

303295
const auto tryHandleDataPage = [&](TChildState child) -> bool {
304-
if (child.PageId == key1PageId || child.PageId == key2PageId) {
296+
if (chargeGroups && (child.PageId == key1PageId || child.PageId == key2PageId)) {
305297
const auto page = TryGetDataPage(child.PageId, { });
306298
if (page) { // update beginRowId, endRowId
307299
auto data = NPage::TDataPage(page);
308300
if (child.PageId == key1PageId) {
309301
auto iter = data.LookupKeyReverse(key1, Scheme.Groups[0], ESeek::Lower, &keyDefaults);
310302
if (iter) {
311303
TRowId key1RowId = data.BaseRow() + iter.Off();
312-
Cerr << "key1RowId " << key1RowId << Endl;
313304
endRowId = Min(endRowId, key1RowId + 1);
314305
} else {
315306
endRowId = Min(endRowId, child.BeginRowId);
@@ -319,7 +310,6 @@ class TChargeBTreeIndex : public ICharge {
319310
auto iter = data.LookupKeyReverse(key2, Scheme.Groups[0], ESeek::Upper, &keyDefaults);
320311
if (iter) {
321312
TRowId key2RowId = data.BaseRow() + iter.Off();
322-
Cerr << "key2RowId " << key2RowId << Endl;
323313
beginRowId = Max(beginRowId, key2RowId + 1);
324314
} else {
325315
beginRowId = Max(beginRowId, child.BeginRowId);
@@ -372,7 +362,6 @@ class TChargeBTreeIndex : public ICharge {
372362

373363
private:
374364
bool DoPrechargeGroups(bool chargeGroups, TRowId beginRowId, TRowId endRowId) const noexcept {
375-
Cerr << "Groups " << chargeGroups << " " << beginRowId << " " << endRowId << Endl;
376365
bool ready = true;
377366

378367
if (chargeGroups && beginRowId < endRowId) {

0 commit comments

Comments
 (0)