This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b0ea2650 fix(slog): add an option to exit the process when find slog 
error (#1574)
4b0ea2650 is described below

commit 4b0ea26506b40fdabf6c1753d7446ef032d3c658
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon Jul 31 16:37:33 2023 +0800

    fix(slog): add an option to exit the process when find slog error (#1574)
    
    https://github.com/apache/incubator-pegasus/issues/1572
    
    Add an option to make it possible to exit the process and leave the
    corrupted slog and replicas to be handled by the administrator when
    open slog failed.
---
 src/replica/replica_stub.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp
index f82858556..e9bbab7a4 100644
--- a/src/replica/replica_stub.cpp
+++ b/src/replica/replica_stub.cpp
@@ -132,6 +132,14 @@ DSN_DEFINE_bool(replication,
                 verbose_commit_log_on_start,
                 false,
                 "whether to print verbose log when commit mutation when 
starting the server");
+DSN_DEFINE_bool(
+    replication,
+    crash_on_slog_error,
+    false,
+    "whether to exit the process while fail to open slog. If true, the process 
will exit and leave "
+    "the corrupted slog and replicas to be handled by the administrator. If 
false, the process "
+    "will continue, and remove the slog and move all the replicas to 
corresponding error "
+    "directories");
 DSN_DEFINE_uint32(replication,
                   max_concurrent_manual_emergency_checkpointing_count,
                   10,
@@ -708,6 +716,9 @@ void replica_stub::initialize(const replication_options 
&opts, bool clear /* = f
     if (err == ERR_OK) {
         LOG_INFO("replay shared log succeed, time_used = {} ms", finish_time - 
start_time);
     } else {
+        if (FLAGS_crash_on_slog_error) {
+            LOG_FATAL("replay shared log failed, err = {}, please check the 
error details", err);
+        }
         LOG_ERROR("replay shared log failed, err = {}, time_used = {} ms, 
clear all logs ...",
                   err,
                   finish_time - start_time);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to