You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2012/04/17 05:57:19 UTC

svn commit: r1326902 - in /hbase/trunk/src/test: java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java resources/hbase-site.xml

Author: stack
Date: Tue Apr 17 03:57:18 2012
New Revision: 1326902

URL: http://svn.apache.org/viewvc?rev=1326902&view=rev
Log:
HBASE-5804 Add more to verification step in HLogPerformanceEvaluation

Modified:
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java
    hbase/trunk/src/test/resources/hbase-site.xml

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java?rev=1326902&r1=1326901&r2=1326902&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java Tue Apr 17 03:57:18 2012
@@ -49,6 +49,8 @@ import org.apache.hadoop.hbase.regionser
 
 /**
  * This class runs performance benchmarks for {@link HLog}.
+ * See usage for this tool by running:
+ * <code>$ hbase org.apache.hadoop.hbase.regionserver.wal.HLogPerformanceEvaluation -h</code>
  */
 @InterfaceAudience.Private
 public final class HLogPerformanceEvaluation extends Configured implements Tool {
@@ -178,7 +180,7 @@ public final class HLogPerformanceEvalua
         if (verify) {
           Path dir = hlog.getDir();
           for (FileStatus fss: fs.listStatus(dir)) {
-            verifyInSequence(fss.getPath());
+            verify(fss.getPath(), numIterations * numThreads);
           }
         }
       } finally {
@@ -202,13 +204,23 @@ public final class HLogPerformanceEvalua
     return htd;
   }
 
-  void verifyInSequence(final Path wal) throws IOException {
+  /**
+   * Verify the content of the WAL file.
+   * Verify that sequenceids are ascending and that the file has expected number
+   * of edits.
+   * @param wal
+   * @param editsCount
+   * @throws IOException
+   */
+  private void verify(final Path wal, final long editsCount) throws IOException {
     HLog.Reader reader = HLog.getReader(wal.getFileSystem(getConf()), wal, getConf());
     long previousSeqid = -1;
+    long count = 0;
     try {
       while (true) {
         Entry e = reader.next();
         if (e == null) break;
+        count++;
         long seqid = e.getKey().getLogSeqNum();
         if (previousSeqid >= seqid) {
           throw new IllegalStateException("wal=" + wal.getName() +
@@ -216,6 +228,7 @@ public final class HLogPerformanceEvalua
         }
         previousSeqid = seqid;
       }
+      if (count != editsCount) throw new IllegalStateException("Expected=" + editsCount + ", found=" + count);
     } finally {
       reader.close();
     }

Modified: hbase/trunk/src/test/resources/hbase-site.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/resources/hbase-site.xml?rev=1326902&r1=1326901&r2=1326902&view=diff
==============================================================================
--- hbase/trunk/src/test/resources/hbase-site.xml (original)
+++ hbase/trunk/src/test/resources/hbase-site.xml Tue Apr 17 03:57:18 2012
@@ -142,11 +142,4 @@
     version is X.X.X-SNAPSHOT"
     </description>
   </property>
-   <property>
-     <name>hbase.client.retries.number</name>
-     <value>100</value>
-     <description>
-     Use a lot of retries in unit tests.
-     </description>
-   </property>
 </configuration>