summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/ndb/src/kernel/blocks/backup/Backup.cpp51
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp8
2 files changed, 41 insertions, 18 deletions
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.cpp b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
index 41f140ab5ae..2e8d8b548ce 100644
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -3932,19 +3932,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);
+
+ }
}
@@ -4195,9 +4213,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
jam();
continue;
}//if
-
- filePtr.p->fileClosing = 1;
-
+
if(filePtr.p->fileRunning == 1){
jam();
#ifdef DEBUG_ABORT
@@ -4206,7 +4222,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;
@@ -4668,7 +4687,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();
}
@@ -4760,7 +4778,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;
}
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index b0a4d6264fb..a3b6104a059 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -228,6 +228,7 @@ AsyncFile::run()
endReq();
return;
default:
+ DEBUG(ndbout_c("Invalid Request"));
abort();
break;
}//switch
@@ -676,6 +677,7 @@ AsyncFile::extendfile(Request* request) {
return 0;
#else
request = request;
+ DEBUG(ndbout_c("no pwrite"));
abort();
return -1;
#endif
@@ -792,6 +794,7 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
bytes_written = return_value;
if(bytes_written == 0){
+ DEBUG(ndbout_c("no bytes written"));
abort();
}
@@ -830,8 +833,10 @@ AsyncFile::closeReq(Request * request)
#else
if (-1 == ::close(theFd)) {
#ifndef DBUG_OFF
- if (theFd == -1)
+ if (theFd == -1) {
+ DEBUG(ndbout_c("close on fd = -1"));
abort();
+ }
#endif
request->error = errno;
}
@@ -899,6 +904,7 @@ AsyncFile::appendReq(Request * request){
return;
}
if(n == 0){
+ DEBUG(ndbout_c("append with n=0"));
abort();
}
size -= n;