Add missing page lock acquisition to unit test.

This commit is contained in:
Sears Russell 2009-08-08 07:52:02 +00:00
parent 4d2e70f9f3
commit 3760fd1fea

View file

@ -69,6 +69,7 @@ void * worker(void*arg) {
for(int i = 0; i < NUM_STEPS; i++) { for(int i = 0; i < NUM_STEPS; i++) {
pageid_t page = myrandom(NUM_PAGES); pageid_t page = myrandom(NUM_PAGES);
Page * p = loadPage(-1, page); Page * p = loadPage(-1, page);
writelock(p->rwlatch, 0);
switch(myrandom(6)) { switch(myrandom(6)) {
case 0: { case 0: {
stasis_dirty_page_table_set_dirty(dpt, p); stasis_dirty_page_table_set_dirty(dpt, p);
@ -86,6 +87,7 @@ void * worker(void*arg) {
stasis_dirty_page_table_minRecLSN(dpt); stasis_dirty_page_table_minRecLSN(dpt);
} break; } break;
case 5: { case 5: {
unlock(p->rwlatch);
releasePage(p); releasePage(p);
pageid_t start = myrandom(NUM_PAGES); pageid_t start = myrandom(NUM_PAGES);
pageid_t stop = myrandom(NUM_PAGES); pageid_t stop = myrandom(NUM_PAGES);
@ -96,9 +98,11 @@ void * worker(void*arg) {
} }
stasis_dirty_page_table_flush_range(dpt, start, stop); stasis_dirty_page_table_flush_range(dpt, start, stop);
p = loadPage(-1, start); p = loadPage(-1, start);
writelock(p->rwlatch, 0);
} break; } break;
default: abort(); default: abort();
}; };
unlock(p->rwlatch);
releasePage(p); releasePage(p);
} }
return 0; return 0;