From f376d4609042a3d4a4f9c9f6efa3faaae4d42779 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Tue, 15 Jun 2010 23:12:38 +0000 Subject: [PATCH] pull multiops outside of the log latch. (how embarassing...) --- src/stasis/transactional2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/stasis/transactional2.c b/src/stasis/transactional2.c index ccd0293..dc42f06 100644 --- a/src/stasis/transactional2.c +++ b/src/stasis/transactional2.c @@ -157,9 +157,26 @@ void Tupdate(int xid, pageid_t page, assert(xact->prevLSN == e->LSN); DEBUG("Tupdate() e->LSN: %ld\n", e->LSN); - stasis_operation_do(e, p); + LogEntry * multiE = 0; + if(page == MULTI_PAGEID) { + size_t len = sizeofLogEntry(stasis_log_file, e); + multiE = malloc(len); + memcpy(multiE, e, len); + } else { + stasis_operation_do(e, p); + } stasis_log_file->write_entry_done(stasis_log_file, e); + if(page == MULTI_PAGEID) { + // Note: This is not atomic with the log entry. MULTI operations are a special case of segments. + // We assume that any concurrent updates to the backing pages commute with this operation. + // For this to be true, either: + // (a) the pages must not have LSNs in their headers, or + // (b) we must have an implicit latch (which should be the case for allocation requests). + stasis_operation_do(multiE, 0); + free(multiE); + } + if(p) unlock(p->rwlatch); if(p) releasePage(p); }