Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,9 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
void Handle(TEvBlobStorage::TEvAskWardenRestartPDiskResult::TPtr &ev) {
bool restartAllowed = ev->Get()->RestartAllowed;

bool isReadingLog = PDisk->InitPhase == EInitPhase::ReadingSysLog || PDisk->InitPhase == EInitPhase::ReadingLog;
EInitPhase initPhase = PDisk->InitPhase.load();

bool isReadingLog = initPhase == EInitPhase::ReadingSysLog || initPhase == EInitPhase::ReadingLog;

if ((isReadingLog && CurrentStateFunc() != &TPDiskActor::StateError) || IsFormattingNow) {
// If disk is in the process of initialization (reading log) and it is not in error state, or disk is being formatted,
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class TPDisk : public IPDisk {

// Initialization data
ui64 InitialSysLogWritePosition = 0;
EInitPhase InitPhase = EInitPhase::Uninitialized;
std::atomic<EInitPhase> InitPhase = EInitPhase::Uninitialized;
TBuffer *InitialTailBuffer = nullptr;
TLogPosition InitialLogPosition{0, 0};
volatile ui64 InitialPreviousNonce = 0;
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ void TPDisk::MarkChunksAsReleased(TReleaseChunks& req) {
void TPDisk::InitiateReadSysLog(const TActorId &pDiskActor) {
Y_VERIFY_S(PDiskThread.Running(), "expect PDiskThread to be running");
Y_VERIFY_S(InitPhase == EInitPhase::Uninitialized, "expect InitPhase to be Uninitialized, but InitPhase# "
<< InitPhase);
<< InitPhase.load());
ui32 formatSectorsSize = FormatSectorSize * ReplicationFactor;
THolder<TEvReadFormatResult> evReadFormatResult(new TEvReadFormatResult(formatSectorsSize, UseHugePages));
ui8 *formatSectors = evReadFormatResult->FormatSectors.Get();
Expand All @@ -1329,7 +1329,7 @@ void TPDisk::ProcessReadLogResult(const NPDisk::TEvReadLogResult &evReadLogResul
if (evReadLogResult.Status != NKikimrProto::OK) {
P_LOG(PRI_ERROR, BPD01, "Error on log read",
(evReadLogResult, evReadLogResult.ToString()),
(InitPhase, InitPhase));
(InitPhase, InitPhase.load()));
switch (InitPhase) {
case EInitPhase::ReadingSysLog:
*Mon.PDiskState = NKikimrBlobStorage::TPDiskState::InitialSysLogReadError;
Expand Down Expand Up @@ -1509,7 +1509,7 @@ void TPDisk::ProcessReadLogResult(const NPDisk::TEvReadLogResult &evReadLogResul
return;
}
default:
Y_FAIL_S("Unexpected InitPhase# " << InitPhase);
Y_FAIL_S("Unexpected InitPhase# " << InitPhase.load());
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/blobstorage/ut_blobstorage/lib/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ struct TEnvironmentSetup {
}

static void SetupEnv() {
TAppData::TimeProvider = TTestActorSystem::CreateTimeProvider();
ui64 seed = RandomNumber<ui64>();
if (const TString& s = GetEnv("SEED", "")) {
seed = FromString<ui64>(s);
Expand Down Expand Up @@ -202,6 +201,7 @@ struct TEnvironmentSetup {

void Initialize() {
Runtime = MakeRuntime();
TAppData::TimeProvider = TTestActorSystem::CreateTimeProvider();
if (Settings.PrepareRuntime) {
Settings.PrepareRuntime(*Runtime);
}
Expand Down
10 changes: 8 additions & 2 deletions ydb/core/util/testactorsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,17 @@ IExecutorPool *TTestActorSystem::CreateTestExecutorPool(ui32 nodeId) {
thread_local TTestActorSystem *TTestActorSystem::CurrentTestActorSystem = nullptr;

TIntrusivePtr<ITimeProvider> TTestActorSystem::CreateTimeProvider() {
auto& clock = CurrentTestActorSystem->Clock;
class TTestActorTimeProvider : public ITimeProvider {
public:
TInstant Now() override { return CurrentTestActorSystem->Clock; }
TTestActorTimeProvider(TInstant& clock)
: Clock(clock)
{}
TInstant Now() override { return Clock; }
private:
TInstant& Clock;
};
return MakeIntrusive<TTestActorTimeProvider>();
return MakeIntrusive<TTestActorTimeProvider>(clock);
}

TIntrusivePtr<IMonotonicTimeProvider> TTestActorSystem::CreateMonotonicTimeProvider() {
Expand Down