Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7c29f7b6
Commit
7c29f7b6
authored
Aug 02, 2006
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - add OM_AUTO_SYNC ta make sure os-kernel does not buffer too much
add sync-flag to FsAppendReq
parent
dca8afa9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
24 deletions
+43
-24
storage/ndb/include/kernel/signaldata/FsAppendReq.hpp
storage/ndb/include/kernel/signaldata/FsAppendReq.hpp
+2
-1
storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
+6
-5
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+18
-11
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
+4
-3
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+13
-4
No files found.
storage/ndb/include/kernel/signaldata/FsAppendReq.hpp
View file @
7c29f7b6
...
...
@@ -39,7 +39,7 @@ class FsAppendReq {
friend
bool
printFSAPPENDREQ
(
FILE
*
output
,
const
Uint32
*
theData
,
Uint32
len
,
Uint16
receiverBlockNo
);
public:
STATIC_CONST
(
SignalLength
=
6
);
STATIC_CONST
(
SignalLength
=
7
);
private:
...
...
@@ -52,6 +52,7 @@ private:
UintR
varIndex
;
// DATA 3
UintR
offset
;
// DATA 4
UintR
size
;
// DATA 5
UintR
synch_flag
;
// DATA 6
};
#endif
storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
View file @
7c29f7b6
...
...
@@ -53,7 +53,7 @@ public:
/**
* Length of signal
*/
STATIC_CONST
(
SignalLength
=
1
0
);
STATIC_CONST
(
SignalLength
=
1
1
);
SECTION
(
FILENAME
=
0
);
private:
...
...
@@ -69,6 +69,7 @@ private:
Uint32
page_size
;
Uint32
file_size_hi
;
Uint32
file_size_lo
;
Uint32
auto_sync_size
;
// In bytes
STATIC_CONST
(
OM_READONLY
=
0
);
STATIC_CONST
(
OM_WRITEONLY
=
1
);
...
...
@@ -80,10 +81,10 @@ private:
STATIC_CONST
(
OM_TRUNCATE
=
0x200
);
STATIC_CONST
(
OM_AUTOSYNC
=
0x400
);
STATIC_CONST
(
OM_CREATE_IF_NONE
=
0x0
4
00
);
STATIC_CONST
(
OM_INIT
=
0x
08
00
);
//
STATIC_CONST
(
OM_CHECK_SIZE
=
0x
1
000
);
STATIC_CONST
(
OM_DIRECT
=
0x
2
000
);
STATIC_CONST
(
OM_CREATE_IF_NONE
=
0x0
8
00
);
STATIC_CONST
(
OM_INIT
=
0x
10
00
);
//
STATIC_CONST
(
OM_CHECK_SIZE
=
0x
2
000
);
STATIC_CONST
(
OM_DIRECT
=
0x
4
000
);
enum
Suffixes
{
S_DATA
=
0
,
...
...
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
View file @
7c29f7b6
...
...
@@ -219,6 +219,10 @@ AsyncFile::run()
case
Request
:
:
append
:
appendReq
(
request
);
break
;
case
Request
:
:
append_synch
:
appendReq
(
request
);
syncReq
(
request
);
break
;
case
Request
:
:
rmrf
:
rmrfReq
(
request
,
(
char
*
)
theFileName
.
c_str
(),
request
->
par
.
rmrf
.
own_directory
);
break
;
...
...
@@ -246,9 +250,8 @@ extern Uint32 Global_syncFreq;
void
AsyncFile
::
openReq
(
Request
*
request
)
{
m_openedWithSync
=
false
;
m_syncFrequency
=
0
;
m_syncCount
=
0
;
m_auto_sync_freq
=
0
;
m_write_wo_sync
=
0
;
// for open.flags, see signal FSOPENREQ
#ifdef NDB_WIN32
...
...
@@ -329,7 +332,7 @@ void AsyncFile::openReq(Request* request)
if
(
flags
&
FsOpenReq
::
OM_AUTOSYNC
)
{
m_
syncFrequency
=
1024
*
1024
;
// Hard coded to 1M
m_
auto_sync_freq
=
request
->
par
.
open
.
auto_sync_size
;
}
if
(
flags
&
FsOpenReq
::
OM_APPEND
){
...
...
@@ -429,7 +432,7 @@ void AsyncFile::openReq(Request* request)
{
request
->
error
=
errno
;
}
else
if
(
buf
.
st_size
!=
request
->
par
.
open
.
file_size
)
else
if
(
(
Uint64
)
buf
.
st_size
!=
request
->
par
.
open
.
file_size
)
{
request
->
error
=
FsRef
::
fsErrInvalidFileSize
;
}
...
...
@@ -737,6 +740,10 @@ AsyncFile::writeReq( Request * request)
return
;
}
}
// while(write_not_complete)
if
(
m_auto_sync_freq
&&
m_write_wo_sync
>
m_auto_sync_freq
){
syncReq
(
request
);
}
}
int
...
...
@@ -746,6 +753,8 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
size_t
bytes_to_write
=
chunk_size
;
int
return_value
;
m_write_wo_sync
+=
size
;
#ifdef NDB_WIN32
DWORD
dwSFP
=
SetFilePointer
(
hFile
,
offset
,
0
,
FILE_BEGIN
);
if
(
dwSFP
!=
offset
)
{
...
...
@@ -805,7 +814,6 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
}
#endif
m_syncCount
+=
bytes_written
;
buf
+=
bytes_written
;
size
-=
bytes_written
;
offset
+=
bytes_written
;
...
...
@@ -856,8 +864,7 @@ bool AsyncFile::isOpen(){
void
AsyncFile
::
syncReq
(
Request
*
request
)
{
if
(
m_openedWithSync
||
m_syncCount
==
0
){
if
(
m_auto_sync_freq
&&
m_write_wo_sync
==
0
){
return
;
}
#ifdef NDB_WIN32
...
...
@@ -871,7 +878,7 @@ AsyncFile::syncReq(Request * request)
return
;
}
#endif
m_
syncCount
=
0
;
m_
write_wo_sync
=
0
;
}
void
...
...
@@ -880,7 +887,7 @@ AsyncFile::appendReq(Request * request){
const
char
*
buf
=
request
->
par
.
append
.
buf
;
Uint32
size
=
request
->
par
.
append
.
size
;
m_
syncCount
+=
size
;
m_
write_wo_sync
+=
size
;
#ifdef NDB_WIN32
DWORD
dwWritten
=
0
;
...
...
@@ -912,7 +919,7 @@ AsyncFile::appendReq(Request * request){
}
#endif
if
(
m_
syncFrequency
!=
0
&&
m_syncCount
>
m_syncFrequency
){
if
(
m_
auto_sync_freq
&&
m_write_wo_sync
>
m_auto_sync_freq
){
syncReq
(
request
);
}
}
...
...
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
View file @
7c29f7b6
...
...
@@ -123,6 +123,7 @@ public:
sync
,
end
,
append
,
append_synch
,
rmrf
,
readPartial
};
...
...
@@ -132,6 +133,7 @@ public:
Uint32
flags
;
Uint32
page_size
;
Uint64
file_size
;
Uint32
auto_sync_size
;
}
open
;
struct
{
int
numberOfPages
;
...
...
@@ -232,9 +234,8 @@ private:
int
theWriteBufferSize
;
char
*
theWriteBuffer
;
bool
m_openedWithSync
;
Uint32
m_syncCount
;
Uint32
m_syncFrequency
;
size_t
m_write_wo_sync
;
// Writes wo/ sync
size_t
m_auto_sync_freq
;
// Auto sync freq in bytes
public:
SimulatedBlock
&
m_fs
;
Ptr
<
GlobalPage
>
m_page_ptr
;
...
...
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
View file @
7c29f7b6
...
...
@@ -230,6 +230,7 @@ Ndbfs::execFSOPENREQ(Signal* signal)
request
->
par
.
open
.
file_size
=
fsOpenReq
->
file_size_hi
;
request
->
par
.
open
.
file_size
<<=
32
;
request
->
par
.
open
.
file_size
|=
fsOpenReq
->
file_size_lo
;
request
->
par
.
open
.
auto_sync_size
=
fsOpenReq
->
auto_sync_size
;
ndbrequire
(
forward
(
file
,
request
));
}
...
...
@@ -567,6 +568,7 @@ Ndbfs::execFSAPPENDREQ(Signal * signal)
const
Uint32
tSz
=
myBaseAddrRef
->
nrr
;
const
Uint32
offset
=
fsReq
->
offset
;
const
Uint32
size
=
fsReq
->
size
;
const
Uint32
synch_flag
=
fsReq
->
synch_flag
;
Request
*
request
=
theRequestPool
->
get
();
if
(
openFile
==
NULL
)
{
...
...
@@ -596,12 +598,15 @@ Ndbfs::execFSAPPENDREQ(Signal * signal)
request
->
error
=
0
;
request
->
set
(
userRef
,
userPointer
,
filePointer
);
request
->
file
=
openFile
;
request
->
action
=
Request
::
append
;
request
->
theTrace
=
signal
->
getTrace
();
request
->
par
.
append
.
buf
=
(
const
char
*
)(
tWA
+
offset
);
request
->
par
.
append
.
size
=
size
<<
2
;
if
(
!
synch_flag
)
request
->
action
=
Request
::
append
;
else
request
->
action
=
Request
::
append_synch
;
ndbrequire
(
forward
(
openFile
,
request
));
return
;
...
...
@@ -744,7 +749,9 @@ Ndbfs::report(Request * request, Signal* signal)
sendSignal
(
ref
,
GSN_FSSYNCREF
,
signal
,
FsRef
::
SignalLength
,
JBB
);
break
;
}
case
Request
:
:
append
:
{
case
Request
:
:
append
:
case
Request
:
:
append_synch
:
{
jam
();
sendSignal
(
ref
,
GSN_FSAPPENDREF
,
signal
,
FsRef
::
SignalLength
,
JBB
);
break
;
...
...
@@ -814,7 +821,9 @@ Ndbfs::report(Request * request, Signal* signal)
sendSignal
(
ref
,
GSN_FSSYNCCONF
,
signal
,
1
,
JBB
);
break
;
}
//case
case
Request
:
:
append
:
{
case
Request
:
:
append
:
case
Request
:
:
append_synch
:
{
jam
();
signal
->
theData
[
1
]
=
request
->
par
.
append
.
size
;
sendSignal
(
ref
,
GSN_FSAPPENDCONF
,
signal
,
2
,
JBB
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment