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.