[ 
https://issues.apache.org/jira/browse/HIVE-14400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wei Zheng updated HIVE-14400:
-----------------------------
    Description: 
With multiple users concurrently issuing insert statements on the same 
partition has a side effect that some queries may not see a partition at the 
time when they're issued, but will realize the partition is actually there when 
it is trying to add such partition to the metastore and thus get 
AlreadyExistsException, because some earlier query just created it (race 
condition).

For example, imagine such a table is created:
{code}
create table T (name char(50)) partitioned by (ds string);
{code}
and the following two queries are launched at the same time, from different 
sessions:
{code}
insert into table T partition (ds) values ('Bob', 'today'); -- creates the 
partition 'today'
insert into table T partition (ds) values ('Joe', 'today'); -- will fail with 
AlreadyExistsException
{code}

  was:
With multiple users concurrently issuing insert statements on the same 
partition has a side effect that some queries may not see a partition at the 
time when they're issued, but will realize the partition is actually there when 
it is trying to add such partition to the metastore and thus get 
AlreadyExistsException, because some earlier query just created it (race 
condition).

For example, imagine such a table is created:
{code}
create table T (name char(50)) partitioned by (ds string) clustered by (name) 
into 2 buckets stored as orc tblproperties('transactional'='true');
{code}
and the following two queries are launched at the same time, from different 
sessions:
{code}
insert into table T partition (ds) values ('Bob', 'today'); -- creates the 
partition 'today'
insert into table T partition (ds) values ('Joe', 'today'); -- will fail with 
AlreadyExistsException
{code}


> Handle concurrent insert with dynamic partition
> -----------------------------------------------
>
>                 Key: HIVE-14400
>                 URL: https://issues.apache.org/jira/browse/HIVE-14400
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 2.2.0
>            Reporter: Wei Zheng
>            Assignee: Wei Zheng
>         Attachments: HIVE-14400.1.patch
>
>
> With multiple users concurrently issuing insert statements on the same 
> partition has a side effect that some queries may not see a partition at the 
> time when they're issued, but will realize the partition is actually there 
> when it is trying to add such partition to the metastore and thus get 
> AlreadyExistsException, because some earlier query just created it (race 
> condition).
> For example, imagine such a table is created:
> {code}
> create table T (name char(50)) partitioned by (ds string);
> {code}
> and the following two queries are launched at the same time, from different 
> sessions:
> {code}
> insert into table T partition (ds) values ('Bob', 'today'); -- creates the 
> partition 'today'
> insert into table T partition (ds) values ('Joe', 'today'); -- will fail with 
> AlreadyExistsException
> {code}



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

Reply via email to