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 2837b1705 fix: fix some build errors on the latest MacOS (#2158)
2837b1705 is described below

commit 2837b1705edbdab2663b2fa1dabad9edc10e9379
Author: Yingchun Lai <laiyingc...@apache.org>
AuthorDate: Tue Dec 10 10:19:23 2024 +0800

    fix: fix some build errors on the latest MacOS (#2158)
---
 src/meta/meta_state_service_simple.cpp | 6 +++---
 src/meta/meta_state_service_simple.h   | 2 +-
 src/meta/test/balancer_validator.cpp   | 4 ++--
 src/replica/prepare_list.cpp           | 5 ++---
 src/test/bench_test/benchmark.cpp      | 9 +++++----
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/meta/meta_state_service_simple.cpp 
b/src/meta/meta_state_service_simple.cpp
index f875699d5..3ce5453e2 100644
--- a/src/meta/meta_state_service_simple.cpp
+++ b/src/meta/meta_state_service_simple.cpp
@@ -93,8 +93,8 @@ void meta_state_service_simple::write_log(blob &&log_blob,
         CHECK(log_succeed, "we cannot handle logging failure now");
         __err_cb_bind_and_enqueue(task, internal_operation(), 0);
     }));
-    auto continuation_task_ptr = continuation_task.get();
-    _task_queue.emplace(move(continuation_task));
+    auto *continuation_task_ptr = continuation_task.get();
+    _task_queue.emplace(std::move(continuation_task));
     _log_lock.unlock();
 
     file::write(_log,
@@ -525,7 +525,7 @@ task_ptr meta_state_service_simple::get_children(const 
std::string &node,
             result.push_back(child_pair.first);
         }
         return tasking::enqueue(
-            cb_code, tracker, [=]() mutable { cb_get_children(ERR_OK, 
move(result)); });
+            cb_code, tracker, [=]() mutable { cb_get_children(ERR_OK, result); 
});
     }
 }
 
diff --git a/src/meta/meta_state_service_simple.h 
b/src/meta/meta_state_service_simple.h
index c4e9298ed..9a5a6b395 100644
--- a/src/meta/meta_state_service_simple.h
+++ b/src/meta/meta_state_service_simple.h
@@ -123,7 +123,7 @@ private:
     {
         bool done;
         std::function<void(bool)> cb;
-        operation(bool done, std::function<void(bool)> &&cb) : done(done), 
cb(move(cb)) {}
+        operation(bool done, std::function<void(bool)> &&cb) : done(done), 
cb(std::move(cb)) {}
     };
 
 #pragma pack(push, 1)
diff --git a/src/meta/test/balancer_validator.cpp 
b/src/meta/test/balancer_validator.cpp
index 2543b2893..a0a5dbb15 100644
--- a/src/meta/test/balancer_validator.cpp
+++ b/src/meta/test/balancer_validator.cpp
@@ -118,8 +118,8 @@ static void check_cure(app_mapper &apps, node_mapper 
&nodes, ::dsn::partition_co
     CHECK(node != nodes.end(), "");
     ns = &node->second;
     SET_OBJ_IP_AND_HOST_PORT(pc, primary, act, node);
-    std::remove(pc.secondaries.begin(), pc.secondaries.end(), pc.primary);
-    std::remove(pc.hp_secondaries.begin(), pc.hp_secondaries.end(), 
pc.hp_primary);
+    (void)std::remove(pc.secondaries.begin(), pc.secondaries.end(), 
pc.primary);
+    (void)std::remove(pc.hp_secondaries.begin(), pc.hp_secondaries.end(), 
pc.hp_primary);
     CHECK_EQ(ns->served_as(pc.pid), partition_status::PS_SECONDARY);
     ns->put_partition(pc.pid, true);
 }
diff --git a/src/replica/prepare_list.cpp b/src/replica/prepare_list.cpp
index d2fdff233..2663c8932 100644
--- a/src/replica/prepare_list.cpp
+++ b/src/replica/prepare_list.cpp
@@ -183,17 +183,16 @@ void prepare_list::commit(decree d, commit_type ct)
         return;
     }
     case COMMIT_ALL_READY: {
-        if (d != last_committed_decree() + 1)
+        if (d != last_committed_decree() + 1) {
             return;
+        }
 
-        int count = 0;
         mutation_ptr mu = get_mutation_by_decree(last_committed_decree() + 1);
 
         while (mu != nullptr && mu->is_ready_for_commit() && 
mu->data.header.ballot >= last_bt) {
             _last_committed_decree++;
             last_bt = mu->data.header.ballot;
             _committer(mu);
-            count++;
             mu = mutation_cache::get_mutation_by_decree(_last_committed_decree 
+ 1);
         }
 
diff --git a/src/test/bench_test/benchmark.cpp 
b/src/test/bench_test/benchmark.cpp
index 321c56f86..bd705ddb4 100644
--- a/src/test/bench_test/benchmark.cpp
+++ b/src/test/bench_test/benchmark.cpp
@@ -172,10 +172,11 @@ void benchmark::write_random(thread_arg *thread)
 {
     // do write operation num times
     uint64_t bytes = 0;
-    int count = 0;
     for (int i = 0; i < FLAGS_benchmark_num; i++) {
         // generate hash key and sort key
-        std::string hashkey, sortkey, value;
+        std::string hashkey;
+        std::string sortkey;
+        std::string value;
         generate_kv_pair(hashkey, sortkey, value);
 
         // write to pegasus
@@ -185,9 +186,9 @@ void benchmark::write_random(thread_arg *thread)
             int ret = _client->set(hashkey, sortkey, value, 
FLAGS_pegasus_timeout_ms);
             if (ret == ::pegasus::PERR_OK) {
                 bytes += FLAGS_value_size + FLAGS_hashkey_size + 
FLAGS_sortkey_size;
-                count++;
                 break;
-            } else if (ret != ::pegasus::PERR_TIMEOUT || try_count > 3) {
+            }
+            if (ret != ::pegasus::PERR_TIMEOUT || try_count > 3) {
                 fmt::print(stderr, "Set returned an error: {}\n", 
_client->get_error_string(ret));
                 dsn_exit(1);
             } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pegasus.apache.org
For additional commands, e-mail: commits-h...@pegasus.apache.org

Reply via email to