You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2015/12/10 19:35:11 UTC
[jira] [Created] (PHOENIX-2510) ReserveNSequence opens new
connection per invocation
James Taylor created PHOENIX-2510:
-------------------------------------
Summary: ReserveNSequence opens new connection per invocation
Key: PHOENIX-2510
URL: https://issues.apache.org/jira/browse/PHOENIX-2510
Project: Phoenix
Issue Type: Bug
Reporter: James Taylor
Assignee: Siddhi Mehta
Fix For: 4.7.0
Happened to be looking at this code and I noticed that a connection member variable is set for each call to exec by calling ConnectionUtil.getOutputConnection regardless of the initialization code above it. Doesn't look right to me.
{code}
@Override
public Long exec(Tuple input) throws IOException {
Preconditions.checkArgument(input != null && input.size() >= 2, INVALID_TUPLE_MESSAGE);
Long numToReserve = (Long)(input.get(0));
Preconditions.checkArgument(numToReserve > 0, INVALID_NUMBER_MESSAGE);
String sequenceName = (String)input.get(1);
Preconditions.checkNotNull(sequenceName, EMPTY_SEQUENCE_NAME_MESSAGE);
// It will create a connection when called for the first Tuple per task.
// The connection gets cleaned up in finish() method
if (connection == null) {
initConnection();
}
ResultSet rs = null;
try {
connection = ConnectionUtil.getOutputConnection(configuration);
String sql = getNextNSequenceSelectStatement(Long.valueOf(numToReserve), sequenceName);
rs = connection.createStatement().executeQuery(sql);
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)