hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r619657 - in /hadoop/hbase/trunk: CHANGES.txt conf/hbase-env.sh src/java/org/apache/hadoop/hbase/HLog.java src/test/org/apache/hadoop/hbase/TestHLog.java
Date Thu, 07 Feb 2008 21:49:10 GMT
Author: stack
Date: Thu Feb  7 13:48:58 2008
New Revision: 619657

URL: http://svn.apache.org/viewvc?rev=619657&view=rev
Log:
HBASE-2 hlog numbers should wrap around when they reach 999

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/conf/hbase-env.sh
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HLog.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestHLog.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=619657&r1=619656&r2=619657&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu Feb  7 13:48:58 2008
@@ -13,6 +13,8 @@
                (Stu Hood and Bryan Duxbury via Stack)
    HBASE-28    thrift put/mutateRow methods need to throw IllegalArgument exceptions
                (Dave Simpson via Bryan Duxbury via Stack)
+   HBASE-2     hlog numbers should wrap around when they reach 999
+               (Bryan Duxbury via Stack)
 
   IMPROVEMENTS
    HBASE-415   Rewrite leases to use DelayedBlockingQueue instead of polling

Modified: hadoop/hbase/trunk/conf/hbase-env.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/conf/hbase-env.sh?rev=619657&r1=619656&r2=619657&view=diff
==============================================================================
--- hadoop/hbase/trunk/conf/hbase-env.sh (original)
+++ hadoop/hbase/trunk/conf/hbase-env.sh Thu Feb  7 13:48:58 2008
@@ -23,6 +23,7 @@
 
 # The java implementation to use.  Required.
 # export JAVA_HOME=/usr/lib/j2sdk1.5-sun
+export JAVA_HOME=/usr
 
 # Extra Java CLASSPATH elements.  Optional.
 # export HBASE_CLASSPATH=

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HLog.java?rev=619657&r1=619656&r2=619657&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HLog.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HLog.java Thu Feb  7 13:48:58 2008
@@ -119,7 +119,8 @@
   volatile long logSeqNum = 0;
 
   volatile long filenum = 0;
-
+  volatile long old_filenum = -1;
+  
   volatile int numEntries = 0;
 
   // This lock prevents starting a log roll during a cache flush.
@@ -215,7 +216,7 @@
         if (this.writer != null) {
           // Close the current writer, get a new one.
           this.writer.close();
-          Path p = computeFilename(filenum - 1);
+          Path p = computeFilename(old_filenum);
           if (LOG.isDebugEnabled()) {
             LOG.debug("Closing current log writer " + p.toString() +
             " to get a new one");
@@ -226,7 +227,9 @@
             }
           }
         }
-        Path newPath = computeFilename(filenum++);
+        old_filenum = filenum;
+        filenum = System.currentTimeMillis();
+        Path newPath = computeFilename(filenum);
         this.writer = SequenceFile.createWriter(this.fs, this.conf, newPath,
             HLogKey.class, HLogEdit.class, getCompressionType(this.conf));
         LOG.info("new log writer created at " + newPath);
@@ -294,8 +297,7 @@
    * file-number.
    */
   Path computeFilename(final long fn) {
-    return new Path(dir,
-      HLOG_DATFILE + String.format("%1$03d", Long.valueOf(fn)));
+    return new Path(dir, HLOG_DATFILE + new Long(fn).toString());
   }
 
   /**

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestHLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestHLog.java?rev=619657&r1=619656&r2=619657&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestHLog.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestHLog.java Thu Feb  7 13:48:58
2008
@@ -110,7 +110,7 @@
       long logSeqId = log.startCacheFlush();
       log.completeCacheFlush(regionName, tableName, logSeqId);
       log.close();
-      Path filename = log.computeFilename(log.filenum - 1);
+      Path filename = log.computeFilename(log.filenum);
       log = null;
       // Now open a reader on the log and assert append worked.
       reader = new SequenceFile.Reader(fs, filename, conf);



Mime
View raw message