From 0d4c83daf7174788d2a83321c33a215a9bdfa89f Mon Sep 17 00:00:00 2001 From: sueloverso Date: Tue, 14 Jun 2016 00:39:20 -0400 Subject: WT-2696 Wait if we find an unbuffered flag without the size set yet. (#2794) * Modify recovery test to use multiple threads to reproduce this issue. --- src/log/log_slot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/log/log_slot.c') diff --git a/src/log/log_slot.c b/src/log/log_slot.c index b7efb1d9018..47071211450 100644 --- a/src/log/log_slot.c +++ b/src/log/log_slot.c @@ -94,6 +94,17 @@ retry: if (WT_LOG_SLOT_DONE(new_state)) *releasep = 1; slot->slot_end_lsn = slot->slot_start_lsn; + /* + * A thread setting the unbuffered flag sets the unbuffered size after + * setting the flag. There could be a delay between a thread setting + * the flag, a thread closing the slot, and the original thread setting + * that value. If the state is unbuffered, wait for the unbuffered + * size to be set. + */ + while (WT_LOG_SLOT_UNBUFFERED_ISSET(old_state) && + slot->slot_unbuffered == 0) + __wt_yield(); + end_offset = WT_LOG_SLOT_JOINED_BUFFERED(old_state) + slot->slot_unbuffered; slot->slot_end_lsn.l.offset += (uint32_t)end_offset; -- cgit v1.2.1