Skip to content

Commit

Permalink
Merge pull request #130 from brpc/master
Browse files Browse the repository at this point in the history
 Replace gflags namespace from google:: to FLAGS_NS:: to fix compatibility problem.
  • Loading branch information
PFZheng committed Apr 26, 2019
2 parents ba9479b + a98a30b commit 243f90e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/braft/util.cpp
Expand Up @@ -35,11 +35,11 @@ static bool valid_percentile(const char*, int32_t v) {
return v > 0 && v < 100;
}

const bool ALLOW_UNUSED dummy_bvar_counter_p1 = ::google::RegisterFlagValidator(
const bool ALLOW_UNUSED dummy_bvar_counter_p1 = GFLAGS_NS::RegisterFlagValidator(
&FLAGS_bvar_counter_p1, valid_percentile);
const bool ALLOW_UNUSED dummy_bvar_counter_p2 = ::google::RegisterFlagValidator(
const bool ALLOW_UNUSED dummy_bvar_counter_p2 = GFLAGS_NS::RegisterFlagValidator(
&FLAGS_bvar_counter_p2, valid_percentile);
const bool ALLOW_UNUSED dummy_bvar_counter_p3 = ::google::RegisterFlagValidator(
const bool ALLOW_UNUSED dummy_bvar_counter_p3 = GFLAGS_NS::RegisterFlagValidator(
&FLAGS_bvar_counter_p3, valid_percentile);

namespace detail {
Expand Down
12 changes: 6 additions & 6 deletions test/test_node.cpp
Expand Up @@ -505,7 +505,7 @@ class NodeTest : public testing::TestWithParam<const char*> {
void SetUp() {
g_dont_print_apply_log = false;
//logging::FLAGS_v = 90;
google::SetCommandLineOption("crash_on_fatal_log", "true");
GFLAGS_NS::SetCommandLineOption("crash_on_fatal_log", "true");
if (GetParam() == std::string("NoReplication")) {
braft::FLAGS_raft_max_parallel_append_entries_rpc_num = 1;
braft::FLAGS_raft_enable_append_entries_cache = false;
Expand Down Expand Up @@ -1477,7 +1477,7 @@ TEST_P(NodeTest, PreVote) {
}

TEST_P(NodeTest, Vote_timedout) {
google::SetCommandLineOption("raft_step_down_when_vote_timedout", "true");
GFLAGS_NS::SetCommandLineOption("raft_step_down_when_vote_timedout", "true");
std::vector<braft::PeerId> peers;
for (int i = 0; i < 2; i++) {
braft::PeerId peer;
Expand Down Expand Up @@ -1525,7 +1525,7 @@ TEST_P(NodeTest, Vote_timedout) {
LOG(WARNING) << "cluster stop";
cluster.stop_all();

google::SetCommandLineOption("raft_step_down_when_vote_timedout", "false");
GFLAGS_NS::SetCommandLineOption("raft_step_down_when_vote_timedout", "false");
}

TEST_P(NodeTest, SetPeer1) {
Expand Down Expand Up @@ -1840,7 +1840,7 @@ TEST_P(NodeTest, InstallSnapshot) {
}

TEST_P(NodeTest, install_snapshot_exceed_max_task_num) {
google::SetCommandLineOption("raft_max_install_snapshot_tasks_num", "1");
GFLAGS_NS::SetCommandLineOption("raft_max_install_snapshot_tasks_num", "1");
std::vector<braft::PeerId> peers;
for (int i = 0; i < 5; i++) {
braft::PeerId peer;
Expand Down Expand Up @@ -1943,7 +1943,7 @@ TEST_P(NodeTest, install_snapshot_exceed_max_task_num) {

LOG(WARNING) << "cluster stop";
cluster.stop_all();
google::SetCommandLineOption("raft_max_install_snapshot_tasks_num", "1000");
GFLAGS_NS::SetCommandLineOption("raft_max_install_snapshot_tasks_num", "1000");
}

TEST_P(NodeTest, NoSnapshot) {
Expand Down Expand Up @@ -3762,6 +3762,6 @@ INSTANTIATE_TEST_CASE_P(NodeTestWithPipelineReplication,
int main(int argc, char* argv[]) {
::testing::AddGlobalTestEnvironment(new TestEnvironment());
::testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}
12 changes: 6 additions & 6 deletions test/test_snapshot.cpp
Expand Up @@ -759,7 +759,7 @@ TEST_F(SnapshotTest, snapshot_throttle_for_writing) {
}

TEST_F(SnapshotTest, snapshot_throttle_for_reading_without_enable_throttle) {
google::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "false");
GFLAGS_NS::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "false");
braft::FileSystemAdaptor* fs;
FOR_EACH_FILE_SYSTEM_ADAPTOR_BEGIN(fs);

Expand Down Expand Up @@ -839,11 +839,11 @@ TEST_F(SnapshotTest, snapshot_throttle_for_reading_without_enable_throttle) {
delete storage1;

FOR_EACH_FILE_SYSTEM_ADAPTOR_END;
google::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "true");
GFLAGS_NS::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "true");
}

TEST_F(SnapshotTest, snapshot_throttle_for_writing_without_enable_throttle) {
google::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "false");
GFLAGS_NS::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "false");
braft::FileSystemAdaptor* fs;
FOR_EACH_FILE_SYSTEM_ADAPTOR_BEGIN(fs);

Expand Down Expand Up @@ -922,11 +922,11 @@ TEST_F(SnapshotTest, snapshot_throttle_for_writing_without_enable_throttle) {
delete storage1;

FOR_EACH_FILE_SYSTEM_ADAPTOR_END;
google::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "true");
GFLAGS_NS::SetCommandLineOption("raft_enable_throttle_when_install_snapshot", "true");
}

TEST_F(SnapshotTest, dynamically_change_throttle_threshold) {
google::SetCommandLineOption("raft_minimal_throttle_threshold_mb", "1");
GFLAGS_NS::SetCommandLineOption("raft_minimal_throttle_threshold_mb", "1");
braft::FileSystemAdaptor* fs;
FOR_EACH_FILE_SYSTEM_ADAPTOR_BEGIN(fs);

Expand Down Expand Up @@ -1005,5 +1005,5 @@ TEST_F(SnapshotTest, dynamically_change_throttle_threshold) {
delete storage1;

FOR_EACH_FILE_SYSTEM_ADAPTOR_END;
google::SetCommandLineOption("raft_minimal_throttle_threshold_mb", "0");
GFLAGS_NS::SetCommandLineOption("raft_minimal_throttle_threshold_mb", "0");
}

0 comments on commit 243f90e

Please sign in to comment.