lirui-apache commented on a change in pull request #14802:
URL: https://github.com/apache/flink/pull/14802#discussion_r567773736



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java
##########
@@ -697,6 +703,9 @@ private void dropTemporaryTableInternal(
         CatalogBaseTable catalogBaseTable = 
temporaryTables.get(objectIdentifier);
         if (filter.test(catalogBaseTable)) {
             temporaryTables.remove(objectIdentifier);
+            Optional<TemporaryOperationListener> listener =
+                    getTemporaryOperationListener(objectIdentifier);
+            listener.ifPresent(l -> 
l.onDropTemporaryTable(objectIdentifier.toObjectPath()));

Review comment:
       Hi @wuchong , I want to avoid the situation when `onDropTemporaryTable` 
succeeds but "removing table" fails, in which case the table is still there but 
is likely to be unusable. But I also agree there may be connectors that want to 
do something before, rather than after, the table is dropped.
   Maybe another option is to add interfaces both before and after the 
operation is performed? Something like this:
   ```
        Object preCreateTemporaryObject(ObjectType typeEnum, ObjectPath 
objectPath, Object object);
   
        void postCreateTemporaryObject(ObjectType typeEnum, ObjectPath 
objectPath, Object object);
   
        void preDropTemporaryObject(ObjectType typeEnum, ObjectPath objectPath);
   
        void postDropTemporaryObject(ObjectType typeEnum, ObjectPath 
objectPath);
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to