You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/08/05 04:37:45 UTC
svn commit: r801048 -
/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
Author: jbellis
Date: Wed Aug 5 02:37:45 2009
New Revision: 801048
URL: http://svn.apache.org/viewvc?rev=801048&view=rev
Log:
fix SC.serializedSize. patch by jbellis; reviewed by Chris Goffinet for CASSANDRA-341
Modified:
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java?rev=801048&r1=801047&r2=801048&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java Wed Aug 5 02:37:45 2009
@@ -110,24 +110,11 @@
*/
public int serializedSize()
{
- /*
- * Size of a super-column is =
- * size of a name (UtfPrefix + length of the string)
- * + 1 byte to indicate if the super-column has been deleted
- * + 4 bytes for size of the sub-columns
- * + 4 bytes for the number of sub-columns
- * + size of all the sub-columns.
- */
-
- /*
- * We store the string as UTF-8 encoded, so when we calculate the length, it
- * should be converted to UTF-8.
- */
/*
* We need to keep the way we are calculating the column size in sync with the
* way we are calculating the size for the column family serializer.
*/
- return IColumn.UtfPrefix_ + name_.length + DBConstants.boolSize_ + DBConstants.intSize_ + DBConstants.intSize_ + getSizeOfAllColumns();
+ return IColumn.UtfPrefix_ + name_.length + DBConstants.intSize_ + DBConstants.longSize_ + DBConstants.intSize_ + getSizeOfAllColumns();
}
/**
@@ -136,8 +123,7 @@
int getSizeOfAllColumns()
{
int size = 0;
- Collection<IColumn> subColumns = getSubColumns();
- for ( IColumn subColumn : subColumns )
+ for (IColumn subColumn : getSubColumns())
{
size += subColumn.serializedSize();
}
@@ -346,10 +332,8 @@
dos.writeLong(superColumn.getMarkedForDeleteAt());
Collection<IColumn> columns = column.getSubColumns();
- int size = columns.size();
- dos.writeInt(size);
+ dos.writeInt(columns.size());
- dos.writeInt(superColumn.getSizeOfAllColumns());
for ( IColumn subColumn : columns )
{
Column.serializer().serialize(subColumn, dos);
@@ -364,8 +348,6 @@
/* read the number of columns */
int size = dis.readInt();
- /* read the size of all columns */
- dis.readInt();
for ( int i = 0; i < size; ++i )
{
IColumn subColumn = Column.serializer().deserialize(dis);