ibessonov commented on code in PR #7590:
URL: https://github.com/apache/ignite-3/pull/7590#discussion_r2810966983
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/handlers/BuildIndexCommandHandler.java:
##########
@@ -107,13 +108,31 @@ protected CommandResult handleInternally(
if (indexMeta == null || indexMeta.isDropped()) {
// Index has been dropped.
-
- storage.runConsistently(locker -> {
+ return storage.runConsistently(locker -> {
storage.lastApplied(commandIndex, commandTerm);
- return null;
+
+ return EMPTY_APPLIED_RESULT;
});
+ }
+
+ IndexUpdateHandler indexUpdateHandler =
storageUpdateHandler.getIndexUpdateHandler();
- return EMPTY_APPLIED_RESULT;
+ RowId previousNextRowIdToBuild =
indexUpdateHandler.getNextRowIdToBuildIndex(command.indexId());
+ if (previousNextRowIdToBuild == null) {
+ // Index is already built. This command either repeats the final
batch, or it is one of the previous commands that's been
+ // processed out of order for some reason.
+ if (command.finish()) {
+ logCommandDuplication(command);
+ } else {
+ // TODO: https://issues.apache.org/jira/browse/IGNITE-27844
+ logCommandReordering(command);
+ }
+
+ return storage.runConsistently(locker -> {
Review Comment:
Executing duplicated commands will lead to unwanted storage activity, I
would want to avoid doing that. This code will be further optimized later to
remove the rest of duplicated processing.
--
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]