• unknown's avatar
    BUG#17928 testBackup fails in error handling testcases · d2a491b5
    unknown authored
    Reproduced failure of NFMaster on my laptop, this is the fix with some added
    debug information to help people in the future when they trigger asserts in
    AsyncFile (ndbfs helper threads).
    
    
    storage/ndb/src/kernel/blocks/backup/Backup.cpp:
      In Backup::checkFile(Signal*, BackupFilePtr), only send FSCLOSEREQ if file
      is not already being closed.
      
      Add debug printouts if DEBUG_ABORT is defined to help in finding the problem.
      
      Only set filePtr.p->fileClosing when we are actually closing the file, not when
      we're anticipating a close.
      
      In Backup::closeFiles(Signal*,BackupRecordPtr), when we're closing a file,
      make sure we've queued everything to be written out before sending FSCLOSEREQ.
      
      This solves two problems:
      - in testBackup (NFMaster) on my machine (but not in autotest since the end of
      March for whatever reason), we were hitting an assert in the buffer for files
      saying we hadn't written everything out of the buffer before closing. (for the
      interested, it was 10 bytes of data)
      - once I'd fixed the above (by the checkFile before close) I'd then get really
      nonsensical trace dumps in NFMaster for ERROR_INSERT 10003. It turns out that
      any asserts in AsyncFile (the thread that NDBFS runs to do its bidding) don't
      cause anything to be written out anywhere and you're left scratching your head
      as to what on earth happenned (apart from getting "caught signal 6, aborted").
      What really was happenning was we were then calling FSCLOSEREQ one too many times,
      hitting the assert on trying to close an fd of -1 in AsyncFile.
    storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
      It turns out that any asserts in AsyncFile (the thread that NDBFS runs to do 
      its bidding) don't cause anything to be written out anywhere and you're left 
      scratching your head as to what on earth happenned (apart from getting 
      "caught signal 6, aborted"). What really was happenning was we were then 
      calling FSCLOSEREQ one too many times, hitting the assert on trying to close
      an fd of -1 in AsyncFile.
      
      Added DEBUG printouts for every assert in AsyncFile
    d2a491b5
AsyncFile.cpp 29 KB