[
https://issues.apache.org/jira/browse/PHOENIX-6090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17181689#comment-17181689
]
Kadir OZDEMIR commented on PHOENIX-6090:
----------------------------------------
[~larsh], I noticed that in IndexRegionObserver, we inadvertently changed the
order of local index versus data table updates. Indexer (the old coproc)
updates both local and global index tables after the data table is updated.
However, IndexRegionObserver updates them before the data table is updated.
This should be the root cause of this bug. If the data table update is aborted
because of region splits but the local index update is made then you would get
extra version of index rows when the data table update is retried. Your test
overwrites the rows, and the overwrites will only remove one of the versions of
these index rows. This should be the reason that you observed that the index
has more rows than the data table has when you split and overwrite the data
table. The fix is to move the local index updates to the post batch mutate
hook. Please feel free to make the change and verify it if you like to do that.
> Local indexes get out of sync after changes for global consistent indexes
> -------------------------------------------------------------------------
>
> Key: PHOENIX-6090
> URL: https://issues.apache.org/jira/browse/PHOENIX-6090
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.1.0
> Reporter: Lars Hofhansl
> Assignee: Kadir OZDEMIR
> Priority: Blocker
> Fix For: 5.1.0, 4.15.1, 4.16.0
>
> Attachments: 6090-test-4.x.txt, 6090-test-v2-4.x.txt
>
>
> {code:java}
> > select /*+ NO_INDEX */ count(*) from test;
> +----------+
> | COUNT(1) |
> +----------+
> | 522244 |
> +----------+
> 1 row selected (1.213 seconds)
> > select count(*) from test;
> +---------+
> | COUNT(1) |
> +----------+
> | 522245 |
> +----------+
> 1 row selected (1.23 seconds)
> {code}
>
> This was after I did some insert and a bunch of splits (but not in parallel).
> It's not, yet, clear under what circumstances that exactly happens. Just that
> after a while it happens.
> This is Phoenix built from master and HBase built from branch-2.3. (Client
> and server versions of HBase are matching).
> I've since tried with Phoenix 4.x and see the same issue - also see attached
> tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)