Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 16, 2024
1 parent bf3ee03 commit 9f3b2e3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/meta/meta_split_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void meta_split_service::on_add_child_on_remote_storage_reply(error_code ec,
SET_OBJ_IP_AND_HOST_PORT(*update_child_request, node, request, primary);

// TODO(yingchun): should use conference?
auto &child_pc = app->pcs[child_gpid.get_partition_index()];
auto child_pc = app->pcs[child_gpid.get_partition_index()];
child_pc.secondaries = request.child_config.secondaries;
child_pc.__set_hp_secondaries(request.child_config.hp_secondaries);
_state->update_configuration_locally(*app, update_child_request);
Expand Down
9 changes: 4 additions & 5 deletions src/meta/server_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2566,8 +2566,8 @@ bool server_state::check_all_partitions()
continue;
}
for (unsigned int i = 0; i != app->partition_count; ++i) {
partition_configuration &pc = app->pcs[i];
config_context &cc = app->helpers->contexts[i];
const auto &pc = app->pcs[i];
const auto &cc = app->helpers->contexts[i];
// partition is under re-configuration or is child partition
if (cc.stage != config_status::pending_remote_sync && pc.ballot != invalid_ballot) {
configuration_proposal_action action;
Expand Down Expand Up @@ -3259,8 +3259,7 @@ template <typename Response>
bool server_state::check_max_replica_count_consistent(const std::shared_ptr<app_state> &app,
Response &response) const
{
for (int i = 0; i < static_cast<int>(app->pcs.size()); ++i) {
const auto &pc = app->pcs[i];
for (const auto &pc : app->pcs) {
if (pc.max_replica_count == app->max_replica_count) {
continue;
}
Expand All @@ -3270,7 +3269,7 @@ bool server_state::check_max_replica_count_consistent(const std::shared_ptr<app_
"app_max_replica_count({}) for partition {}",
pc.max_replica_count,
app->max_replica_count,
i);
pc.pid);
return false;
}

Expand Down
13 changes: 4 additions & 9 deletions src/meta/test/json_compacity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,15 @@ void meta_service_test_app::json_compacity()

// 4. old pc version
const char *json3 = "{\"pid\":\"1.1\",\"ballot\":234,\"max_replica_count\":3,"
"\"primary\":\"127.0.0.1:1\",\"secondaries\":[\"127.0.0.1:6\"],"
"\"hp_primary\":\"localhost:1\",\"hp_secondaries\":[\"localhost:6\"],"
"\"primary\":\"invalid address\",\"secondaries\":[\"127.0.0.1:6\"],"
"\"hp_primary\":\"invalid host_port\",\"hp_secondaries\":[\"localhost:6\"],"
"\"last_drops\":[],\"last_committed_decree\":157}";
dsn::partition_configuration pc;
dsn::json::json_forwarder<dsn::partition_configuration>::decode(
dsn::blob(json3, 0, strlen(json3)), pc);
ASSERT_EQ(234, pc.ballot);
// As how we do in src/meta/server_state.cpp, we have to set the '__isset' fields manually.
ASSERT_FALSE(pc.__isset.hp_primary);
ASSERT_TRUE(pc.hp_primary);
ASSERT_TRUE(pc.primary);
ASSERT_STREQ("127.0.0.1:1", pc.primary.to_string());
ASSERT_EQ("localhost:1", pc.hp_primary.to_string());
ASSERT_FALSE(pc.__isset.hp_secondaries);
ASSERT_TRUE(!pc.hp_primary);
ASSERT_TRUE(!pc.primary);
ASSERT_EQ(1, pc.hp_secondaries.size());
ASSERT_EQ(1, pc.secondaries.size());
ASSERT_STREQ("127.0.0.1:6", pc.secondaries[0].to_string());
Expand Down
1 change: 1 addition & 0 deletions src/meta/test/meta_partition_guardian_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* THE SOFTWARE.
*/

// IWYU pragma: no_include <ext/alloc_traits.h>
#include <algorithm>
#include <atomic>
#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion src/replica/split/replica_split_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ void replica_split_manager::register_child_on_meta(ballot b) // on primary paren
return;
}

partition_configuration child_pc = _replica->_primary_states.pc;
auto child_pc = _replica->_primary_states.pc;
child_pc.ballot++;
child_pc.last_committed_decree = 0;
CLEAR_IP_AND_HOST_PORT(child_pc, last_drops);
Expand Down
1 change: 0 additions & 1 deletion src/replica/storage/simple_kv/test/checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ bool test_checker::get_current_config(parti_config &config)
// the rDSN's
//"enqueue,dequeue and lock..."

// meta->_service->_state->query_configuration_by_gpid(g_default_gpid, pc);
const meta_view view = meta->_service->_state->get_meta_view();
config.convert_from(*get_config(*(view.apps), g_default_gpid));
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "client/replication_ddl_client.h"
#include "common/gpid.h"
#include "dsn.layer2_types.h"
#include "gtest/gtest.h"
#include "include/pegasus/client.h"
#include "include/pegasus/error.h"
Expand Down

0 comments on commit 9f3b2e3

Please sign in to comment.