Samarth Jain created PHOENIX-1943:
-------------------------------------

             Summary: UPSERT SELECT is not thread safe
                 Key: PHOENIX-1943
                 URL: https://issues.apache.org/jira/browse/PHOENIX-1943
             Project: Phoenix
          Issue Type: Bug
            Reporter: Samarth Jain
            Assignee: Samarth Jain


When UPSERT SELECT is run on the client side, we use the 
UpsertingParallelIteratorFactory where every iterator returned by newIterator() 
method calls the UpsertSelect method. Each of these mutating iterators are 
called from different threads in parallel. However, the upsertSelect() method 
called from each of these iterators uses the same mutationState instance which 
is not thread safe. 

In particular this code in UpsertCompiler#upsertSelect

{code}
PhoenixStatement statement = context.getStatement();
PhoenixConnection connection = statement.getConnection();
.....
.....
// Commit a batch if auto commit is true and we're at our batch size
                if (isAutoCommit && rowCount % batchSize == 0) {
                    MutationState state = new MutationState(tableRef, mutation, 
0, maxSize, connection);
                    connection.getMutationState().join(state);
                    connection.commit();
                    mutation.clear();
                }
{code}

[~rajeshbabu] - I will try and get a fix for this by EOD today.

FYI [~jamestaylor]




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to