hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14450 Addendum aligns with API from HBASE-16455
Date Mon, 22 Aug 2016 17:03:50 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-7912 0309725e8 -> cd2712e43


HBASE-14450 Addendum aligns with API from HBASE-16455


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cd2712e4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cd2712e4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cd2712e4

Branch: refs/heads/HBASE-7912
Commit: cd2712e43a62a6736bfd62da7b9aa4b060d81b6b
Parents: 0309725
Author: tedyu <yuzhihong@gmail.com>
Authored: Mon Aug 22 10:03:37 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Mon Aug 22 10:03:37 2016 -0700

----------------------------------------------------------------------
 .../regionserver/LogRollBackupSubprocedure.java | 21 +++++++++++++-------
 .../hbase/regionserver/HRegionServer.java       |  5 +++--
 .../regionserver/RegionServerServices.java      |  6 ++++++
 .../hadoop/hbase/wal/DefaultWALProvider.java    | 10 +++++-----
 .../hadoop/hbase/wal/DisabledWALProvider.java   |  7 +++++--
 .../hbase/wal/RegionGroupingProvider.java       | 15 ++++++--------
 .../org/apache/hadoop/hbase/wal/WALFactory.java |  4 ++--
 .../apache/hadoop/hbase/wal/WALProvider.java    |  5 ++---
 .../hadoop/hbase/MockRegionServerServices.java  |  6 ++++++
 .../hadoop/hbase/master/MockRegionServer.java   |  6 ++++++
 .../apache/hadoop/hbase/wal/IOTestProvider.java |  7 +++++--
 11 files changed, 60 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/regionserver/LogRollBackupSubprocedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/regionserver/LogRollBackupSubprocedure.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/regionserver/LogRollBackupSubprocedure.java
index 2a94ab2..ed5c44e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/regionserver/LogRollBackupSubprocedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/regionserver/LogRollBackupSubprocedure.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hbase.backup.regionserver;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.concurrent.Callable;
 
 import org.apache.commons.logging.Log;
@@ -34,6 +35,7 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 import org.apache.hadoop.hbase.regionserver.wal.FSHLog;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.wal.WAL;
 
 /**
  * This backup subprocedure implementation forces a log roll on the RS.
@@ -73,20 +75,25 @@ public class LogRollBackupSubprocedure extends Subprocedure {
       if (LOG.isDebugEnabled()) {
         LOG.debug("++ DRPC started: " + rss.getServerName());
       }
-      hlog = (FSHLog) rss.getWAL(null);
-      long filenum = hlog.getFilenum();
-      long highest = ((HRegionServer)rss).getHighestFilenum();
+      List<WAL> wals = rss.getWALs();
+      long highest = 0;
+      for (WAL wal : wals) {
+        if (wal == null) continue;
+        if (((FSHLog)wal).getFilenum() > highest) {
+          highest = ((FSHLog)wal).getFilenum();
+        }
+      }
 
-      LOG.info("Trying to roll log in backup subprocedure, current log number: " + filenum
-          + " highest: " + highest + " on " + rss.getServerName());
+      LOG.info("Trying to roll log in backup subprocedure, "
+          + " highest log num: " + highest + " on " + rss.getServerName());
       ((HRegionServer)rss).walRoller.requestRollAll();
       long start = EnvironmentEdgeManager.currentTime();
       while (!((HRegionServer)rss).walRoller.walRollFinished()) {
         Thread.sleep(20);
       }
       LOG.debug("log roll took " + (EnvironmentEdgeManager.currentTime()-start));
-      LOG.info("After roll log in backup subprocedure, current log number: " + hlog.getFilenum()
-          + " highest: " + ((HRegionServer)rss).getHighestFilenum() + " on " + rss.getServerName());
+      LOG.info("After roll log in backup subprocedure, "
+          + " on " + rss.getServerName());
 
       Connection connection = rss.getConnection();
       try(final BackupSystemTable table = new BackupSystemTable(connection)) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index f6a1395..36d2c53 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -1873,8 +1873,9 @@ public class HRegionServer extends HasThread implements
 
   private static final byte[] UNSPECIFIED_REGION = new byte[]{};
 
-  public long getHighestFilenum() {
-    return walFactory.getHighestFilenum();
+  @Override
+  public List<WAL> getWALs() throws IOException {
+    return walFactory.getWALs();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
index 2a71629..cf200ac 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hbase.regionserver;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
@@ -55,6 +56,11 @@ public interface RegionServerServices extends OnlineRegions, FavoredNodesForRegi
    * default (common) WAL */
   WAL getWAL(HRegionInfo regionInfo) throws IOException;
 
+  /** @return the List of WALs that are used by this server
+   *  Doesn't include the meta WAL
+   */
+  List<WAL> getWALs() throws IOException;
+
   /**
    * @return Implementation of {@link CompactionRequestor} or null.
    */

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java
index feeff95..86da27c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hbase.wal;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.regex.Pattern;
@@ -118,11 +119,10 @@ public class DefaultWALProvider implements WALProvider {
   }
 
   @Override
-  public long getHighestFilenum() {
-    if (log == null) {
-      return 0;
-    }
-    return log.getFilenum();
+  public List<WAL> getWALs() throws IOException {
+    List<WAL> wals = new ArrayList<WAL>();
+    wals.add(log);
+    return wals;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DisabledWALProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DisabledWALProvider.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DisabledWALProvider.java
index 0b21c5e..6adfc6b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DisabledWALProvider.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DisabledWALProvider.java
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hbase.wal;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -65,8 +66,10 @@ class DisabledWALProvider implements WALProvider {
   }
 
   @Override
-  public long getHighestFilenum() {
-    return 0;
+  public List<WAL> getWALs() throws IOException {
+    List<WAL> wals = new ArrayList<WAL>();
+    wals.add(disabled);
+    return wals;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java
index 0d021ea..4d4ca0b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java
@@ -22,6 +22,7 @@ import static org.apache.hadoop.hbase.wal.DefaultWALProvider.META_WAL_PROVIDER_I
 import static org.apache.hadoop.hbase.wal.DefaultWALProvider.WAL_FILE_NAME_DELIMITER;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -185,16 +186,12 @@ class RegionGroupingProvider implements WALProvider {
   }
 
   @Override
-  public long getHighestFilenum() {
-    long filenum = 0;
-    synchronized (this.walCacheLock) {
-      for (WAL log : cached.values()) {
-        if (((FSHLog)log).getFilenum() > filenum) {
-          filenum = ((FSHLog)log).getFilenum();
-        }
-      }
+  public List<WAL> getWALs() throws IOException {
+    List<WAL> wals = new ArrayList<WAL>();
+    for (FSHLog log : cached.values()) {
+      wals.add(log);
     }
-    return filenum;
+    return wals;
   }
 
   private WAL getWAL(final String group) throws IOException {

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
index 9306a70..74f8f76 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
@@ -223,8 +223,8 @@ public class WALFactory {
     }
   }
 
-  public long getHighestFilenum() {
-    return provider.getHighestFilenum();
+  public List<WAL> getWALs() throws IOException {
+    return provider.getWALs();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java
index 746a2f6..6522ee6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java
@@ -58,10 +58,9 @@ public interface WALProvider {
    */
   WAL getWAL(final byte[] identifier, byte[] namespace) throws IOException;
 
-  /*
-   * @return the highest filenum among all the WAL files
+  /** @return the List of WALs that are used by this server
    */
-  long getHighestFilenum();
+  List<WAL> getWALs() throws IOException;
 
   /**
    * persist outstanding WALs to storage and stop accepting new appends.

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java
index e634327..0c6230e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -244,6 +245,11 @@ public class MockRegionServerServices implements RegionServerServices
{
   }
 
   @Override
+  public List<WAL> getWALs() throws IOException {
+    return Collections.emptyList();
+  }
+
+  @Override
   public WAL getWAL(HRegionInfo regionInfo) throws IOException {
     return null;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
index 453bdbf..f62550e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -562,6 +563,11 @@ ClientProtos.ClientService.BlockingInterface, RegionServerServices {
   }
 
   @Override
+  public List<WAL> getWALs() throws IOException {
+    return Collections.emptyList();
+  }
+
+  @Override
   public WAL getWAL(HRegionInfo regionInfo) throws IOException {
     return null;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2712e4/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/IOTestProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/IOTestProvider.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/IOTestProvider.java
index 3a04f75..d27939d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/IOTestProvider.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/IOTestProvider.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hbase.wal;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
@@ -108,8 +109,10 @@ public class IOTestProvider implements WALProvider {
   }
 
   @Override
-  public long getHighestFilenum() {
-    return log.getFilenum();
+  public List<WAL> getWALs() throws IOException {
+    List<WAL> wals = new ArrayList<WAL>();
+    wals.add(log);
+    return wals;
   }
 
   @Override


Mime
View raw message