Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

[Transactions3/ABR] Need to abort at the put timestamp or higher #5847

Merged
merged 4 commits into from
Jan 11, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public PreparedStatement prepareAbortStatement(TableMetadata transactionsTable,
.where(QueryBuilder.eq(CassandraConstants.ROW, QueryBuilder.bindMarker()))
.and(QueryBuilder.eq(CassandraConstants.COLUMN, QueryBuilder.bindMarker()))
.and(QueryBuilder.eq(CassandraConstants.TIMESTAMP, CassandraConstants.ENCODED_CAS_TABLE_TIMESTAMP))
.using(QueryBuilder.timestamp(CellValuePutter.SET_TIMESTAMP + 1))
.onlyIf(QueryBuilder.eq(CassandraConstants.VALUE, QueryBuilder.bindMarker()));
// if you change this from CAS then you must update RetryPolicy
return session.prepare(abortStatement.toString());
Expand Down Expand Up @@ -123,7 +124,6 @@ public Statement bindAbortStatement(PreparedStatement preparedAbortStatement, Tr
BoundStatement bound = preparedAbortStatement.bind(rowKeyBb, columnNameBb, valueBb);
return bound.setConsistencyLevel(ConsistencyLevel.QUORUM)
.setSerialConsistencyLevel(ConsistencyLevel.SERIAL)
.setDefaultTimestamp(CellValuePutter.SET_TIMESTAMP + 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From javadoc of Statement#setDefaultTimestamp(long):

   * <p>Note that unlike other configuration, when this statement is prepared {@link
   * BoundStatement}s created off of {@link PreparedStatement} do not inherit this configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like this should apply, given that we set it on the bound statement already

.setReadTimeoutMillis(LONG_READ_TIMEOUT_MS)
.setIdempotent(true) // by default CAS operations are not idempotent in case of multiple clients
.setRetryPolicy(abortRetryPolicy);
Expand Down