You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2014/05/13 16:52:24 UTC
[1/2] git commit: Fix the InvertedIndex trigger example
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 09feef30b -> c6bed8270
Fix the InvertedIndex trigger example
patch by Anthony Cozzie; reviewed by Aleksey Yeschenko for CASSANDRA-7211
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/820f0eb6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/820f0eb6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/820f0eb6
Branch: refs/heads/cassandra-2.1
Commit: 820f0eb60b89e043761a8c882ff8a016c3ea2212
Parents: 256109c
Author: Anthony Cozzie <ac...@datastax.com>
Authored: Mon May 12 09:49:37 2014 -0600
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Tue May 13 17:46:21 2014 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/triggers/InvertedIndex.java | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/820f0eb6/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 32bd539..58cebbd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,7 @@
* 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
http://git-wip-us.apache.org/repos/asf/cassandra/blob/820f0eb6/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
----------------------------------------------------------------------
diff --git a/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java b/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
index a2d7644..ae58b33 100644
--- a/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
+++ b/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
@@ -40,12 +40,18 @@ public class InvertedIndex implements ITrigger
public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
{
List<RowMutation> mutations = new ArrayList<>();
+
for (Column cell : update)
{
- RowMutation mutation = new RowMutation(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.add(properties.getProperty("columnfamily"), cell.name(), key, System.currentTimeMillis());
+ mutations.add(mutation);
+ }
}
+
return mutations;
}
@@ -53,7 +59,8 @@ public class InvertedIndex implements ITrigger
{
Properties properties = new Properties();
InputStream stream = InvertedIndex.class.getClassLoader().getResourceAsStream("InvertedIndex.properties");
- try {
+ try
+ {
properties.load(stream);
}
catch (Exception e)
[2/2] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by al...@apache.org.
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 <al...@apache.org>
Authored: Tue May 13 17:51:34 2014 +0300
Committer: Aleksey Yeschenko <al...@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;
}