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

Stefan Miklosovic edited comment on CASSANDRA-19270 at 1/16/24 9:42 AM:
------------------------------------------------------------------------

I backported that test to 4.0 (1) and two tests fail there: 
compositeValueClustering and compositeValuePk, the latter fails on

{code}
java.lang.AssertionError: 
Expecting a root cause with message:
  <"Key length of 65554 is longer than maximum of 65535">
but message was:
  <"Key length of 65560 is longer than maximum of 65535">.
Throwable that failed the check:

com.datastax.driver.core.exceptions.InvalidQueryException: Key length of 65560 
is longer than maximum of 65535
{code}

(1) 
https://github.com/smiklosovic/cassandra/commit/61233d566c11a44fdd57bcab08ae715bead08b55

I think that you are right that this is a problem in 4.x but this is fixed in 
5.0. 

I wonder how complicated it would be to fix this in 4.x as well ...

In 4.0, with your example, it fails on

{code}
ERROR [Native-Transport-Requests-1] 2024-01-16 10:39:39,139 
QueryMessage.java:121 - Unexpected error during query
java.lang.IllegalArgumentException: null
        at java.nio.Buffer.limit(Buffer.java:275)
        at 
org.apache.cassandra.db.marshal.ByteBufferAccessor.slice(ByteBufferAccessor.java:107)
        at 
org.apache.cassandra.db.marshal.ByteBufferAccessor.slice(ByteBufferAccessor.java:39)
        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:740)
        at 
org.apache.cassandra.cql3.statements.ModificationStatement.getMutations(ModificationStatement.java:689)
        at 
org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:470)
        at 
org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:454)
        at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:244)
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:337)
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:324)
        at 
org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:108)
        at 
org.apache.cassandra.transport.Message$Request.execute(Message.java:242)
        at 
org.apache.cassandra.transport.Dispatcher.processRequest(Dispatcher.java:86)
        at 
org.apache.cassandra.transport.Dispatcher.processRequest(Dispatcher.java:106)
        at 
org.apache.cassandra.transport.Dispatcher.lambda$dispatch$0(Dispatcher.java:70)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at 
org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:165)
        at 
org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:137)
        at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:119)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)
ERROR [Native-Transport-Requests-1] 2024-01-16 10:39:39,139 
ErrorMessage.java:457 - Unexpected exception during request
java.lang.IllegalArgumentException: null
{code}

Which seems to somehow confirm what you see.


was (Author: smiklosovic):
I backported that test to 4.0 (1) and two tests fail there: 
compositeValueClustering and compositeValuePk, the latter fails on

{code}
java.lang.AssertionError: 
Expecting a root cause with message:
  <"Key length of 65554 is longer than maximum of 65535">
but message was:
  <"Key length of 65560 is longer than maximum of 65535">.
Throwable that failed the check:

com.datastax.driver.core.exceptions.InvalidQueryException: Key length of 65560 
is longer than maximum of 65535
{code}

(1) 
https://github.com/smiklosovic/cassandra/commit/cea90ebd3aef09ae09cdd69fd218bb6baebcc3c1

I think that you are right that this is a problem in 4.x but this is fixed in 
5.0. 

I wonder how complicated it would be to fix this in 4.x as well ...

> 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