diff options
author | unknown <stewart@mysql.com> | 2006-06-14 00:21:46 +1000 |
---|---|---|
committer | unknown <stewart@mysql.com> | 2006-06-14 00:21:46 +1000 |
commit | d2a491b57c792cf04d8c35cf9f2d5204b806b5ef (patch) | |
tree | 33e2ee694184efa712a19bd1b3abc15e9f523e9c /storage/ndb/src/kernel/blocks/backup/Backup.cpp | |
parent | def8e0ce9c47c2eb913e4e1d5c20e9cd78293f2b (diff) | |
download | mariadb-git-d2a491b57c792cf04d8c35cf9f2d5204b806b5ef.tar.gz |
BUG#17928 testBackup fails in error handling testcases
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
Diffstat (limited to 'storage/ndb/src/kernel/blocks/backup/Backup.cpp')
-rw-r--r-- | storage/ndb/src/kernel/blocks/backup/Backup.cpp | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.cpp b/storage/ndb/src/kernel/blocks/backup/Backup.cpp index 07df1db862b..e593b5ff044 100644 --- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp +++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp @@ -3819,19 +3819,37 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr) FsAppendReq::SignalLength, JBA); return; }//if - - filePtr.p->fileRunning = 0; - filePtr.p->fileClosing = 1; - - FsCloseReq * req = (FsCloseReq *)signal->getDataPtrSend(); - req->filePointer = filePtr.p->filePointer; - req->userPointer = filePtr.i; - req->userReference = reference(); - req->fileFlag = 0; + +#ifdef DEBUG_ABORT + Uint32 running= filePtr.p->fileRunning; + Uint32 closing= filePtr.p->fileClosing; +#endif + + if(!filePtr.p->fileClosing) + { + filePtr.p->fileRunning = 0; + filePtr.p->fileClosing = 1; + + FsCloseReq * req = (FsCloseReq *)signal->getDataPtrSend(); + req->filePointer = filePtr.p->filePointer; + req->userPointer = filePtr.i; + req->userReference = reference(); + req->fileFlag = 0; +#ifdef DEBUG_ABORT + ndbout_c("***** a FSCLOSEREQ filePtr.i = %u run=%d cl=%d", filePtr.i, + running, closing); +#endif + sendSignal(NDBFS_REF, GSN_FSCLOSEREQ, signal, FsCloseReq::SignalLength, JBA); + } + else + { #ifdef DEBUG_ABORT - ndbout_c("***** a FSCLOSEREQ filePtr.i = %u", filePtr.i); + ndbout_c("***** a NOT SENDING FSCLOSEREQ filePtr.i = %u run=%d cl=%d", + filePtr.i, + running, closing); #endif - sendSignal(NDBFS_REF, GSN_FSCLOSEREQ, signal, FsCloseReq::SignalLength, JBA); + + } } @@ -4082,9 +4100,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) jam(); continue; }//if - - filePtr.p->fileClosing = 1; - + if(filePtr.p->fileRunning == 1){ jam(); #ifdef DEBUG_ABORT @@ -4093,7 +4109,10 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) filePtr.p->operation.dataBuffer.eof(); } else { jam(); - + filePtr.p->fileClosing = 1; + filePtr.p->operation.dataBuffer.eof(); + checkFile(sig, filePtr); // make sure we write everything before closing + FsCloseReq * req = (FsCloseReq *)sig->getDataPtrSend(); req->filePointer = filePtr.p->filePointer; req->userPointer = filePtr.i; @@ -4555,7 +4574,6 @@ Backup::execLCP_PREPARE_REQ(Signal* signal) jam(); BackupFilePtr filePtr; c_backupFilePool.getPtr(filePtr, ptr.p->dataFilePtr); - filePtr.p->fileClosing = 1; filePtr.p->operation.dataBuffer.eof(); } @@ -4647,7 +4665,6 @@ Backup::execEND_LCPREQ(Signal* signal) BackupFilePtr filePtr; c_backupFilePool.getPtr(filePtr, ptr.p->dataFilePtr); - filePtr.p->fileClosing = 1; filePtr.p->operation.dataBuffer.eof(); return; } |