ibessonov commented on code in PR #1992:
URL: https://github.com/apache/ignite-3/pull/1992#discussion_r1180342821
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java:
##########
@@ -590,14 +513,71 @@ public void testScanWithUpperBound() throws Exception {
null
);
- ArrayList<BinaryRow> scannedRows2 = scanAllRows(publisher2);
+ List<BinaryRow> scannedRows2 = scanAllRows(publisher2);
assertEquals(5, scannedRows2.size());
log.info("Result of scanning after insert rows: " +
scannedRows2.stream().map(binaryRow -> rowToString(binaryRow))
.collect(Collectors.joining(", ")));
}
+ @Test
+ public void testPhantomReads() throws Exception {
+ int iterations = 10;
+
+ // "for" is better at detecting data races than RepeatedTest.
+ for (int i = 0; i < iterations; i++) {
+ KeyValueView<Tuple, Tuple> kvView = table.keyValueView();
+
+ UUID sortedIndexId = getSortedIndexId();
+
+ int partId = 0;
+
+ InternalTransaction tx = startTxWithEnlistedPartition(partId);
+
+ try {
+ IgniteBiTuple<ClusterNode, Long> leaderWithTerm =
tx.enlistedNodeAndTerm(new TablePartitionId(table.tableId(), partId));
+
+ PrimaryReplica recipient = new
PrimaryReplica(leaderWithTerm.get1(), leaderWithTerm.get2());
+
+ Publisher<BinaryRow> publisher = internalTable.scan(partId,
tx.id(), recipient, sortedIndexId, null, null, 0, null);
+
+ // Non-thread-safe collection is fine, HB is guaranteed by
"Thread#join" inside of "runRace".
Review Comment:
I don't like using thread-safe collections when no one needs them, I
consider this a bad practice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]