Author: ivol37 at gmail.com
Date: Mon Nov 8 15:17:47 2010
New Revision: 254
Log:
[AMDATU-159] Upgraded cassandra from beta2 to early release of beta3.
Added:
trunk/amdatu-buildsupport/src/main/resources/lib/apache-cassandra-0.7.0-beta3.jar
(contents, props changed)
trunk/amdatu-buildsupport/src/main/resources/lib/libthrift-0.5.jar
(contents, props changed)
trunk/platform-bundles/cassandra-application/src/main/resources/lib/libthrift-0.5.jar
(contents, props changed)
Removed:
trunk/platform-bundles/cassandra-application/src/main/resources/cassandra/apache-cassandra-0.7.0-beta2.jar
trunk/platform-bundles/cassandra-application/src/main/resources/lib/libthrift-r959516.jar
Modified:
trunk/amdatu-buildsupport/pom.xml
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
trunk/platform-bundles/cassandra-application/pom.xml
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/CassandraDaemonService.java
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/service/CassandraDaemonServiceImpl.java
trunk/platform-bundles/cassandra-application/src/main/resources/conf/cassandra.yaml
trunk/platform-bundles/cassandra-listener/src/main/java/org/amdatu/platform/cassandra/listener/service/CassandraDaemonServiceListener.java
trunk/platform-bundles/cassandra-persistencemanager/src/main/java/org/amdatu/platform/cassandra/persistencemanager/service/CassandraPersistenceManagerImpl.java
trunk/pom.xml
Modified: trunk/amdatu-buildsupport/pom.xml
==============================================================================
--- trunk/amdatu-buildsupport/pom.xml (original)
+++ trunk/amdatu-buildsupport/pom.xml Mon Nov 8 15:17:47 2010
@@ -76,6 +76,34 @@
<packaging>jar</packaging>
</configuration>
</execution>
+ <execution>
+ <id>install-apache-cassandra</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <configuration>
+
<file>src/main/resources/lib/apache-cassandra-0.7.0-beta3.jar</file>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>cassandra</artifactId>
+ <version>${cassandra.version}</version>
+ <packaging>jar</packaging>
+ </configuration>
+ </execution>
+ <execution>
+ <id>install-libthrift</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <configuration>
+ <file>src/main/resources/lib/libthrift-0.5.jar</file>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.5</version>
+ <packaging>jar</packaging>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
Added:
trunk/amdatu-buildsupport/src/main/resources/lib/apache-cassandra-0.7.0-beta3.jar
==============================================================================
Binary file. No diff available.
Added: trunk/amdatu-buildsupport/src/main/resources/lib/libthrift-0.5.jar
==============================================================================
Binary file. No diff available.
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
Mon Nov 8 15:17:47 2010
@@ -146,7 +146,9 @@
assertRequiredMemberCount("TestEditUsers", 2);
guestGroup.addMember(adminUser);
+ sleep();
guestGroup.addMember(editorUser);
+ sleep();
guestGroup.addMember(guestUser);
sleep();
@@ -187,10 +189,7 @@
.getMembers().length : 0;
if (count != expected) {
Role[] members = ((Group) m_userAdmin.getRole(group)).getMembers();
- String sMembers = "";
- for (Role role : members) {
- sMembers += role.getName() + " ";
- }
+ String sMembers = toString(members);
Assert.assertTrue("Group '" + group + "' has " + count + " basic
members. Expected: " + expected
+ ". Members found: " + sMembers, false);
}
@@ -203,12 +202,17 @@
.getRequiredMembers().length : 0;
if (count != expected) {
Role[] members = ((Group)
m_userAdmin.getRole(group)).getRequiredMembers();
- String sMembers = "";
- for (Role role : members) {
- sMembers += role.getName() + " ";
- }
+ String sMembers = toString(members);
Assert.assertTrue("Group '" + group + "' has " + count + "
required members. Expected: " + expected
+ ". Members found: " + sMembers, false);
}
}
+
+ private String toString(Role[] members) {
+ String sMembers = "";
+ for (Role role : members) {
+ sMembers += role.getName() + " ";
+ }
+ return sMembers;
+ }
}
Modified: trunk/platform-bundles/cassandra-application/pom.xml
==============================================================================
--- trunk/platform-bundles/cassandra-application/pom.xml (original)
+++ trunk/platform-bundles/cassandra-application/pom.xml Mon Nov 8
15:17:47 2010
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
- <version>917130</version>
+ <version>0.5</version>
</dependency>
<dependency>
<groupId>org.amdatu.platform</groupId>
@@ -88,7 +88,7 @@
lib/jetty-util-6.1.21.jar,
lib/json-simple-1.1.jar,
lib/jug-2.0.0.jar,
- lib/libthrift-r959516.jar,
+ lib/libthrift-0.5.jar,
lib/log4j-1.2.16.jar,
lib/slf4j-api-1.6.1.jar,
lib/slf4j-jdk14-1.6.1.jar,
Modified:
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/CassandraDaemonService.java
==============================================================================
---
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/CassandraDaemonService.java
(original)
+++
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/CassandraDaemonService.java
Mon Nov 8 15:17:47 2010
@@ -45,8 +45,10 @@
*
* @return List of all keyspaces currently available in Cassandra.
* @throws TException In case an error occurred while retrieving keyspaces
+ * @throws InvalidRequestException If a keyspace or column family does not
exist, required parameters are missing,
+ * or a parameter is malformed.
*/
- List<String> getKeyspaces() throws TException;
+ List<String> getKeyspaces() throws TException, InvalidRequestException;
/**
* Verifies if a keyspace with the specified name exists. This check is
case-sensitive
@@ -55,8 +57,10 @@
* @param keyspaceName Name of the keyspace to check its existence for
* @return <code>true</code> if the keyspace exists, <code>false</code>
otherwise
* @throws TException In case an error occurred while checking the
existence
+ * @throws InvalidRequestException If a keyspace or column family does not
exist, required parameters are missing,
+ * or a parameter is malformed.
*/
- boolean keyspaceExists(String keyspaceName) throws TException;
+ boolean keyspaceExists(String keyspaceName) throws TException,
InvalidRequestException;
/**
* Adds a keyspace with the specified name and throws an
InvalidRequestException if
@@ -68,10 +72,11 @@
* @throws TException In case an error occurred while adding the keyspace
*/
void addKeyspace(String name) throws InvalidRequestException, TException;
-
+
/**
* Drops the keyspace with the specified name. All data (i.e.
ColumnFamily's) contained
* by the keyspace are also removed. Note that keyspace names are case
sensitive.
+ *
* @param keyspace Name of the keyspace to remove.
* @throws InvalidRequestException In case no keyspace with the specified
name exists
* @throws TException In case an error occurred while removing the keyspace
@@ -85,8 +90,10 @@
* @param keyspaceName Name of the keyspace to retrieve the ColumnFamily's
for
* @return List of all available ColumnFamily's in the specified keyspace.
* @throws NotFoundException In case the keyspace with the specified name
could not be found
+ * @throws InvalidRequestException If a keyspace or column family does not
exist, required parameters are missing,
+ * or a parameter is malformed.
*/
- List<String> getColumnFamilies(String keyspaceName) throws
NotFoundException;
+ List<String> getColumnFamilies(String keyspaceName) throws
NotFoundException, InvalidRequestException;
/**
* Verifies if the specified keyspace contains a ColumnFamily with the
specified name.
@@ -96,8 +103,10 @@
* @param columnFamilyName Name of the ColumnFamily to check its existence
for
* @return <code>true</code> if the specified keyspace contains a
ColumnFamily with the
* specified name.
+ * @throws InvalidRequestException If a keyspace or column family does not
exist, required parameters are missing,
+ * or a parameter is malformed.
*/
- boolean columnFamilyExists(String keyspaceName, String columnFamilyName)
throws NotFoundException;
+ boolean columnFamilyExists(String keyspaceName, String columnFamilyName)
throws NotFoundException, InvalidRequestException;
/**
* Adds a new ColumnFamily to the specified keyspace. If a ColumnFamily
with that name already exists
@@ -127,7 +136,8 @@
* @param columnType Column type to compare the ColumnFamily with
* @param comparatorType Comparator type to compare the ColumnFamily with
* @param subComparatorType Sub comparator type to compare the
ColumnFamily with
- * @return <code>true</code> in case a ColumnFamily with the specified
name in the specified keyspace exists with not exactly the same columnType,
+ * @return <code>true</code> in case a ColumnFamily with the specified
name in the specified keyspace exists with
+ * not exactly the same columnType,
* comparatorType and subComparatorType. <code>false</code> in all
other cases.
* @throws NotFoundException In case the specified keyspace could not be
found
* @throws InvalidRequestException In case the specified ColumnFamily
could not be found
Modified:
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/service/CassandraDaemonServiceImpl.java
==============================================================================
---
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/service/CassandraDaemonServiceImpl.java
(original)
+++
trunk/platform-bundles/cassandra-application/src/main/java/org/amdatu/platform/cassandra/application/service/CassandraDaemonServiceImpl.java
Mon Nov 8 15:17:47 2010
@@ -99,7 +99,7 @@
return m_cassandraServer;
}
- public boolean keyspaceExists(String keyspaceName) throws TException {
+ public boolean keyspaceExists(String keyspaceName) throws TException,
InvalidRequestException {
List<KsDef> keyspaces = m_cassandraServer.describe_keyspaces();
for (KsDef keyspace : keyspaces) {
if (keyspace.getName().equals(keyspaceName)) {
@@ -109,7 +109,7 @@
return false;
}
- public List<String> getKeyspaces() throws TException {
+ public List<String> getKeyspaces() throws TException,
InvalidRequestException {
List<String> keyspaceNames = new ArrayList<String>();
List<KsDef> keyspaces = m_cassandraServer.describe_keyspaces();
for (KsDef keyspace : keyspaces) {
@@ -128,7 +128,7 @@
m_cassandraServer.system_drop_keyspace(keyspace);
}
- public boolean columnFamilyExists(String keyspaceName, String
columnFamilyName) throws NotFoundException {
+ public boolean columnFamilyExists(String keyspaceName, String
columnFamilyName) throws NotFoundException, InvalidRequestException {
KsDef ksDef = m_cassandraServer.describe_keyspace(keyspaceName);
List<CfDef> cfDefs = ksDef.getCf_defs();
for (CfDef cfDef : cfDefs) {
@@ -139,7 +139,7 @@
return false;
}
- public List<String> getColumnFamilies(String keyspaceName) throws
NotFoundException {
+ public List<String> getColumnFamilies(String keyspaceName) throws
NotFoundException, InvalidRequestException {
List<String> cfNames = new ArrayList<String>();
KsDef ksDef = m_cassandraServer.describe_keyspace(keyspaceName);
List<CfDef> cfDefs = ksDef.getCf_defs();
Modified:
trunk/platform-bundles/cassandra-application/src/main/resources/conf/cassandra.yaml
==============================================================================
---
trunk/platform-bundles/cassandra-application/src/main/resources/conf/cassandra.yaml
(original)
+++
trunk/platform-bundles/cassandra-application/src/main/resources/conf/cassandra.yaml
Mon Nov 8 15:17:47 2010
@@ -9,16 +9,16 @@
# one logical cluster from joining another.
cluster_name: 'Amdatu Cluster'
-# If you are using an order-preserving partitioner and you know your key
-# distribution, you can specify the token for this node to use. (Keys
-# are sent to the node with the "closest" token, so distributing your
-# tokens equally along the key distribution space will spread keys
-# evenly across your cluster.) This setting is only checked the first
-# time a node is started.
-
-# This can also be useful with RandomPartitioner to force equal spacing
-# of tokens around the hash space, especially for clusters with a small
-# number of nodes.
+# You should always specify InitialToken when setting up a production
+# cluster for the first time, and often when adding capacity later.
+# The principle is that each node should be given an equal slice of
+# the token ring; see http://wiki.apache.org/cassandra/Operations
+# for more details.
+#
+# If blank, Cassandra will request a token bisecting the range of
+# the heaviest-loaded existing node. If there is no load information
+# available, such as is the case with a new cluster, it will pick
+# a random token, which will lead to hot spots.
initial_token:
# Set to true to make new [non-seed] nodes automatically migrate data
@@ -51,10 +51,13 @@
# directories where Cassandra should store data on disk.
data_file_directories:
- ${org.amdatu.platform.cassandra.application/datafiledir}
-
+
# commit log
commitlog_directory: ${org.amdatu.platform.cassandra.application/commitlogdir}
+# saved caches
+saved_caches_directory:
${org.amdatu.platform.cassandra.application/savedcachesdir}
+
# Size to allow commitlog to grow to before creating a new segment
commitlog_rotation_threshold_in_mb: 128
@@ -109,13 +112,26 @@
# TCP port, for commands and data
storage_port: 7000
-# Address to bind to and tell other nodes to connect to. You _must_
-# change this if you want multiple nodes to be able to communicate!
+# Address to bind to and tell other Cassandra nodes to connect to. You
+# _must_ change this if you want multiple nodes to be able to
+# communicate!
+#
+# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
+# will always do the Right Thing *if* the node is properly configured
+# (hostname, name resolution, etc), and the Right Thing is to use the
+# address associated with the hostname (it might not be).
+#
+# Setting this to 0.0.0.0 is always wrong.
listen_address: localhost
-# The address to bind the Thrift RPC service to
+# The address to bind the Thrift RPC service to -- clients connect
+# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
+# you want Thrift to listen on all interfaces.
+#
+# Leaving this blank has the same effect it does for ListenAddress,
+# (i.e. it will be based on the configured hostname of the node).
rpc_address: localhost
-# port for Thrift to listen on
+# port for Thrift to listen for clients on
rpc_port: 9160
# enable or disable keepalive on rpc connections
@@ -147,20 +163,6 @@
# The threshold size in megabytes the binary memtable must grow to,
# before it's submitted for flushing to disk.
binary_memtable_throughput_in_mb: 256
-# The maximum time to leave a dirty memtable unflushed.
-# (While any affected columnfamilies have unflushed data from a
-# commit log segment, that segment cannot be deleted.)
-# This needs to be large enough that it won't cause a flush storm
-# of all your memtables flushing at once because none has hit
-# the size or count thresholds yet.
-# defaults to 60
-#memtable_flush_after_mins: 60
-# Size of the memtable in memory before it is flushed
-# if left undefined, 1/8 of the heap will be used
-#memtable_throughput_in_mb: 256
-# Number of objects in millions in the memtable before it is flushed
-# if left undefined, the memtable_throughput_in_mb / 64 * 0.3 will be used
-#memtable_operations_in_millions: 1.2
# Add column indexes to a row after its contents reach this size.
# Increase if your column values are large, or if you have a very large
@@ -204,6 +206,18 @@
# and avoid reading from hosts that have slowed (due to compaction,
# for instance)
dynamic_snitch: true
+# controls how often to perform the more expensive part of host score
+# calculation
+dynamic_snitch_update_interval_in_ms: 100
+# controls how often to reset all host scores, allowing a bad host to
+# possibly recover
+dynamic_snitch_reset_interval_in_ms: 600000
+# if set greater than zero and read_repair_chance is < 1.0, this will allow
+# 'pinning' of replicas to hosts in order to increase cache capacity.
+# The badness threshold will control how much worse the pinned host has to be
+# before the dynamic snitch will prefer other replicas over it. This is
+# expressed as a double which represents a percentage.
+dynamic_snitch_badness_threshold: 0.0
# request_scheduler -- Set this to a class that implements
# RequestScheduler, which will schedule incoming client requests
Added:
trunk/platform-bundles/cassandra-application/src/main/resources/lib/libthrift-0.5.jar
==============================================================================
Binary file. No diff available.
Modified:
trunk/platform-bundles/cassandra-listener/src/main/java/org/amdatu/platform/cassandra/listener/service/CassandraDaemonServiceListener.java
==============================================================================
---
trunk/platform-bundles/cassandra-listener/src/main/java/org/amdatu/platform/cassandra/listener/service/CassandraDaemonServiceListener.java
(original)
+++
trunk/platform-bundles/cassandra-listener/src/main/java/org/amdatu/platform/cassandra/listener/service/CassandraDaemonServiceListener.java
Mon Nov 8 15:17:47 2010
@@ -24,6 +24,7 @@
import org.amdatu.platform.cassandra.listener.ColumnFamilyAvailable;
import
org.amdatu.platform.cassandra.persistencemanager.CassandraPersistenceManagerFactory;
import org.apache.cassandra.thrift.CfDef;
+import org.apache.cassandra.thrift.InvalidRequestException;
import org.apache.cassandra.thrift.KsDef;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
@@ -93,5 +94,8 @@
catch (TException e) {
m_logService.log(LogService.LOG_ERROR, "Failed to start
CassandraDaemonServiceListener", e);
}
+ catch (InvalidRequestException e) {
+ m_logService.log(LogService.LOG_ERROR, "Failed to start
CassandraDaemonServiceListener", e);
+ }
}
}
Modified:
trunk/platform-bundles/cassandra-persistencemanager/src/main/java/org/amdatu/platform/cassandra/persistencemanager/service/CassandraPersistenceManagerImpl.java
==============================================================================
---
trunk/platform-bundles/cassandra-persistencemanager/src/main/java/org/amdatu/platform/cassandra/persistencemanager/service/CassandraPersistenceManagerImpl.java
(original)
+++
trunk/platform-bundles/cassandra-persistencemanager/src/main/java/org/amdatu/platform/cassandra/persistencemanager/service/CassandraPersistenceManagerImpl.java
Mon Nov 8 15:17:47 2010
@@ -18,6 +18,7 @@
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -62,7 +63,7 @@
private final static int COLUMN_LIMIT = 1000000;
// Empty byte array
- private final static byte[] EMPTY = new byte[0];
+ private final static ByteBuffer EMPTY = ByteBuffer.wrap(new byte[0]);
// The consistency level to use for READ operations
private final static ConsistencyLevel READ_CONSISTENCY_LEVEL =
ConsistencyLevel.ALL;
@@ -479,10 +480,10 @@
long timestamp = System.currentTimeMillis();
ColumnParent column_parent = new ColumnParent(columnFamilyName);
column_parent.setSuper_column(toBytes(superColumnName));
- Column column = new Column(columnName.getBytes(), value,
timestamp);
+ Column column = new Column(toBytes(columnName),
ByteBuffer.wrap(value), timestamp);
Iface cs = m_daemonService.getCassandraServer();
cs.set_keyspace(m_keyspace);
- cs.insert(rowKey.getBytes(DEFAULT_CHARSET), column_parent, column,
WRITE_CONSISTENCY_LEVEL);
+ cs.insert(toBytes(rowKey), column_parent, column,
WRITE_CONSISTENCY_LEVEL);
}
catch (Exception e) {
if (!(e instanceof RuntimeException)) {
@@ -539,7 +540,7 @@
byte[] bytes = null;
if (value != null) {
- bytes = toBytes(value);
+ bytes = toBytes(value).array();
}
setValue(columnFamilyName, rowKey, superColumnName, columnName,
bytes);
}
@@ -583,7 +584,7 @@
}
Iface cs = m_daemonService.getCassandraServer();
cs.set_keyspace(m_keyspace);
- cs.remove(rowKey.getBytes(), columnPath, timestamp,
WRITE_CONSISTENCY_LEVEL);
+ cs.remove(toBytes(rowKey), columnPath, timestamp,
WRITE_CONSISTENCY_LEVEL);
}
catch (Exception e) {
if (!(e instanceof RuntimeException)) {
@@ -693,7 +694,7 @@
try {
ColumnParent columnParent = new ColumnParent(table);
SlicePredicate p = new SlicePredicate();
- p.setColumn_names(columnNames);
+ p.setColumn_names(toBytesList(columnNames));
KeyRange range = new KeyRange(1);
range.setStart_key(toBytes(key));
@@ -774,13 +775,21 @@
return result;
}
- private byte[] toBytes(String value) throws UnsupportedEncodingException {
- return value.getBytes(DEFAULT_CHARSET);
+ private ByteBuffer toBytes(String value) throws
UnsupportedEncodingException {
+ return ByteBuffer.wrap(value.getBytes(DEFAULT_CHARSET));
}
private String toString(byte[] bytes) throws UnsupportedEncodingException {
return new String(bytes, DEFAULT_CHARSET);
}
+
+ private List<ByteBuffer> toBytesList(List<byte[]> values) {
+ List<ByteBuffer> result = new ArrayList<ByteBuffer>();
+ for (byte[] value : values) {
+ result.add(ByteBuffer.wrap(value));
+ }
+ return result;
+ }
public String toString() {
return "CassandraPersistenceManager for keyspace '" + m_keyspace + "'";
Modified: trunk/pom.xml
==============================================================================
--- trunk/pom.xml (original)
+++ trunk/pom.xml Mon Nov 8 15:17:47 2010
@@ -74,7 +74,7 @@
Version numbers of platform bundles
-->
<shindig.version>2.0.0</shindig.version>
- <cassandra.version>0.7.0-beta2</cassandra.version>
+ <cassandra.version>0.7.0-beta3</cassandra.version>
<openrdf.version>2.3.1</openrdf.version>
</properties>