[
https://issues.apache.org/jira/browse/HIVE-25113?focusedWorklogId=596918&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-596918
]
ASF GitHub Bot logged work on HIVE-25113:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 14/May/21 21:11
Start Date: 14/May/21 21:11
Worklog Time Spent: 10m
Work Description: kishendas commented on a change in pull request #2272:
URL: https://github.com/apache/hive/pull/2272#discussion_r632810253
##########
File path:
ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandlerWithOneConnection.java
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore.txn;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.GetValidWriteIdsRequest;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.metastore.utils.TestTxnDbUtil;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+
+/**
+ * Tests to ensure function works even with connection pool size is 1
+ */
+public class TestTxnHandlerWithOneConnection {
+ static final private String CLASS_NAME = TxnHandler.class.getName();
+ private static final Logger LOG = LoggerFactory.getLogger(CLASS_NAME);
+
+ private HiveConf conf = new HiveConf();
+ private TxnStore txnHandler;
+
+ public TestTxnHandlerWithOneConnection() throws Exception {
+ TestTxnDbUtil.setConfValues(conf);
+ TestTxnDbUtil.prepDb(conf);
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ Configuration conf = ctx.getConfiguration();
+ conf.getLoggerConfig(CLASS_NAME).setLevel(Level.DEBUG);
+ ctx.updateLoggers(conf);
+ tearDown();
+ }
+
+ @Test
+ public void testGetValidWriteIds() throws Exception {
+ GetValidWriteIdsRequest req = new GetValidWriteIdsRequest();
+ req.setFullTableNames(Collections.singletonList("foo.bar"));
+ txnHandler.getValidWriteIds(req);
Review comment:
How are you verifying that same connection is reused ?
Don't you have to call multiple getValidWriteIds in parallel and make sure
they don't time out ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 596918)
Time Spent: 1h 10m (was: 1h)
> Connection starvation in TxnHandler.getValidWriteIds
> ----------------------------------------------------
>
> Key: HIVE-25113
> URL: https://issues.apache.org/jira/browse/HIVE-25113
> Project: Hive
> Issue Type: Bug
> Components: Transactions
> Reporter: Yu-Wen Lai
> Assignee: Yu-Wen Lai
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
>
> The current code looks like below.
> {code:java}
> dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
> validTxnList = TxnUtils.createValidReadTxnList(getOpenTxns(), 0);
> {code}
> In the function getOpenTxns, it will request another connection from pool.
> That is, this thread already held a connection, however, it would request for
> another connection. When there are more than 10 (default connection pool
> size) simultaneous getValidWriteIds requests, it can cause a starvation
> problem. In that situation, each thread holds a connection and waits for
> another connection. Then, we will see the following exception after timeout.
> {code:java}
> metastore.RetryingHMSHandler: MetaException(message:Unable to select from
> transaction database, java.sql.SQLTransientConnectionException: HikariPool-3
> - Connection is not available, request timed out after 30000ms.{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)