@ -1865,9 +1865,11 @@ Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
w . done = false ;
w . done = false ;
w . timeout_hint_us = kNoTimeOut ;
w . timeout_hint_us = kNoTimeOut ;
Status s ;
{
WriteContext context ;
WriteContext context ;
mutex_ . Lock ( ) ;
MutexLock guard_lock ( & mutex_ ) ;
Status s = BeginWrite ( & w , 0 ) ;
s = BeginWrite ( & w , 0 ) ;
assert ( s . ok ( ) & & ! w . done ) ; // No timeout and nobody should do our job
assert ( s . ok ( ) & & ! w . done ) ; // No timeout and nobody should do our job
// SetNewMemtableAndNewLogFile() will release and reacquire mutex
// SetNewMemtableAndNewLogFile() will release and reacquire mutex
@ -1879,7 +1881,7 @@ Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
assert ( ! writers_ . empty ( ) ) ;
assert ( ! writers_ . empty ( ) ) ;
assert ( writers_ . front ( ) = = & w ) ;
assert ( writers_ . front ( ) = = & w ) ;
EndWrite ( & w , & w , s ) ;
EndWrite ( & w , & w , s ) ;
mutex_ . Unlock ( ) ;
}
if ( s . ok ( ) & & options . wait ) {
if ( s . ok ( ) & & options . wait ) {