JingsongLi commented on code in PR #595:
URL: https://github.com/apache/flink-table-store/pull/595#discussion_r1133625287


##########
flink-table-store-hive/flink-table-store-hive-catalog/src/main/java/org/apache/flink/table/store/hive/HiveCatalog.java:
##########
@@ -297,13 +297,20 @@ public void alterTable(
         }
 
         try {
+            final SchemaManager schemaManager = schemaManager(identifier);
             // first commit changes to underlying files
             TableSchema schema = 
schemaManager(identifier).commitChanges(changes);
 
-            // sync to hive hms
-            Table table = client.getTable(identifier.getDatabaseName(), 
identifier.getObjectName());
-            updateHmsTable(table, identifier, schema);
-            client.alter_table(identifier.getDatabaseName(), 
identifier.getObjectName(), table);
+            try {
+                // sync to hive hms
+                Table table =
+                        client.getTable(identifier.getDatabaseName(), 
identifier.getObjectName());
+                updateHmsTable(table, identifier, schema);
+                client.alter_table(identifier.getDatabaseName(), 
identifier.getObjectName(), table);
+            } catch (TException te) {
+                fileIO.deleteQuietly(schemaManager.toSchemaPath(schema.id()));

Review Comment:
   introduce a function: `SchemaManager.deleteSchema(long schemaId)`?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to