Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(duplication): make the task code for incremental loading from private logs configurable #2184

Merged
merged 11 commits into from
Mar 7, 2025
20 changes: 15 additions & 5 deletions src/replica/duplication/replica_duplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,25 @@
#include "load_from_private_log.h"
#include "replica/mutation_log.h"
#include "replica/replica.h"
#include "task/task_code.h"
#include "utils/autoref_ptr.h"
#include "utils/error_code.h"
#include "utils/flags.h"
#include "utils/fmt_logging.h"

METRIC_DEFINE_counter(replica,
dup_confirmed_mutations,
dsn::metric_unit::kMutations,
"The number of confirmed mutations for dup");

namespace dsn {
namespace replication {
DSN_DEFINE_bool(replication,
load_from_private_log_level_common,
false,
"The level of load_from_private_log when doing a duplication.Be false means the "
"task level of replaing plog is low, otherwise the task level is common");
DSN_TAG_VARIABLE(load_from_private_log_level_common, FT_MUTABLE);

namespace dsn::replication {

replica_duplicator::replica_duplicator(const duplication_entry &ent, replica *r)
: replica_base(r),
Expand Down Expand Up @@ -161,7 +169,10 @@ void replica_duplicator::start_dup_log()
_load = std::make_unique<load_mutation>(this, _replica, _load_private.get());

from(*_load).link(*_ship).link(*_load);
fork(*_load_private, LPC_REPLICATION_LONG_LOW, 0).link(*_ship);
const dsn::task_code load_from_private_log_level = FLAGS_load_from_private_log_level_common
? LPC_REPLICATION_LONG_COMMON
: LPC_REPLICATION_LONG_LOW;
fork(*_load_private, load_from_private_log_level, 0).link(*_ship);

run_pipeline();
}
Expand Down Expand Up @@ -317,5 +328,4 @@ void replica_duplicator::set_duplication_plog_checking(bool checking)
_replica->set_duplication_plog_checking(checking);
}

} // namespace replication
} // namespace dsn
} // namespace dsn::replication
Loading