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 <eolivelli@gmail.com>, Sijie Guo <None>
This closes #2198 from wolfstudy/xiaolong/sse42Crc32C
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 @@
@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 @@
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;
}
}