Skip to content

Commit

Permalink
Create intermediate directories for async replication (#14454)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberROFL authored Feb 11, 2025
1 parent a61d156 commit 0a47e49
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ydb/core/tx/schemeshard/schemeshard__op_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -491,6 +492,23 @@ class TCreateReplication: public TSubOperation {

} // 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);
}
Expand Down

0 comments on commit 0a47e49

Please sign in to comment.