Skip to content

Commit 791e87d

Browse files
committed
Shift tabulation to reduce merge conflicts
1 parent a2529fc commit 791e87d

File tree

4 files changed

+176
-175
lines changed

4 files changed

+176
-175
lines changed

ydb/core/tx/datashard/build_index/local_kmeans.cpp

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -193,80 +193,80 @@ class TLocalKMeansScan: public TActor<TLocalKMeansScan>, public NTable::IScan {
193193

194194
EScan Seek(TLead& lead, ui64 seq) noexcept final
195195
{
196-
try {
197-
LOG_T("Seek " << seq << " " << Debug());
196+
try {
197+
LOG_T("Seek " << seq << " " << Debug());
198198

199-
if (IsExhausted) {
200-
return Uploader.CanFinish()
201-
? EScan::Final
202-
: EScan::Sleep;
203-
}
199+
if (IsExhausted) {
200+
return Uploader.CanFinish()
201+
? EScan::Final
202+
: EScan::Sleep;
203+
}
204204

205-
lead = Lead;
205+
lead = Lead;
206206

207-
return EScan::Feed;
208-
} catch (const std::exception& exc) {
209-
Uploader.AddIssue(exc);
210-
return EScan::Final;
211-
}
207+
return EScan::Feed;
208+
} catch (const std::exception& exc) {
209+
Uploader.AddIssue(exc);
210+
return EScan::Final;
211+
}
212212
}
213213

214214
EScan Feed(TArrayRef<const TCell> key, const TRow& row) noexcept final
215215
{
216-
try {
217-
// LOG_T("Feed " << Debug());
216+
try {
217+
// LOG_T("Feed " << Debug());
218218

219-
++ReadRows;
220-
ReadBytes += CountBytes(key, row);
219+
++ReadRows;
220+
ReadBytes += CountBytes(key, row);
221221

222-
if (PrefixColumns && Prefix && !TCellVectorsEquals{}(Prefix.GetCells(), key.subspan(0, PrefixColumns))) {
223-
if (!FinishPrefix()) {
224-
// scan current prefix rows with a new state again
225-
return EScan::Reset;
226-
}
222+
if (PrefixColumns && Prefix && !TCellVectorsEquals{}(Prefix.GetCells(), key.subspan(0, PrefixColumns))) {
223+
if (!FinishPrefix()) {
224+
// scan current prefix rows with a new state again
225+
return EScan::Reset;
227226
}
227+
}
228228

229-
if (PrefixColumns && !Prefix) {
230-
Prefix = TSerializedCellVec{key.subspan(0, PrefixColumns)};
231-
auto newParent = key.at(0).template AsValue<ui64>();
232-
Child += (newParent - Parent) * Clusters->GetK();
233-
Parent = newParent;
234-
}
229+
if (PrefixColumns && !Prefix) {
230+
Prefix = TSerializedCellVec{key.subspan(0, PrefixColumns)};
231+
auto newParent = key.at(0).template AsValue<ui64>();
232+
Child += (newParent - Parent) * Clusters->GetK();
233+
Parent = newParent;
234+
}
235235

236-
if (IsFirstPrefixFeed && IsPrefixRowsValid) {
237-
PrefixRows.AddRow(TSerializedCellVec{key}, TSerializedCellVec::Serialize(*row));
238-
if (HasReachedLimits(PrefixRows, ScanSettings)) {
239-
PrefixRows.Clear();
240-
IsPrefixRowsValid = false;
241-
}
236+
if (IsFirstPrefixFeed && IsPrefixRowsValid) {
237+
PrefixRows.AddRow(TSerializedCellVec{key}, TSerializedCellVec::Serialize(*row));
238+
if (HasReachedLimits(PrefixRows, ScanSettings)) {
239+
PrefixRows.Clear();
240+
IsPrefixRowsValid = false;
242241
}
242+
}
243243

244-
Feed(key, *row);
244+
Feed(key, *row);
245245

246-
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
247-
} catch (const std::exception& exc) {
248-
Uploader.AddIssue(exc);
249-
return EScan::Final;
250-
}
246+
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
247+
} catch (const std::exception& exc) {
248+
Uploader.AddIssue(exc);
249+
return EScan::Final;
250+
}
251251
}
252252

253253
EScan Exhausted() noexcept final
254254
{
255-
try {
256-
LOG_T("Exhausted " << Debug());
257-
258-
if (!FinishPrefix()) {
259-
return EScan::Reset;
260-
}
261-
262-
IsExhausted = true;
255+
try {
256+
LOG_T("Exhausted " << Debug());
263257

264-
// call Seek to wait uploads
258+
if (!FinishPrefix()) {
265259
return EScan::Reset;
266-
} catch (const std::exception& exc) {
267-
Uploader.AddIssue(exc);
268-
return EScan::Final;
269260
}
261+
262+
IsExhausted = true;
263+
264+
// call Seek to wait uploads
265+
return EScan::Reset;
266+
} catch (const std::exception& exc) {
267+
Uploader.AddIssue(exc);
268+
return EScan::Final;
269+
}
270270
}
271271

272272
protected:

ydb/core/tx/datashard/build_index/prefix_kmeans.cpp

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -226,84 +226,84 @@ class TPrefixKMeansScan: public TActor<TPrefixKMeansScan>, public NTable::IScan
226226

227227
EScan Seek(TLead& lead, ui64 seq) noexcept final
228228
{
229-
try {
230-
LOG_T("Seek " << seq << " " << Debug());
229+
try {
230+
LOG_T("Seek " << seq << " " << Debug());
231231

232-
if (IsExhausted) {
233-
return Uploader.CanFinish()
234-
? EScan::Final
235-
: EScan::Sleep;
236-
}
232+
if (IsExhausted) {
233+
return Uploader.CanFinish()
234+
? EScan::Final
235+
: EScan::Sleep;
236+
}
237237

238-
lead = Lead;
238+
lead = Lead;
239239

240-
return EScan::Feed;
241-
} catch (const std::exception& exc) {
242-
Uploader.AddIssue(exc);
243-
return EScan::Final;
244-
}
240+
return EScan::Feed;
241+
} catch (const std::exception& exc) {
242+
Uploader.AddIssue(exc);
243+
return EScan::Final;
244+
}
245245
}
246246

247247
EScan Feed(TArrayRef<const TCell> key, const TRow& row) noexcept final
248248
{
249-
try {
250-
// LOG_T("Feed " << Debug());
249+
try {
250+
// LOG_T("Feed " << Debug());
251251

252-
++ReadRows;
253-
ReadBytes += CountBytes(key, row);
252+
++ReadRows;
253+
ReadBytes += CountBytes(key, row);
254254

255-
if (Prefix && !TCellVectorsEquals{}(Prefix.GetCells(), key.subspan(0, PrefixColumns))) {
256-
if (!FinishPrefix()) {
257-
// scan current prefix rows with a new state again
258-
return EScan::Reset;
259-
}
255+
if (Prefix && !TCellVectorsEquals{}(Prefix.GetCells(), key.subspan(0, PrefixColumns))) {
256+
if (!FinishPrefix()) {
257+
// scan current prefix rows with a new state again
258+
return EScan::Reset;
260259
}
260+
}
261261

262-
if (!Prefix) {
263-
Prefix = TSerializedCellVec{key.subspan(0, PrefixColumns)};
262+
if (!Prefix) {
263+
Prefix = TSerializedCellVec{key.subspan(0, PrefixColumns)};
264264

265-
// write {Prefix..., Parent} row to PrefixBuf:
266-
auto pk = TSerializedCellVec::Serialize(Prefix.GetCells());
267-
std::array<TCell, 1> cells;
268-
cells[0] = TCell::Make(Parent);
269-
TSerializedCellVec::UnsafeAppendCells(cells, pk);
270-
PrefixBuf->AddRow(TSerializedCellVec{std::move(pk)}, TSerializedCellVec::Serialize({}));
271-
}
265+
// write {Prefix..., Parent} row to PrefixBuf:
266+
auto pk = TSerializedCellVec::Serialize(Prefix.GetCells());
267+
std::array<TCell, 1> cells;
268+
cells[0] = TCell::Make(Parent);
269+
TSerializedCellVec::UnsafeAppendCells(cells, pk);
270+
PrefixBuf->AddRow(TSerializedCellVec{std::move(pk)}, TSerializedCellVec::Serialize({}));
271+
}
272272

273-
if (IsFirstPrefixFeed && IsPrefixRowsValid) {
274-
PrefixRows.AddRow(TSerializedCellVec{key}, TSerializedCellVec::Serialize(*row));
275-
if (HasReachedLimits(PrefixRows, ScanSettings)) {
276-
PrefixRows.Clear();
277-
IsPrefixRowsValid = false;
278-
}
273+
if (IsFirstPrefixFeed && IsPrefixRowsValid) {
274+
PrefixRows.AddRow(TSerializedCellVec{key}, TSerializedCellVec::Serialize(*row));
275+
if (HasReachedLimits(PrefixRows, ScanSettings)) {
276+
PrefixRows.Clear();
277+
IsPrefixRowsValid = false;
279278
}
279+
}
280280

281-
Feed(key, *row);
281+
Feed(key, *row);
282282

283-
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
284-
} catch (const std::exception& exc) {
285-
Uploader.AddIssue(exc);
286-
return EScan::Final;
287-
}
283+
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
284+
} catch (const std::exception& exc) {
285+
Uploader.AddIssue(exc);
286+
return EScan::Final;
287+
}
288288
}
289289

290290
EScan Exhausted() noexcept final
291291
{
292-
try {
293-
LOG_T("Exhausted " << Debug());
294-
295-
if (!FinishPrefix()) {
296-
return EScan::Reset;
297-
}
298-
299-
IsExhausted = true;
292+
try {
293+
LOG_T("Exhausted " << Debug());
300294

301-
// call Seek to wait uploads
295+
if (!FinishPrefix()) {
302296
return EScan::Reset;
303-
} catch (const std::exception& exc) {
304-
Uploader.AddIssue(exc);
305-
return EScan::Final;
306297
}
298+
299+
IsExhausted = true;
300+
301+
// call Seek to wait uploads
302+
return EScan::Reset;
303+
} catch (const std::exception& exc) {
304+
Uploader.AddIssue(exc);
305+
return EScan::Final;
306+
}
307307
}
308308

309309
protected:

ydb/core/tx/datashard/build_index/reshuffle_kmeans.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -167,54 +167,54 @@ class TReshuffleKMeansScan: public TActor<TReshuffleKMeansScan>, public NTable::
167167

168168
EScan Seek(TLead& lead, ui64 seq) noexcept final
169169
{
170-
try {
171-
LOG_T("Seek " << seq << " " << Debug());
170+
try {
171+
LOG_T("Seek " << seq << " " << Debug());
172172

173-
if (IsExhausted) {
174-
return Uploader.CanFinish()
175-
? EScan::Final
176-
: EScan::Sleep;
177-
}
173+
if (IsExhausted) {
174+
return Uploader.CanFinish()
175+
? EScan::Final
176+
: EScan::Sleep;
177+
}
178178

179-
lead = Lead;
179+
lead = Lead;
180180

181-
return EScan::Feed;
182-
} catch (const std::exception& exc) {
183-
Uploader.AddIssue(exc);
184-
return EScan::Final;
185-
}
181+
return EScan::Feed;
182+
} catch (const std::exception& exc) {
183+
Uploader.AddIssue(exc);
184+
return EScan::Final;
185+
}
186186
}
187187

188188
EScan Feed(TArrayRef<const TCell> key, const TRow& row) noexcept final
189189
{
190-
try {
191-
// LOG_T("Feed " << Debug());
190+
try {
191+
// LOG_T("Feed " << Debug());
192192

193-
++ReadRows;
194-
ReadBytes += CountBytes(key, row);
193+
++ReadRows;
194+
ReadBytes += CountBytes(key, row);
195195

196-
Feed(key, *row);
196+
Feed(key, *row);
197197

198-
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
199-
} catch (const std::exception& exc) {
200-
Uploader.AddIssue(exc);
201-
return EScan::Final;
202-
}
198+
return Uploader.ShouldWaitUpload() ? EScan::Sleep : EScan::Feed;
199+
} catch (const std::exception& exc) {
200+
Uploader.AddIssue(exc);
201+
return EScan::Final;
202+
}
203203
}
204204

205205
EScan Exhausted() noexcept final
206206
{
207-
try {
208-
LOG_T("Exhausted " << Debug());
207+
try {
208+
LOG_T("Exhausted " << Debug());
209209

210-
IsExhausted = true;
210+
IsExhausted = true;
211211

212-
// call Seek to wait uploads
213-
return EScan::Reset;
214-
} catch (const std::exception& exc) {
215-
Uploader.AddIssue(exc);
216-
return EScan::Final;
217-
}
212+
// call Seek to wait uploads
213+
return EScan::Reset;
214+
} catch (const std::exception& exc) {
215+
Uploader.AddIssue(exc);
216+
return EScan::Final;
217+
}
218218
}
219219

220220
protected:

0 commit comments

Comments
 (0)