cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Wick (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-9324) Map Mutation rejected by Cassandra: IllegalArgumentException
Date Thu, 07 May 2015 16:34:00 GMT


Mark Wick commented on CASSANDRA-9324:

Sure - here's the cql3 create table statement (I've removed the other non-key columns for
brevity's sake):

	name ascii,
	id varint,
    attributes map<ascii,ascii>,
    PRIMARY KEY(name, id)

Here's a snippet of the c++ used to generate the mutation (with minor refactoring to removing
product information):
for(TSPoint::Attributes::const_iterator it = point->get_metadata_itr_begin(); it != point->get_metadata_itr_end();
		CompositeColumnList name_parts;
		std::string attributes_s("attributes");
                //CassValue is our own class which encodes various types to the bytes Cassandra
                //It is unchanged since our migration from 2.0.14
		CassValue attributes_name_v(attributes_s);
		CassValue name_v(it->first);

		CassValue item(it->second);

		OSII_TIME_T current_time_ms = utc_time_ms();

		Mutation m; = encode_values(name_parts);
		m.column_or_supercolumn.column.value = item.stringValue();
		m.column_or_supercolumn.column.timestamp = current_time_ms * 1000;
		m.__isset.column_or_supercolumn = true;
		m.column_or_supercolumn.__isset.column = true;
		m.column_or_supercolumn.column.__isset.value = true;
		m.column_or_supercolumn.column.__isset.timestamp = true;

		//...code ommited for storage / sending of the Mutation after it's been created

//here's the function to encode the composite column, which is used successfully for our other
mutations with no errors, and which is unchanged from when this worked in 2.0.14
std::string CassandraConnection::encode_values(CompositeColumnList & values)
	std::string result;
	result.reserve(values.size() * 10);//approximate, for efficiency only
	for(CompositeColumnList::iterator it = values.begin(); it != values.end(); it++)
		//Encode value - size then data
                //encode_int16_to_string just stores the raw bytes in a std::string, as the
thrift API expects for byte arrays/buffers
		result += encode_int16_to_string((OSII_UINT16)(*it)->size());
		result += (*it)->stringValue();
		result += '\0';
	return result;

> Map Mutation rejected by Cassandra: IllegalArgumentException
> ------------------------------------------------------------
>                 Key: CASSANDRA-9324
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>         Environment: Windows 7, Cassandra 2.1.5
>            Reporter: Mark Wick
>            Priority: Minor
>             Fix For: 2.1.x
> We use a collection (map<ascii,ascii>) in a CQL3 table. We write into that cql3
table using thrift mutations, from a c++ application. We are prototyping migrating from our
current Cassandra (2.0.7) to 2.1.5, and are unable to write rows to this cql3 table. We have
no problems when we remove the writes to the map column, and all other writes succeed in this
case. Cassandra is rejecting our writes and we are catching a TTransportException (no more
data to read). The below call stack is from the Cassandra instance that is rejecting the write.
> {code}
> ERROR 14:08:10 Error occurred during processing of message.
> java.lang.IllegalArgumentException: null
>         at java.nio.Buffer.limit(Unknown Source) ~[na:1.7.0_71]
>         at org.apache.cassandra.utils.ByteBufferUtil.readBytes(
>         at org.apache.cassandra.serializers.CollectionSerializer.readValue(
>         at org.apache.cassandra.serializers.MapSerializer.validateForNativeProtocol(
>         at org.apache.cassandra.serializers.CollectionSerializer.validate(
>         at org.apache.cassandra.db.marshal.AbstractType.validate(
>         at org.apache.cassandra.thrift.ThriftValidation.validateColumnData(
>         at org.apache.cassandra.thrift.ThriftValidation.validateColumnOrSuperColumn(
>         at org.apache.cassandra.thrift.ThriftValidation.validateMutation(
>         at org.apache.cassandra.thrift.CassandraServer.createMutationList(
>         at org.apache.cassandra.thrift.CassandraServer.batch_mutate(
>         at org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.getResult(
>         at org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.getResult(
>         at org.apache.thrift.ProcessFunction.process( ~[libthrift-0.9.2.jar:0.9.2]
>         at org.apache.thrift.TBaseProcessor.process( ~[libthrift-0.9.2.jar:0.9.2]
>         at org.apache.cassandra.thrift.CustomTThreadPoolServer$
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_71]
>         at java.util.concurrent.ThreadPoolExecutor$ Source) [na:1.7.0_71]
>         at Source) [na:1.7.0_71]{code}

This message was sent by Atlassian JIRA

View raw message