[
https://issues.apache.org/jira/browse/HIVE-24463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17282293#comment-17282293
]
Janos Kovacs commented on HIVE-24463:
-------------------------------------
[~belugabehr] I'm not sure if LAST_INSERT_ID() usage here is a good idea. It's
not only non deterministic in some cases but also does not return the highest
value for next_val value in other cases:
* for batched value generation it returns the first value of the batch which
is the smallest value not the highest one which would be needed for next_val
* for rolled back sessions it does not return the highest value related the
last successful value generated
While it's more elegant to use the DB Engine's solution, this function -
last_insert_id() - does not fit for the logic here.
> Add special case for Derby and MySQL in Get Next ID DbNotificationListener
> --------------------------------------------------------------------------
>
> Key: HIVE-24463
> URL: https://issues.apache.org/jira/browse/HIVE-24463
> Project: Hive
> Issue Type: Improvement
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> * Derby does not support {{SELECT FOR UPDATE}} statements
> * MySQL can be optimized to use {{LAST_INSERT_ID()}}
>
> Debry tables are locked in other parts of the code already, but not in this
> path.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)