Fix failing assert by replacing trywritelock with writelock in concurrentBufferManager. Revision -r1380 relaxed an invariant, causing the trylock to sometimes contend with other threads

This commit is contained in:
Sears Russell 2010-04-26 04:07:38 +00:00
parent 74803d354e
commit ee6d0768d3

View file

@ -201,8 +201,10 @@ static Page * chLoadPageImpl_helper(stasis_buffer_manager_t* bm, int xid, const
p = tls->p;
tls->p = NULL;
int succ = trywritelock(p->loadlatch, 0);
assert(succ);
// Need to acquire lock because some loadPage (in race with us) could have a
// pointer to the page. However, we must be the only thread
// that has the page in its TLS, or something is seriously wrong.
writelock(p->loadlatch, 0);
// this has to happen before the page enters LRU; concurrentWrapper (and perhaps future implementations) hash on pageid.
p->id = pageid;