[ 
https://issues.apache.org/jira/browse/PHOENIX-2510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Taylor resolved PHOENIX-2510.
-----------------------------------
    Resolution: Fixed

> 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
>
>         Attachments: PHOENIX-2510.patch
>
>
> 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)

Reply via email to