Skip to content

Commit 0a47e49

Browse files
authored
Create intermediate directories for async replication (#14454)
1 parent a61d156 commit 0a47e49

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ydb/core/tx/schemeshard/schemeshard__op_traits.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ struct TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpRestoreBackupCo
173173
constexpr inline static bool CreateAdditionalDirs = true;
174174
};
175175

176+
template <>
177+
struct TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication>
178+
: public TSchemeTxTraitsFallback
179+
{
180+
constexpr inline static bool CreateDirsFromName = true;
181+
};
176182

177183
namespace NOperation {
178184

ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "schemeshard__operation_part.h"
22
#include "schemeshard__operation_common.h"
33
#include "schemeshard_impl.h"
4+
#include "schemeshard__op_traits.h"
45

56
#include <ydb/core/mind/hive/hive.h>
67
#include <ydb/core/tx/replication/controller/public_events.h>
@@ -491,6 +492,23 @@ class TCreateReplication: public TSubOperation {
491492

492493
} // anonymous
493494

495+
using TTag = TSchemeTxTraits<NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication>;
496+
497+
namespace NOperation {
498+
499+
template <>
500+
std::optional<TString> GetTargetName<TTag>(TTag, const TTxTransaction& tx) {
501+
return tx.GetReplication().GetName();
502+
}
503+
504+
template <>
505+
bool SetName<TTag>(TTag, TTxTransaction& tx, const TString& name) {
506+
tx.MutableReplication()->SetName(name);
507+
return true;
508+
}
509+
510+
} // namespace NOperation
511+
494512
ISubOperation::TPtr CreateNewReplication(TOperationId id, const TTxTransaction& tx) {
495513
return MakeSubOperation<TCreateReplication>(id, tx, &ReplicationStrategy);
496514
}

0 commit comments

Comments
 (0)