Skip to content

Commit e5fe580

Browse files
authored
Merge e8dad24 into be7fe5b
2 parents be7fe5b + e8dad24 commit e5fe580

7 files changed

+45
-0
lines changed

ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,16 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
557557
<< "We are sure you did this or something even more creative, like killing the formatter.";
558558
LOG_ERROR_S(*TlsActivationContext, NKikimrServices::BS_PDISK, str.Str());
559559
InitError(str.Str());
560+
} else if (!PDisk->CheckPlainChunksNotUsed()) {
561+
*PDisk->Mon.PDiskState = NKikimrBlobStorage::TPDiskState::InitialFormatReadError;
562+
*PDisk->Mon.PDiskBriefState = TPDiskMon::TPDisk::Error;
563+
*PDisk->Mon.PDiskDetailedState = TPDiskMon::TPDisk::ErrorInitialFormatRead;
564+
PDisk->ErrorStr = "This disk used plain chunks. The feature is not supported in current version!";
565+
TStringStream str;
566+
str << "PDiskId# " << PDisk->PDiskId << " " << PDisk->ErrorStr << " "
567+
<< "data is not corrupted, but can be retrieved only with PDisk of newer version (25-1+)";
568+
LOG_ERROR_S(*TlsActivationContext, NKikimrServices::BS_PDISK, str.Str());
569+
InitError(str.Str());
560570
} else {
561571
// PDisk GUID is OK and format is complete
562572
*PDisk->Mon.PDiskState = NKikimrBlobStorage::TPDiskState::InitialSysLogRead;

ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ struct TPDiskConfig : public TThrRefBase {
159159

160160
ui32 CompletionThreadsCount = 1;
161161

162+
bool PlainDataChunks = false;
163+
162164
TPDiskConfig(ui64 pDiskGuid, ui32 pdiskId, ui64 pDiskCategory)
163165
: TPDiskConfig({}, pDiskGuid, pdiskId, pDiskCategory)
164166
{}
@@ -307,6 +309,7 @@ struct TPDiskConfig : public TThrRefBase {
307309
str << " YellowLogChunksMultiplier# " << YellowLogChunksMultiplier << x;
308310
str << " SpaceColorBorder# " << SpaceColorBorder << x;
309311
str << " CompletionThreadsCount# " << CompletionThreadsCount << x;
312+
str << " PlainDataChunks# " << PlainDataChunks << x;
310313
str << "}";
311314
return str.Str();
312315
}
@@ -392,6 +395,9 @@ struct TPDiskConfig : public TThrRefBase {
392395
if (cfg->HasCompletionThreadsCount()) {
393396
CompletionThreadsCount = cfg->GetCompletionThreadsCount();
394397
}
398+
if (cfg->HasPlainDataChunks()) {
399+
PlainDataChunks = cfg->GetPlainDataChunks();
400+
}
395401
}
396402
};
397403

ydb/core/blobstorage/pdisk/blobstorage_pdisk_data.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ enum EFormatFlags {
484484
FormatFlagEncryptFormat = 1 << 5, // Always on, flag is useless
485485
FormatFlagEncryptData = 1 << 6, // Always on, flag is useless
486486
FormatFlagFormatInProgress = 1 << 7, // Not implemented (Must be OFF for a formatted disk)
487+
FormatFlagPlainDataChunks = 1 << 8, // Default is off, means "encrypted", for backward compatibility
487488
};
488489

489490
struct TDiskFormat {
@@ -530,6 +531,7 @@ struct TDiskFormat {
530531
isFirst = NText::OutFlag(isFirst, flags & FormatFlagEncryptFormat, "EncryptFormat", str);
531532
isFirst = NText::OutFlag(isFirst, flags & FormatFlagEncryptData, "EncryptData", str);
532533
isFirst = NText::OutFlag(isFirst, flags & FormatFlagFormatInProgress, "FormatFlagFormatInProgress", str);
534+
isFirst = NText::OutFlag(isFirst, flags & FormatFlagPlainDataChunks, "FormatFlagPlainDataChunks", str);
533535
NText::OutFlag(isFirst, isFirst, "Unknown", str);
534536
return str.Str();
535537
}
@@ -599,6 +601,10 @@ struct TDiskFormat {
599601
return FormatFlags & FormatFlagFormatInProgress;
600602
}
601603

604+
bool IsPlainDataChunks() const {
605+
return FormatFlags & FormatFlagPlainDataChunks;
606+
}
607+
602608
void SetFormatInProgress(bool isInProgress) {
603609
FormatFlags &= ~FormatFlagFormatInProgress;
604610
if (isInProgress) {

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ bool TPDisk::CheckFormatComplete() {
230230
return !Format.IsFormatInProgress();
231231
}
232232

233+
bool TPDisk::CheckPlainChunksNotUsed() {
234+
return !Format.IsPlainDataChunks();
235+
}
236+
233237
void TPDisk::InitFreeChunks() {
234238
TGuard<TMutex> guard(StateMutex);
235239
for (ui32 i = 0; i < ChunkState.size(); ++i) {

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class TPDisk : public IPDisk {
209209
bool IsFormatMagicValid(ui8 *magicData, ui32 magicDataSize); // Called by actor
210210
bool CheckGuid(TString *outReason); // Called by actor
211211
bool CheckFormatComplete(); // Called by actor
212+
bool CheckPlainChunksNotUsed(); // Called by actor
212213
void ReadSysLog(const TActorId &pDiskActor); // Called by actor
213214
bool ProcessChunk0(const TEvReadLogResult &readLogResult, TString& errorReason);
214215
void PrintChunksDebugInfo();

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ void TPDisk::RenderState(IOutputStream &str, THttpInfo &httpInfo) {
8080
}
8181
}
8282
}
83+
TABLER() {
84+
TABLED() {str << "PlainDataChunks";}
85+
TABLED() {
86+
if (Format.IsPlainDataChunks()) {
87+
RED_TEXT(str, "Plain data chunks are not supported in this version");
88+
if (!Cfg->PlainDataChunks) {
89+
YELLOW_TEXT(str, "notice: config is set for encrypted chunks");
90+
}
91+
} else {
92+
GREEN_TEXT(str, "Encrypted data chunks are in use");
93+
if (Cfg->PlainDataChunks) {
94+
YELLOW_TEXT(str, "notice: config is set for plain chunks<br>(not supported in this version, nothing is gonna happen)");
95+
}
96+
}
97+
}
98+
}
8399
}
84100
}
85101
TAG(TH4) {str << "State description"; }

ydb/core/protos/blobstorage_pdisk_config.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ message TPDiskConfig {
9393
optional uint32 ChunkBaseLimit = 2002; // Free chunk permille that triggers Cyan color (e.g. 100 is 10%). Between 130 (default) and 13.
9494

9595
optional uint32 CompletionThreadsCount = 2003;
96+
reserved 2004;
97+
optional bool PlainDataChunks = 2005;
9698
};

0 commit comments

Comments
 (0)