aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlnaz Nizametdinov <ilnaz@ydb.tech>2025-02-11 19:59:57 +0300
committerGitHub <noreply@github.com>2025-02-11 16:59:57 +0000
commit0a47e49538472a88145552ffa171b158c13eb7ab (patch)
tree686c4e5def24d04d25e981a7274994a7c9a94cc8
parenta61d1560c1a93c333b938ba5c0669e8a2c35c927 (diff)
downloadydb-0a47e49538472a88145552ffa171b158c13eb7ab.tar.gz
Create intermediate directories for async replication (#14454)
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__op_traits.h6
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp18
2 files changed, 24 insertions, 0 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__op_traits.h b/ydb/core/tx/schemeshard/schemeshard__op_traits.h
index f7d1aba070..9571562f2c 100644
--- a/ydb/core/tx/schemeshard/schemeshard__op_traits.h
+++ b/ydb/core/tx/schemeshard/schemeshard__op_traits.h
@@ -173,6 +173,12 @@ struct TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpRestoreBackupCo
constexpr inline static bool CreateAdditionalDirs = true;
};
+template <>
+struct TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication>
+ : public TSchemeTxTraitsFallback
+{
+ constexpr inline static bool CreateDirsFromName = true;
+};
namespace NOperation {
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp
index d8307a88d8..aa94905a35 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp
@@ -1,6 +1,7 @@
#include "schemeshard__operation_part.h"
#include "schemeshard__operation_common.h"
#include "schemeshard_impl.h"
+#include "schemeshard__op_traits.h"
#include <ydb/core/mind/hive/hive.h>
#include <ydb/core/tx/replication/controller/public_events.h>
@@ -491,6 +492,23 @@ private:
} // anonymous
+using TTag = TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication>;
+
+namespace NOperation {
+
+template <>
+std::optional<TString> GetTargetName<TTag>(TTag, const TTxTransaction& tx) {
+ return tx.GetReplication().GetName();
+}
+
+template <>
+bool SetName<TTag>(TTag, TTxTransaction& tx, const TString& name) {
+ tx.MutableReplication()->SetName(name);
+ return true;
+}
+
+} // namespace NOperation
+
ISubOperation::TPtr CreateNewReplication(TOperationId id, const TTxTransaction& tx) {
return MakeSubOperation<TCreateReplication>(id, tx, &ReplicationStrategy);
}