You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2022/10/15 09:10:20 UTC

[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1184: fix: update app_name on 'on_config_sync'

acelyc111 commented on code in PR #1184:
URL: https://github.com/apache/incubator-pegasus/pull/1184#discussion_r996277954


##########
src/rdsn/src/replica/replica.h:
##########
@@ -496,6 +496,7 @@ class replica : public serverlet<replica>, public ref_counter, public replica_ba
     clear_on_failure(replica_stub *stub, replica *rep, const std::string &path, const gpid &pid);
 
     void update_app_max_replica_count(int32_t max_replica_count);
+    void update_app_name(std::string app_name);

Review Comment:
   better to use const reference



##########
src/rdsn/src/replica/replica_config.cpp:
##########
@@ -1143,6 +1144,23 @@ void replica::on_config_sync(const app_info &info,
     }
 }
 
+void replica::update_app_name(std::string app_name)
+{
+    if (app_name == _app_info.app_name) {
+        return;
+    }
+
+    auto old_app_name = _app_info.app_name;
+    _app_info.app_name = app_name;
+
+    auto ec = store_app_info(_app_info);
+    dassert_replica(ec == ERR_OK,

Review Comment:
   use `dcheck_eq_replica` to simplify the code



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org