You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2023/03/08 01:23:55 UTC

[accumulo] branch main updated: Revert and fix "Fix warning by removing unused variable"

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

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 373d0c7ed7 Revert and fix "Fix warning by removing unused variable"
373d0c7ed7 is described below

commit 373d0c7ed7f7fa71bbc07d9c26c132c867917dba
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Tue Mar 7 20:17:39 2023 -0500

    Revert and fix "Fix warning by removing unused variable"
    
    This reverts commit 1dac6758a8de221edffd4a424ba541e4b303e269 and fixes
    it by using the return value from the cache.get, so it does not trigger
    an errorprone warning.
---
 .../apache/accumulo/core/iterators/Combiner.java   | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
index 2d6dec27e7..a8d60f7acb 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
@@ -189,16 +189,20 @@ public abstract class Combiner extends WrappingIterator implements OptionDescrib
       Caffeine.newBuilder().expireAfterWrite(1, HOURS).maximumSize(10000).build();
 
   private void sawDelete() {
-    if (isMajorCompaction && !reduceOnFullCompactionOnly) {
-      loggedMsgCache.get(this.getClass().getName(), k -> {
-        sawDeleteLog.error(
-            "Combiner of type {} saw a delete during a"
-                + " partial compaction. This could cause undesired results. See"
-                + " ACCUMULO-2232. Will not log subsequent occurrences for at least 1 hour.",
-            Combiner.this.getClass().getSimpleName());
-        // the value is not used and does not matter
-        return Boolean.TRUE;
-      });
+    if (isMajorCompaction && !reduceOnFullCompactionOnly
+        && loggedMsgCache.get(this.getClass().getName(), k -> {
+          sawDeleteLog.error(
+              "Combiner of type {} saw a delete during a"
+                  + " partial compaction. This could cause undesired results. See"
+                  + " ACCUMULO-2232. Will not log subsequent occurrences for at least 1 hour.",
+              Combiner.this.getClass().getSimpleName());
+          // the value is not used and does not matter
+          return Boolean.TRUE;
+        })) {
+      // do nothing;
+      // this is a workaround to ignore the return value of the cache, since we're relying only on
+      // the side-effect of logging when the cache entry expires;
+      // if the cached value is present, it's value is always true
     }
   }