Fix #31: Entries can disappear when deleted key is reassigned during a migration
authorJeff Preshing <filter-github@preshing.com>
Sat, 30 Dec 2017 16:33:49 +0000 (11:33 -0500)
committerJeff Preshing <filter-github@preshing.com>
Sat, 30 Dec 2017 16:33:49 +0000 (11:33 -0500)
commitfdaa2b5b2a5c1d2e40a7b8ffb1616933c9feda6d
tree45c81f983d2c302bb5b357af99fe575c98d1c3be
parent14f74b75cedcd90e8fb735d6c6845f9f4c022785
Fix #31: Entries can disappear when deleted key is reassigned during a migration

Bug was in the Mutator classes. In the Mutator constructor: If an existing
cell was found, and that cell's value was Redirect, Mutator::m_value was
assigned to Redirect. The constructor would then loop a second time.
On the second iteration of the loop, if no existing cell was found, a new
cell was inserted, but Mutator::m_value was left set to Redirect. This
left the Mutator in an inconsistent state, so that on the next exchangeValue(),
it thought there was a racing write to the same key (which there wasn't), and
neglected to write the new value.

Fix is to avoid ever setting Mutator::m_value to Redirect.
.gitignore
junction/ConcurrentMap_Grampa.h
junction/ConcurrentMap_Leapfrog.h
junction/ConcurrentMap_Linear.h
samples/MapCorrectnessTests/MapCorrectnessTests.cpp
samples/MapCorrectnessTests/TestDoubleAssign.h [new file with mode: 0644]