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

Alexander Kolbasov edited comment on HIVE-18783 at 2/23/18 7:09 AM:
--------------------------------------------------------------------

Here is alter_table_core with a bit more core:

{code}
      try {
        Table oldt = get_table_core(dbname, name);
        firePreEvent(new PreAlterTableEvent(oldt, newTable, this));
        alterHandler.alterTable(getMS(), wh, dbname, name, newTable,  // 
<--Here!
                envContext, this);
{code}

The alterHandler is {{HiveALterHandler}} so you call {{alterTable()}} and it 
has this piece:

{code}
      if (transactionalListeners != null && !transactionalListeners.isEmpty()) {
        MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
                                              
EventMessage.EventType.ALTER_TABLE,
                                              new AlterTableEvent(oldt, newt, 
true, handler),
                                              environmentContext);
{code}

This is the part that is executed inside transaction. The part that you quoted 
is, indeed, post-transactional listeners invocation. Does it make sense?



was (Author: akolb):
Here is alter_table_core with a bit more core:

{code}
      try {
        Table oldt = get_table_core(dbname, name);
        firePreEvent(new PreAlterTableEvent(oldt, newTable, this));
        alterHandler.alterTable(getMS(), wh, dbname, name, newTable,  // 
<--Here!
                envContext, this);
{code}

The alterHandler is {{HiveALterHandler}} so you call {{alterTable()}} there 
there is this piece:

{code}
      if (transactionalListeners != null && !transactionalListeners.isEmpty()) {
        MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
                                              
EventMessage.EventType.ALTER_TABLE,
                                              new AlterTableEvent(oldt, newt, 
true, handler),
                                              environmentContext);
{code}

This is the part that is executed inside transaction. The part that you quoted 
is, indeed, post-transactional listeners invocation. Does it make sense?


> 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