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
842d6250
Commit
842d6250
authored
Mar 03, 2008
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/innodb+: Add posix_fadvise() caching hints to the temporary files
that are used in merge sort when creating indexes.
parent
388b78c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
row/row0merge.c
row/row0merge.c
+25
-4
No files found.
row/row0merge.c
View file @
842d6250
...
@@ -40,6 +40,11 @@ Completed by Sunny Bains and Marko Makela
...
@@ -40,6 +40,11 @@ Completed by Sunny Bains and Marko Makela
#include "ut0sort.h"
#include "ut0sort.h"
#include "handler0alter.h"
#include "handler0alter.h"
/* Ignore posix_fadvise() on those platforms where it does not exist */
#if defined __WIN__
# define posix_fadvise(fd, offset, len, advice)
/* nothing */
#endif
/* __WIN__ */
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
/* Set these in order ot enable debug printout. */
/* Set these in order ot enable debug printout. */
static
ibool
row_merge_print_cmp
;
static
ibool
row_merge_print_cmp
;
...
@@ -641,6 +646,9 @@ row_merge_read(
...
@@ -641,6 +646,9 @@ row_merge_read(
(
ulint
)
(
ofs
&
0xFFFFFFFF
),
(
ulint
)
(
ofs
&
0xFFFFFFFF
),
(
ulint
)
(
ofs
>>
32
),
(
ulint
)
(
ofs
>>
32
),
sizeof
*
buf
);
sizeof
*
buf
);
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise
(
fd
,
ofs
,
sizeof
*
buf
,
POSIX_FADV_DONTNEED
);
if
(
UNIV_UNLIKELY
(
!
success
))
{
if
(
UNIV_UNLIKELY
(
!
success
))
{
ut_print_timestamp
(
stderr
);
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
fprintf
(
stderr
,
...
@@ -664,11 +672,18 @@ row_merge_write(
...
@@ -664,11 +672,18 @@ row_merge_write(
{
{
ib_uint64_t
ofs
=
((
ib_uint64_t
)
offset
)
ib_uint64_t
ofs
=
((
ib_uint64_t
)
offset
)
*
sizeof
(
row_merge_block_t
);
*
sizeof
(
row_merge_block_t
);
ibool
success
;
return
(
UNIV_LIKELY
(
os_file_write
(
"(merge)"
,
OS_FILE_FROM_FD
(
fd
),
buf
,
success
=
os_file_write
(
"(merge)"
,
OS_FILE_FROM_FD
(
fd
),
buf
,
(
ulint
)
(
ofs
&
0xFFFFFFFF
),
(
ulint
)
(
ofs
&
0xFFFFFFFF
),
(
ulint
)
(
ofs
>>
32
),
(
ulint
)
(
ofs
>>
32
),
sizeof
(
row_merge_block_t
))));
sizeof
(
row_merge_block_t
));
/* The block will be needed on the next merge pass,
but it can be evicted from the file cache meanwhile. */
posix_fadvise
(
fd
,
ofs
,
sizeof
*
buf
,
POSIX_FADV_DONTNEED
);
return
(
UNIV_LIKELY
(
success
));
}
}
/************************************************************************
/************************************************************************
...
@@ -1416,6 +1431,12 @@ row_merge(
...
@@ -1416,6 +1431,12 @@ row_merge(
of
.
fd
=
*
tmpfd
;
of
.
fd
=
*
tmpfd
;
of
.
offset
=
0
;
of
.
offset
=
0
;
/* The input file will be read sequentially, starting from the
beginning and the middle. In Linux, the POSIX_FADV_SEQUENTIAL
affects the entire file. Each block will be read exactly once. */
posix_fadvise
(
file
->
fd
,
0
,
0
,
POSIX_FADV_SEQUENTIAL
|
POSIX_FADV_NOREUSE
);
/* Merge blocks to the output file. */
/* Merge blocks to the output file. */
foffs0
=
0
;
foffs0
=
0
;
foffs1
=
half
;
foffs1
=
half
;
...
...
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