Skip to content

Commit 7f0d628

Browse files
Fix TExportToS3WithRebootsTests CancelShouldSucceedOnManyTables test after auto dropping (#17381)
Co-authored-by: Ilnaz Nizametdinov <i.nizametdinov@gmail.com>
1 parent 8a844f1 commit 7f0d628

File tree

5 files changed

+38
-15
lines changed

5 files changed

+38
-15
lines changed

.github/config/muted_ya.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ ydb/core/quoter/ut QuoterWithKesusTest.KesusRecreation
4848
ydb/core/quoter/ut QuoterWithKesusTest.PrefetchCoefficient
4949
ydb/core/statistics/aggregator/ut AnalyzeColumnshard.AnalyzeRebootColumnShard
5050
ydb/core/tx/datashard/ut_incremental_backup IncrementalBackup.ComplexRestoreBackupCollection+WithIncremental
51-
ydb/core/tx/schemeshard/ut_export_reboots_s3 TExportToS3WithRebootsTests.CancelShouldSucceedOnManyTables
5251
ydb/core/tx/schemeshard/ut_export_reboots_s3 TExportToS3WithRebootsTests.ShouldSucceedOnManyTables
5352
ydb/core/tx/schemeshard/ut_login_large TSchemeShardLoginLargeTest.RemoveLogin_Many
5453
ydb/core/tx/schemeshard/ut_move_reboots TSchemeShardMoveRebootsTest.WithData

ydb/core/tx/schemeshard/schemeshard_export__create.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,18 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
554554
Send(Self->TxAllocatorClient, new TEvTxAllocatorClient::TEvAllocate(), 0, exportInfo->Id);
555555
}
556556

557+
void PrepareAutoDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db) {
558+
bool isContinued = false;
559+
PrepareDropping(ss, exportInfo, db, TExportInfo::EState::AutoDropping, [&](ui64 itemIdx) {
560+
exportInfo->PendingDropItems.push_back(itemIdx);
561+
isContinued = true;
562+
AllocateTxId(exportInfo);
563+
});
564+
if (!isContinued) {
565+
AllocateTxId(exportInfo);
566+
}
567+
}
568+
557569
void SubscribeTx(TTxId txId) {
558570
Send(Self->SelfId(), new TEvSchemeShard::TEvNotifyTxCompletion(ui64(txId)));
559571
}
@@ -1146,8 +1158,7 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
11461158
Self->PersistExportItemState(db, exportInfo, itemIdx);
11471159

11481160
if (AllOf(exportInfo->Items, &TExportInfo::TItem::IsDone)) {
1149-
PrepareDropping(Self, exportInfo, db, true);
1150-
AllocateTxId(exportInfo);
1161+
PrepareAutoDropping(Self, exportInfo, db);
11511162
}
11521163
} else if (exportInfo->State == EState::Cancellation) {
11531164
item.State = EState::Cancelled;
@@ -1347,8 +1358,7 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
13471358
}
13481359
}
13491360
if (!itemHasIssues && AllOf(exportInfo->Items, &TExportInfo::TItem::IsDone)) {
1350-
PrepareDropping(Self, exportInfo, db, true);
1351-
AllocateTxId(exportInfo);
1361+
PrepareAutoDropping(Self, exportInfo, db);
13521362
}
13531363

13541364
Self->PersistExportItemState(db, exportInfo, itemIdx);
@@ -1365,7 +1375,7 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
13651375
item.WaitTxId = InvalidTxId;
13661376
Self->PersistExportItemState(db, exportInfo, itemIdx);
13671377

1368-
if (exportInfo->AllItemsAreDropped() || exportInfo->State == EState::AutoDropping) {
1378+
if (exportInfo->AllItemsAreDropped()) {
13691379
AllocateTxId(exportInfo);
13701380
}
13711381
} else {

ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,17 @@ TString ExportItemPathName(const TString& exportPathName, ui32 itemIdx) {
328328
return TStringBuilder() << exportPathName << "/" << itemIdx;
329329
}
330330

331-
void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db, bool isAutoDropping) {
331+
void PrepareDropping(
332+
TSchemeShard* ss,
333+
TExportInfo::TPtr exportInfo,
334+
NIceDb::TNiceDb& db,
335+
TExportInfo::EState droppingState,
336+
std::function<void(ui64)> func)
337+
{
338+
Y_ABORT_UNLESS(IsIn({TExportInfo::EState::AutoDropping, TExportInfo::EState::Dropping}, droppingState));
339+
332340
exportInfo->WaitTxId = InvalidTxId;
333-
exportInfo->State = isAutoDropping ? TExportInfo::EState::AutoDropping : TExportInfo::EState::Dropping;
341+
exportInfo->State = droppingState;
334342
ss->PersistExportState(db, exportInfo);
335343

336344
for (ui32 itemIdx : xrange(exportInfo->Items.size())) {
@@ -341,14 +349,18 @@ void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNi
341349
const TPath itemPath = TPath::Resolve(ExportItemPathName(ss, exportInfo, itemIdx), ss);
342350
if (itemPath.IsResolved() && !itemPath.IsDeleted()) {
343351
item.State = TExportInfo::EState::Dropping;
344-
if (isAutoDropping) {
345-
exportInfo->PendingDropItems.push_back(itemIdx);
352+
if (exportInfo->State == TExportInfo::EState::AutoDropping) {
353+
func(itemIdx);
346354
}
347355
}
348356

349357
ss->PersistExportItemState(db, exportInfo, itemIdx);
350358
}
351359
}
352360

361+
void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db) {
362+
PrepareDropping(ss, exportInfo, db, TExportInfo::EState::Dropping, [](ui64){});
363+
}
364+
353365
} // NSchemeShard
354366
} // NKikimr

ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
4747
TString ExportItemPathName(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx);
4848
TString ExportItemPathName(const TString& exportPathName, ui32 itemIdx);
4949

50-
void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db, bool isAutoDropping = false);
50+
void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db,
51+
TExportInfo::EState droppingState, std::function<void(ui64)> func);
52+
void PrepareDropping(TSchemeShard* ss, TExportInfo::TPtr exportInfo, NIceDb::TNiceDb& db);
5153

5254
} // NSchemeShard
5355
} // NKikimr

ydb/core/tx/schemeshard/ut_export/ut_export.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ partitioning_settings {
12641264
TTestEnv env(runtime);
12651265
ui64 txId = 100;
12661266

1267-
TBlockEvents<NKikimr::NWrappers::NExternalStorage::TEvPutObjectRequest> blockPartition0(runtime, [](auto&& ev) {
1267+
TBlockEvents<NKikimr::NWrappers::NExternalStorage::TEvPutObjectRequest> blockPartition01(runtime, [](auto&& ev) {
12681268
return ev->Get()->Request.GetKey() == "/data_01.csv";
12691269
});
12701270

@@ -1300,7 +1300,7 @@ partitioning_settings {
13001300
)", port));
13011301

13021302

1303-
runtime.WaitFor("put object request from 01 partition", [&]{ return blockPartition0.size() >= 1; });
1303+
runtime.WaitFor("put object request from 01 partition", [&]{ return blockPartition01.size() >= 1; });
13041304
bool isCompleted = false;
13051305

13061306
while (!isCompleted) {
@@ -1318,8 +1318,8 @@ partitioning_settings {
13181318
}
13191319
}
13201320

1321-
blockPartition0.Stop();
1322-
blockPartition0.Unblock();
1321+
blockPartition01.Stop();
1322+
blockPartition01.Unblock();
13231323

13241324
env.TestWaitNotification(runtime, txId);
13251325

0 commit comments

Comments
 (0)