You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2019/11/07 11:25:47 UTC

[bookkeeper] branch master updated: Fix the log level of not support Sse42Crc32C

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

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f4b135  Fix the log level of not support Sse42Crc32C
9f4b135 is described below

commit 9f4b1359e58fcd9872e895bc8d8ef14b409f86ac
Author: 冉小龙 <ra...@gmail.com>
AuthorDate: Thu Nov 7 19:25:41 2019 +0800

    Fix the log level of not support Sse42Crc32C
    
    Signed-off-by: xiaolong.ran <ranxiaolong716gmail.com>
    
    ### Motivation
    
    When users are using Apache Pulsar, they will encounter the following error about `Sse42Crc32C`. But in fact it does not affect the correctness of Apache Pulsar use. But the error level log information will cause confusion for the user.
    ```
    10:12:49.119 [pulsar-ordered-OrderedExecutor-0-0-EventThread] ERROR org.apache.bookkeeper.proto.checksum.CRC32CDigestManager - Sse42Crc32C is not supported, will use a slower CRC32C implementation.
    ```
    
    
    
    ### Changes
    
    Replace the log level of `not support Sse42Crc32C` from error to warn.
    
    
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <None>
    
    This closes #2198 from wolfstudy/xiaolong/sse42Crc32C
---
 .../org/apache/bookkeeper/proto/checksum/CRC32CDigestManager.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/checksum/CRC32CDigestManager.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/checksum/CRC32CDigestManager.java
index 59dec3a..f12b547 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/checksum/CRC32CDigestManager.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/checksum/CRC32CDigestManager.java
@@ -32,6 +32,8 @@ import org.apache.commons.lang3.mutable.MutableInt;
 @Slf4j
 class CRC32CDigestManager extends DigestManager {
 
+    private static boolean nonSupportedMessagePrinted = false;
+
     private static final FastThreadLocal<MutableInt> currentCrc = new FastThreadLocal<MutableInt>() {
         @Override
         protected MutableInt initialValue() throws Exception {
@@ -41,8 +43,10 @@ class CRC32CDigestManager extends DigestManager {
 
     public CRC32CDigestManager(long ledgerId, boolean useV2Protocol, ByteBufAllocator allocator) {
         super(ledgerId, useV2Protocol, allocator);
-        if (!Sse42Crc32C.isSupported()) {
-            log.error("Sse42Crc32C is not supported, will use a slower CRC32C implementation.");
+
+        if (!Sse42Crc32C.isSupported() && !nonSupportedMessagePrinted) {
+            log.warn("Sse42Crc32C is not supported, will use a slower CRC32C implementation.");
+            nonSupportedMessagePrinted = true;
         }
     }