@@ -77,7 +77,6 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
77
77
i64 MaxClockSkewWithPeerUs;
78
78
ui32 MaxClockSkewPeerId;
79
79
NKikimrWhiteboard::TSystemStateInfo SystemStateInfo;
80
- NKikimrMemory::TMemoryStats MemoryStats;
81
80
THolder<NTracing::ITraceCollection> TabletIntrospectionData;
82
81
83
82
::NMonitoring::TDynamicCounters::TCounterPtr MaxClockSkewWithPeerUsCounter;
@@ -691,31 +690,41 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
691
690
}
692
691
693
692
void Handle (TEvWhiteboard::TEvMemoryStatsUpdate::TPtr &ev, const TActorContext &ctx) {
694
- MemoryStats. Swap (& ev->Get ()->Record ) ;
693
+ const auto & memoryStats = ev->Get ()->Record ;
695
694
696
695
// Note: copy stats to sys info fields for backward compatibility
697
- NKikimrWhiteboard::TSystemStateInfo systemStateUpdate;
698
- if (MemoryStats.HasAnonRss ()) {
699
- systemStateUpdate.SetMemoryUsed (MemoryStats.GetAnonRss ());
696
+ if (memoryStats.HasAnonRss ()) {
697
+ SystemStateInfo.SetMemoryUsed (memoryStats.GetAnonRss ());
698
+ } else {
699
+ SystemStateInfo.ClearMemoryUsed ();
700
700
}
701
- if (MemoryStats.HasHardLimit ()) {
702
- systemStateUpdate.SetMemoryLimit (MemoryStats.GetHardLimit ());
701
+ if (memoryStats.HasHardLimit ()) {
702
+ SystemStateInfo.SetMemoryLimit (memoryStats.GetHardLimit ());
703
+ } else {
704
+ SystemStateInfo.ClearMemoryLimit ();
703
705
}
704
- if (MemoryStats.HasAllocatedMemory ()) {
705
- systemStateUpdate.SetMemoryUsedInAlloc (MemoryStats.GetAllocatedMemory ());
706
+ if (memoryStats.HasAllocatedMemory ()) {
707
+ SystemStateInfo.SetMemoryUsedInAlloc (memoryStats.GetAllocatedMemory ());
708
+ } else {
709
+ SystemStateInfo.ClearMemoryUsedInAlloc ();
706
710
}
707
-
708
- // Note: is rendered in UI as 'Caches', so let's pass aggregated caches stats (not only Shared Cache stats)
709
- if (MemoryStats. HasConsumersConsumption ()) {
710
- systemStateUpdate .MutableSharedCacheStats ()->SetUsedBytes (MemoryStats. GetConsumersConsumption () );
711
+ if (memoryStats. HasSharedCacheConsumption ()) {
712
+ SystemStateInfo. MutableSharedCacheStats ()-> SetUsedBytes (memoryStats. GetSharedCacheConsumption ());
713
+ } else {
714
+ SystemStateInfo .MutableSharedCacheStats ()->ClearUsedBytes ( );
711
715
}
712
- if (MemoryStats.HasConsumersLimit ()) {
713
- systemStateUpdate.MutableSharedCacheStats ()->SetLimitBytes (MemoryStats.GetConsumersLimit ());
716
+ if (memoryStats.HasSharedCacheLimit ()) {
717
+ SystemStateInfo.MutableSharedCacheStats ()->SetLimitBytes (memoryStats.GetSharedCacheLimit ());
718
+ } else {
719
+ SystemStateInfo.MutableSharedCacheStats ()->ClearLimitBytes ();
714
720
}
715
721
716
- if (CheckedMerge (SystemStateInfo, systemStateUpdate)) {
717
- SystemStateInfo.SetChangeTime (ctx.Now ().MilliSeconds ());
718
- }
722
+ SystemStateInfo.MutableMemoryStats ()->Swap (&ev->Get ()->Record );
723
+
724
+ // Note: there is no big reason (and an easy way) to compare the previous and the new memory stats
725
+ // and allocated memory stat is expected to change every time
726
+ // so always update change time unconditionally
727
+ SystemStateInfo.SetChangeTime (ctx.Now ().MilliSeconds ());
719
728
}
720
729
721
730
void Handle (TEvWhiteboard::TEvSystemStateAddEndpoint::TPtr &ev, const TActorContext &ctx) {
0 commit comments