Phillippko commented on code in PR #7311:
URL: https://github.com/apache/ignite-3/pull/7311#discussion_r2647585544
##########
modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexBuildCompletenessTest.java:
##########
@@ -113,13 +117,57 @@ void
raceBetweenIndexBuildAndWriteFromDeadCoordinatorDoesNotCauseIndexIncomplete
.atMost(10, SECONDS)
.until(() ->
isIndexAvailable(unwrapIgniteImpl(cluster.aliveNode()), INDEX_NAME));
- assertThat(rowsInIndex(cluster.aliveNode()), is(transactions.size() -
failedTransactions));
- assertThat((long) rowsInIndex(cluster.aliveNode()),
is(rowCountInTable()));
+ int successfulOperations = transactions.size() - failedOperations;
+
+ assertAll(
+ () -> assertThat(rowsInIndex(cluster.aliveNode()),
is(successfulOperations)),
+ () -> assertThat((long) rowsInIndex(cluster.aliveNode()),
is(rowCountInTable()))
+ );
}
private long rowCountInTable() {
try (ResultSet<SqlRow> resultSet =
cluster.aliveNode().sql().execute(null, "SELECT COUNT(*) FROM " + TABLE_NAME)) {
return resultSet.next().longValue(0);
}
}
+
+ @Test
+ void
raceBetweenIndexBuildAndWriteFromDeadCoordinatorDoesNotCauseIndexIncompletenessForImplicitTransactions()
{
+ createTestTable(cluster, 1, 1);
+
+ createIndex(cluster, INDEX_NAME);
+
+ simulateCoordinatorLeaveToMakeIndexBuildStart();
+
+ CompletableFuture<Void> indexBuildCompleted =
CompletableFuture.runAsync(() -> {
+ await("Index must become available in time")
+ .atMost(10, SECONDS)
+ .until(() ->
isIndexAvailable(unwrapIgniteImpl(cluster.aliveNode()), INDEX_NAME));
+ });
+
+ KeyValueView<Integer, Integer> kvView =
cluster.aliveNode().tables().table(TABLE_NAME).keyValueView(Integer.class,
Integer.class);
+
+ int failedOperations = 0;
+ int i = 0;
+ while (!indexBuildCompleted.isDone()) {
Review Comment:
I don't see any check that we completed any operations, in case index build
happens too fast
--
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]