hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r737240 - in /hadoop/hbase/branches/0.19: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HLog.java src/java/org/apache/hadoop/hbase/regionserver/HRegion.java src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
Date Fri, 23 Jan 2009 23:08:18 GMT
Author: jimk
Date: Fri Jan 23 23:08:17 2009
New Revision: 737240

URL: http://svn.apache.org/viewvc?rev=737240&view=rev
Log:
HBASE-1148  Always flush HLog on root or meta region updates

Modified:
    hadoop/hbase/branches/0.19/CHANGES.txt
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hadoop/hbase/branches/0.19/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java

Modified: hadoop/hbase/branches/0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/CHANGES.txt?rev=737240&r1=737239&r2=737240&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19/CHANGES.txt Fri Jan 23 23:08:17 2009
@@ -2,6 +2,7 @@
 Release 0.19.1 - Unreleased
   BUG FIXES
    HBASE-1121  Cluster confused about where -ROOT- is
+   HBASE-1148  Always flush HLog on root or meta region updates
 
 Release 0.19.0
   INCOMPATIBLE CHANGES

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java?rev=737240&r1=737239&r2=737240&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java Fri
Jan 23 23:08:17 2009
@@ -456,13 +456,12 @@
    *
    * @param regionName
    * @param tableName
-   * @param row
-   * @param columns
-   * @param timestamp
+   * @param edits
+   * @param sync
    * @throws IOException
    */
   void append(byte [] regionName, byte [] tableName,
-      TreeMap<HStoreKey, byte[]> edits)
+      TreeMap<HStoreKey, byte[]> edits, boolean sync)
   throws IOException {
     if (closed) {
       throw new IOException("Cannot append; log is closed");
@@ -483,7 +482,7 @@
           new HLogKey(regionName, tableName, key.getRow(), seqNum[counter++]);
         HLogEdit logEdit =
           new HLogEdit(key.getColumn(), es.getValue(), key.getTimestamp());
-       doWrite(logKey, logEdit);
+       doWrite(logKey, logEdit, sync);
 
         this.numEntries++;
       }
@@ -521,10 +520,11 @@
     }
   }
   
-  private void doWrite(HLogKey logKey, HLogEdit logEdit) throws IOException {
+  private void doWrite(HLogKey logKey, HLogEdit logEdit, boolean sync)
+  throws IOException {
     try {
       this.writer.append(logKey, logEdit);
-      if (++unflushedEntries >= flushlogentries) {
+      if (sync || ++unflushedEntries >= flushlogentries) {
         sync();
       }
     } catch (IOException e) {
@@ -570,7 +570,8 @@
       }
 
       HLogKey logKey = new HLogKey(regionName, tableName, row, seqNum);
-      doWrite(logKey, logEdit);
+      boolean sync = regionInfo.isMetaRegion() || regionInfo.isRootRegion();
+      doWrite(logKey, logEdit, sync);
       this.numEntries++;
       updateLock.notifyAll();
     }

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=737240&r1=737239&r2=737240&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Fri Jan 23 23:08:17 2009
@@ -1707,7 +1707,8 @@
     try {
       if (writeToWAL) {
         this.log.append(regionInfo.getRegionName(),
-          regionInfo.getTableDesc().getName(), updatesByColumn);
+          regionInfo.getTableDesc().getName(), updatesByColumn,
+          (regionInfo.isMetaRegion() || regionInfo.isRootRegion()));
       }
       long size = 0;
       for (Map.Entry<HStoreKey, byte[]> e: updatesByColumn.entrySet()) {

Modified: hadoop/hbase/branches/0.19/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java?rev=737240&r1=737239&r2=737240&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
(original)
+++ hadoop/hbase/branches/0.19/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
Fri Jan 23 23:08:17 2009
@@ -77,7 +77,7 @@
             byte [] column = Bytes.toBytes(Integer.toString(j));
             edit.put(new HStoreKey(rowName, column, System.currentTimeMillis()),
               column);
-            log.append(Bytes.toBytes(Integer.toString(i)), tableName, edit);
+            log.append(Bytes.toBytes(Integer.toString(i)), tableName, edit, false);
           }
         }
         log.rollWriter();
@@ -110,7 +110,7 @@
         cols.put(new HStoreKey(row, Bytes.toBytes(Integer.toString(i)), timestamp),
             new byte[] { (byte)(i + '0') });
       }
-      log.append(regionName, tableName, cols);
+      log.append(regionName, tableName, cols, false);
       long logSeqId = log.startCacheFlush();
       log.completeCacheFlush(regionName, tableName, logSeqId);
       log.close();



Mime
View raw message