tledkov-gridgain commented on a change in pull request #692:
URL: https://github.com/apache/ignite-3/pull/692#discussion_r815780717



##########
File path: 
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java
##########
@@ -72,33 +72,43 @@ public SchemaPlus schema(@Nullable String schema) {
     /** {@inheritDoc} */
     @Override
     @NotNull
-    public IgniteTable tableById(UUID id) {
+    public IgniteTable tableById(UUID id, int ver) {
         IgniteTable table = tablesById.get(id);
 
         // there is a chance that someone tries to resolve table before
         // the distributed event of that table creation has been processed
         // by TableManager, so we need to get in sync with the TableManager
-        if (table == null) {
-            ensureTableStructuresCreated(id);
-
-            // at this point the table is either null means no such table
-            // really exists or the table itself
-            table = tablesById.get(id);
+        if (table == null || ver > table.version()) {
+            table = awaitLatestTableSchema(id);
         }
 
         if (table == null) {
             throw new IgniteInternalException(
                     IgniteStringFormatter.format("Table not found 
[tableId={}]", id));
         }
 
+        if (table.version() < ver) {
+            throw new IgniteInternalException(
+                    IgniteStringFormatter.format("Table version not found 
[tableId={}, requiredVer={},  latestKnownVer={}]",

Review comment:
       - Two spaces between 'requiredVer={}' and 'latestKnownVer'
   - Should we use different exceptions for cases when table not found (normal 
flow, e.g. table dropped) and invalid schema version (breaks internal invariant)
   
   




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