Skip to content

Commit

Permalink
a separate flag instead of extending enum
Browse files Browse the repository at this point in the history
  • Loading branch information
vporyadke committed Oct 10, 2024
1 parent e77be53 commit ba369f8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ydb/core/health_check/health_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
&& info.has_lastalivetimestamp()
&& (info.lastalivetimestamp() != 0 && TInstant::MilliSeconds(info.lastalivetimestamp()) < settings.AliveBarrier)
&& info.tabletbootmode() == NKikimrHive::TABLET_BOOT_MODE_DEFAULT
&& (info.generation() > 0 || info.volatilestate() != NKikimrHive::TABLET_VOLATILE_STATE_BOOTING)) {
&& (info.generation() > 0 || info.volatilestate() != NKikimrHive::TABLET_VOLATILE_STATE_BOOTING || info.inwaitqueue())) {
State = ETabletState::Dead;
} else if (info.restartsperperiod() >= settings.MaxRestartsPerPeriod) {
State = ETabletState::RestartsTooOften;
Expand Down
6 changes: 5 additions & 1 deletion ydb/core/mind/hive/hive_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ void THive::ExecuteProcessBootQueue(NIceDb::TNiceDb&, TSideEffects& sideEffects)
if (tablet == nullptr) {
continue;
}
tablet->InWaitQueue = false;
if (tablet->IsAlive()) {
BLOG_D("tablet " << record.TabletId << " already alive, skipping");
continue;
Expand All @@ -258,7 +259,7 @@ void THive::ExecuteProcessBootQueue(NIceDb::TNiceDb&, TSideEffects& sideEffects)
}
tablet->ActorsToNotifyOnRestart.clear();
BootQueue.AddToWaitQueue(record); // waiting for new node
tablet->ChangeVolatileState(TTabletInfo::EVolatileState::TABLET_VOLATILE_STATE_WAITING);
tablet->InWaitQueue = true;
continue;
}
}
Expand Down Expand Up @@ -1879,6 +1880,9 @@ void THive::FillTabletInfo(NKikimrHive::TEvResponseHiveInfo& response, ui64 tabl
if (req.GetReturnMetrics()) {
tabletInfo.MutableMetrics()->CopyFrom(info->GetResourceValues());
}
if (info->InWaitQueue) {
tabletInfo.SetInWaitQueue(true);
}
if (req.GetReturnChannelHistory()) {
for (const auto& channel : info->TabletStorageInfo->Channels) {
auto& tabletChannel = *tabletInfo.AddTabletChannels();
Expand Down
5 changes: 1 addition & 4 deletions ydb/core/mind/hive/tablet_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ bool TTabletInfo::IsReadyToStart(TInstant now) const {
return false;
}
}
return NodeId == 0 &&
(VolatileState == EVolatileState::TABLET_VOLATILE_STATE_BOOTING
|| VolatileState == EVolatileState::TABLET_VOLATILE_STATE_WAITING) &&
now >= PostponedStart;
return NodeId == 0 && VolatileState == EVolatileState::TABLET_VOLATILE_STATE_BOOTING && now >= PostponedStart;
}

bool TTabletInfo::IsStarting() const {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/mind/hive/tablet_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ struct TTabletInfo {
case EVolatileState::TABLET_VOLATILE_STATE_STARTING: return "Starting";
case EVolatileState::TABLET_VOLATILE_STATE_RUNNING: return "Running";
case EVolatileState::_TABLET_VOLATILE_STATE_BLOCKED: return "Blocked";
case EVolatileState::TABLET_VOLATILE_STATE_WAITING: return "Waiting";
default: return Sprintf("%d", static_cast<int>(value));
}
}
Expand Down Expand Up @@ -165,6 +164,7 @@ struct TTabletInfo {
TNodeId FailedNodeId = 0; // last time we tried to start the tablet, we failed on this node
TInstant BootTime;
TNodeFilter NodeFilter;
bool InWaitQueue = false;

TTabletInfo(ETabletRole role, THive& hive);
TTabletInfo(const TTabletInfo&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/protos/hive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ enum ETabletVolatileState {
TABLET_VOLATILE_STATE_STARTING = 3;
TABLET_VOLATILE_STATE_RUNNING = 4;
_TABLET_VOLATILE_STATE_BLOCKED = 5; // deprecated
TABLET_VOLATILE_STATE_WAITING = 6;
}

enum EMigrationState {
Expand Down Expand Up @@ -496,6 +495,7 @@ message TTabletInfo {
optional uint32 RestartsPerPeriod = 22;
optional uint64 LastAliveTimestamp = 23;
optional EBalancerPolicy BalancerPolicy = 24;
optional bool InWaitQueue = 25;
}

message TEvSeizeTabletsReply {
Expand Down
1 change: 0 additions & 1 deletion ydb/core/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ NKikimrViewer::EFlag GetFlagFromTabletState(NKikimrHive::ETabletVolatileState st
NKikimrViewer::EFlag flag = NKikimrViewer::EFlag::Grey;
switch (state) {
case NKikimrHive::ETabletVolatileState::TABLET_VOLATILE_STATE_STOPPED:
case NKikimrHive::ETabletVolatileState::TABLET_VOLATILE_STATE_WAITING:
flag = NKikimrViewer::EFlag::Red;
break;
case NKikimrHive::ETabletVolatileState::TABLET_VOLATILE_STATE_BOOTING:
Expand Down

0 comments on commit ba369f8

Please sign in to comment.