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

Update Write-Write Transaction Conflict Error Message #7242

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 @@ -102,8 +102,8 @@ private TransactionConflictException(

@Override
public @Safe String getLogMessage() {
return "There was a write-write transaction conflict. This transaction wrote a cell to which a concurrent"
+ " transaction wrote a different value.";
return "There was a write-write transaction conflict. This transaction wrote to a cell while another, "
+ "concurrent transaction wrote to the same cell.";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void testCfEqualityChecker() throws TException {
.collect(Collectors.toList()));

assertThat(ColumnFamilyDefinitions.isMatchingCf(
kvs.getCfForTable(NEVER_SEEN, getMetadata(), FOUR_DAYS_IN_SECONDS), clusterSideCf))
kvs.getCfForTable(NEVER_SEEN, getMetadata(), FOUR_DAYS_IN_SECONDS), clusterSideCf))
.as("After serialization and deserialization to database, Cf metadata did not match.")
.isTrue();
}
Expand All @@ -256,8 +256,10 @@ private static String getInternalTestTableName() {
@SuppressWarnings("CompileTimeConstant")
public void shouldNotErrorForTimestampTableWhenCreatingCassandraKvs() {
verify(logger, atLeast(0))
.error(startsWith("Found a table {} that did not have persisted"),
assertArg((Arg<String> arg) -> assertThat(arg.getValue()).doesNotContain("timestamp")));
.error(
startsWith("Found a table {} that did not have persisted"),
assertArg(
(Arg<String> arg) -> assertThat(arg.getValue()).doesNotContain("timestamp")));
}

@Test
Expand Down Expand Up @@ -492,20 +494,20 @@ public void setOnceTest() {

keyValueService.putUnlessExists(userTable, ImmutableMap.of(CELL, sad));
assertThat(keyValueService
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE))
.get(CELL)
.getContents())
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE))
.get(CELL)
.getContents())
.containsExactly(sad);

keyValueService.setOnce(userTable, ImmutableMap.of(CELL, happy));
assertThat(keyValueService
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE))
.get(CELL)
.getContents())
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE))
.get(CELL)
.getContents())
.containsExactly(happy);
assertThat(keyValueService
.getAllTimestamps(userTable, ImmutableSet.of(CELL), Long.MAX_VALUE)
.size())
.getAllTimestamps(userTable, ImmutableSet.of(CELL), Long.MAX_VALUE)
.size())
.isEqualTo(1);
keyValueService.truncateTable(userTable);
}
Expand Down Expand Up @@ -665,9 +667,9 @@ public void testMultiCheckAndSetCannotUpdateAcrossMultipleRows() {
Cell nextTestCell = Cell.create(row(1), column(1));

assertThatThrownBy(() -> keyValueService.multiCheckAndSet(MultiCheckAndSetRequest.newCells(
TEST_TABLE,
firstTestCell.getRowName(),
ImmutableMap.of(firstTestCell, val(0, 0), nextTestCell, val(0, 1)))))
TEST_TABLE,
firstTestCell.getRowName(),
ImmutableMap.of(firstTestCell, val(0, 0), nextTestCell, val(0, 1)))))
.isInstanceOf(SafeIllegalStateException.class)
.hasMessageContaining("Can only update cells in one row.");
}
Expand All @@ -683,7 +685,7 @@ public void testMultiCheckAndSetIndependentlyFails() {
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 1))));

assertThatThrownBy(() -> keyValueService.multiCheckAndSet(MultiCheckAndSetRequest.newCells(
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 2)))))
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 2)))))
.isInstanceOf(MultiCheckAndSetException.class);

MultiCheckAndSetException ex = catchThrowableOfType(
Expand Down Expand Up @@ -808,7 +810,7 @@ private CfDef createDefaultCfDef(String namespace, String tableName) {
.setComment("")
.setColumn_metadata(new ArrayList<>())
.setTriggers(new ArrayList<>())
.setKey_alias(new byte[]{0x6B, 0x65, 0x79})
.setKey_alias(new byte[] {0x6B, 0x65, 0x79})
.setComparator_type("org.apache.cassandra.db.marshal.CompositeType"
+ "(org.apache.cassandra.db.marshal.BytesType,org.apache.cassandra.db.marshal.LongType)")
.setCompaction_strategy_options(new HashMap<>())
Expand Down