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 2026/01/29 15:27:31 UTC
[PR] IGNITE-27460 Add schema compatibility validation for full commands [ignite-3]
rpuch opened a new pull request, #7500:
URL: https://github.com/apache/ignite-3/pull/7500
https://issues.apache.org/jira/browse/IGNITE-27460
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on code in PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#discussion_r2753141060
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/network/command/UpdateCommandBase.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.partition.replicator.network.command;
+
+import java.util.UUID;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.network.annotations.PropertyName;
+import org.apache.ignite.internal.replicator.message.ReplicationGroupIdMessage;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Base for commands executing updates to the storage.
+ */
+public interface UpdateCommandBase extends PartitionCommand {
+ @PropertyName("tablePartitionId")
+ ReplicationGroupIdMessage commitPartitionId();
+
+ UUID txCoordinatorId();
Review Comment:
Could you add javaDoc on this field?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -378,12 +364,43 @@ private CommandResult handleUpdateAllCommand(
advanceLastAppliedIndexConsistently(commandIndex, commandTerm);
}
- replicaTouch(txId, cmd.txCoordinatorId(), cmd.full() ? safeTimestamp : null, cmd.full());
+ replicaTouch(txId, cmd.txCoordinatorId(), cmd.full());
- return new CommandResult(
- new UpdateCommandResult(true, isPrimaryInGroupTopology(storageLeaseInfo), safeTimestamp.longValue()),
- true
+ UpdateCommandResult result = new UpdateCommandResult(
+ true,
+ isPrimaryInGroupTopology(storageLeaseInfo),
+ safeTimestamp.longValue(),
+ failedCompatValidationResult
);
+
+ return new CommandResult(result, true);
+ }
+
+ private @Nullable CompatibilityValidationResult validateSchemaCompatibilityIfNeeded(
+ UUID txId,
+ boolean full,
+ @Nullable HybridTimestamp commitTsOrNull
+ ) {
+ if (!full) {
+ return null;
+ }
+
+ HybridTimestamp commitTs = Objects.requireNonNull(commitTsOrNull);
+
+ CompatibilityValidationResult validationResult;
+ try {
+ validationResult = schemaCompatibilityValidator
+ .validateCommit(txId, Set.of(storage.tableId()), commitTs)
+ .get();
Review Comment:
Timeout?
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/schemacompat/CompatibilityValidationResult.java:
##########
@@ -154,4 +166,32 @@ public String details() {
return details;
}
+
+ /**
+ * Throws an exception produced by the given factory if the validation failed.
+ *
+ * @param exceptionFactory Exception factory.
+ */
+ public <X extends Exception> void throwIfSchemaValidationOnCommitFailed(Function<String, ? extends X> exceptionFactory) throws X {
+ CompatibilityValidationResult validationResult = this;
Review Comment:
What is the point of this assignment? Just genuine question.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -378,12 +364,43 @@ private CommandResult handleUpdateAllCommand(
advanceLastAppliedIndexConsistently(commandIndex, commandTerm);
}
- replicaTouch(txId, cmd.txCoordinatorId(), cmd.full() ? safeTimestamp : null, cmd.full());
+ replicaTouch(txId, cmd.txCoordinatorId(), cmd.full());
- return new CommandResult(
- new UpdateCommandResult(true, isPrimaryInGroupTopology(storageLeaseInfo), safeTimestamp.longValue()),
- true
+ UpdateCommandResult result = new UpdateCommandResult(
+ true,
+ isPrimaryInGroupTopology(storageLeaseInfo),
+ safeTimestamp.longValue(),
+ failedCompatValidationResult
);
+
+ return new CommandResult(result, true);
+ }
+
+ private @Nullable CompatibilityValidationResult validateSchemaCompatibilityIfNeeded(
+ UUID txId,
+ boolean full,
+ @Nullable HybridTimestamp commitTsOrNull
+ ) {
+ if (!full) {
+ return null;
+ }
+
+ HybridTimestamp commitTs = Objects.requireNonNull(commitTsOrNull);
+
+ CompatibilityValidationResult validationResult;
+ try {
+ validationResult = schemaCompatibilityValidator
Review Comment:
We can just return it here. Instead of separating assignment and initialization
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#discussion_r2811038716
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/network/command/UpdateCommandBase.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.partition.replicator.network.command;
+
+import java.util.UUID;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.network.annotations.PropertyName;
+import org.apache.ignite.internal.replicator.message.ReplicationGroupIdMessage;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Base for commands executing updates to the storage.
+ */
+public interface UpdateCommandBase extends PartitionCommand {
+ @PropertyName("tablePartitionId")
+ ReplicationGroupIdMessage commitPartitionId();
+
+ UUID txCoordinatorId();
Review Comment:
I just moved it, and in the original place it does not have javadoc as well. I would prefer to concentrate on the task at hand in this PR
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#issuecomment-3936065948
Superceded by #7598
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on code in PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#discussion_r2754449643
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -104,15 +113,23 @@ public class TablePartitionProcessor implements RaftTableProcessor {
*/
private final ZonePartitionId realReplicationGroupId;
+ private final SchemaCompatibilityValidator schemaCompatibilityValidator;
+
private ReplicaMeta lastKnownLease;
+ private final StorageUpdater<UpdateCommand> singleUpdateStorageUpdater = new SingleUpdateStorageUpdater();
+
+ private final StorageUpdater<UpdateAllCommand> batchUpdateStorageUpdater = new BatchUpdateStorageUpdater();
Review Comment:
I have the same concerns about StorageUpdater - we are needlesly overcomplecating logic in this place.
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#discussion_r2811035610
##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java:
##########
@@ -392,18 +417,82 @@ void updatesLastAppliedForCommandsUpdatingLastAppliedIndex(WriteCommand command)
verify(mvPartitionStorage).lastApplied(3, 2);
}
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void returnsFailedValidationResultIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ CommandResult commandResult = commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ assertThat(commandResult.wasApplied(), is(true));
+ UpdateCommandResult updateCommandResult = (UpdateCommandResult) commandResult.result();
+ assertThat(updateCommandResult, is(notNullValue()));
+ assertThat(updateCommandResult, is(instanceOf(UpdateCommandResult.class)));
+ CompatibilityValidationResult compatibilityValidationResult = updateCommandResult.compatibilityValidationResult();
+ assertThat(compatibilityValidationResult, is(notNullValue()));
+ assertThat(compatibilityValidationResult.isSuccessful(), is(false));
+ }
+
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void doesNotUpdateStorageIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ verify(mvPartitionStorage, never()).addWriteCommitted(any(), any(), any());
+ }
+
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void updatesLastAppliedIndexIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ verify(mvPartitionStorage).lastApplied(3, 2);
+ }
+
+ private static Stream<Arguments> fullUpdateCommands() {
+ return Stream.of(updateCommand(true), updateAllCommand(true))
+ .map(Arguments::of);
+ }
+
+ private static List<FullTableSchema> incompatibleSchemaChange() {
+ CatalogTableColumnDescriptor column1 = new CatalogTableColumnDescriptor("column1", ColumnType.INT32, false, 0, 0, 0, null);
+ CatalogTableColumnDescriptor column2 = new CatalogTableColumnDescriptor("column2", ColumnType.INT32, false, 0, 0, 0, null);
+
+ // Dropping a column is a forward-incompatible schema change.
Review Comment:
If a schema change is forward-compatible (like adding a nullable/defaulted column), a transaction started before the change CAN be committed after the change. In such a case, the binary tuple will be formatted in the old format (with old schema), but commitTs will point to the new one.
But for forward-incompatible changes, we cannot commit a transaction that started on the old schema, but attempts to be committed on the new one. The whole issue is about preventing such illegal commits (which can currently happen for 1PC transactions, even though they should be forbidden).
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #7500:
URL: https://github.com/apache/ignite-3/pull/7500#discussion_r2753256065
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -360,16 +337,25 @@ private CommandResult handleUpdateAllCommand(
UUID txId = cmd.txId();
+ assert storageLeaseInfo != null;
+ assert localNodeId != null;
+
+ CompatibilityValidationResult failedCompatValidationResult = null;
+
if (shouldUpdateStorage(cmd.full(), storageLeaseInfo)) {
- storageUpdateHandler.handleUpdateAll(
- txId,
- cmd.rowsToUpdate(),
- cmd.commitPartitionId().asReplicationGroupId(),
- !cmd.full(),
- () -> storage.lastApplied(commandIndex, commandTerm),
- cmd.full() ? safeTimestamp : null,
- indexIdsAtRwTxBeginTs(catalogService, txId, storage.tableId())
- );
+ HybridTimestamp commitTsOrNull = cmd.full() ? safeTimestamp : null;
+
+ failedCompatValidationResult = validateSchemaCompatibilityIfNeeded(cmd.txId(), cmd.full(), commitTsOrNull);
+
+ if (failedCompatValidationResult == null) {
+ storageUpdater.updateStorage(cmd, commandIndex, commandTerm, commitTsOrNull, safeTimestamp);
+ } else {
+ assert !failedCompatValidationResult.isSuccessful();
Review Comment:
Assuming that `isSuccessful` is expected to be tautologically `true` if an instance itself is not `null`, why do we have such a method in the first place?
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/schemacompat/CompatibilityValidationResult.java:
##########
@@ -17,13 +17,25 @@
package org.apache.ignite.internal.partition.replicator.schemacompat;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.io.Serializable;
+import java.util.function.Function;
import org.jetbrains.annotations.Nullable;
/**
* Result of a schema compatibility validation.
*/
-public class CompatValidationResult {
- private static final CompatValidationResult SUCCESSFUL_RESULT = new CompatValidationResult(ValidationStatus.SUCCESS, "", -1, -1, null);
+public class CompatibilityValidationResult implements Serializable {
Review Comment:
Could you please comment on why this class is Serializable now?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -104,15 +113,23 @@ public class TablePartitionProcessor implements RaftTableProcessor {
*/
private final ZonePartitionId realReplicationGroupId;
+ private final SchemaCompatibilityValidator schemaCompatibilityValidator;
+
private ReplicaMeta lastKnownLease;
+ private final StorageUpdater<UpdateCommand> singleUpdateStorageUpdater = new SingleUpdateStorageUpdater();
+
+ private final StorageUpdater<UpdateAllCommand> batchUpdateStorageUpdater = new BatchUpdateStorageUpdater();
Review Comment:
Have you considered moving the update[all] logic into its own `AbstractCommandHandler` instead of leaving it here with an additional layer of abstraction (`StorageUpdater`)?
From my perspective, your improvement further increases complexity by keeping all these things internal to the "partition processor" class (especially assuming that a collection of handlers will probably become extensible in the future).
It doesn't have to be this way. We may discuss what can be done about it.
##########
modules/table/src/main/java/org/apache/ignite/internal/tx/UpdateCommandResult.java:
##########
@@ -19,6 +19,7 @@
import java.io.Serializable;
import java.util.Objects;
+import org.apache.ignite.internal.partition.replicator.schemacompat.CompatibilityValidationResult;
Review Comment:
Let's consult TX guys about the change of a module. It was probably intentional, I'm afraid we may break some implicit design here
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/schemacompat/CompatibilityValidationResult.java:
##########
@@ -154,4 +166,32 @@ public String details() {
return details;
}
+
+ /**
+ * Throws an exception produced by the given factory if the validation failed.
+ *
+ * @param exceptionFactory Exception factory.
+ */
+ public <X extends Exception> void throwIfSchemaValidationOnCommitFailed(Function<String, ? extends X> exceptionFactory) throws X {
+ CompatibilityValidationResult validationResult = this;
Review Comment:
Is this necessary? It only adds noise to the code, in my opinion. This is probably an artifact of a refactoring, right?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -378,12 +364,43 @@ private CommandResult handleUpdateAllCommand(
advanceLastAppliedIndexConsistently(commandIndex, commandTerm);
}
- replicaTouch(txId, cmd.txCoordinatorId(), cmd.full() ? safeTimestamp : null, cmd.full());
+ replicaTouch(txId, cmd.txCoordinatorId(), cmd.full());
- return new CommandResult(
- new UpdateCommandResult(true, isPrimaryInGroupTopology(storageLeaseInfo), safeTimestamp.longValue()),
- true
+ UpdateCommandResult result = new UpdateCommandResult(
+ true,
+ isPrimaryInGroupTopology(storageLeaseInfo),
+ safeTimestamp.longValue(),
+ failedCompatValidationResult
);
+
+ return new CommandResult(result, true);
+ }
+
+ private @Nullable CompatibilityValidationResult validateSchemaCompatibilityIfNeeded(
+ UUID txId,
+ boolean full,
+ @Nullable HybridTimestamp commitTsOrNull
+ ) {
+ if (!full) {
+ return null;
+ }
+
+ HybridTimestamp commitTs = Objects.requireNonNull(commitTsOrNull);
+
+ CompatibilityValidationResult validationResult;
+ try {
+ validationResult = schemaCompatibilityValidator
+ .validateCommit(txId, Set.of(storage.tableId()), commitTs)
+ .get();
Review Comment:
is it possible to have a non-completed future here? If so, it would be good to write a comment that explains the situation.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/TablePartitionProcessor.java:
##########
@@ -378,12 +364,43 @@ private CommandResult handleUpdateAllCommand(
advanceLastAppliedIndexConsistently(commandIndex, commandTerm);
}
- replicaTouch(txId, cmd.txCoordinatorId(), cmd.full() ? safeTimestamp : null, cmd.full());
+ replicaTouch(txId, cmd.txCoordinatorId(), cmd.full());
- return new CommandResult(
- new UpdateCommandResult(true, isPrimaryInGroupTopology(storageLeaseInfo), safeTimestamp.longValue()),
- true
+ UpdateCommandResult result = new UpdateCommandResult(
+ true,
+ isPrimaryInGroupTopology(storageLeaseInfo),
+ safeTimestamp.longValue(),
+ failedCompatValidationResult
);
+
+ return new CommandResult(result, true);
+ }
+
+ private @Nullable CompatibilityValidationResult validateSchemaCompatibilityIfNeeded(
+ UUID txId,
+ boolean full,
+ @Nullable HybridTimestamp commitTsOrNull
+ ) {
+ if (!full) {
+ return null;
+ }
+
+ HybridTimestamp commitTs = Objects.requireNonNull(commitTsOrNull);
+
+ CompatibilityValidationResult validationResult;
+ try {
+ validationResult = schemaCompatibilityValidator
+ .validateCommit(txId, Set.of(storage.tableId()), commitTs)
+ .get();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IgniteInternalException(INTERNAL_ERR, e);
+ } catch (ExecutionException e) {
+ throw new IgniteInternalException(INTERNAL_ERR, e);
+ }
+
+ return validationResult.isSuccessful() ? null : validationResult;
Review Comment:
Ok, this makes one of my comments obsolete. Could you please explain this pattern? Why do we use `null` if we already have a dedicated flag?
##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java:
##########
@@ -392,18 +417,82 @@ void updatesLastAppliedForCommandsUpdatingLastAppliedIndex(WriteCommand command)
verify(mvPartitionStorage).lastApplied(3, 2);
}
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void returnsFailedValidationResultIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ CommandResult commandResult = commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ assertThat(commandResult.wasApplied(), is(true));
+ UpdateCommandResult updateCommandResult = (UpdateCommandResult) commandResult.result();
+ assertThat(updateCommandResult, is(notNullValue()));
+ assertThat(updateCommandResult, is(instanceOf(UpdateCommandResult.class)));
+ CompatibilityValidationResult compatibilityValidationResult = updateCommandResult.compatibilityValidationResult();
+ assertThat(compatibilityValidationResult, is(notNullValue()));
+ assertThat(compatibilityValidationResult.isSuccessful(), is(false));
+ }
+
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void doesNotUpdateStorageIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ verify(mvPartitionStorage, never()).addWriteCommitted(any(), any(), any());
+ }
+
+ @ParameterizedTest
+ @MethodSource("fullUpdateCommands")
+ void updatesLastAppliedIndexIfSchemaChangeValidationOn1PcCommitFails(WriteCommand command) {
+ when(validationSchemasSource.tableSchemaVersionsBetween(anyInt(), any(HybridTimestamp.class), any(HybridTimestamp.class)))
+ .thenReturn(incompatibleSchemaChange());
+
+ commandListener.processCommand(command, 3, 2, hybridClock.now());
+
+ verify(mvPartitionStorage).lastApplied(3, 2);
+ }
+
+ private static Stream<Arguments> fullUpdateCommands() {
+ return Stream.of(updateCommand(true), updateAllCommand(true))
+ .map(Arguments::of);
+ }
+
+ private static List<FullTableSchema> incompatibleSchemaChange() {
+ CatalogTableColumnDescriptor column1 = new CatalogTableColumnDescriptor("column1", ColumnType.INT32, false, 0, 0, 0, null);
+ CatalogTableColumnDescriptor column2 = new CatalogTableColumnDescriptor("column2", ColumnType.INT32, false, 0, 0, 0, null);
+
+ // Dropping a column is a forward-incompatible schema change.
Review Comment:
Just a question, I got a little confused here. Why are we concerned with forward-incompatible schema changes here? They should not affect anything, or are they?
--
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-27460 Add schema compatibility validation for full commands [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch closed pull request #7500: IGNITE-27460 Add schema compatibility validation for full commands
URL: https://github.com/apache/ignite-3/pull/7500
--
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