aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.com>2022-12-06 16:31:58 +0300
committerivanmorozov <ivanmorozov@yandex-team.com>2022-12-06 16:31:58 +0300
commit0ca041dc2b282b64373ae3197952331ceaa430e5 (patch)
treed084ba740777261bf97b28bee78282f2793eef46
parentb0404150aa8f02c83fd7e4da214b26a2542c384e (diff)
downloadydb-0ca041dc2b282b64373ae3197952331ceaa430e5.tar.gz
use path for metadata storage from config
-rw-r--r--ydb/core/protos/config.proto1
-rw-r--r--ydb/services/metadata/ds_table/config.cpp8
-rw-r--r--ydb/services/metadata/ds_table/config.h1
-rw-r--r--ydb/services/metadata/ds_table/service.h2
-rw-r--r--ydb/services/metadata/manager/object.h6
-rw-r--r--ydb/services/metadata/service.cpp9
-rw-r--r--ydb/services/metadata/service.h6
7 files changed, 28 insertions, 5 deletions
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index f425649349f..62a616d5276 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -585,6 +585,7 @@ message TMetadataProviderConfig {
optional bool Enabled = 1 [default = true];
optional uint32 RefreshPeriodSeconds = 2 [default = 10];
optional TInternalRequestConfig RequestConfig = 3;
+ optional string Path = 4;
}
message TBackgroundTasksConfig {
diff --git a/ydb/services/metadata/ds_table/config.cpp b/ydb/services/metadata/ds_table/config.cpp
index 45003ceca6a..5bfe6786196 100644
--- a/ydb/services/metadata/ds_table/config.cpp
+++ b/ydb/services/metadata/ds_table/config.cpp
@@ -1,9 +1,17 @@
#include "config.h"
+#include <library/cpp/actors/core/log.h>
#include <util/generic/ylimits.h>
namespace NKikimr::NMetadataProvider {
bool TConfig::DeserializeFromProto(const NKikimrConfig::TMetadataProviderConfig& config) {
+ if (config.HasPath()) {
+ Path = config.GetPath();
+ }
+ if (!Path) {
+ ALS_ERROR(NKikimrServices::METADATA_PROVIDER) << "incorrect path for metadata - empty";
+ return false;
+ }
EnabledFlag = config.GetEnabled();
if (!RequestConfig.DeserializeFromProto(config.GetRequestConfig())) {
return false;
diff --git a/ydb/services/metadata/ds_table/config.h b/ydb/services/metadata/ds_table/config.h
index f4344506a40..8e11873496f 100644
--- a/ydb/services/metadata/ds_table/config.h
+++ b/ydb/services/metadata/ds_table/config.h
@@ -11,6 +11,7 @@ private:
YDB_READONLY_DEF(NInternal::NRequest::TConfig, RequestConfig);
YDB_READONLY(TDuration, RefreshPeriod, TDuration::Seconds(10));
YDB_READONLY_FLAG(Enabled, false);
+ YDB_READONLY(TString, Path, ".metadata");
public:
TConfig() = default;
diff --git a/ydb/services/metadata/ds_table/service.h b/ydb/services/metadata/ds_table/service.h
index 779970456f5..11e7fd891f4 100644
--- a/ydb/services/metadata/ds_table/service.h
+++ b/ydb/services/metadata/ds_table/service.h
@@ -153,7 +153,7 @@ public:
TService(const TConfig& config)
: Config(config)
{
- TServiceOperator::Register();
+ TServiceOperator::Register(Config);
}
};
diff --git a/ydb/services/metadata/manager/object.h b/ydb/services/metadata/manager/object.h
index 33dc088867a..2f476dfc627 100644
--- a/ydb/services/metadata/manager/object.h
+++ b/ydb/services/metadata/manager/object.h
@@ -1,7 +1,9 @@
#pragma once
-#include <ydb/public/api/protos/ydb_table.pb.h>
#include <ydb/core/base/appdata.h>
+#include <ydb/public/api/protos/ydb_table.pb.h>
+#include <ydb/services/metadata/service.h>
+
namespace NKikimr::NMetadataManager {
class TBaseObject {
@@ -18,7 +20,7 @@ public:
}
static TString GetStorageTablePath() {
- return "/" + AppData()->TenantName + "/.metadata/" + TDerived::GetInternalStorageTablePath();
+ return "/" + AppData()->TenantName + "/" + NMetadataProvider::TServiceOperator::GetPath() + "/" + TDerived::GetInternalStorageTablePath();
}
static Ydb::Table::CreateTableRequest AddHistoryTableScheme(const Ydb::Table::CreateTableRequest& baseScheme) {
diff --git a/ydb/services/metadata/service.cpp b/ydb/services/metadata/service.cpp
index 059b3fd51e8..bc00a034b4f 100644
--- a/ydb/services/metadata/service.cpp
+++ b/ydb/services/metadata/service.cpp
@@ -1,17 +1,24 @@
#include "service.h"
+#include <ydb/services/metadata/ds_table/config.h>
+
namespace NKikimr::NMetadataProvider {
NActors::TActorId MakeServiceId(const ui32 nodeId) {
return NActors::TActorId(nodeId, "SrvcMetaData");
}
-void TServiceOperator::Register() {
+void TServiceOperator::Register(const TConfig& config) {
Singleton<TServiceOperator>()->EnabledFlag = true;
+ Singleton<TServiceOperator>()->Path = config.GetPath();
}
bool TServiceOperator::IsEnabled() {
return Singleton<TServiceOperator>()->EnabledFlag;
}
+const TString& TServiceOperator::GetPath() {
+ return Singleton<TServiceOperator>()->Path;
+}
+
}
diff --git a/ydb/services/metadata/service.h b/ydb/services/metadata/service.h
index 72964ba0e7e..ba9f6dcda76 100644
--- a/ydb/services/metadata/service.h
+++ b/ydb/services/metadata/service.h
@@ -48,13 +48,17 @@ public:
NActors::TActorId MakeServiceId(const ui32 node);
+class TConfig;
+
class TServiceOperator {
private:
friend class TService;
bool EnabledFlag = false;
- static void Register();
+ TString Path = ".metadata";
+ static void Register(const TConfig& config);
public:
static bool IsEnabled();
+ static const TString& GetPath();
};
}