sashapolo commented on code in PR #2030:
URL: https://github.com/apache/ignite-3/pull/2030#discussion_r1186141665
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuilder.java:
##########
@@ -100,10 +111,14 @@ void stop() {
*/
void startIndexBuild(TableIndexView tableIndexView, TableImpl table) {
for (int partitionId = 0; partitionId <
table.internalTable().partitions(); partitionId++) {
+ // Let's check if there is a node in the assignments for the
partition.
Review Comment:
```suggestion
// Check if this node is present in the assignments for the
partition.
```
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItBuildIndexTest.java:
##########
@@ -63,8 +70,20 @@ TABLE_NAME, toValuesString(List.of(1, 1), List.of(2, 2),
List.of(3, 3), List.of(
sql(IgniteStringFormatter.format("CREATE INDEX {} ON {} (i1)",
INDEX_NAME, TABLE_NAME));
// TODO: IGNITE-19150 We are waiting for schema synchronization to
avoid races to create and destroy indexes
- waitForIndexBuild(TABLE_NAME, INDEX_NAME);
+ Map<Integer, List<Ignite>> nodesWithBuiltIndexesByPartitionId =
waitForIndexBuild(TABLE_NAME, INDEX_NAME);
+
+ // Check that the number of nodes with built indexes is equal to the
number of replicas.
+ assertEquals(partitions, nodesWithBuiltIndexesByPartitionId.size());
+
+ for (Entry<Integer, List<Ignite>> entry :
nodesWithBuiltIndexesByPartitionId.entrySet()) {
+ assertEquals(
+ replicas,
+ entry.getValue().size(),
+ IgniteStringFormatter.format("p={}, nodes={}",
entry.getKey(), entry.getValue())
+ );
+ }
+ // Let's check the sql query.
Review Comment:
This comment is redundant
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuilder.java:
##########
@@ -100,10 +111,14 @@ void stop() {
*/
void startIndexBuild(TableIndexView tableIndexView, TableImpl table) {
for (int partitionId = 0; partitionId <
table.internalTable().partitions(); partitionId++) {
+ // Let's check if there is a node in the assignments for the
partition.
+ if (!replicaManager.startedGroups().contains(new
TablePartitionId(table.tableId(), partitionId))) {
Review Comment:
Why do we need to iterate over all partitions and check if `startedGroups`
contains a particular one? Can we simply iterate over `startedGroups` and get
partitions from there?
--
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]