Author: mduerig
Date: Mon Feb 16 16:21:00 2015
New Revision: 1660154

URL: http://svn.apache.org/r1660154
Log:
OAK-2527: Update SegmentMK header format definition

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segmentmk.md

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java?rev=1660154&r1=1660153&r2=1660154&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
 Mon Feb 16 16:21:00 2015
@@ -51,6 +51,9 @@ import org.apache.jackrabbit.oak.plugins
  */
 public class Segment {
 
+    // michid doc 10 = ..
+    public static final byte STORAGE_FORMAT_VERSION = 10;
+
     /**
      * Number of bytes used for storing a record identifier. One byte
      * is used for identifying the segment and two for the record offset
@@ -137,7 +140,7 @@ public class Segment {
             checkState(data.get(0) == '0'
                     && data.get(1) == 'a'
                     && data.get(2) == 'K'
-                    && data.get(3) == '\n');
+                    && data.get(3) == STORAGE_FORMAT_VERSION);
             this.refids = new SegmentId[getRefCount()];
             refids[0] = id;
         } else {

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java?rev=1660154&r1=1660153&r2=1660154&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
 Mon Feb 16 16:21:00 2015
@@ -38,6 +38,7 @@ import static org.apache.jackrabbit.oak.
 import static 
org.apache.jackrabbit.oak.plugins.segment.Segment.MAX_SEGMENT_SIZE;
 import static 
org.apache.jackrabbit.oak.plugins.segment.Segment.RECORD_ID_BYTES;
 import static 
org.apache.jackrabbit.oak.plugins.segment.Segment.SEGMENT_REFERENCE_LIMIT;
+import static 
org.apache.jackrabbit.oak.plugins.segment.Segment.STORAGE_FORMAT_VERSION;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -94,8 +95,8 @@ public class SegmentWriter {
         buffer[0] = '0';
         buffer[1] = 'a';
         buffer[2] = 'K';
-        buffer[3] = '\n';
-        buffer[4] = 0;
+        buffer[3] = STORAGE_FORMAT_VERSION;
+        buffer[4] = 0; // reserved
         buffer[5] = 0; // refcount
         return buffer;
     }

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segmentmk.md
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segmentmk.md?rev=1660154&r1=1660153&r2=1660154&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segmentmk.md 
(original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segmentmk.md Mon 
Feb 16 16:21:00 2015
@@ -94,7 +94,7 @@ four bytes and to align the next record
 The segment header consists of the following fields:
 
     +--------+--------+--------+--------+--------+--------+--------+--------+
-    | magic bytes: "0aK\n" in ASCII     |version |idcount |rootcount        |
+    | magic bytes: "0aK" ASCII |version |reserved|idcount |rootcount        |
     +--------+--------+--------+--------+--------+--------+--------+--------+
     | blobrefcount    | reserved (set to 0)                                 |
     +--------+--------+--------+--------+--------+--------+--------+--------+
@@ -114,9 +114,9 @@ The segment header consists of the follo
     |                                            | padding (set to 0)       |
     +--------+--------+--------+--------+--------+--------+--------+--------+
 
-The first four bytes of a segment always contain the ASCII string "0aK\n",
+The first three bytes of a segment always contain the ASCII string "0aK",
 which is intended to make the binary segment data format easily detectable.
-The next byte indicates the version of segment format, and is set to zero
+The next byte indicates the version of segment format, and is set to 10
 for all segments that follow the format described here.
 
 The `idcount` byte indicates how many other segments are referenced by


Reply via email to