[
https://issues.apache.org/jira/browse/CASSANDRA-5415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aleksey Yeschenko updated CASSANDRA-5415:
-----------------------------------------
Attachment: 5415.txt
BatchStatement.getMutations() currently modifies its nested modification
statements when you set a batch-level timestamp:
{noformat}
for (ModificationStatement statement : statements)
{
if (isSetTimestamp())
statement.setTimestamp(getTimestamp(now));
{noformat}
Because of this, only the first execution of such a prepared statement will
succeed. All subsequent attempts will fall because of this check in
BatchStatement.validate():
{noformat}
for (ModificationStatement statement : statements)
{
if (isSetTimestamp() && statement.isSetTimestamp())
throw new InvalidRequestException("Timestamp must be set either on
BATCH or individual statements");
{noformat}
The attached patch fixes this.
> Batch with timestamp failed
> ---------------------------
>
> Key: CASSANDRA-5415
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5415
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.3
> Reporter: Alexey Tereschenko
> Assignee: Aleksey Yeschenko
> Priority: Minor
> Fix For: 1.2.4
>
> Attachments: 5415.txt
>
>
> When I create a prepared statement with the following CQL3 using Thrift
> protocol:
> {code}
> BEGIN BATCH USING TIMESTAMP <number>
> <some INSERT INTO or UPDATE statements ....>
> APPLY BATCH
> {code}
> and execute this statement in a loop, I randomly get the error:
> *InvalidRequestException(why:Timestamp must be set either on BATCH or
> individual statements)*
> All statements inside the batch have no individual USING TIMESTAMP.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira