hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schulman <mschul...@lightboxcap.com>
Subject Re: svn commit: r714193 - in /hadoop/hbase/trunk: ./ src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/regionserver/ src/java/org/apache/hadoop/hbase/util/ src/test/org/apache/hadoop/hbase/ src/webapps/master/
Date Sat, 15 Nov 2008 00:53:43 GMT

301 W. 53rd Street

----- Original Message -----
From: stack@apache.org <stack@apache.org>
To: hbase-commits@hadoop.apache.org <hbase-commits@hadoop.apache.org>
Sent: Fri Nov 14 23:46:53 2008
Subject: svn commit: r714193 - in /hadoop/hbase/trunk: ./ src/java/org/apache/hadoop/hbase/
src/java/org/apache/hadoop/hbase/regionserver/ src/java/org/apache/hadoop/hbase/util/ src/test/org/apache/hadoop/hbase/
src/webapps/master/

Author: stack
Date: Fri Nov 14 15:46:53 2008
New Revision: 714193

URL: http://svn.apache.org/viewvc?rev=714193&view=rev
Log:
HBASE-999 Up versions on historian and keep history of deleted regions for a while rather
than delete immediately

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HConstants.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestEmptyMetaInfo.java
    hadoop/hbase/trunk/src/webapps/master/regionhistorian.jsp

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri Nov 14 15:46:53 2008
@@ -117,6 +117,8 @@
    HBASE-993   Turn of logging of every catalog table row entry on every scan
    HBASE-992   Up the versions kept by catalog tables; currently 1. Make it 10?
    HBASE-998   Narrow getClosestRowBefore by passing column family
+   HBASE-999   Up versions on historian and keep history of deleted regions for a
+               while rather than delete immediately
         
   NEW FEATURES
    HBASE-875   Use MurmurHash instead of JenkinsHash [in bloomfilters]

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HConstants.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HConstants.java Fri Nov 14 15:46:53
2008
@@ -234,6 +234,8 @@
    * Unlimited time-to-live.
    */
   static final int FOREVER = -1;
+  
+  public static final int WEEK_IN_SECONDS = 7 * 24 * 3600;
 
   //TODO: HBASE_CLIENT_RETRIES_NUMBER_KEY is only used by TestMigrate. Move it
   //      there.

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java Fri Nov 14 15:46:53
2008
@@ -617,10 +617,10 @@
   public static final HTableDescriptor META_TABLEDESC = new HTableDescriptor(
       HConstants.META_TABLE_NAME, new HColumnDescriptor[] {
           new HColumnDescriptor(HConstants.COLUMN_FAMILY,
-              10, // Ten is arbitrary number.  Keep versions to help debuggging.
-              HColumnDescriptor.CompressionType.NONE, false, false,
-              Integer.MAX_VALUE, HConstants.FOREVER, false),
+            10, // Ten is arbitrary number.  Keep versions to help debuggging.
+            HColumnDescriptor.CompressionType.NONE, false, false,
+            Integer.MAX_VALUE, HConstants.FOREVER, false),
           new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
-              HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
-              false, false, Integer.MAX_VALUE, HConstants.FOREVER, false) });
+            HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
+            false, false, Integer.MAX_VALUE, HConstants.WEEK_IN_SECONDS, false)});
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java Fri Nov 14 15:46:53
2008
@@ -73,6 +73,8 @@
     }
   } 
 
+  public static final String SPLIT_PREFIX = "Region split from: ";
+
   /**
    * Default constructor. Initializes reference to .META. table.  Inaccessible.
    * Use {@link #getInstance(HBaseConfiguration)} to obtain the Singleton
@@ -170,8 +172,8 @@
      HRegionInfo newInfo2) {
     HRegionInfo[] infos = new HRegionInfo[] { newInfo1, newInfo2 };
     for (HRegionInfo info : infos) {
-      add(HistorianColumnKey.REGION_SPLIT.key, "Region split from  : "
-          + oldInfo.getRegionNameAsString(), info);
+      add(HistorianColumnKey.REGION_SPLIT.key, SPLIT_PREFIX +
+        oldInfo.getRegionNameAsString(), info);
     }
   }
 

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri Nov
14 15:46:53 2008
@@ -1335,8 +1335,9 @@
     long now = System.currentTimeMillis();
     try {
       for (HStore store : stores.values()) {
-        List<HStoreKey> keys = store.getKeys(new HStoreKey(row, ts, this.regionInfo),
-          ALL_VERSIONS, now, null);
+        List<HStoreKey> keys =
+          store.getKeys(new HStoreKey(row, ts, this.regionInfo), ALL_VERSIONS,
+            now, null);
         TreeMap<HStoreKey, byte []> edits = new TreeMap<HStoreKey, byte []>(
           new HStoreKey.HStoreKeyWritableComparator(regionInfo));
         for (HStoreKey key: keys) {
@@ -2104,7 +2105,8 @@
 
   /**
    * Delete a region's meta information from the passed
-   * <code>meta</code> region.
+   * <code>meta</code> region.  Removes content in the 'info' column family.
+   * Does not remove region historian info.
    * 
    * @param srvr META server to be updated
    * @param metaRegionName Meta region name
@@ -2115,7 +2117,8 @@
   public static void removeRegionFromMETA(final HRegionInterface srvr,
     final byte [] metaRegionName, final byte [] regionName)
   throws IOException {
-    srvr.deleteAll(metaRegionName, regionName, HConstants.LATEST_TIMESTAMP, -1L);
+    srvr.deleteFamily(metaRegionName, regionName, HConstants.COLUMN_FAMILY,
+      HConstants.LATEST_TIMESTAMP, -1L);
   }
 
   /**

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java Fri Nov 14 15:46:53
2008
@@ -257,14 +257,22 @@
    * @param true if we changed value
    */
   private boolean updateVersions(final HRegionInfo hri) {
+    boolean result = false;
     HColumnDescriptor hcd =
-      hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY);
+      hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY_HISTORIAN);
+    // Set historian records so they timeout after a week.
+    if (hcd.getTimeToLive() == HConstants.FOREVER) {
+      hcd.setTimeToLive(HConstants.WEEK_IN_SECONDS);
+      result = true;
+    }
+    // Set the versions up to 10 from old default of 1.
+    hcd = hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY);
     if (hcd.getMaxVersions() == 1) {
       // Set it to 10, an arbitrary high number
       hcd.setMaxVersions(10);
-      return true;
+      result = true;
     }
-    return false;
+    return result;
   }
 
   private int parseArgs(String[] args) {

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestEmptyMetaInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestEmptyMetaInfo.java?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestEmptyMetaInfo.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestEmptyMetaInfo.java Fri Nov 14
15:46:53 2008
@@ -74,4 +74,4 @@
     assertTrue(tries >= 0);
     assertEquals(0, count);
   }
-}
+}
\ No newline at end of file

Modified: hadoop/hbase/trunk/src/webapps/master/regionhistorian.jsp
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/webapps/master/regionhistorian.jsp?rev=714193&r1=714192&r2=714193&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/webapps/master/regionhistorian.jsp (original)
+++ hadoop/hbase/trunk/src/webapps/master/regionhistorian.jsp Fri Nov 14 15:46:53 2008
@@ -1,5 +1,6 @@
 <%@ page contentType="text/html;charset=UTF-8"
   import="java.util.List"
+  import="java.util.regex.*"
   import="org.apache.hadoop.hbase.RegionHistorian"
   import="org.apache.hadoop.hbase.master.HMaster"
   import="org.apache.hadoop.hbase.RegionHistorian.RegionHistoryInformation"
@@ -7,6 +8,8 @@
   String regionName = request.getParameter("regionname");
   HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
   List<RegionHistoryInformation> informations = RegionHistorian.getInstance().getRegionHistory(regionName);
+  // Pattern used so we can wrap a regionname in an href.
+  Pattern pattern = Pattern.compile(RegionHistorian.SPLIT_PREFIX + "(.*)$");
 %><?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
@@ -24,8 +27,18 @@
 <hr id="head_rule" />
 <%if(informations != null && informations.size() > 0) { %>
 <table><tr><th>Timestamp</th><th>Event</th><th>Description</th></tr>
-<%  for( RegionHistoryInformation information : informations) {%>
-<tr><td><%= information.getTimestampAsString() %></td><td><%=
information.getEvent() %></td><td><%= information.getDescription()%></td></tr>
+<%  for( RegionHistoryInformation information : informations) {
+    String description = information.getDescription();
+    Matcher m = pattern.matcher(description);
+    if (m.matches()) {
+      // Wrap the region name in an href so user can click on it.
+      description = RegionHistorian.SPLIT_PREFIX +
+      "<a href=\"regionhistorian.jsp?regionname=" + m.group(1) + "\">" +
+        m.group(1) + "</a>";
+    }
+    
+    %>
+<tr><td><%= information.getTimestampAsString() %></td><td><%=
information.getEvent() %></td><td><%= description %></td></tr>
 <%  } %>
 </table>
 <p>


Mime
View raw message