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

kwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 7fa3c43  Fix broken main branch caused by wrong getBitSet method (#177)
7fa3c43 is described below

commit 7fa3c4323777799ca5a5d8de74827278a414f990
Author: Yunze Xu <[email protected]>
AuthorDate: Wed Jan 18 18:35:20 2023 +0800

    Fix broken main branch caused by wrong getBitSet method (#177)
    
    ### Motivation
    
    Currently the main branch is broken by the concurrent merge of
    https://github.com/apache/pulsar-client-cpp/pull/153 and
    https://github.com/apache/pulsar-client-cpp/pull/151.
    
    ### Modifications
    
    Add a dummy `getBitSet` implementation to `BatchMessageAcker` and the
    correct implementation for `BatchMessageAckerImpl`.
---
 lib/BatchMessageAcker.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/BatchMessageAcker.h b/lib/BatchMessageAcker.h
index 7aa8c1f..fa0392c 100644
--- a/lib/BatchMessageAcker.h
+++ b/lib/BatchMessageAcker.h
@@ -43,7 +43,10 @@ class BatchMessageAcker {
         return 
prevBatchCumulativelyAcked_.compare_exchange_strong(expectedValue, true);
     }
 
-    const BitSet& getBitSet() const noexcept { return bitSet_; }
+    virtual const BitSet& getBitSet() const noexcept {
+        static BitSet emptyBitSet;
+        return emptyBitSet;
+    }
 
    private:
     // When a batched message is acknowledged cumulatively, the previous 
message id will be acknowledged
@@ -80,6 +83,8 @@ class BatchMessageAckerImpl : public BatchMessageAcker {
         return bitSet_.isEmpty();
     }
 
+    const BitSet& getBitSet() const noexcept override { return bitSet_; }
+
    private:
     BitSet bitSet_;
     mutable std::mutex mutex_;

Reply via email to