Bug #105866 Failure in testOIBasic -case d
Submitted: 10 Dec 2021 15:20 Modified: 13 Dec 2021 12:19
Reporter: Mikael Ronström Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:8.0.27 OS:Any
Assigned to: CPU Architecture:Any

[10 Dec 2021 15:20] Mikael Ronström
Description:
    The problem was pkupdatescanread
    This test case runs 4 threads where some thread can perform pkupdate,
    some perform scans using index and some makes lookups using a unique
    hash index. The problem is related to performing updates in pkupdate
    concurrent with reads using unique keys.
    
    pkupdate can update the rows in parallel with reads in hashindexread.
    This means that the result of the operation is random, this means that
    the test case fails regularly.
    
    To make the test case predictable in its result we have to stop
    read UK and pkupdate to not run concurrently.
    

How to repeat:
testOIBasic -case d

Suggested fix:
    Introduce new state StRead and m_read_ref_count to keep track of
    number of concurrent readers.
    
    Ensure that writes will not be allowed when the state is StRead.
    Similarly ensure that reads will not be allowed to proceed when
    the state is not equal to StCommit.
    
    Change hashindexread such that it calls a selrow method that sets
    state to StRead and increments reference counter. Ensure that the
    state is reset after completion in a new method called post_read.
    Ensure that both those methods are called under mutex protection.
[13 Dec 2021 12:19] MySQL Verification Team
Thanks for the report Mikael,

all best
Bogdan