Rajeshbabu Chintaguntla created PHOENIX-7257:
------------------------------------------------

             Summary: Writes to index tables on immutable table can be parallel 
for better performance
                 Key: PHOENIX-7257
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7257
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Rajeshbabu Chintaguntla
            Assignee: Rajeshbabu Chintaguntla


3 phase commit has introduced to ensure strong consistency of between data 
table and index tables when the data table is immutable. 
Writing data to indexes happening serially which can be made parallel to get 
better performance. Here is the code snippet in MutationState.
{noformat}
    private void sendMutations(Iterator<Entry<TableInfo, List<Mutation>>> 
mutationsIterator, Span span, ImmutableBytesWritable indexMetaDataPtr, boolean 
isVerifiedPhase)
            throws SQLException {
        while (mutationsIterator.hasNext()) {
            Entry<TableInfo, List<Mutation>> pair = mutationsIterator.next();
            TableInfo tableInfo = pair.getKey();
            byte[] htableName = tableInfo.getHTableName().getBytes();
            List<Mutation> mutationList = pair.getValue();
            List<List<Mutation>> mutationBatchList =
                    getMutationBatchList(batchSize, batchSizeBytes, 
mutationList);
                ....

                Table hTable = 
connection.getQueryServices().getTable(htableName);
                try {
                    if (table.isTransactional()) {
                        // Track tables to which we've sent uncommitted data
                        if (tableInfo.isDataTable()) {
                            
uncommittedPhysicalNames.add(table.getPhysicalName().getString());
                            phoenixTransactionContext.markDMLFence(table);
                        }
                        // Only pass true for last argument if the index is 
being written to on it's own (i.e. initial
                        // index population), not if it's being written to for 
normal maintenance due to writes to
                        // the data table. This case is different because the 
initial index population does not need
                        // to be done transactionally since the index is only 
made active after all writes have
                        // occurred successfully.
                        hTable = 
phoenixTransactionContext.getTransactionalTableWriter(connection, table, 
hTable, tableInfo.isDataTable() && table.getType() == PTableType.INDEX);
                    }
                    .....

                            hTable.batch(mutationBatch, null);
                        }
                   ....
        }
    }
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to