[ 
https://issues.apache.org/jira/browse/CASSANDRA-19270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17806656#comment-17806656
 ] 

Nadav Har'El commented on CASSANDRA-19270:
------------------------------------------

Experimenting some more, I encountered even more bizarre errors when trying to 
use *compound* partition keys which aren't even oversized. As an example I used 
a compound partition key (p1,p2) - both strings - trying to insert p1 a 
2-character string and p2 a 65433-character string, so the total is 65435 
bytes, 100 bytes less than the 65535 maximum - and this should work. But it 
didn't, and got the strange error:

{{E   cassandra.cluster.NoHostAvailable: ('Unable to complete the operation 
against any hosts', \{<Host: 127.40.212.179:9042 datacenter1>: <Error from 
server: code=0000 [Server error] message="java.lang.IllegalArgumentException: 
newLimit < 0: (-96 < 0)">})}}

In this case, there was also something in the log:

{{09:09:37.671 [Native-Transport-Requests-1] ERROR 
org.apache.cassandra.transport.}}
{{messages.ErrorMessage - Unexpected exception during request}}
{{java.lang.IllegalArgumentException: newLimit < 0: (-96 < 0)}}
{{        at java.base/java.nio.Buffer.createLimitException(Buffer.java:372)}}
{{        at java.base/java.nio.Buffer.limit(Buffer.java:346)}}
{{        at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1107)}}
{{        at 
org.apache.cassandra.db.marshal.ByteBufferAccessor.slice(ByteBufferAccessor.java:109)}}
{{        at 
org.apache.cassandra.db.marshal.ByteBufferAccessor.slice(ByteBufferAccessor.java:41)}}
{{        at 
org.apache.cassandra.db.marshal.AbstractCompositeType.validate(AbstractCompositeType.java:297)}}
{{        at 
org.apache.cassandra.db.marshal.AbstractCompositeType.validate(AbstractCompositeType.java:275)}}
{{        at 
org.apache.cassandra.cql3.Validation.validateKey(Validation.java:60)}}
{{        at 
org.apache.cassandra.cql3.statements.ModificationStatement.addUpdates(ModificationStatement.java:785)}}
{{        at 
org.apache.cassandra.cql3.statements.ModificationStatement.getMutations(ModificationStatement.java:732)}}
{{        at 
org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:509)}}
{{        at 
org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:491)}}
{{        at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:258)}}
{{        at 
org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:826)}}
{{        at 
org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:804)}}
{{        at 
org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:167)}}
{{        at 
org.apache.cassandra.transport.Message$Request.execute(Message.java:255)}}

> Incorrect error type on oversized compound partition key
> --------------------------------------------------------
>
>                 Key: CASSANDRA-19270
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19270
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Nadav Har'El
>            Priority: Normal
>
> Cassandra limits key lengths (partition and clustering) to 64 KB. If a user 
> attempts to INSERT data with a partition key or clustering key exceeding that 
> size, the result is a clear InvalidRequest error with a message like "{{{}Key 
> length of 66560 is longer than maximum of 65535{}}}".
> There is one exception: If you have a *compound* partition key (i.e., two or 
> more partition key components) and attempt to write one of them larger than 
> 64 KB, then instead of an orderly InvalidRequest like you got when there was 
> just one component, now you get a NoHostAvailable  with the message: 
> "{{{}error("'H' format requires 0 <= number <= 65535")}){}}}". This is not 
> only uglier, it can also confuse the Cassandra driver to retry this request - 
> because it doesn't realize that the request itself is broken and there is no 
> point to repeat it.
> Interestingly, if there are multiple clustering key columns, this problem 
> doesn't happen: we still get a nice InvalidRequest if any one of these is 
> more than 64 KB.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to