aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortesseract <tesseract@yandex-team.com>2023-06-01 21:06:39 +0300
committertesseract <tesseract@yandex-team.com>2023-06-01 21:06:39 +0300
commit9dce232fc537280fb9f4e07ab8d4595f93f54cb7 (patch)
tree29a75772604840b0bb3a937ac7106fa04717c7c6
parent1d535b80ece0d404870a15b343a701da59c366f2 (diff)
downloadydb-9dce232fc537280fb9f4e07ab8d4595f93f54cb7.tar.gz
Спрятать под фичефлаг изменение способа расчета resources.storage.used_bytes
-rw-r--r--ydb/core/persqueue/partition.cpp2
-rw-r--r--ydb/core/persqueue/partition_read.cpp2
-rw-r--r--ydb/core/persqueue/utils.cpp8
-rw-r--r--ydb/core/tablet/tablet_counters_aggregator.cpp6
-rw-r--r--ydb/core/tx/schemeshard/ut_subdomain.cpp20
5 files changed, 25 insertions, 13 deletions
diff --git a/ydb/core/persqueue/partition.cpp b/ydb/core/persqueue/partition.cpp
index 842b9bde606..c6b5b52b00c 100644
--- a/ydb/core/persqueue/partition.cpp
+++ b/ydb/core/persqueue/partition.cpp
@@ -2346,7 +2346,7 @@ void TPartition::Handle(TEvQuota::TEvClearance::TPtr& ev, const TActorContext& c
}
size_t TPartition::GetQuotaRequestSize(const TEvKeyValue::TEvRequest& request) {
- if (Config.GetMeteringMode() == NKikimrPQ::TPQTabletConfig::METERING_MODE_REQUEST_UNITS) {
+ if (Config.GetMeteringMode() != NKikimrPQ::TPQTabletConfig::METERING_MODE_RESERVED_CAPACITY) {
return 0;
}
if (AppData()->PQConfig.GetQuotingConfig().GetTopicWriteQuotaEntityToLimit() ==
diff --git a/ydb/core/persqueue/partition_read.cpp b/ydb/core/persqueue/partition_read.cpp
index 4c2895ee75e..82b84db309a 100644
--- a/ydb/core/persqueue/partition_read.cpp
+++ b/ydb/core/persqueue/partition_read.cpp
@@ -744,7 +744,7 @@ void TPartition::OnReadRequestFinished(TReadInfo&& info, ui64 answerSize) {
auto userInfo = UsersInfoStorage->GetIfExists(info.User);
Y_VERIFY(userInfo);
- if (Config.GetMeteringMode() == NKikimrPQ::TPQTabletConfig::METERING_MODE_REQUEST_UNITS) {
+ if (Config.GetMeteringMode() != NKikimrPQ::TPQTabletConfig::METERING_MODE_RESERVED_CAPACITY) {
return;
}
diff --git a/ydb/core/persqueue/utils.cpp b/ydb/core/persqueue/utils.cpp
index 285640ffe69..71c155049e3 100644
--- a/ydb/core/persqueue/utils.cpp
+++ b/ydb/core/persqueue/utils.cpp
@@ -3,6 +3,10 @@
namespace NKikimr::NPQ {
ui64 TopicPartitionReserveSize(const NKikimrPQ::TPQTabletConfig& config) {
+ if (!config.HasMeteringMode()) {
+ // Only for federative and dedicated installations
+ return 0;
+ }
if (NKikimrPQ::TPQTabletConfig::METERING_MODE_REQUEST_UNITS == config.GetMeteringMode()) {
return 0;
}
@@ -13,6 +17,10 @@ ui64 TopicPartitionReserveSize(const NKikimrPQ::TPQTabletConfig& config) {
}
ui64 TopicPartitionReserveThroughput(const NKikimrPQ::TPQTabletConfig& config) {
+ if (!config.HasMeteringMode()) {
+ // Only for federative and dedicated installations
+ return 0;
+ }
if (NKikimrPQ::TPQTabletConfig::METERING_MODE_REQUEST_UNITS == config.GetMeteringMode()) {
return 0;
}
diff --git a/ydb/core/tablet/tablet_counters_aggregator.cpp b/ydb/core/tablet/tablet_counters_aggregator.cpp
index f677e799af6..27aa8f1a22c 100644
--- a/ydb/core/tablet/tablet_counters_aggregator.cpp
+++ b/ydb/core/tablet/tablet_counters_aggregator.cpp
@@ -922,7 +922,11 @@ private:
ResourcesStorageTableUsedBytes->Set(DiskSpaceTablesTotalBytes->Val());
ResourcesStorageTopicUsedBytes->Set(DiskSpaceTopicsTotalBytes->Val());
- ResourcesStorageUsedBytes->Set(ResourcesStorageTableUsedBytes->Val() + ResourcesStorageTopicUsedBytes->Val());
+ if (AppData()->FeatureFlags.GetEnableTopicDiskSubDomainQuota()) {
+ ResourcesStorageUsedBytes->Set(ResourcesStorageTableUsedBytes->Val() + ResourcesStorageTopicUsedBytes->Val());
+ } else {
+ ResourcesStorageUsedBytes->Set(ResourcesStorageTableUsedBytes->Val());
+ }
auto quota = StreamShardsQuota->Val();
ResourcesStreamUsedShards->Set(StreamShardsCount->Val());
diff --git a/ydb/core/tx/schemeshard/ut_subdomain.cpp b/ydb/core/tx/schemeshard/ut_subdomain.cpp
index ec752a4d286..2fd2050a035 100644
--- a/ydb/core/tx/schemeshard/ut_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/ut_subdomain.cpp
@@ -2316,7 +2316,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 3
PartitionPerTablet: 2
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 WriteSpeedInBytesPerSecond : 1000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 WriteSpeedInBytesPerSecond : 1000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -2333,7 +2333,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 1
PartitionPerTablet: 2
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 200001}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 200001} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -2351,7 +2351,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 1
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)");
env.TestWaitNotification(runtime, txId - 1);
@@ -2368,7 +2368,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 2
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)");
env.TestWaitNotification(runtime, txId - 1);
@@ -2385,7 +2385,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 2
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100001}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100001} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -3027,7 +3027,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 3
PartitionPerTablet: 2
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 WriteSpeedInBytesPerSecond : 1000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 WriteSpeedInBytesPerSecond : 1000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -3042,7 +3042,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 1
PartitionPerTablet: 2
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 200001}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 200001} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -3058,7 +3058,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 1
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)");
env.TestWaitNotification(runtime, txId - 1);
@@ -3073,7 +3073,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 2
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100000} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)");
env.TestWaitNotification(runtime, txId - 1);
@@ -3088,7 +3088,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "Isolda"
TotalGroupCount: 2
PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100001}}
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 1 WriteSpeedInBytesPerSecond : 100001} MeteringMode: METERING_MODE_RESERVED_CAPACITY}
)", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);