hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1147043 - in /hbase/trunk/src: main/java/org/apache/hadoop/hbase/util/FSUtils.java test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
Date Fri, 15 Jul 2011 09:01:42 GMT
Author: tedyu
Date: Fri Jul 15 09:01:41 2011
New Revision: 1147043

URL: http://svn.apache.org/viewvc?rev=1147043&view=rev
Log:
HBASE-451 getTableInfoPath() should be called in FSUtils.getTableInfoModtime()

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1147043&r1=1147042&r2=1147043&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Fri Jul 15 09:01:41
2011
@@ -884,7 +884,7 @@ public class FSUtils {
   public static long getTableInfoModtime(final FileSystem fs, final Path rootdir,
       final String tablename)
   throws IOException {
-    Path p = getTablePath(rootdir, tablename);
+    Path p = getTableInfoPath(rootdir, tablename);
     FileStatus [] status = fs.listStatus(p);
     if (status.length < 1) throw new FileNotFoundException("No status for " + p.toString());
     return status[0].getModificationTime();

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java?rev=1147043&r1=1147042&r2=1147043&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java Fri
Jul 15 09:01:41 2011
@@ -22,6 +22,8 @@ import static org.junit.Assert.*;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -40,6 +42,7 @@ import org.junit.Test;
  */
 public class TestFSTableDescriptors {
   private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
+  private static final Log LOG = LogFactory.getLog(TestFSTableDescriptors.class);
 
   @Test
   public void testRemoves() throws IOException {
@@ -75,7 +78,7 @@ public class TestFSTableDescriptors {
   throws IOException, InterruptedException {
     final String name = "testHTableDescriptors";
     FileSystem fs = FileSystem.get(UTIL.getConfiguration());
-    // Cleanup old tests if any detrius laying around.
+    // Cleanup old tests if any debris laying around.
     Path rootdir = new Path(HBaseTestingUtility.getTestDir(), name);
     final int count = 10;
     // Write out table infos.
@@ -87,7 +90,7 @@ public class TestFSTableDescriptors {
       @Override
       public HTableDescriptor get(byte[] tablename)
           throws TableExistsException, FileNotFoundException, IOException {
-        System.out.println(Bytes.toString(tablename) + ", cachehits=" + this.cachehits);
+        LOG.info(Bytes.toString(tablename) + ", cachehits=" + this.cachehits);
         return super.get(tablename);
       }
     };
@@ -97,14 +100,14 @@ public class TestFSTableDescriptors {
     for (int i = 0; i < count; i++) {
       assertTrue(htds.get(Bytes.toBytes(name + i)) !=  null);
     }
-    // Wait a while so mod time we write is for sure different.
-    Thread.sleep(1000);
     // Update the table infos
     for (int i = 0; i < count; i++) {
       HTableDescriptor htd = new HTableDescriptor(name + i);
       htd.addFamily(new HColumnDescriptor("" + i));
       FSUtils.updateHTableDescriptor(fs, rootdir, htd);
     }
+    // Wait a while so mod time we write is for sure different.
+    Thread.sleep(100);
     for (int i = 0; i < count; i++) {
       assertTrue(htds.get(Bytes.toBytes(name + i)) !=  null);
     }
@@ -113,7 +116,7 @@ public class TestFSTableDescriptors {
     }
     assertEquals(count * 4, htds.invocations);
     assertTrue("expected=" + (count * 2) + ", actual=" + htds.cachehits,
-      htds.cachehits >= (count * 2));
+      htds.cachehits == (count * 2));
     assertTrue(htds.get(HConstants.ROOT_TABLE_NAME) != null);
     assertEquals(htds.invocations, count * 4 + 1);
     assertTrue("expected=" + ((count * 2) + 1) + ", actual=" + htds.cachehits,



Mime
View raw message