From aefa580d09442aa2d326d717b3a0761ef4f19fc3 Mon Sep 17 00:00:00 2001 From: Wei Deng Date: Mon, 25 Apr 2016 03:12:59 +0000 Subject: [PATCH] Better javadoc UnfilteredSerializer patch by weideng; reviewed by slebresne for CASSANDRA-11640 --- .../db/rows/UnfilteredSerializer.java | 96 +++++++++++-------- 1 file changed, 57 insertions(+), 39 deletions(-) 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: + *

+ *

+ * 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); }