tkalkirill commented on code in PR #1800:
URL: https://github.com/apache/ignite-3/pull/1800#discussion_r1144806911
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -534,32 +584,159 @@ public BinaryTuple convert(BinaryRow binaryRow) {
}
private class ConfigurationListener implements
ConfigurationNamedListListener<TableIndexView> {
- /** {@inheritDoc} */
@Override
- public @NotNull CompletableFuture<?> onCreate(@NotNull
ConfigurationNotificationEvent<TableIndexView> ctx) {
+ public CompletableFuture<?>
onCreate(ConfigurationNotificationEvent<TableIndexView> ctx) {
return onIndexCreate(ctx);
}
- /** {@inheritDoc} */
@Override
- public @NotNull CompletableFuture<?> onRename(
+ public CompletableFuture<?> onRename(
String oldName,
String newName,
ConfigurationNotificationEvent<TableIndexView> ctx
) {
return failedFuture(new
UnsupportedOperationException("https://issues.apache.org/jira/browse/IGNITE-16196"));
}
- /** {@inheritDoc} */
@Override
- public @NotNull CompletableFuture<?> onDelete(@NotNull
ConfigurationNotificationEvent<TableIndexView> ctx) {
+ public CompletableFuture<?>
onDelete(ConfigurationNotificationEvent<TableIndexView> ctx) {
return onIndexDrop(ctx);
}
- /** {@inheritDoc} */
@Override
- public @NotNull CompletableFuture<?> onUpdate(@NotNull
ConfigurationNotificationEvent<TableIndexView> ctx) {
+ public CompletableFuture<?>
onUpdate(ConfigurationNotificationEvent<TableIndexView> ctx) {
return failedFuture(new IllegalStateException("Should not be
called"));
}
}
+
+ /**
+ * Initializes the build of the index.
+ */
+ private void initIndexBuildIfNeeded(TableIndexView tableIndexView,
TableImpl table) {
+ for (int partitionId = 0; partitionId <
table.internalTable().partitions(); partitionId++) {
+ buildIndexExecutor.submit(new BuildIndexTask(table,
tableIndexView, partitionId, true));
+ }
+ }
+
+ /**
+ * Task of building a table index for a partition.
+ *
+ * <p>Only the leader of the raft group will manage the building of the
index. Leader sends batches of row IDs via
+ * {@link BuildIndexCommand}, the next batch will only be send after the
previous batch has been processed.
+ *
+ * <p>Index building itself occurs locally on each node of the raft group
(majority) when processing {@link BuildIndexCommand}. This
+ * ensures that the index build in the raft group is consistent and that
the index build is restored after restarting the raft group
Review Comment:
Add it.
--
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]