You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Marta Kuczora (Jira)" <ji...@apache.org> on 2019/10/21 08:11:00 UTC
[jira] [Updated] (HIVE-22375)
ObjectStore.lockNotificationSequenceForUpdate is leaking query in case of
error
[ https://issues.apache.org/jira/browse/HIVE-22375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marta Kuczora updated HIVE-22375:
---------------------------------
Description:
In the ObjectStore.lockNotificationSequenceForUpdate method, the query doesn't get closed if an error occur:
{noformat}
private void lockNotificationSequenceForUpdate() throws MetaException {
if (sqlGenerator.getDbProduct() == DatabaseProduct.DERBY && directSql != null) {
// Derby doesn't allow FOR UPDATE to lock the row being selected (See https://db.apache
// .org/derby/docs/10.1/ref/rrefsqlj31783.html) . So lock the whole table. Since there's
// only one row in the table, this shouldn't cause any performance degradation.
new RetryingExecutor(conf, () -> {
directSql.lockDbTable("NOTIFICATION_SEQUENCE");
}).run();
} else {
String selectQuery = "select \"NEXT_EVENT_ID\" from \"NOTIFICATION_SEQUENCE\"";
String lockingQuery = sqlGenerator.addForUpdateClause(selectQuery);
new RetryingExecutor(conf, () -> {
prepareQuotes();
Query query = pm.newQuery("javax.jdo.query.SQL", lockingQuery);
query.setUnique(true);
// only need to execute it to get db Lock
query.execute();
query.closeAll();
}).run();
}
}
{noformat}
was:
In the ObjectStore.lockNotificationSequenceForUpdate method, the query doesn't get closed if an error occur:
{noformat}
private void lockNotificationSequenceForUpdate() throws MetaException {
if (sqlGenerator.getDbProduct() == DatabaseProduct.DERBY && directSql != null) {
new RetryingExecutor(conf, () -> {
directSql.lockDbTable("NOTIFICATION_SEQUENCE");
}).run();
} else {
String selectQuery = "select \"NEXT_EVENT_ID\" from \"NOTIFICATION_SEQUENCE\"";
String lockingQuery = sqlGenerator.addForUpdateClause(selectQuery);
new RetryingExecutor(conf, () -> {
prepareQuotes();
Query query = pm.newQuery("javax.jdo.query.SQL", lockingQuery);
query.setUnique(true);
// only need to execute it to get db Lock
query.execute();
query.closeAll();
}).run();
}
}
{noformat}
> ObjectStore.lockNotificationSequenceForUpdate is leaking query in case of error
> -------------------------------------------------------------------------------
>
> Key: HIVE-22375
> URL: https://issues.apache.org/jira/browse/HIVE-22375
> Project: Hive
> Issue Type: Bug
> Components: Standalone Metastore
> Affects Versions: 4.0.0
> Reporter: Marta Kuczora
> Assignee: Marta Kuczora
> Priority: Minor
>
> In the ObjectStore.lockNotificationSequenceForUpdate method, the query doesn't get closed if an error occur:
> {noformat}
> private void lockNotificationSequenceForUpdate() throws MetaException {
> if (sqlGenerator.getDbProduct() == DatabaseProduct.DERBY && directSql != null) {
> // Derby doesn't allow FOR UPDATE to lock the row being selected (See https://db.apache
> // .org/derby/docs/10.1/ref/rrefsqlj31783.html) . So lock the whole table. Since there's
> // only one row in the table, this shouldn't cause any performance degradation.
> new RetryingExecutor(conf, () -> {
> directSql.lockDbTable("NOTIFICATION_SEQUENCE");
> }).run();
> } else {
> String selectQuery = "select \"NEXT_EVENT_ID\" from \"NOTIFICATION_SEQUENCE\"";
> String lockingQuery = sqlGenerator.addForUpdateClause(selectQuery);
> new RetryingExecutor(conf, () -> {
> prepareQuotes();
> Query query = pm.newQuery("javax.jdo.query.SQL", lockingQuery);
> query.setUnique(true);
> // only need to execute it to get db Lock
> query.execute();
> query.closeAll();
> }).run();
> }
> }
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)