hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r473522 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSEditLog.java
Date Fri, 10 Nov 2006 21:53:41 GMT
Author: cutting
Date: Fri Nov 10 13:53:40 2006
New Revision: 473522

URL: http://svn.apache.org/viewvc?view=rev&rev=473522
Log:
HADOOP-646.  Fix DFS namenode to handle edits files larger than 2GB.  Contributed by Milind.

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?view=diff&rev=473522&r1=473521&r2=473522
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Nov 10 13:53:40 2006
@@ -50,6 +50,9 @@
 15. HADOOP-708.  Fix test-libhdfs to return the correct status, so
     that failures will break the build.  (Nigel Daley via cutting)
 
+16. HADOOP-646.  Fix namenode to handle edits files larger than 2GB.
+    (Milind Bhandarkar via cutting)
+
 
 Release 0.8.0 - 2006-11-03
 

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?view=diff&rev=473522&r1=473521&r2=473522
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java Fri Nov 10 13:53:40
2006
@@ -20,6 +20,7 @@
 import java.io.BufferedInputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
+import java.io.EOFException;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
@@ -157,8 +158,15 @@
               new FileInputStream(edits)));
       // Read log file version. Could be missing. 
       in.mark( 4 );
-      if( in.available() > 0 ) {
+      // If edits log is greater than 2G, available method will return negative
+      // numbers, so we avoid having to call available
+      boolean available = true;
+      try {
         logVersion = in.readByte();
+      } catch (EOFException e) {
+        available = false;
+      }
+      if (available) {
         in.reset();
         if( logVersion >= 0 )
           logVersion = 0;
@@ -174,8 +182,13 @@
       
       short replication = (short)conf.getInt("dfs.replication", 3);
       try {
-        while (in.available() > 0) {
-          byte opcode = in.readByte();
+        while (true) {
+          byte opcode = -1;
+          try {
+            opcode = in.readByte();
+          } catch (EOFException e) {
+            break; // no more transactions
+          }
           numEdits++;
           switch (opcode) {
           case OP_ADD: {



Mime
View raw message