hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [hbase] branch branch-1.3 updated: HBASE-22508 Address findbugs/spotbugs complaints (branch-1.3)
Date Sat, 01 Jun 2019 00:17:30 GMT
This is an automated email from the ASF dual-hosted git repository.

apurtell pushed a commit to branch branch-1.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1.3 by this push:
     new be463e7  HBASE-22508 Address findbugs/spotbugs complaints (branch-1.3)
be463e7 is described below

commit be463e77f7edec577dcffcfa4ede94a51485a163
Author: Andrew Purtell <apurtell@apache.org>
AuthorDate: Thu May 30 16:40:07 2019 -0700

    HBASE-22508 Address findbugs/spotbugs complaints (branch-1.3)
    
    Closes #275
    
    Signed-off-by: Sean Busbey <busbey@apache.org>
---
 .../hadoop/metrics2/lib/MetricsExecutorImpl.java    |  2 +-
 .../apache/hadoop/hbase/regionserver/HRegion.java   | 21 ++++++++++++++++-----
 .../apache/hadoop/hbase/regionserver/HStore.java    |  6 +++++-
 .../java/org/apache/hadoop/hbase/tool/Canary.java   |  4 +++-
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
index c381609..0a83a5e 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
@@ -48,7 +48,7 @@ public class MetricsExecutorImpl implements MetricsExecutor {
 
   private enum ExecutorSingleton {
     INSTANCE;
-    private final ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
+    private transient final ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
         new ThreadPoolExecutorThreadFactory("HBase-Metrics2-"));
   }
 
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index d667786..f7abe2a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -7812,11 +7812,15 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
         for (Map.Entry<Store, List<Cell>> entry : removedCellsForMemStore.entrySet())
{
           Store currStore = entry.getKey();
           for (Cell cell: entry.getValue()) {
-            CellUtil.setSequenceId(cell, walKey.getWriteEntry().getWriteNumber());
+            if (we != null) {
+              CellUtil.setSequenceId(cell, we.getWriteNumber());
+            }
             currStore.add(cell);
           }
         }
-        if (we != null) mvcc.complete(we);
+        if (we != null) {
+          mvcc.complete(we);
+        }
       } else if (we != null) {
         mvcc.completeAndWait(we);
       }
@@ -8042,6 +8046,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
         rowLock.release();
       }
       // if the wal sync was unsuccessful, remove keys from memstore
+      WriteEntry we = walKey != null ? walKey.getWriteEntry() : null;
       if (doRollBackMemstore) {
         for (Map.Entry<Store, List<Cell>> entry : forMemStore.entrySet()) {
           rollbackMemstore(entry.getKey(), entry.getValue());
@@ -8049,13 +8054,19 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
         for (Map.Entry<Store, List<Cell>> entry : removedCellsForMemStore.entrySet())
{
           Store currStore = entry.getKey();
           for (Cell cell : entry.getValue()) {
-            CellUtil.setSequenceId(cell, walKey.getWriteEntry().getWriteNumber());
+            if (we != null) {
+              CellUtil.setSequenceId(cell, we.getWriteNumber());
+            }
             currStore.add(cell);
           }
         }
-        if (walKey != null) mvcc.complete(walKey.getWriteEntry());
+        if (we != null) {
+          mvcc.complete(we);
+        }
       } else {
-        if (walKey != null) mvcc.completeAndWait(walKey.getWriteEntry());
+        if (we != null) {
+          mvcc.completeAndWait(we);
+        }
       }
     }
 
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 08dc3f8..764099f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -2806,10 +2806,14 @@ public class HStore implements Store {
             // Just close and return
             filesToRemove.add(file);
           } else {
-            LOG.info("Can't archive compacted file " + file.getPath()
+            if (r != null) {
+              LOG.info("Can't archive compacted file " + file.getPath()
                 + " because of either isCompactedAway=" + r.isCompactedAway()
                 + " or file has reference, isReferencedInReads=" + r.isReferencedInReads()
                 + ", refCount=" + r.getRefCount() + ", skipping for now.");
+            } else {
+              LOG.info("Can't archive compacted file " + file.getPath() + ", skipping for
now.");
+            }
           }
         } catch (Exception e) {
           LOG.error(
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
index c0655d8..7c17db9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
@@ -35,6 +35,7 @@ import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Random;
 import java.util.Set;
 import java.util.TreeSet;
@@ -1089,7 +1090,8 @@ public final class Canary implements Tool {
             }
           }
           Map<String, AtomicLong> actualReadTableLatency = regionSink.getReadLatencyMap();
-          for (String tableName : this.configuredReadTableTimeouts.keySet()) {
+          for (Entry<String, Long> entry : this.configuredReadTableTimeouts.entrySet())
{
+            String tableName = entry.getKey();
             if (actualReadTableLatency.containsKey(tableName)) {
               Long actual = actualReadTableLatency.get(tableName).longValue();
               Long configured = this.configuredReadTableTimeouts.get(tableName);


Mime
View raw message