diff options
author | unknown <pekka@sama.ndb.mysql.com> | 2007-08-27 21:58:49 +0300 |
---|---|---|
committer | unknown <pekka@sama.ndb.mysql.com> | 2007-08-27 21:58:49 +0300 |
commit | d319e12ab713c60b0efb4e34637977f1e3f3e401 (patch) | |
tree | 5047b44cd2e4abc25e9d6bf14ae24ed7d355dab1 | |
parent | b0ac87dc443f4b7b704d49f906f7673562541352 (diff) | |
download | mariadb-git-d319e12ab713c60b0efb4e34637977f1e3f3e401.tar.gz |
ndb - bug#30646 fsync on close only if file is open for write
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
AsyncFile: fsync on close only if file is open for write (for AIX)
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp:
AsyncFile: fsync on close only if file is open for write (for AIX)
-rw-r--r-- | storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 9 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index cf18bf34040..5300d5bbfd9 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -99,6 +99,7 @@ AsyncFile::AsyncFile(SimulatedBlock& fs) : { m_page_ptr.setNull(); m_current_request= m_last_request= 0; + m_open_flags = 0; } void @@ -328,6 +329,7 @@ void AsyncFile::openReq(Request* request) { m_auto_sync_freq = 0; m_write_wo_sync = 0; + m_open_flags = request->par.open.flags; // for open.flags, see signal FSOPENREQ #ifdef NDB_WIN32 @@ -954,7 +956,12 @@ AsyncFile::writevReq( Request * request) void AsyncFile::closeReq(Request * request) { - syncReq(request); + if (m_open_flags & ( + FsOpenReq::OM_WRITEONLY | + FsOpenReq::OM_READWRITE | + FsOpenReq::OM_APPEND )) { + syncReq(request); + } #ifdef NDB_WIN32 if(!CloseHandle(hFile)) { request->error = GetLastError(); diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp index d8d585c47f7..e4a01753acd 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp @@ -224,6 +224,8 @@ private: #else int theFd; #endif + + Uint32 m_open_flags; // OM_ flags from request to open file MemoryChannel<Request> *theReportTo; MemoryChannel<Request>* theMemoryChannelPtr; |