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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/AbstractTableView.java:
##########
@@ -163,11 +164,14 @@ private <T> CompletableFuture<T> withSchemaSync(@Nullable 
Transaction tx, @Nulla
                         .handle((res, ex) -> {
                             if 
(isOrCausedBy(InternalSchemaVersionMismatchException.class, ex)) {
                                 assert tx == null : "Only for implicit 
transactions a retry might be requested";
-                                assert previousSchemaVersion == null || 
!Objects.equals(schemaVersion, previousSchemaVersion)
-                                        : "Same schema version (" + 
schemaVersion
-                                        + ") on a retry: something is wrong, 
is this caused by the test setup?";
+                                
assertSchemaVersionIncreased(previousSchemaVersion, schemaVersion);
 
                                 // Repeat.
+                                return withSchemaSync(tx, schemaVersion, 
action);
+                            } else if (tx == null && 
isOrCausedBy(IncompatibleSchemaException.class, ex)) {

Review Comment:
   When doing a KV operation and we DON'T have an explicit transaction, this is 
what happens:
   
   1. We take the 'current' table version at 'now' and marshal keys/values 
using this version (this is moment T1)
   2. Then we call a method of `InternalTable`, it creates a new transaction at 
moment T2
   3. Then an operation is executed at moment T3
   
   `InternalSchemaVersionMismatchException` is for a case when table version at 
T2 is different from table version at T1. This is needed to close that gap 
between marshalling and starting a transaction: to make sure that transaction 
works with rows in the version it expects, but avoid creating a transaction in 
the KV view (we tried this, it causes troubles)
   
   And `IncompatibleSchemaException` is for a case when table version at T3 is 
different from table version at T2.



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