aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzalyalov <zalyalov@yandex-team.com>2023-10-12 15:22:44 +0300
committerzalyalov <zalyalov@yandex-team.com>2023-10-12 16:39:56 +0300
commit82b8a8475bd9ea093987a644baba6135e0967199 (patch)
tree369d77775a2f65d549e5268e5f56bd198cf668fb
parent73d404b21a70913028d86e4147b3a022e02df511 (diff)
downloadydb-82b8a8475bd9ea093987a644baba6135e0967199.tar.gz
fix counter going negative
-rw-r--r--ydb/core/mind/hive/hive_impl.h8
-rw-r--r--ydb/core/mind/hive/hive_statics.cpp10
-rw-r--r--ydb/core/mind/hive/tablet_info.h2
-rw-r--r--ydb/core/mind/hive/tx__load_everything.cpp6
4 files changed, 12 insertions, 14 deletions
diff --git a/ydb/core/mind/hive/hive_impl.h b/ydb/core/mind/hive/hive_impl.h
index 6fd8aab2146..38583005719 100644
--- a/ydb/core/mind/hive/hive_impl.h
+++ b/ydb/core/mind/hive/hive_impl.h
@@ -135,10 +135,10 @@ TString GetResourceValuesHtml(const NKikimrTabletBase::TMetrics& values);
NJson::TJsonValue GetResourceValuesJson(const NKikimrTabletBase::TMetrics& values);
ui64 GetReadThroughput(const NKikimrTabletBase::TMetrics& values);
ui64 GetWriteThroughput(const NKikimrTabletBase::TMetrics& values);
-TString GetCounter(ui64 counter, const TString& zero = "0");
-TString GetBytes(ui64 bytes, const TString& zero = "0B");
-TString GetBytesPerSecond(ui64 bytes, const TString& zero = "0B/s");
-TString GetTimes(ui64 times, const TString& zero = "0.00%");
+TString GetCounter(i64 counter, const TString& zero = "0");
+TString GetBytes(i64 bytes, const TString& zero = "0B");
+TString GetBytesPerSecond(i64 bytes, const TString& zero = "0B/s");
+TString GetTimes(i64 times, const TString& zero = "0.00%");
TString GetConditionalGreyString(const TString& str, bool condition);
TString GetConditionalBoldString(const TString& str, bool condition);
TString GetConditionalRedString(const TString& str, bool condition);
diff --git a/ydb/core/mind/hive/hive_statics.cpp b/ydb/core/mind/hive/hive_statics.cpp
index f9fae013064..c1302fc809f 100644
--- a/ydb/core/mind/hive/hive_statics.cpp
+++ b/ydb/core/mind/hive/hive_statics.cpp
@@ -249,14 +249,14 @@ ui64 GetWriteThroughput(const NKikimrTabletBase::TMetrics& values) {
return acc;
}
-TString GetCounter(ui64 counter, const TString& zero) {
+TString GetCounter(i64 counter, const TString& zero) {
if (counter == 0) {
return zero;
}
- return Sprintf("%lu", counter);
+ return Sprintf("%ld", counter);
}
-TString GetBytes(ui64 bytes, const TString& zero) {
+TString GetBytes(i64 bytes, const TString& zero) {
if (bytes == 0) {
return zero;
}
@@ -277,14 +277,14 @@ TString GetBytes(ui64 bytes, const TString& zero) {
return Sprintf(format, value);
}
-TString GetBytesPerSecond(ui64 bytes, const TString& zero) {
+TString GetBytesPerSecond(i64 bytes, const TString& zero) {
if (bytes == 0) {
return zero;
}
return GetBytes(bytes) + "/s";
}
-TString GetTimes(ui64 times, const TString& zero) {
+TString GetTimes(i64 times, const TString& zero) {
if (times == 0) {
return zero;
}
diff --git a/ydb/core/mind/hive/tablet_info.h b/ydb/core/mind/hive/tablet_info.h
index 987d4ef26ce..d77cc046f6b 100644
--- a/ydb/core/mind/hive/tablet_info.h
+++ b/ydb/core/mind/hive/tablet_info.h
@@ -278,7 +278,7 @@ public:
}
void InitTabletMetrics() {
- ResourceValues.SetCounter(1);
+ UpdateResourceUsage({});
}
const TTabletMetricsAggregates& GetResourceMetricsAggregates() const {
diff --git a/ydb/core/mind/hive/tx__load_everything.cpp b/ydb/core/mind/hive/tx__load_everything.cpp
index f60d203767e..87feb4ab138 100644
--- a/ydb/core/mind/hive/tx__load_everything.cpp
+++ b/ydb/core/mind/hive/tx__load_everything.cpp
@@ -435,6 +435,7 @@ public:
tablet.BecomeStopped();
}
}
+ tablet.InitTabletMetrics();
TOwnerIdxType::TValueType owner = tabletRowset.GetValue<Schema::Tablet::Owner>();
Self->OwnerToTablet.emplace(owner, tabletId);
@@ -593,6 +594,7 @@ public:
follower.BecomeStopped();
}
}
+ follower.InitTabletMetrics();
} else {
++numMissingTablets;
}
@@ -633,10 +635,6 @@ public:
<< numMissingTablets << " for missing tablets)");
}
- for (auto& [tabletId, tablet] : Self->Tablets) {
- tablet.ActualizeCounter();
- }
-
size_t numDeletedNodes = 0;
for (auto itNode = Self->Nodes.begin(); itNode != Self->Nodes.end();) {
if (itNode->second.CanBeDeleted()) {