You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2022/02/24 06:47:46 UTC

[pulsar] branch branch-2.8 updated (f1a1294 -> bb50dc6)

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

mmarshall pushed a change to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git.


    from f1a1294  Fix send to deadLetterTopic not working when reach maxRedeliverCount (#14317)
     new db38aeb  Fix adding message to list potential issue (#14377)
     new bb50dc6  [C++] Fix GCC compilation failure caused by warning macro (#14402)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pulsar-client-cpp/CMakeLists.txt                                   | 2 +-
 .../src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java  | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

[pulsar] 01/02: Fix adding message to list potential issue (#14377)

Posted by mm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mmarshall pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit db38aebc596b5b5a43b14439cc6ca3d1dfc32358
Author: Jiwei Guo <te...@apache.org>
AuthorDate: Sat Feb 19 01:38:24 2022 +0800

    Fix adding message to list potential issue (#14377)
    
    (cherry picked from commit b22445f961da5cf2e7baaac4b3847007f4c6ed59)
---
 .../src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
index 3ddc5d6..86d07e9 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
@@ -1656,18 +1656,17 @@ public class ConsumerImpl<T> extends ConsumerBase<T> implements ConnectionHandle
             return CompletableFuture.completedFuture(Collections.emptyList());
         }
         List<MessageIdData> data = new ArrayList<>(messageIds.size());
-        List<CompletableFuture<Boolean>> futures = new ArrayList<>(messageIds.size());
+        List<CompletableFuture<Void>> futures = new ArrayList<>(messageIds.size());
         messageIds.forEach(messageId -> {
             CompletableFuture<Boolean> future = processPossibleToDLQ(messageId);
-            futures.add(future);
-            future.thenAccept(sendToDLQ -> {
+            futures.add(future.thenAccept(sendToDLQ -> {
                 if (!sendToDLQ) {
                     data.add(new MessageIdData()
                             .setPartition(messageId.getPartitionIndex())
                             .setLedgerId(messageId.getLedgerId())
                             .setEntryId(messageId.getEntryId()));
                 }
-            });
+            }));
         });
         return FutureUtil.waitForAll(futures).thenCompose(v -> CompletableFuture.completedFuture(data));
     }

[pulsar] 02/02: [C++] Fix GCC compilation failure caused by warning macro (#14402)

Posted by mm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mmarshall pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit bb50dc622593c5bf82513c31936115a140754acf
Author: Yunze Xu <xy...@163.com>
AuthorDate: Wed Feb 23 05:41:28 2022 +0800

    [C++] Fix GCC compilation failure caused by warning macro (#14402)
    
    ### Motivation
    
    When I tried to build the C++ client with GCC 7.3 and when warnings are
    printed (because `BOOST_ARCH_X86_64` is not defined), the compilation
    failed with:
    
    ```
    #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled”
      ^~~~~~~
    cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror]
    cc1plus: all warnings being treated as errors
    ```
    
    It seems to be a bug before GCC 8.1. I added
    `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile
    command:
    
    ```
    -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation
    ```
    
    See
    https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106
    
    For GCC > 4.9, `-Wno-stringop-truncation` option was added. However,
    when a message was printed by `#warning` macro, it would fail with the
    strange error message.
    
    The simplest way to reproduce the bug is compiling following code:
    
    ```c++
    #warnings "hello"
    
    int main() {}
    ```
    
    You can paste the code above to https://godbolt.org/, select any GCC
    compiler whose version is lower than 8.0, then add the following
    options:
    
    ```
    -Werror -Wno-error=cpp -Wno-stringop-truncation
    ```
    
    The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1.
    
    ### Modifications
    
    Only add the `-Wno-stringop-truncation` option for GCC >= 8.1.
    
    (cherry picked from commit 958fc7820106c9b4da33f1b720d1dcce8ff772b1)
---
 pulsar-client-cpp/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index 51f0352..251d486 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -99,7 +99,7 @@ else() # GCC or Clang are mostly compatible:
     # Options unique to Clang or GCC:
     if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
         add_compile_options(-Qunused-arguments) 
-    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
+    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.1))
         add_compile_options(-Wno-stringop-truncation)
     endif()
 endif()