[ 
https://issues.apache.org/jira/browse/HIVE-18783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373986#comment-16373986
 ] 

Na Li commented on HIVE-18783:
------------------------------

[~akolb] The hive branch I mentioned is 2.3.2. I found this issue by stepping 
into the code. 

"this.listeners" is for post event lisener processing.  
"this.transactionalListeners" is for transactional listener.

For example, create table event contains the notification ID because it calls 
both listeners.
  
{code:java}
+  HiveMetaStore.create_table_core          
            if (primaryKeys == null && foreignKeys == null) {
              ms.createTable(tbl);
            } else {
              ms.createTableWithConstraints(tbl, primaryKeys, foreignKeys);
            }

            if (!this.transactionalListeners.isEmpty()) {
              transactionalListenerResponses = 
MetaStoreListenerNotifier.notifyEvent(this.transactionalListeners, 
EventType.CREATE_TABLE, new CreateTableEvent(tbl, true, this), envContext);
            }

            success = ms.commitTransaction();
          } finally {
            if (!success) {
              ms.rollbackTransaction();
              if (madeDir) {
                this.wh.deleteDir(tblPath, true);
              }
            }

            if (!this.listeners.isEmpty()) {
              MetaStoreListenerNotifier.notifyEvent(this.listeners, 
EventType.CREATE_TABLE, new CreateTableEvent(tbl, success, this), envContext, 
transactionalListenerResponses, ms);
            }{code}
 

 

 

> Set Notification ID for Alter Table event
> -----------------------------------------
>
>                 Key: HIVE-18783
>                 URL: https://issues.apache.org/jira/browse/HIVE-18783
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Na Li
>            Assignee: Alexander Kolbasov
>            Priority: Major
>
>  in HiveMetaStore, alter_table_core does NOT call transactional listener, and 
> the notification ID corresponding to the alter table event is NOT set in the 
> event parameters.
> {code}
> + alter_table_core
>       
>       try {
>         Table oldt = this.get_table_core(dbname, name);
>         this.firePreEvent(new PreAlterTableEvent(oldt, newTable, this));
>         this.alterHandler.alterTable(this.getMS(), this.wh, dbname, name, 
> newTable, envContext, this);
>         success = true;
>         if (!this.listeners.isEmpty()) {
>           MetaStoreListenerNotifier.notifyEvent(this.listeners, 
> EventType.ALTER_TABLE, new AlterTableEvent(oldt, newTable, true, this), 
> envContext);
>         }
>       } catch (NoSuchObjectException var12) {
>         ex = var12;
>         throw new InvalidOperationException(var12.getMessage());
>       } catch (Exception var13) {
>         ex = var13;
>         if (var13 instanceof MetaException) {
>           throw (MetaException)var13;
>         }
>         if (var13 instanceof InvalidOperationException) {
>           throw (InvalidOperationException)var13;
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to