Created
April 25, 2011 23:01
-
-
Save amorton/941445 to your computer and use it in GitHub Desktop.
force sub columns to be ordered when the super column is deserialised (cassandra 0.7.4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/java/org/apache/cassandra/db/SuperColumn.java | |
=================================================================== | |
--- src/java/org/apache/cassandra/db/SuperColumn.java (date 1300200460000) | |
+++ src/java/org/apache/cassandra/db/SuperColumn.java (revision ) | |
@@ -359,8 +359,11 @@ | |
/* read the number of columns */ | |
int size = dis.readInt(); | |
ColumnSerializer serializer = Column.serializer(); | |
- ColumnSortedMap preSortedMap = new ColumnSortedMap(comparator, serializer, dis, size); | |
- SuperColumn superColumn = new SuperColumn(name, new ConcurrentSkipListMap<ByteBuffer,IColumn>(preSortedMap)); | |
+ final ColumnSortedMap preSortedMap = new ColumnSortedMap(comparator, serializer, dis, size); | |
+ ConcurrentSkipListMap<ByteBuffer, IColumn> columns = new ConcurrentSkipListMap<ByteBuffer, IColumn>(preSortedMap.comparator()){{ | |
+ putAll(preSortedMap); | |
+ }}; | |
+ SuperColumn superColumn = new SuperColumn(name, columns); | |
if (localDeleteTime != Integer.MIN_VALUE && localDeleteTime <= 0) | |
{ | |
throw new IOException("Invalid localDeleteTime read: " + localDeleteTime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for a specific case where the on disk order of the sub columns needed to change. Running nodetool scrub should re-write the sub columns in the new order. Do not use in production other than to fix this. Only works if all rows smaller than in memory compaction limit.