[Date Prev][Date Next]
(ITS#8209) Broken MDB_CP_COMPACT threading
Full_Name: Hallvard B Furuseth
Submission from: (NULL) (188.8.131.52)
Submitted by: hallvard
mdb_env_copyfd1() and mdb_env_copythr() synchronize via my->mc_new,
copythr() starts before there is any data to consume, and copyfd1()
does not tell it (by setting mc_new and signalling) when there is
data. Instead it sets mc_new before it has finished producing the
data. I suppose copythr just waits for a spurious wakeup, I haven't
looked closely. It got it right originally when copyfd1 did not start
the new thread until data (metapages) was ready. Or copyfd1 could
start with mc_new = 0, and set it and signal when data is ready.
copythr holds the mutex while writing. That's not how conds are
supposed to be used. Threads are supposed to grab the mutex briefly
around code which operates on mc_new.
mc_status can be lost. Copyfd1 does not always use it, or it discards
it. And copythr should set mc_new=0 before exiting also when setting
mc_status. so copyfd1 won't just sit and wait.