Commit d319e12a authored by unknown's avatar unknown

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)
parent b0ac87dc
...@@ -99,6 +99,7 @@ AsyncFile::AsyncFile(SimulatedBlock& fs) : ...@@ -99,6 +99,7 @@ AsyncFile::AsyncFile(SimulatedBlock& fs) :
{ {
m_page_ptr.setNull(); m_page_ptr.setNull();
m_current_request= m_last_request= 0; m_current_request= m_last_request= 0;
m_open_flags = 0;
} }
void void
...@@ -328,6 +329,7 @@ void AsyncFile::openReq(Request* request) ...@@ -328,6 +329,7 @@ void AsyncFile::openReq(Request* request)
{ {
m_auto_sync_freq = 0; m_auto_sync_freq = 0;
m_write_wo_sync = 0; m_write_wo_sync = 0;
m_open_flags = request->par.open.flags;
// for open.flags, see signal FSOPENREQ // for open.flags, see signal FSOPENREQ
#ifdef NDB_WIN32 #ifdef NDB_WIN32
...@@ -954,7 +956,12 @@ AsyncFile::writevReq( Request * request) ...@@ -954,7 +956,12 @@ AsyncFile::writevReq( Request * request)
void void
AsyncFile::closeReq(Request * request) AsyncFile::closeReq(Request * request)
{ {
syncReq(request); if (m_open_flags & (
FsOpenReq::OM_WRITEONLY |
FsOpenReq::OM_READWRITE |
FsOpenReq::OM_APPEND )) {
syncReq(request);
}
#ifdef NDB_WIN32 #ifdef NDB_WIN32
if(!CloseHandle(hFile)) { if(!CloseHandle(hFile)) {
request->error = GetLastError(); request->error = GetLastError();
......
...@@ -224,6 +224,8 @@ private: ...@@ -224,6 +224,8 @@ private:
#else #else
int theFd; int theFd;
#endif #endif
Uint32 m_open_flags; // OM_ flags from request to open file
MemoryChannel<Request> *theReportTo; MemoryChannel<Request> *theReportTo;
MemoryChannel<Request>* theMemoryChannelPtr; MemoryChannel<Request>* theMemoryChannelPtr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment