rpuch commented on code in PR #3066:
URL: https://github.com/apache/ignite-3/pull/3066#discussion_r1461413316


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/descriptors/CatalogIndexStatus.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.descriptors;
+
+/**
+ * Index statuses.
+ *
+ * <p>Possible status transitions:</p>
+ * <ul>
+ *     <li>{@link #REGISTERED} -> {@link #BUILDING} -> {@link #AVAILABLE}.</li>
+ *     <li>{@link #AVAILABLE} (PK index).</li>
+ * </ul>
+ */
+public enum CatalogIndexStatus {
+    /**
+     * Index has been registered and is awaiting the start of building.
+     *
+     * <p>Not readable or writable.</p>

Review Comment:
   Actually transactions that see an index as REGISTERED on their start do 
write to this index, but backfill is not possible in this state.



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/ChangeIndexStatusValidationException.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog;
+
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexStatus;
+
+/** Exception that occurs when an incorrect attempt to change the {@link 
CatalogIndexDescriptor#status()}. */

Review Comment:
   ```suggestion
   /** Exception that occurs on an incorrect attempt to change the {@link 
CatalogIndexDescriptor#status()}. */
   ```



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildingManager.java:
##########
@@ -34,12 +48,18 @@
 import org.apache.ignite.network.ClusterService;
 
 /**
- * Component is responsible for building indexes and making them {@link 
CatalogIndexDescriptor#available() available}. Both in a running
+ * Component is responsible for building indexes and making them in {@link 
CatalogIndexStatus#AVAILABLE available}. Both in a running

Review Comment:
   ```suggestion
    * Component is responsible for building indexes and making them {@link 
CatalogIndexStatus#AVAILABLE available}. Both in a running
   ```



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/ChangeIndexStatusValidationException.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog;
+
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexStatus;
+
+/** Exception that occurs when an incorrect attempt to change the {@link 
CatalogIndexDescriptor#status()}. */

Review Comment:
   It seems that it should be either 'on an incorrect attempt to ...', or 'when 
an incorrect attempt to ... happens'.



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/descriptors/CatalogIndexStatus.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.descriptors;
+
+/**
+ * Index statuses.

Review Comment:
   ```suggestion
    * Index status.
   ```



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java:
##########
@@ -101,8 +105,8 @@
  *
  * <p>Approximate recovery algorithm:</p>
  * <ul>
- *     <li>For registered indexes: <ul>
- *         <li>If the new index did not have time to add
+ *     <li>For buildings indexes: <ul>

Review Comment:
   ```suggestion
    *     <li>For building indexes: <ul>
   ```



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexChooser.java:
##########
@@ -158,7 +160,7 @@ public void close() {
      */
     List<CatalogIndexDescriptor> chooseForRwTxUpdateOperation(int 
catalogVersion, int tableId) {
         return inBusyLock(busyLock, () -> {
-            List<CatalogIndexDescriptor> tableIndexes = 
catalogService.indexes(catalogVersion, tableId);
+            List<CatalogIndexDescriptor> tableIndexes = 
collectAvailableAndBuildingIndexes(catalogService.indexes(catalogVersion, 
tableId));

Review Comment:
   We must write to indices that were REGISTERED at the tx start as well



-- 
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]

Reply via email to