You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dh...@apache.org on 2007/12/05 20:29:45 UTC

svn commit: r601476 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSEditLog.java

Author: dhruba
Date: Wed Dec  5 11:29:44 2007
New Revision: 601476

URL: http://svn.apache.org/viewvc?rev=601476&view=rev
Log:
HADOOP-2349.  Improve code layout in file system transaction logging code.
(Tsz Wo (Nicholas), SZE via dhruba)


Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=601476&r1=601475&r2=601476&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Dec  5 11:29:44 2007
@@ -195,6 +195,9 @@
     would be ignored even if it was set in hadoop-site.xml.
     (Amareshwari Sri Ramadasu via ddas)
 
+    HADOOP-2349.  Improve code layout in file system transaction logging code.
+    (Tsz Wo (Nicholas), SZE via dhruba)
+
 Branch 0.15 (unreleased)
 
   BUG FIXES

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java?rev=601476&r1=601475&r2=601476&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java Wed Dec  5 11:29:44 2007
@@ -603,7 +603,7 @@
    * Write an operation to the edit log. Do not sync to persistent
    * store yet.
    */
-  synchronized void logEdit(byte op, Writable w1, Writable w2) {
+  synchronized void logEdit(byte op, Writable ... writables) {
     assert this.getNumEditStreams() > 0 : "no editlog streams";
     long start = FSNamesystem.now();
     for (int idx = 0; idx < editStreams.size(); idx++) {
@@ -611,11 +611,8 @@
       try {
         DataOutputStream od = eStream.getOutputStream();
         od.write(op);
-        if (w1 != null) {
-          w1.write(od);
-        }
-        if (w2 != null) {
-          w2.write(od);
+        for(Writable w : writables) {
+          w.write(od);
         }
       } catch (IOException ie) {
         try {
@@ -763,7 +760,7 @@
       new UTF8(path),
       FSEditLog.toLogLong(newNode.getModificationTime())
     };
-    logEdit(OP_MKDIR, new ArrayWritable(UTF8.class, info), null);
+    logEdit(OP_MKDIR, new ArrayWritable(UTF8.class, info));
   }
   
   /** 
@@ -775,7 +772,7 @@
       new UTF8(src),
       new UTF8(dst),
       FSEditLog.toLogLong(timestamp)};
-    logEdit(OP_RENAME, new ArrayWritable(UTF8.class, info), null);
+    logEdit(OP_RENAME, new ArrayWritable(UTF8.class, info));
   }
   
   /** 
@@ -794,7 +791,7 @@
     UTF8 info[] = new UTF8[] { 
       new UTF8(src),
       FSEditLog.toLogLong(timestamp)};
-    logEdit(OP_DELETE, new ArrayWritable(UTF8.class, info), null);
+    logEdit(OP_DELETE, new ArrayWritable(UTF8.class, info));
   }
   
   static UTF8 toLogReplication(short replication) {