empiredan commented on code in PR #1217:
URL: 
https://github.com/apache/incubator-pegasus/pull/1217#discussion_r1013584225


##########
src/meta/server_state.cpp:
##########
@@ -3873,29 +3824,31 @@ void 
server_state::recover_all_partitions_max_replica_count(std::shared_ptr<app_
                 std::string 
old_pc_str(boost::lexical_cast<std::string>(old_pc));
                 std::string 
new_pc_str(boost::lexical_cast<std::string>(new_pc));
 
-                dassert_f(ec == ERR_OK,
-                          "An error that can't be handled occurs while 
recovering remote "
-                          "partition-level max_replica_count: error_code={}, 
app_name={}, "
-                          "app_id={}, partition_index={}, partition_count={}, "
-                          "old_partition_config={}, new_partition_config={}",
-                          ec.to_string(),
-                          app->app_name,
-                          app->app_id,
-                          i,
-                          app->partition_count,
-                          old_pc_str,
-                          new_pc_str);
-
-                dassert_f(old_pc.ballot + 1 == new_pc.ballot,
-                          "invalid ballot while recovering max_replica_count: 
app_name={}, "
-                          "app_id={}, partition_index={}, partition_count={}, "
-                          "old_partition_config={}, new_partition_config={}",
-                          app->app_name,
-                          app->app_id,
-                          i,
-                          app->partition_count,
-                          old_pc_str,
-                          new_pc_str);
+                CHECK_EQ_MSG(ec,
+                             ERR_OK,
+                             "An error that can't be handled occurs while 
recovering remote "
+                             "partition-level max_replica_count: 
error_code={}, app_name={}, "
+                             "app_id={}, partition_index={}, 
partition_count={}, "
+                             "old_partition_config={}, 
new_partition_config={}",
+                             ec.to_string(),

Review Comment:
   ```suggestion
                                ec,
   ```



##########
src/meta/server_state.cpp:
##########
@@ -3942,15 +3895,16 @@ void 
server_state::recover_app_max_replica_count(std::shared_ptr<app_state> &app
             zauto_write_lock l(_lock);
 
             auto old_max_replica_count = app->max_replica_count;
-            dassert_f(ec == ERR_OK,
-                      "An error that can't be handled occurs while recovering 
remote "
-                      "app-level max_replica_count: error_code={}, 
app_name={}, app_id={}, "
-                      "old_max_replica_count={}, new_max_replica_count={}",
-                      ec.to_string(),
-                      app->app_name,
-                      app->app_id,
-                      old_max_replica_count,
-                      new_max_replica_count);
+            CHECK_EQ_MSG(ec,
+                         ERR_OK,
+                         "An error that can't be handled occurs while 
recovering remote "
+                         "app-level max_replica_count: error_code={}, 
app_name={}, app_id={}, "
+                         "old_max_replica_count={}, new_max_replica_count={}",
+                         ec.to_string(),

Review Comment:
   ```suggestion
                            ec,
   ```



##########
src/meta/server_state.cpp:
##########
@@ -3374,16 +3319,17 @@ void 
server_state::set_max_replica_count_env_updating(std::shared_ptr<app_state>
 
             zauto_write_lock l(_lock);
 
-            dassert_f(ec == ERR_OK,
-                      "An error that can't be handled occurs while updating 
remote env of "
-                      "max_replica_count: error_code={}, app_name={}, 
app_id={}, "
-                      "new_max_replica_count={}, {}={}",
-                      ec.to_string(),
-                      app->app_name,
-                      app->app_id,
-                      new_max_replica_count,
-                      replica_envs::UPDATE_MAX_REPLICA_COUNT,
-                      app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
+            CHECK_EQ_MSG(ec,
+                         ERR_OK,
+                         "An error that can't be handled occurs while updating 
remote env of "
+                         "max_replica_count: error_code={}, app_name={}, 
app_id={}, "
+                         "new_max_replica_count={}, {}={}",
+                         ec.to_string(),

Review Comment:
   ```suggestion
                            ec,
   ```



##########
src/meta/server_state.cpp:
##########
@@ -3499,28 +3446,30 @@ void 
server_state::update_app_max_replica_count(std::shared_ptr<app_state> &app,
 
         zauto_write_lock l(_lock);
 
-        dassert_f(ec == ERR_OK,
-                  "An error that can't be handled occurs while updating remote 
app-level "
-                  "max_replica_count: error_code={}, app_name={}, app_id={}, "
-                  "old_max_replica_count={}, new_max_replica_count={}, {}={}",
-                  ec.to_string(),
-                  app->app_name,
-                  app->app_id,
-                  old_max_replica_count,
-                  new_max_replica_count,
-                  replica_envs::UPDATE_MAX_REPLICA_COUNT,
-                  app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
-
-        dassert_f(old_max_replica_count == app->max_replica_count,
-                  "app-level max_replica_count has been updated to remote 
storage, however "
-                  "old_max_replica_count from response is not consistent with 
current local "
-                  "max_replica_count: app_name={}, app_id={}, 
old_max_replica_count={}, "
-                  "local_max_replica_count={}, new_max_replica_count={}",
-                  app->app_name,
-                  app->app_id,
-                  old_max_replica_count,
-                  app->max_replica_count,
-                  new_max_replica_count);
+        CHECK_EQ_MSG(ec,
+                     ERR_OK,
+                     "An error that can't be handled occurs while updating 
remote app-level "
+                     "max_replica_count: error_code={}, app_name={}, 
app_id={}, "
+                     "old_max_replica_count={}, new_max_replica_count={}, 
{}={}",
+                     ec.to_string(),

Review Comment:
   ```suggestion
                        ec,
   ```



-- 
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]

Reply via email to