Updated Branches: refs/heads/trunk 7a1a7b9b7 -> c320b82be
Fix composite index bug patch by slebresne; reviewed by jbellis for CASSANDRA-4884 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c320b82b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c320b82b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c320b82b Branch: refs/heads/trunk Commit: c320b82be883059bdc3c5efd95ffb492df93635e Parents: 7a1a7b9 Author: Sylvain Lebresne <[email protected]> Authored: Wed Oct 31 16:40:52 2012 +0100 Committer: Sylvain Lebresne <[email protected]> Committed: Wed Oct 31 16:40:52 2012 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/index/SecondaryIndexManager.java | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c320b82b/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 48cb945..fed3bc1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -44,6 +44,7 @@ * Fix potential infinite loop in tombstone compaction (CASSANDRA-4781) * Remove system tables accounting from schema (CASSANDRA-4850) * Force provided columns in clustering key order in 'CLUSTERING ORDER BY' (CASSANDRA-4881) + * Fix composite index bug (CASSANDRA-4884) Merged from 1.1: * add get[Row|Key]CacheEntries to CacheServiceMBean (CASSANDRA-4859) * fix get_paged_slice to wrap to next row correctly (CASSANDRA-4816) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c320b82b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java index 1eb5d2a..f7d1c92 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java @@ -422,10 +422,8 @@ public class SecondaryIndexManager // Update entire row only once per row level index Set<Class<? extends SecondaryIndex>> appliedRowLevelIndexes = null; - for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet()) + for (SecondaryIndex index : indexesByColumn.values()) { - SecondaryIndex index = entry.getValue(); - if (index instanceof PerRowSecondaryIndex) { if (appliedRowLevelIndexes == null) @@ -436,11 +434,11 @@ public class SecondaryIndexManager } else { - IColumn column = cf.getColumn(entry.getKey()); - if (column == null) - continue; - - ((PerColumnSecondaryIndex) index).insert(key, column); + for (IColumn column : cf) + { + if (index.indexes(column.name())) + ((PerColumnSecondaryIndex) index).insert(key, column); + } } } }
