empiredan commented on code in PR #2184:
URL:
https://github.com/apache/incubator-pegasus/pull/2184#discussion_r1961144616
##########
src/replica/duplication/replica_duplicator.cpp:
##########
@@ -35,17 +35,26 @@
#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_string(replication,
+ load_from_private_log_level,
Review Comment:
`load_from_private_log_level` seems to a configuration for the log level of
something. Also, it does not show the relationship to duplication. In addition,
this configuration is essentially a task code specifying a class of tasks
running on the specific thread pool. We could use `dup_load_plog_task` to show
a configurable task for incremental loading from private logs while duplicating.
```suggestion
dup_load_plog_task,
```
##########
src/replica/duplication/replica_duplicator.cpp:
##########
@@ -35,17 +35,26 @@
#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_string(replication,
+ load_from_private_log_level,
+ "LPC_REPLICATION_LONG_LOW",
+ "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 (We do "
+ "not recommend high level)");
Review Comment:
```suggestion
"The task code for incremental loading from private logs
while duplicating. Tasks with "
"TASK_PRIORITY_HIGH are not recommended.");
```
##########
src/replica/duplication/replica_duplicator.cpp:
##########
@@ -35,17 +35,26 @@
#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_string(replication,
+ load_from_private_log_level,
+ "LPC_REPLICATION_LONG_LOW",
+ "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 (We do "
+ "not recommend high level)");
+DSN_TAG_VARIABLE(load_from_private_log_level, FT_MUTABLE);
Review Comment:
```suggestion
DSN_TAG_VARIABLE(dup_load_plog_task, FT_MUTABLE);
```
##########
src/replica/duplication/replica_duplicator.cpp:
##########
@@ -161,7 +170,12 @@ 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 =
+ dsn::task_code::try_get(FLAGS_load_from_private_log_level,
LPC_REPLICATION_LONG_LOW);
+ LOG_ERROR_PREFIX("unexpected load_from_private_log_level ({}), put it to
default value "
+ "LPC_REPLICATION_LONG_LOW",
+ load_from_private_log_level);
+ fork(*_load_private, load_from_private_log_level, 0).link(*_ship);
Review Comment:
```suggestion
auto dup_load_plog_task =
dsn::task_code::try_get(FLAGS_dup_load_plog_task, TASK_CODE_INVALID);
if (dup_load_plog_task == TASK_CODE_INVALID) {
dup_load_plog_task = LPC_REPLICATION_LONG_LOW;
LOG_ERROR_PREFIX("invalid dup_load_plog_task ({}), set it to
LPC_REPLICATION_LONG_LOW",
FLAGS_dup_load_plog_task);
}
fork(*_load_private, dup_load_plog_task, 0).link(*_ship);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]