You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2025/12/25 12:01:52 UTC
[PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
rpuch opened a new pull request, #7311:
URL: https://github.com/apache/ignite-3/pull/7311
https://issues.apache.org/jira/browse/IGNITE-27456
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
Posted by "Phillippko (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch merged PR #7311:
URL: https://github.com/apache/ignite-3/pull/7311
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #7311:
URL: https://github.com/apache/ignite-3/pull/7311#discussion_r2647641493
##########
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:
Now operations loop is started before index creation
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
Posted by "Phillippko (via GitHub)" <gi...@apache.org>.
Phillippko commented on code in PR #7311:
URL: https://github.com/apache/ignite-3/pull/7311#discussion_r2647583102
##########
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(() -> {
Review Comment:
In other test we do operations and then wait for build. Here we go other way around. How is it a race then? Is it a typo?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27456 Add test for race between starting index build and writing committed values [ignite-3]
Posted by "Phillippko (via GitHub)" <gi...@apache.org>.
Phillippko commented on code in PR #7311:
URL: https://github.com/apache/ignite-3/pull/7311#discussion_r2647583102
##########
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(() -> {
Review Comment:
In other test we do operations and then wait for build. Here we go other way around. How is it a race then? Is it a typo?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org