This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/branch-1.18.x by this push:
     new 8aaa7e71b [consensus] address warning on released replicates
8aaa7e71b is described below

commit 8aaa7e71b0084486241df16d56500536d3c810cd
Author: Alexey Serbin <[email protected]>
AuthorDate: Wed Feb 19 15:01:14 2025 -0800

    [consensus] address warning on released replicates
    
    This patch addresses a warning that appeared after upgrading protobuf
    to version 3.21.9.  Since the new protobuf marks some of the
    auto-generated methods with the [[nodiscard]] attribute, there was an
    extra warning that might have pointed to a possible memory leak.
    It wasn't the case because of the Log::AsyncAppendReplicates() method's
    semantics, but it's worth addressing it anyway.
    
    Change-Id: Ia756597b920622baef8c55b5040d6c051814db63
    Reviewed-on: http://gerrit.cloudera.org:8080/22505
    Tested-by: Alexey Serbin <[email protected]>
    Reviewed-by: Abhishek Chennaka <[email protected]>
    (cherry picked from commit 57fb36a72261e1369dd9e5bc222676a0b860525e)
    Reviewed-on: http://gerrit.cloudera.org:8080/22507
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/consensus/log.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/kudu/consensus/log.cc b/src/kudu/consensus/log.cc
index 0e99edc6f..8ae2c174c 100644
--- a/src/kudu/consensus/log.cc
+++ b/src/kudu/consensus/log.cc
@@ -869,7 +869,9 @@ Status Log::AsyncAppendReplicates(vector<ReplicateRefPtr> 
replicates,
       CreateBatchFromPB(REPLICATE, batch_pb, std::move(callback));
 
   for (LogEntryPB& entry : *batch_pb.mutable_entry()) {
-    entry.release_replicate();
+    // Release the ownership of ReplicateMsg in every entry since it's managed
+    // at the upper level where the 'replicates' parameter is passed from.
+    entry.unsafe_arena_release_replicate();
   }
 
   return AsyncAppend(std::move(batch));

Reply via email to