hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sra...@apache.org
Subject svn commit: r1360991 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java
Date Thu, 12 Jul 2012 22:46:53 GMT
Author: sradia
Date: Thu Jul 12 22:46:53 2012
New Revision: 1360991

URL: http://svn.apache.org/viewvc?rev=1360991&view=rev
Log:
HDFS-3630 Modify TestPersistBlocks to use both flush and hflush  (sanjay)

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1360991&r1=1360990&r2=1360991&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Jul 12 22:46:53 2012
@@ -107,6 +107,8 @@ Trunk (unreleased changes)
     HDFS-3190. Simple refactors in existing NN code to assist
     QuorumJournalManager extension. (todd)
 
+    HDFS-3630 Modify TestPersistBlocks to use both flush and hflush  (sanjay)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java?rev=1360991&r1=1360990&r2=1360991&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPersistBlocks.java
Thu Jul 12 22:46:53 2012
@@ -72,10 +72,25 @@ public class TestPersistBlocks {
     rand.nextBytes(DATA_BEFORE_RESTART);
     rand.nextBytes(DATA_AFTER_RESTART);
   }
+ 
+  /** check if DFS remains in proper condition after a restart 
+   **/
+  @Test  
+  public void TestRestartDfsWithFlush() throws Exception {
+    testRestartDfs(true);
+  }
   
-  /** check if DFS remains in proper condition after a restart */
-  @Test
-  public void testRestartDfs() throws Exception {
+  
+  /** check if DFS remains in proper condition after a restart 
+   **/
+  public void TestRestartDfsWithSync() throws Exception {
+    testRestartDfs(false);
+  }
+  
+  /** check if DFS remains in proper condition after a restart
+   * @param useFlush - if true then flush is used instead of sync (ie hflush)
+   */
+  void testRestartDfs(boolean useFlush) throws Exception {
     final Configuration conf = new HdfsConfiguration();
     // Turn off persistent IPC, so that the DFSClient can survive NN restart
     conf.setInt(
@@ -92,7 +107,10 @@ public class TestPersistBlocks {
       // Creating a file with 4096 blockSize to write multiple blocks
       stream = fs.create(FILE_PATH, true, BLOCK_SIZE, (short) 1, BLOCK_SIZE);
       stream.write(DATA_BEFORE_RESTART);
-      stream.hflush();
+      if (useFlush)
+        stream.flush();
+      else 
+        stream.hflush();
       
       // Wait for at least a few blocks to get through
       while (len <= BLOCK_SIZE) {



Mime
View raw message