[
https://issues.apache.org/jira/browse/PHOENIX-7830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Kyle Purtell updated PHOENIX-7830:
-----------------------------------------
Description: {{MutableIndexFailureIT}} has two independent bugs that cause
flaky and cascading test failures. First, the outer class declares its own
static volatile {{FAIL_WRITE}} field that shadows
{{{}FailingRegionObserver.FAIL_WRITE{}}}, so the finally block in
{{testIndexWriteFailure}} resets the dead outer field and leaves
{{FailingRegionObserver.FAIL_WRITE}} stuck at true when the test fails mid-way,
breaking subsequent tests in the same fork. Second,
{{FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY}} is not declared volatile
even though it is written by app threads in {{addRowsInTableDuringRetry}} and
read by region server handler threads in {{{}preBatchMutate{}}}, so the RS
thread can observe a stale false, miss the retry toggle, and surface a
{{CommitException}} that fails the assertion. The fix removes the shadowed
outer {{FAIL_WRITE}} field, retargets the finally block to reset
{{{}FailingRegionObserver.FAIL_WRITE{}}}, and marks
{{FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY}} volatile to guarantee
cross-thread visibility. (was: `MutableIndexFailureIT` has two independent
bugs that cause flaky and cascading test failures. First, the outer class
declares its own static volatile `FAIL_WRITE` field that shadows
`FailingRegionObserver.FAIL_WRITE`, so the finally block in
`testIndexWriteFailure` resets the dead outer field and leaves
`FailingRegionObserver.FAIL_WRITE` stuck at true when the test fails mid-way,
breaking subsequent tests in the same fork. Second,
`FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY` is not declared volatile
even though it is written by app threads in `addRowsInTableDuringRetry` and
read by region server handler threads in `preBatchMutate`, so the RS thread can
observe a stale false, miss the retry toggle, and surface a `CommitException`
that fails the assertion. The fix removes the shadowed outer `FAIL_WRITE`
field, retargets the finally block to reset `FailingRegionObserver.FAIL_WRITE`,
and marks `FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY` volatile to
guarantee cross-thread visibility.)
> De-flake MutableIndexFailureIT
> ------------------------------
>
> Key: PHOENIX-7830
> URL: https://issues.apache.org/jira/browse/PHOENIX-7830
> Project: Phoenix
> Issue Type: Sub-task
> Components: test
> Reporter: Andrew Kyle Purtell
> Assignee: Andrew Kyle Purtell
> Priority: Major
> Fix For: 5.4.0, 5.3.1
>
>
> {{MutableIndexFailureIT}} has two independent bugs that cause flaky and
> cascading test failures. First, the outer class declares its own static
> volatile {{FAIL_WRITE}} field that shadows
> {{{}FailingRegionObserver.FAIL_WRITE{}}}, so the finally block in
> {{testIndexWriteFailure}} resets the dead outer field and leaves
> {{FailingRegionObserver.FAIL_WRITE}} stuck at true when the test fails
> mid-way, breaking subsequent tests in the same fork. Second,
> {{FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY}} is not declared
> volatile even though it is written by app threads in
> {{addRowsInTableDuringRetry}} and read by region server handler threads in
> {{{}preBatchMutate{}}}, so the RS thread can observe a stale false, miss the
> retry toggle, and surface a {{CommitException}} that fails the assertion. The
> fix removes the shadowed outer {{FAIL_WRITE}} field, retargets the finally
> block to reset {{{}FailingRegionObserver.FAIL_WRITE{}}}, and marks
> {{FailingRegionObserver.TOGGLE_FAIL_WRITE_FOR_RETRY}} volatile to guarantee
> cross-thread visibility.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)