Skip to content

Commit 3a3c392

Browse files
authored
Fix metadata processing on SectorMap (merge from main #15418) (#15446)
1 parent 0264d40 commit 3a3c392

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_metadata.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,15 @@ namespace NKikimr::NPDisk {
621621
const size_t bytesToWrite = payload.size();
622622

623623
ui64 rawDeviceSize = 0;
624-
try {
625-
bool isBlockDevice = false;
626-
DetectFileParameters(Cfg->Path, rawDeviceSize, isBlockDevice);
627-
} catch (const std::exception&) {
628-
rawDeviceSize = 0;
624+
if (Cfg->SectorMap) {
625+
rawDeviceSize = Cfg->SectorMap->GetDeviceSize();
626+
} else {
627+
try {
628+
bool isBlockDevice = false;
629+
DetectFileParameters(Cfg->Path, rawDeviceSize, isBlockDevice);
630+
} catch (const std::exception&) {
631+
rawDeviceSize = 0;
632+
}
629633
}
630634

631635
const ui64 deviceSizeInBytes = rawDeviceSize & ~ui64(DefaultSectorSize - 1);

ydb/library/pdisk_io/sector_map.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ class TSectorMap : public TThrRefBase {
356356
void LoadFromFile(const TString& path);
357357
void StoreToFile(const TString& path);
358358

359+
ui64 GetDeviceSize() const {
360+
return DeviceSize;
361+
}
362+
359363
NSectorMap::TSectorOperationThrottler::TDiskModeParams* GetDiskModeParams() {
360364
if (SectorOperationThrottler) {
361365
return SectorOperationThrottler->GetDiskModeParams();

0 commit comments

Comments
 (0)