[
https://issues.apache.org/jira/browse/PHOENIX-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086532#comment-14086532
]
rajeshbabu commented on PHOENIX-1126:
-------------------------------------
[~jeffreyz]
Here are the high level steps how writes happen in transactional way in hindex.
1) When we do puts/deletes on user table first we prepare index updates in
prePut/Delete
2) Acquire locks on both data and index regions (acquire lock on index region
through postStartRegionOperation hook)
3) Then write data table puts/deletes to data region memstore(s)
4) write wal edits of both user and index records at time through wal hooks.
5) In postBatchMutate hook write index table puts/deletes to index region
memstore(s). at the end these puts/deletes visible for reading.(this is not a
problem because hindex won't have support to read index table directly).
6) make data region puts/deletes visible for reading.
7) Then release the locks on both data and index regions(release lock on index
region through postCloseRegionOperation hook).
Let's suppose
if we get any failures
i) before 4th step any way we rollback memstore and release both regions locks
so no writes happen to any region.
ii)While writing the wal edits to log then also we rollback data region
memstore(s) so updates won't happen to any region.
iii)after 4th or 5th step we will retry or abort RS. Since we have written
edits of both data and index updates to log at a time so while replaying both
user and index edits will be replayed.
Thanks.
> Make local index updates transactional with the data updates
> ------------------------------------------------------------
>
> Key: PHOENIX-1126
> URL: https://issues.apache.org/jira/browse/PHOENIX-1126
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: James Taylor
> Assignee: rajeshbabu
>
> Given that local index updates happen on the same region server as the data
> updates, we should be able to make them transaction: either both the data and
> index updates succeed, or neither of them do. I seem to remember [~lhofhansl]
> mentioned that the all or none behavior of HRegion.mutateRowsWithLocks()
> could be emulated across tables if you knew that the mutations were all local.
--
This message was sent by Atlassian JIRA
(v6.2#6252)