diff --git a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
index 27b0df11ea..8157bbb10e 100644
--- a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
+++ b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
@@ -28,46 +28,62 @@ import org.apache.cassandra.io.util.DataOutputPlus;
/**
* Serialize/deserialize a single Unfiltered (both on-wire and on-disk).
+ *
*
- * {@code
- * The encoded format for an unfiltered is (|) where:
- *
- * is a byte (or two) whose bits are flags used by the rest of the serialization. Each
- * flag is defined/explained below as the "Unfiltered flags" constants. One of those flags
- * is an extension flag, and if present, trigger the rid of another byte that contains more
- * flags. If the extension is not set, defaults are assumed for the flags of that 2nd byte.
- * is [][][]...... where
- * is the row clustering as serialized by {@code Clustering.serializer} (note
- * that static row are an exception and don't have this).
- * is the size of the whole unfiltered on disk (it's only used for sstables and is
- * used to efficiently skip rows).
- * , and are the row timestamp, ttl and deletion
- * whose presence is determined by the flags. is the simple columns of the row and the
- * complex ones.
- * The columns for the row are then serialized if they differ from those in the header,
- * and each cell then follows:
- * * Each simple column will simply be a
- * (which might have no value, see below),
- * * Each will be []... where
- * is the deletion for this complex column (if flags indicates it present),
- * is the vint encoded value of n, i.e. 's 1-based index,
- * are the for this complex column
- * is where is the marker bound as serialized
- * by {@code ClusteringBoundOrBoundary.serializer} and is the marker deletion
- * time.
- *
- * A cell start with a 1 byte . The 2nd and third flag bits indicate if
- * it's a deleted or expiring cell. The 4th flag indicates if the value
- * is empty or not. The 5th and 6th indicates if the timestamp and ttl/
- * localDeletionTime for the cell are the same than the row one (if that
- * is the case, those are not repeated for the cell).Follows the
- * (unless it's marked empty in the flag) and a delta-encoded long
- * (unless the flag tells to use the row level one).
- * Then if it's a deleted or expiring cell a delta-encoded int
- * and if it's expiring a delta-encoded int (unless it's an expiring cell
- * and the ttl and localDeletionTime are indicated by the flags to be the same
- * than the row ones, in which case none of those appears).
- * }
+ * The encoded format for an unfiltered is {@code (|)} where:
+ *
+ * -
+ * {@code } is a byte (or two) whose bits are flags used by the rest
+ * of the serialization. Each flag is defined/explained below as the
+ * "Unfiltered flags" constants. One of those flags is an extension flag,
+ * and if present, indicates the presence of a 2ndbyte that contains more
+ * flags. If the extension is not set, defaults are assumed for the flags
+ * of that 2nd byte.
+ *
+ * -
+ * {@code
} is
+ * {@code [][][]}
+ * where:
+ *
+ * - {@code } is the row clustering as serialized by
+ * {@link Clustering.serializer} (note that static row are an
+ * exception and don't have this).
+ * - {@code } are the sizes of the whole unfiltered on disk and
+ * of the previous unfiltered. This is only present for sstables and
+ * is used to efficiently skip rows (both forward and backward).
+ * - {@code } is the row primary key liveness infos, and it
+ * contains the timestamp, ttl and local deletion time of that info,
+ * though some/all of those can be absent based on the flags.
+ * - {@code deletion} is the row deletion. It's presence is determined
+ * by the flags and if present, it conists of both the deletion
+ * timestamp and local deletion time.
+ * - {@code } are the columns present in the row encoded by
+ * {@link Columns.serializer#serializeSubset}. It is absent if the row
+ * contains all the columns of the {@code SerializationHeader} (which
+ * is then indicated by a flag).
+ * - {@code } is the data for each of the column present
+ * in the row. The encoding of each data depends on whether the data
+ * is for a simple or complex column:
+ *
+ * - Simple columns are simply encoded as one {@code
| } |
+ * - Complex columns are encoded as {@code []...}
+ * where {@code } is the deletion for this complex
+ * column (if flags indicates its presence), {@code } is the
+ * vint encoded value of n, i.e. {@code }'s 1-based
+ * inde and {@code } are the {@code
| } for this
+ * complex column |
+ *
+ *
+ *
+ *
+ * -
+ * {@code } is {@code } where {@code } is
+ * the marker bound as serialized by {@link ClusteringBoundOrBoundary.serializer}
+ * and {@code } is the marker deletion time.
+ *
+ *
+ *
+ * The serialization of a {@code | } is defined by {@link Cell.Serializer}.
*/
public class UnfilteredSerializer
{
@@ -163,6 +179,8 @@ public class UnfilteredSerializer
if (header.isForSSTable())
{
out.writeUnsignedVInt(serializedRowBodySize(row, header, previousUnfilteredSize, version));
+ // We write the size of the previous unfiltered to make reverse queries more efficient (and simpler).
+ // This is currently not used however and using it is tbd.
out.writeUnsignedVInt(previousUnfilteredSize);
}
| | | |