hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1099686 - in /hadoop/hdfs/branches/HDFS-1073: ./ src/java/org/apache/hadoop/hdfs/protocol/ src/java/org/apache/hadoop/hdfs/server/namenode/ src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/ src/java/org/apache/hadoop/hdfs/tools/off...
Date Thu, 05 May 2011 05:32:35 GMT
Author: todd
Date: Thu May  5 05:32:35 2011
New Revision: 1099686

URL: http://svn.apache.org/viewvc?rev=1099686&view=rev
Log:
HDFS-1894. Add constants for LAYOUT_VERSIONs in edits log branch. Contributed by Todd Lipcon.

Modified:
    hadoop/hdfs/branches/HDFS-1073/CHANGES.HDFS-1073.txt
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/protocol/FSConstants.java
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java
    hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java

Modified: hadoop/hdfs/branches/HDFS-1073/CHANGES.HDFS-1073.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/CHANGES.HDFS-1073.txt?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/CHANGES.HDFS-1073.txt (original)
+++ hadoop/hdfs/branches/HDFS-1073/CHANGES.HDFS-1073.txt Thu May  5 05:32:35 2011
@@ -16,3 +16,4 @@ HDFS-1858. Add state management variable
            Lipcon via todd)
 HDFS-1859. Add some convenience functions to iterate over edit log streams
            (Ivan Kelly and Todd Lipcon via todd)
+HDFS-1894. Add constants for LAYOUT_VERSIONs in edits log branch (todd)

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/protocol/FSConstants.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/protocol/FSConstants.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/protocol/FSConstants.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/protocol/FSConstants.java
Thu May  5 05:32:35 2011
@@ -94,5 +94,8 @@ public interface FSConstants {
   // -34: persistent transaction IDs
 
   // Record of version numbers for specific changes:
+  // Version where the edits log and image stored txn ID information
+  public static final int FIRST_STORED_TXIDS_VERSION = -34;
+  // Version where the edits log and image file names are based on txn IDs
   public static final int FIRST_TXNID_BASED_LAYOUT_VERSION = -35;
 }

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
Thu May  5 05:32:35 2011
@@ -168,7 +168,7 @@ public class FSEditLogLoader {
           break; // no more transactions
         }
 
-        if (logVersion <= -31) {
+        if (logVersion <= FSConstants.FIRST_STORED_TXIDS_VERSION) {
           // Read the txid
           long thisTxId = in.readLong();
           if (thisTxId != txId + 1) {

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
Thu May  5 05:32:35 2011
@@ -159,7 +159,7 @@ class FSImageFormat {
         
         // read the transaction ID of the last edit represented by
         // this image
-        if (imgVersion <= -31) {
+        if (imgVersion <= FSConstants.FIRST_STORED_TXIDS_VERSION) {
           imgTxId = in.readLong();
         } else {
           imgTxId = 0;

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
Thu May  5 05:32:35 2011
@@ -695,7 +695,7 @@ public class NNStorage extends Storage i
     }
 
     String sCheckpointId = props.getProperty(CHECKPOINT_TXID_PROPERTY);
-    if (layoutVersion <= -28) {
+    if (layoutVersion <= FSConstants.FIRST_STORED_TXIDS_VERSION) {
       if (sCheckpointId == null) {
         throw new InconsistentFSStateException(sd.getRoot(),
             "file " + STORAGE_FILE_VERSION

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java
Thu May  5 05:32:35 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 
+import org.apache.hadoop.hdfs.protocol.FSConstants;
 import org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes;
 
 import static org.apache.hadoop.hdfs.tools.offlineEditsViewer.Tokenizer.ByteToken;
@@ -64,15 +65,21 @@ class EditsLoaderCurrent implements Edit
   }
 
   /**
-   * Visit OP_INVALID
+   * Visit a transaction ID, if the log version supports it.
    */
-  private void visit_OP_INVALID() throws IOException {
-    if(editsVersion <= -31) {
+  private void visitTxId() throws IOException {
+    if (editsVersion <= FSConstants.FIRST_STORED_TXIDS_VERSION) {
       v.visitLong(EditsElement.TRANSACTION_ID);
     }
   }
 
   /**
+   * Visit OP_INVALID
+   */
+  private void visit_OP_INVALID() throws IOException {
+  }
+
+  /**
    * Visit OP_ADD
    */
   private void visit_OP_ADD() throws IOException {
@@ -93,9 +100,7 @@ class EditsLoaderCurrent implements Edit
    */
   private void visit_OP_ADD_or_OP_CLOSE(FSEditLogOpCodes editsOpCode)
     throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     IntToken opAddLength = v.visitInt(EditsElement.LENGTH);
     // this happens if the edits is not properly ended (-1 op code),
@@ -139,9 +144,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_RENAME_OLD
    */
   private void visit_OP_RENAME_OLD() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitInt(        EditsElement.LENGTH);
     v.visitStringUTF8( EditsElement.SOURCE);
@@ -153,9 +156,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_DELETE
    */
   private void visit_OP_DELETE() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitInt(        EditsElement.LENGTH);
     v.visitStringUTF8( EditsElement.PATH);
@@ -166,9 +167,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_MKDIR
    */
   private void visit_OP_MKDIR() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitInt(        EditsElement.LENGTH);
     v.visitStringUTF8( EditsElement.PATH);
@@ -188,9 +187,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SET_REPLICATION
    */
   private void visit_OP_SET_REPLICATION() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitStringUTF8(EditsElement.PATH);
     v.visitStringUTF8(EditsElement.REPLICATION);
@@ -200,9 +197,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SET_PERMISSIONS
    */
   private void visit_OP_SET_PERMISSIONS() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitStringUTF8( EditsElement.PATH);
     v.visitShort(      EditsElement.FS_PERMISSIONS);
@@ -212,9 +207,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SET_OWNER
    */
   private void visit_OP_SET_OWNER() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitStringUTF8(EditsElement.PATH);
     v.visitStringUTF8(EditsElement.USERNAME);
@@ -225,9 +218,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SET_GENSTAMP
    */
   private void visit_OP_SET_GENSTAMP() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitLong(EditsElement.GENERATION_STAMP);
   }
@@ -236,9 +227,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_TIMES
    */
   private void visit_OP_TIMES() throws IOException {
-    if(editsVersion <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitInt(        EditsElement.LENGTH);
     v.visitStringUTF8( EditsElement.PATH);
@@ -250,9 +239,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SET_QUOTA
    */
   private void visit_OP_SET_QUOTA() throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitStringUTF8( EditsElement.PATH);
     v.visitLong(       EditsElement.NS_QUOTA);
@@ -263,9 +250,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_RENAME
    */
   private void visit_OP_RENAME() throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     if(editsVersion > -21) {
       throw new IOException("Unexpected op code " + FSEditLogOpCodes.OP_RENAME
@@ -283,9 +268,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_CONCAT_DELETE
    */
   private void visit_OP_CONCAT_DELETE() throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     if(editsVersion > -22) {
       throw new IOException("Unexpected op code "
@@ -307,9 +290,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_SYMLINK
    */
   private void visit_OP_SYMLINK() throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     v.visitInt(        EditsElement.LENGTH);
     v.visitStringUTF8( EditsElement.SOURCE);
@@ -330,9 +311,7 @@ class EditsLoaderCurrent implements Edit
    * Visit OP_GET_DELEGATION_TOKEN
    */
   private void visit_OP_GET_DELEGATION_TOKEN() throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
     
     if(editsVersion > -24) {
       throw new IOException("Unexpected op code "
@@ -356,9 +335,7 @@ class EditsLoaderCurrent implements Edit
    */
   private void visit_OP_RENEW_DELEGATION_TOKEN()
     throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     if(editsVersion > -24) {
       throw new IOException("Unexpected op code "
@@ -382,9 +359,7 @@ class EditsLoaderCurrent implements Edit
    */
   private void visit_OP_CANCEL_DELEGATION_TOKEN()
     throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
 
     if(editsVersion > -24) {
       throw new IOException("Unexpected op code "
@@ -407,9 +382,7 @@ class EditsLoaderCurrent implements Edit
    */
   private void visit_OP_UPDATE_MASTER_KEY()
     throws IOException {
-    if(editsVersion  <= -31) {
-      v.visitLong(EditsElement.TRANSACTION_ID);
-    }
+    visitTxId();
     
     if(editsVersion > -24) {
       throw new IOException("Unexpected op code "

Modified: hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java?rev=1099686&r1=1099685&r2=1099686&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
(original)
+++ hadoop/hdfs/branches/HDFS-1073/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
Thu May  5 05:32:35 2011
@@ -25,6 +25,7 @@ import java.util.Date;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.protocol.FSConstants;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates;
 import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
 import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization;
@@ -155,7 +156,7 @@ class ImageLoaderCurrent implements Imag
 
       v.visit(ImageElement.GENERATION_STAMP, in.readLong());
 
-      if (imageVersion <= -31) {
+      if (imageVersion <= FSConstants.FIRST_STORED_TXIDS_VERSION) {
         v.visit(ImageElement.TRANSACTION_ID, in.readLong());
       }
 



Mime
View raw message