Skip to content

Commit 22845bd

Browse files
authored
[Backport stable-25-3] PR #30244: Fix S3 data loss in BlobDepot (#30248)
2 parents b140ba5 + 2520add commit 22845bd

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

ydb/core/blob_depot/data.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ namespace NKikimr::NBlobDepot {
808808
}
809809

810810
bool TData::IsUseful(const TS3Locator& locator) const {
811+
Y_DEBUG_ABORT_UNLESS(IsLoaded());
811812
return RefCountS3.contains(locator);
812813
}
813814

ydb/core/blob_depot/data_load.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ namespace NKikimr::NBlobDepot {
204204

205205
void TBlobDepot::OnDataLoadComplete() {
206206
BarrierServer->OnDataLoaded();
207+
S3Manager->OnDataLoaded();
207208
StartGroupAssimilator();
208209
TabletCounters->Simple()[NKikimrBlobDepot::COUNTER_MODE_LOADING_KEYS] = 0;
209210
TabletCounters->Simple()[NKikimrBlobDepot::COUNTER_MODE_LOADED] = 1;

ydb/core/blob_depot/s3.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ namespace NKikimr::NBlobDepot {
2121
Bucket = settings->GetSettings().GetBucket();
2222
SyncMode = settings->HasSyncMode();
2323
AsyncMode = settings->HasAsyncMode();
24-
RunScannerActor();
24+
Enabled = true;
2525
} else {
2626
SyncMode = false;
2727
AsyncMode = false;
28+
Enabled = false;
2829
}
2930
}
3031

@@ -47,6 +48,12 @@ namespace NKikimr::NBlobDepot {
4748
)
4849
}
4950

51+
void TS3Manager::OnDataLoaded() {
52+
if (Enabled) {
53+
RunScannerActor();
54+
}
55+
}
56+
5057
void TBlobDepot::InitS3Manager() {
5158
S3Manager->Init(Config.HasS3BackendSettings() ? &Config.GetS3BackendSettings() : nullptr);
5259
}

ydb/core/blob_depot/s3.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace NKikimr::NBlobDepot {
1313
TString BasePath;
1414
TString Bucket;
1515

16+
bool Enabled = false;
1617
bool SyncMode = false;
1718
bool AsyncMode = false;
1819

@@ -38,6 +39,8 @@ namespace NKikimr::NBlobDepot {
3839
ui64 GetTotalS3TrashObjects() const { return TotalS3TrashObjects; }
3940
ui64 GetTotalS3TrashSize() const { return TotalS3TrashSize; }
4041

42+
void OnDataLoaded();
43+
4144
private: ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4245
class TTxPrepareWriteS3;
4346
friend class TBlobDepot;

ydb/core/blob_depot/s3_windows_stub.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ namespace NKikimr::NBlobDepot {
4343
Y_ABORT("S3 is not supported on Windows");
4444
}
4545

46+
void TBlobDepot::OnDataLoaded() {}
47+
4648
void TBlobDepot::InitS3Manager() {
4749
S3Manager->Init(Config.HasS3BackendSettings() ? &Config.GetS3BackendSettings() : nullptr);
4850
}

0 commit comments

Comments
 (0)