Merge branch 'cassandra-2.0' into cassandra-2.1 Conflicts: CHANGES.txt examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c6bed827 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c6bed827 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c6bed827 Branch: refs/heads/cassandra-2.1 Commit: c6bed827020831dba31d30ba32cee1f358473b38 Parents: 09feef3 820f0eb Author: Aleksey Yeschenko <alek...@apache.org> Authored: Tue May 13 17:51:34 2014 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Tue May 13 17:51:34 2014 +0300 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/triggers/InvertedIndex.java | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c6bed827/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 4abb285,58cebbd..6e0c9e3 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -22,6 -9,25 +22,7 @@@ Merged from 2.0 * cqlsh can't tab-complete disabling compaction (CASSANDRA-7185) * cqlsh: Accept and execute CQL statement(s) from command-line parameter (CASSANDRA-7172) * Fix IllegalStateException in CqlPagingRecordReader (CASSANDRA-7198) + * Fix the InvertedIndex trigger example (CASSANDRA-7211) - - -2.0.8 - * Correctly delete scheduled range xfers (CASSANDRA-7143) - * Make batchlog replica selection rack-aware (CASSANDRA-6551) - * Allow overriding cassandra-rackdc.properties file (CASSANDRA-7072) - * Set JMX RMI port to 7199 (CASSANDRA-7087) - * Use LOCAL_QUORUM for data reads at LOCAL_SERIAL (CASSANDRA-6939) - * Log a warning for large batches (CASSANDRA-6487) - * Queries on compact tables can return more rows that requested (CASSANDRA-7052) - * USING TIMESTAMP for batches does not work (CASSANDRA-7053) - * Fix performance regression from CASSANDRA-5614 (CASSANDRA-6949) - * Merge groupable mutations in TriggerExecutor#execute() (CASSANDRA-7047) - * Fix CFMetaData#getColumnDefinitionFromColumnName() (CASSANDRA-7074) - * Plug holes in resource release when wiring up StreamSession (CASSANDRA-7073) - * Re-add parameter columns to tracing session (CASSANDRA-6942) - * Fix writetime/ttl functions for static columns (CASSANDRA-7081) - * Suggest CTRL-C or semicolon after three blank lines in cqlsh (CASSANDRA-7142) Merged from 1.2: * Add Cloudstack snitch (CASSANDRA-7147) * Update system.peers correctly when relocating tokens (CASSANDRA-7126) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c6bed827/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java ---------------------------------------------------------------------- diff --cc examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java index 8ebc46e,ae58b33..11e98b5 --- a/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java +++ b/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java @@@ -37,15 -37,21 +37,21 @@@ public class InvertedIndex implements I private static final Logger logger = LoggerFactory.getLogger(InvertedIndex.class); private Properties properties = loadProperties(); - public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update) + public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update) { - List<Mutation> mutations = new ArrayList<>(); - List<RowMutation> mutations = new ArrayList<>(); ++ List<Mutation> mutations = new ArrayList<>(update.getColumnCount()); + - for (Column cell : update) + for (Cell cell : update) { - Mutation mutation = new Mutation(properties.getProperty("keyspace"), cell.value()); - mutation.add(properties.getProperty("columnfamily"), cell.name(), key, System.currentTimeMillis()); - mutations.add(mutation); + // Skip the row marker and other empty values, since they lead to an empty key. + if (cell.value().remaining() > 0) + { - RowMutation mutation = new RowMutation(properties.getProperty("keyspace"), cell.value()); ++ Mutation mutation = new Mutation(properties.getProperty("keyspace"), cell.value()); + mutation.add(properties.getProperty("columnfamily"), cell.name(), key, System.currentTimeMillis()); + mutations.add(mutation); + } } + return mutations; }