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

Wei Zheng commented on HIVE-11716:
----------------------------------

[~alangates] You're right. The mismatch is caused by my change, but in a good 
way :)

Basically the test result mismatch is like this:
{code}
< FAILED: SemanticException [Error 10297]: Attempt to do update or delete on 
table default.acid_notbucketed that does not use an AcidOutputFormat or is not 
bucketed
---
> FAILED: SemanticException [Error 10297]: Attempt to do update or delete on 
> table acid_notbucketed that does not use an AcidOutputFormat or is not 
> bucketed
{code}

Without patch the error was thrown by SemanticAnalyzer#checkAcidConstraints, 
there we have
{code}
    if (table.getNumBuckets() < 1) {
      throw new SemanticException(ErrorMsg.ACID_OP_ON_NONACID_TABLE, 
table.getTableName());
    }
{code}
where table.getTableName() just returns tablename acid_notbucketed.

With patch the error was caught earlier and thrown by 
SemanticAnalyzer#getMetaData()
{code}
        // Disallow update and delete on non-acid tables
        if ((updating() || deleting()) && !isAcid && isTableWrittenTo) {
          //isTableWrittenTo: delete from acidTbl where a in (select id from 
nonAcidTable)
          //so only assert this if we are actually writing to this table
          // isAcidTable above also checks for whether we are using an acid 
compliant
          // transaction manager.  But that has already been caught in
          // UpdateDeleteSemanticAnalyzer, so if we are updating or deleting 
and getting nonAcid
          // here, it means the table itself doesn't support it.
          throw new SemanticException(ErrorMsg.ACID_OP_ON_NONACID_TABLE, 
tab_name);
        }
{code}
where tab_name is default.acid_notbucketed

Here isAcid flag was true without patch, which is wrong, because isAcidTable() 
has a bug as it only checked 'transactional'='true', but didn't check whether 
the table is bucketed or whether it's ORC. The patch fixed isAcidTable(), so 
isAcid is false now, thus we can trigger this logic.

> Reading ACID table from non-acid session should raise an error
> --------------------------------------------------------------
>
>                 Key: HIVE-11716
>                 URL: https://issues.apache.org/jira/browse/HIVE-11716
>             Project: Hive
>          Issue Type: Bug
>          Components: Transactions
>    Affects Versions: 1.0.0
>            Reporter: Eugene Koifman
>            Assignee: Wei Zheng
>            Priority: Critical
>         Attachments: HIVE-11716.1.patch, HIVE-11716.2.patch, 
> HIVE-11716.3.patch, HIVE-11716.4.patch
>
>
> if someone performs a delete using DbTxnManager and than starts a new session 
> with DummyTxnManager, then previously successfully deleted data will show up.
> Once the logic to identify all acid tables being read is there, make sure that
> Driver.recordValidTxns() called iff there ACID tables in the query.
> We should also not allow writing to ACID table from non-acid session



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to