sanpwc commented on a change in pull request #611:
URL: https://github.com/apache/ignite-3/pull/611#discussion_r797745030



##########
File path: 
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -1076,34 +1067,25 @@ private boolean isSchemaExists(IgniteUuid tblId, int 
schemaVer) {
      * @param tblId Table id.
      * @return The latest schema version.
      */
-    private int latestSchemaVersion(IgniteUuid tblId) {
-        NamedListView<TableView> directTablesCfg = 
directProxy(tablesCfg.tables()).value();
-
-        ExtendedTableView viewForId = null;
+    private int latestSchemaVersion(UUID tblId) {
+        try {
+            NamedListView<SchemaView> tblSchemas = 
((ExtendedTableConfiguration) getByInternalId(directProxy(tablesCfg.tables()), 
tblId))
+                    .schemas().value();
 
-        // TODO: IGNITE-15721 Need to review this approach after the ticket 
would be fixed.
-        // Probably, it won't be required getting configuration of all tables 
from Metastor.
-        for (String name : directTablesCfg.namedListKeys()) {
-            ExtendedTableView tblView = (ExtendedTableView) 
directTablesCfg.get(name);
+            int lastVer = INITIAL_SCHEMA_VERSION;
 
-            if (tblView != null && 
tblId.equals(IgniteUuid.fromString(tblView.id()))) {
-                viewForId = tblView;
+            for (String schemaVerAsStr : tblSchemas.namedListKeys()) {
+                int ver = Integer.parseInt(schemaVerAsStr);
 
-                break;
+                if (ver > lastVer) {
+                    lastVer = ver;
+                }
             }
-        }
-
-        int lastVer = INITIAL_SCHEMA_VERSION;
-
-        for (String schemaVerAsStr : viewForId.schemas().namedListKeys()) {
-            int ver = Integer.parseInt(schemaVerAsStr);
 
-            if (ver > lastVer) {
-                lastVer = ver;
-            }
+            return lastVer;
+        } catch (NoSuchElementException e) {
+            return INITIAL_SCHEMA_VERSION;

Review comment:
       ок




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