[
https://issues.apache.org/jira/browse/PHOENIX-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16019765#comment-16019765
]
Rajeshbabu Chintaguntla commented on PHOENIX-3827:
--------------------------------------------------
[~jamestaylor]
bq. The region.mutateRowsWithLocks() leads to the call of the regular Indexer
coprocessor hooks, the new local index rows get generated and added as expected
though your new miniBatchOp method, but then they don't appear to be written.
Why wouldn't they be?
What ever mutations added by Indexer coprocessor hooks will be consumed in
HRegion#doMiniBatchMutation but it's not the case in mutateRowsWithLocks. We
need to raise an issue in HBase to support the same in mutateRowsWithLocks as
well.
{noformat}
for (int i = firstIndex; i < lastIndexExclusive; i++) {
if (batchOp.retCodeDetails[i].getOperationStatusCode() !=
OperationStatusCode.NOT_RUN) {
// lastIndexExclusive was incremented above.
continue;
}
// we pass (i - firstIndex) below since the call expects a relative
index
Mutation[] cpMutations =
miniBatchOp.getOperationsFromCoprocessors(i - firstIndex);
if (cpMutations == null) {
continue;
}
// Else Coprocessor added more Mutations corresponding to the
Mutation at this index.
for (int j = 0; j < cpMutations.length; j++) {
Mutation cpMutation =
miniBatchOp.getOperationsFromCoprocessors(i)[j];
Map<byte[], List<Cell>> cpFamilyMap =
cpMutation.getFamilyCellMap();
checkAndPrepareMutation(cpMutation, isInReplay, cpFamilyMap, now);
// Acquire row locks. If not, the whole batch will fail.
acquiredRowLocks.add(getRowLock(cpMutation.getRow(), true));
if (cpMutation.getDurability() == Durability.SKIP_WAL) {
recordMutationWithoutWal(cpFamilyMap);
}
// Returned mutations from coprocessor correspond to the Mutation
at index i. We can
// directly add the cells from those mutations to the familyMaps
of this mutation.
mergeFamilyMaps(familyMaps[i], cpFamilyMap); // will get added to
the memstore later
}
{noformat}
bq. We use mutateRowsWithLocks in UngroupedAggregateRegionObserver in a similar
way, and everything seems to work correctly.
We are using HRegion#batchMutate only where this patch works perfectly.
> Make use of HBASE-15600 to write local index mutations along with data
> mutations atomically
> -------------------------------------------------------------------------------------------
>
> Key: PHOENIX-3827
> URL: https://issues.apache.org/jira/browse/PHOENIX-3827
> Project: Phoenix
> Issue Type: Bug
> Reporter: Rajeshbabu Chintaguntla
> Assignee: Rajeshbabu Chintaguntla
> Fix For: 4.11.0
>
> Attachments: PHOENIX-3827.patch, PHOENIX-3827_v2.patch,
> PHOENIX-3827_v3.patch
>
>
> After HBASE-15600 we can add mutations of the same table from coprocessors so
> we can write local index data along with data mutations so it will be atomic.
> This we can do in 4.x-HBase-1.3 version.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)