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

Eugene Koifman edited comment on HIVE-14400 at 8/2/16 2:22 AM:
---------------------------------------------------------------

Maybe 
{noformat}
EnvironmentContext environmentContext = null;
1602              if (hasFollowingStatsTask) {
1603                environmentContext = new EnvironmentContext();
1604                
environmentContext.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, 
StatsSetupConst.TRUE);
1605              }
1606              alterPartition(tbl.getDbName(), tbl.getTableName(), new 
Partition(tbl, newTPart.getTPartition()), environmentContext);
{noformat}
can be made into a method to be called in both place to make it clear that both 
are doing exactly the same thing

In the comment, I'd modify the table example not to use transactional table as 
an example

Otherwise looks fine


was (Author: ekoifman):
Maybe 
{noformat}
EnvironmentContext environmentContext = null;
1602              if (hasFollowingStatsTask) {
1603                environmentContext = new EnvironmentContext();
1604                
environmentContext.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, 
StatsSetupConst.TRUE);
1605              }
1606              alterPartition(tbl.getDbName(), tbl.getTableName(), new 
Partition(tbl, newTPart.getTPartition()), environmentContext);
{noformat}
can be made into a method to be called in both place to make it clear that both 
are doing exactly the same thing

In the comment, I'd modify the table example not to use transactional table as 
an example

> 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) 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}



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

Reply via email to