hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1596348 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/client/TableServers.java test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java
Date Tue, 20 May 2014 18:18:38 GMT
Author: liyin
Date: Tue May 20 18:18:37 2014
New Revision: 1596348

URL: http://svn.apache.org/r1596348
Log:
[HBASE-11187] Fix null pointer.

Author: elliott

Summary: Fix null pointer when there are no outstanding requests.

Test Plan: mvn test -Dtest=TestEmptyMetaInfo

Reviewers: manukranthk

Reviewed By: manukranthk

Subscribers: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1336725

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java?rev=1596348&r1=1596347&r2=1596348&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
Tue May 20 18:18:37 2014
@@ -107,7 +107,7 @@ public class TableServers implements Ser
   private final int prefetchRegionLimit;
 
   private final Object masterLock = new Object();
-  private final int maxOutstandRequestsPerServer;
+  private final int maxOutstandingRequestsPerServer;
   private volatile boolean closed;
   private volatile HMasterInterface master;
   private volatile boolean masterChecked;
@@ -295,7 +295,7 @@ public class TableServers implements Ser
 
     this.recordClientContext = conf.getBoolean("hbase.client.record.context", false);
 
-    this.maxOutstandRequestsPerServer = conf.getInt("hbase.client.max.outstanding.requests.per.server",
50);
+    this.maxOutstandingRequestsPerServer = conf.getInt("hbase.client.max.outstanding.requests.per.server",
50);
   }
 
   // Used by master and region servers during safe mode only
@@ -3359,7 +3359,7 @@ private HRegionLocation locateMetaInRoot
     AtomicInteger atomicOutstanding = getOutstandingCount(address);
 
     int outstanding = atomicOutstanding.get();
-    if (outstanding > maxOutstandRequestsPerServer) {
+    if (outstanding > maxOutstandingRequestsPerServer) {
       throw new TooManyOutstandingRequestsException(address, outstanding);
     }
     atomicOutstanding.incrementAndGet();
@@ -3373,7 +3373,11 @@ private HRegionLocation locateMetaInRoot
   private AtomicInteger getOutstandingCount(HServerAddress address) {
     AtomicInteger out = outstandingRequests.get(address);
     if (out == null) {
-      out = outstandingRequests.putIfAbsent(address, new AtomicInteger(0));
+      out = new AtomicInteger(0);
+      AtomicInteger prev = outstandingRequests.putIfAbsent(address, out);
+      if (prev != null) {
+        out = prev;
+      }
     }
     return out;
   }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java?rev=1596348&r1=1596347&r2=1596348&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestLoadShedding.java
Tue May 20 18:18:37 2014
@@ -152,7 +152,6 @@ public class TestLoadShedding {
           ht.flushCommits();
         }
       } catch (IOException e) {
-        e.printStackTrace();
         NUM_SHED.incrementAndGet();
       }
     }



Mime
View raw message