acelyc111 commented on code in PR #2054:
URL:
https://github.com/apache/incubator-pegasus/pull/2054#discussion_r1671845131
##########
src/replica/duplication/replica_duplicator.cpp:
##########
@@ -64,10 +63,26 @@ replica_duplicator::replica_duplicator(const
duplication_entry &ent, replica *r)
auto it = ent.progress.find(get_gpid().get_partition_index());
if (it->second == invalid_decree) {
- // keep current max committed_decree as start point.
- // todo(jiashuo1) _start_point_decree hasn't be ready to persist zk,
so if master restart,
- // the value will be reset 0
- _start_point_decree = _progress.last_decree =
_replica->private_log()->max_commit_on_disk();
+ // Ensure that the checkpoint decree is at least 1, otherwise the
checkpoint could not
+ // be created thus the remove cluster would inevitably fail to pull
the files.
Review Comment:
remote?
```suggestion
// be created thus the remote cluster would inevitably fail to pull
the files.
```
##########
src/replica/replica_chkpt.cpp:
##########
@@ -186,8 +194,56 @@ void replica::on_checkpoint_timer()
});
}
+void replica::async_trigger_manual_emergency_checkpoint(decree
min_checkpoint_decree,
+ uint32_t delay_ms,
+
trigger_checkpoint_callback callback)
+{
+ CHECK_GT_PREFIX_MSG(min_checkpoint_decree,
+ 0,
+ "min_checkpoint_decree should be a number greater than
0 "
+ "which means a new checkpoint must be created");
+
+ tasking::enqueue(
+ LPC_REPLICATION_COMMON,
+ &_tracker,
+ [min_checkpoint_decree, callback, this]() {
+ _checker.only_one_thread_access();
+
+ if (_app == nullptr) {
+ LOG_ERROR_PREFIX("app hasn't been initialized or has been
released");
+ return;
+ }
+
+ const auto last_applied_decree = this->last_applied_decree();
+ if (last_applied_decree == 0) {
+ LOG_INFO_PREFIX("ready to commit an empty write to trigger
checkpoint: "
+ "min_checkpoint_decree={},
last_applied_decree={}, "
+ "last_durable_decree={}",
+ min_checkpoint_decree,
+ last_applied_decree,
+ last_durable_decree());
+
+ mutation_ptr mu = new_mutation(invalid_decree);
Review Comment:
Could you add some comments to explain why do it like this?
--
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]