Skip to content

Commit 6c16dcd

Browse files
committed
Fix based on feedback
1 parent 683337b commit 6c16dcd

File tree

1 file changed

+50
-84
lines changed

1 file changed

+50
-84
lines changed

integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitSpecificIntegrationTestBase.java

Lines changed: 50 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5343,7 +5343,7 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
53435343

53445344
@Test
53455345
public void
5346-
get_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecordAfterLazyRecovery()
5346+
get_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecord()
53475347
throws UnknownTransactionStatusException, CrudException, ExecutionException {
53485348
// Arrange
53495349
manager.insert(
@@ -5392,23 +5392,15 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
53925392
.build());
53935393

53945394
// Act Assert
5395-
Optional<Result> actual;
5396-
while (true) {
5397-
try {
5398-
actual =
5399-
manager.get(
5400-
Get.newBuilder()
5401-
.namespace(namespace1)
5402-
.table(TABLE_1)
5403-
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5404-
.clusteringKey(Key.ofInt(ACCOUNT_TYPE, 0))
5405-
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5406-
.build());
5407-
break;
5408-
} catch (CrudConflictException e) {
5409-
// Retry on conflict
5410-
}
5411-
}
5395+
Optional<Result> actual =
5396+
manager.get(
5397+
Get.newBuilder()
5398+
.namespace(namespace1)
5399+
.table(TABLE_1)
5400+
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5401+
.clusteringKey(Key.ofInt(ACCOUNT_TYPE, 0))
5402+
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5403+
.build());
54125404

54135405
assertThat(actual).isNotPresent();
54145406
}
@@ -5490,7 +5482,7 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
54905482

54915483
@Test
54925484
public void
5493-
scan_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecordAfterLazyRecovery()
5485+
scan_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecord()
54945486
throws UnknownTransactionStatusException, CrudException, ExecutionException {
54955487
// Arrange
54965488
manager.mutate(
@@ -5547,22 +5539,14 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
55475539
.build());
55485540

55495541
// Act Assert
5550-
List<Result> results;
5551-
while (true) {
5552-
try {
5553-
results =
5554-
manager.scan(
5555-
Scan.newBuilder()
5556-
.namespace(namespace1)
5557-
.table(TABLE_1)
5558-
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5559-
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5560-
.build());
5561-
break;
5562-
} catch (CrudConflictException e) {
5563-
// Retry on conflict
5564-
}
5565-
}
5542+
List<Result> results =
5543+
manager.scan(
5544+
Scan.newBuilder()
5545+
.namespace(namespace1)
5546+
.table(TABLE_1)
5547+
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5548+
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5549+
.build());
55665550

55675551
assertThat(results).hasSize(1);
55685552
assertThat(results.get(0).getInt(ACCOUNT_ID)).isEqualTo(0);
@@ -5572,7 +5556,7 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
55725556

55735557
@Test
55745558
public void
5575-
scan_WithConjunctionAndLimit_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecordAfterLazyRecovery()
5559+
scan_WithConjunctionAndLimit_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecord()
55765560
throws UnknownTransactionStatusException, CrudException, ExecutionException {
55775561
// Arrange
55785562
manager.mutate(
@@ -5643,23 +5627,15 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
56435627
.build());
56445628

56455629
// Act Assert
5646-
List<Result> results;
5647-
while (true) {
5648-
try {
5649-
results =
5650-
manager.scan(
5651-
Scan.newBuilder()
5652-
.namespace(namespace1)
5653-
.table(TABLE_1)
5654-
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5655-
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5656-
.limit(2)
5657-
.build());
5658-
break;
5659-
} catch (CrudConflictException e) {
5660-
// Retry on conflict
5661-
}
5662-
}
5630+
List<Result> results =
5631+
manager.scan(
5632+
Scan.newBuilder()
5633+
.namespace(namespace1)
5634+
.table(TABLE_1)
5635+
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5636+
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5637+
.limit(2)
5638+
.build());
56635639

56645640
assertThat(results).hasSize(2);
56655641
assertThat(results.get(0).getInt(ACCOUNT_ID)).isEqualTo(0);
@@ -5747,7 +5723,7 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
57475723

57485724
@Test
57495725
public void
5750-
getScanner_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecordAfterLazyRecovery()
5726+
getScanner_WithConjunction_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecord()
57515727
throws UnknownTransactionStatusException, CrudException, ExecutionException {
57525728
// Arrange
57535729
manager.mutate(
@@ -5805,20 +5781,15 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
58055781

58065782
// Act Assert
58075783
List<Result> results;
5808-
while (true) {
5809-
try (TransactionManagerCrudOperable.Scanner scanner =
5810-
manager.getScanner(
5811-
Scan.newBuilder()
5812-
.namespace(namespace1)
5813-
.table(TABLE_1)
5814-
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5815-
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5816-
.build())) {
5817-
results = scanner.all();
5818-
break;
5819-
} catch (CrudConflictException e) {
5820-
// Retry on conflict
5821-
}
5784+
try (TransactionManagerCrudOperable.Scanner scanner =
5785+
manager.getScanner(
5786+
Scan.newBuilder()
5787+
.namespace(namespace1)
5788+
.table(TABLE_1)
5789+
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5790+
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5791+
.build())) {
5792+
results = scanner.all();
58225793
}
58235794

58245795
assertThat(results).hasSize(1);
@@ -5829,7 +5800,7 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
58295800

58305801
@Test
58315802
public void
5832-
getScanner_WithConjunctionAndLimit_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecordAfterLazyRecovery()
5803+
getScanner_WithConjunctionAndLimit_ForCommittedRecordWhoseBeforeImageMatchesConjunction_ShouldNotReturnRecord()
58335804
throws UnknownTransactionStatusException, CrudException, ExecutionException {
58345805
// Arrange
58355806
manager.mutate(
@@ -5901,21 +5872,16 @@ public void getScanner_InReadOnlyMode_WithSerializable_ShouldNotThrowAnyExceptio
59015872

59025873
// Act Assert
59035874
List<Result> results;
5904-
while (true) {
5905-
try (TransactionManagerCrudOperable.Scanner scanner =
5906-
manager.getScanner(
5907-
Scan.newBuilder()
5908-
.namespace(namespace1)
5909-
.table(TABLE_1)
5910-
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5911-
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5912-
.limit(2)
5913-
.build())) {
5914-
results = scanner.all();
5915-
break;
5916-
} catch (CrudConflictException e) {
5917-
// Retry on conflict
5918-
}
5875+
try (TransactionManagerCrudOperable.Scanner scanner =
5876+
manager.getScanner(
5877+
Scan.newBuilder()
5878+
.namespace(namespace1)
5879+
.table(TABLE_1)
5880+
.partitionKey(Key.ofInt(ACCOUNT_ID, 0))
5881+
.where(column(BALANCE).isEqualToInt(INITIAL_BALANCE))
5882+
.limit(2)
5883+
.build())) {
5884+
results = scanner.all();
59195885
}
59205886

59215887
assertThat(results).hasSize(2);

0 commit comments

Comments
 (0)