You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Vincent Poon (JIRA)" <ji...@apache.org> on 2017/09/15 00:14:00 UTC

[jira] [Updated] (PHOENIX-4214) Scans which write should not block region split or close

     [ https://issues.apache.org/jira/browse/PHOENIX-4214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vincent Poon updated PHOENIX-4214:
----------------------------------
    Attachment: splitDuringUpsertSelect_wip.patch

Here's a patch that has following tests to reproduce the issue, they're part of a larger suite I was writing to test global mutable secondary indexing:
testRegionCloseDuringUpsertSelect
testSplitDuringUpsertSelect
Patch includes something like what Samarth Jain suggested - when a split/close has been requested, I throw IOException for any new incoming scans that require a write. This at least allows the split/close to happen eventually, as the scansRefCounter won't go up, while still allowing for the existing operations in progress to finish.
The loop in preClose is rather dangerous, since if a scanner thread is interrupted, there is no guarantee the finally block will run, and so the scanRefCounter might never get back to 0. I encountered this in the test when the miniCluster was attempting to shutdown, not sure if there are other scenarios where this might happen in actual production usage. I throw an IOException during an interrupt there to avoid this.
Note that you currently can't run all the tests in the suite, so just run the individual tests you want to try.

> Scans which write should not block region split or close
> --------------------------------------------------------
>
>                 Key: PHOENIX-4214
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4214
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.12.0
>            Reporter: Vincent Poon
>         Attachments: splitDuringUpsertSelect_wip.patch
>
>
> PHOENIX-3111 introduced a scan reference counter which is checked during region preSplit and preClose.  However, a steady stream of UPSERT SELECT or DELETE can keep the count above 0 indefinitely, preventing or greatly delaying a region split or close.
> We should try to avoid starvation of the split / close request, and fail/reject queries where appropriate.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)