You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:22:00 UTC

svn commit: r1181577 - in /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase: ipc/HRegionInterface.java regionserver/HRegionServer.java

Author: nspiegelberg
Date: Tue Oct 11 02:22:00 2011
New Revision: 1181577

URL: http://svn.apache.org/viewvc?rev=1181577&view=rev
Log:
Add an option to flush regions before starting the snapshot / backup.

Summary:
1. Added an optional flushFlag (default is false) to flush regions before
starting the snapshot.
2. Added a method to HRegionServer to flush a region passed as a parameter
(regionName).
3. Exposed that through HRegionInterface.

Test Plan:
Tested on my dev cluster using a small table. The flush creates the HFiles and
then they are copied.

Reviewed By: aaiyer
Reviewers: aaiyer, kranganathan, kannan, nspiegelberg
Commenters: kannan
CC: pritam, gqchen, kannan, madhuvaidya, aaiyer
Differential Revision: 269380

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java?rev=1181577&r1=1181576&r2=1181577&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java Tue Oct 11 02:22:00 2011
@@ -73,6 +73,12 @@ public interface HRegionInterface extend
    */
   public HRegion [] getOnlineRegionsAsArray();
 
+  /**
+   * Flush the given region
+   */
+  public void flushRegion(byte[] regionName)
+    throws IllegalArgumentException, IOException;
+
   public List<String> getStoreFileList(byte[] regionName, byte[] columnFamily)
     throws IllegalArgumentException;
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1181577&r1=1181576&r2=1181577&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Tue Oct 11 02:22:00 2011
@@ -2221,6 +2221,18 @@ public class HRegionServer implements HR
   }
 
   /**
+  * Flushes the given region
+  */
+  public void flushRegion(byte[] regionName)
+    throws IllegalArgumentException, IOException {
+    HRegion region = getOnlineRegion(regionName);
+    if (region == null) {
+      throw new IllegalArgumentException("No region : " + new String(regionName)
+      + " available");
+    }
+    region.flushcache();
+  }
+  /**
    * @return The HRegionInfos from online regions sorted
    */
   public SortedSet<HRegionInfo> getSortedOnlineRegionInfos() {