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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
da10c5dd
Commit
da10c5dd
authored
May 17, 2007
by
dkatz@damien-katzs-computer.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into damien-katzs-computer.local:/Users/dkatz/mysql51
parents
8406164e
c21c22d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
sql/filesort.cc
sql/filesort.cc
+15
-6
storage/myisam/sort.c
storage/myisam/sort.c
+2
-1
No files found.
sql/filesort.cc
View file @
da10c5dd
...
...
@@ -255,7 +255,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
open_cached_file
(
outfile
,
mysql_tmpdir
,
TEMP_PREFIX
,
READ_RECORD_BUFFER
,
MYF
(
MY_WME
)))
goto
err
;
reinit_io_cache
(
outfile
,
WRITE_CACHE
,
0L
,
0
,
0
);
if
(
reinit_io_cache
(
outfile
,
WRITE_CACHE
,
0L
,
0
,
0
))
goto
err
;
/*
Use also the space previously used by string pointers in sort_buffer
...
...
@@ -375,6 +376,8 @@ static BUFFPEK *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count)
ulong
length
;
BUFFPEK
*
tmp
;
DBUG_ENTER
(
"read_buffpek_from_file"
);
if
(
count
>
ULONG_MAX
/
sizeof
(
BUFFPEK
))
return
0
;
/* sizeof(BUFFPEK)*count will overflow */
tmp
=
(
BUFFPEK
*
)
my_malloc
(
length
=
sizeof
(
BUFFPEK
)
*
count
,
MYF
(
MY_WME
));
if
(
tmp
)
{
...
...
@@ -625,6 +628,9 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
open_cached_file
(
tempfile
,
mysql_tmpdir
,
TEMP_PREFIX
,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
goto
err
;
/* purecov: inspected */
/* check we won't have more buffpeks than we can possibly keep in memory */
if
(
my_b_tell
(
buffpek_pointers
)
+
sizeof
(
BUFFPEK
)
>
(
ulonglong
)
ULONG_MAX
)
goto
err
;
buffpek
.
file_pos
=
my_b_tell
(
tempfile
);
if
((
ha_rows
)
count
>
param
->
max_rows
)
count
=
(
uint
)
param
->
max_rows
;
/* purecov: inspected */
...
...
@@ -983,7 +989,7 @@ static bool save_index(SORTPARAM *param, uchar **sort_keys, uint count,
int
merge_many_buff
(
SORTPARAM
*
param
,
uchar
*
sort_buffer
,
BUFFPEK
*
buffpek
,
uint
*
maxbuffer
,
IO_CACHE
*
t_file
)
{
register
int
i
;
register
u
int
i
;
IO_CACHE
t_file2
,
*
from_file
,
*
to_file
,
*
temp
;
BUFFPEK
*
lastbuff
;
DBUG_ENTER
(
"merge_many_buff"
);
...
...
@@ -998,14 +1004,16 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
from_file
=
t_file
;
to_file
=
&
t_file2
;
while
(
*
maxbuffer
>=
MERGEBUFF2
)
{
reinit_io_cache
(
from_file
,
READ_CACHE
,
0L
,
0
,
0
);
reinit_io_cache
(
to_file
,
WRITE_CACHE
,
0L
,
0
,
0
);
if
(
reinit_io_cache
(
from_file
,
READ_CACHE
,
0L
,
0
,
0
))
goto
cleanup
;
if
(
reinit_io_cache
(
to_file
,
WRITE_CACHE
,
0L
,
0
,
0
))
goto
cleanup
;
lastbuff
=
buffpek
;
for
(
i
=
0
;
i
<=
(
int
)
*
maxbuffer
-
MERGEBUFF
*
3
/
2
;
i
+=
MERGEBUFF
)
for
(
i
=
0
;
i
<=
*
maxbuffer
-
MERGEBUFF
*
3
/
2
;
i
+=
MERGEBUFF
)
{
if
(
merge_buffers
(
param
,
from_file
,
to_file
,
sort_buffer
,
lastbuff
++
,
buffpek
+
i
,
buffpek
+
i
+
MERGEBUFF
-
1
,
0
))
break
;
/* purecov: inspected */
goto
cleanup
;
}
if
(
merge_buffers
(
param
,
from_file
,
to_file
,
sort_buffer
,
lastbuff
++
,
buffpek
+
i
,
buffpek
+
*
maxbuffer
,
0
))
...
...
@@ -1017,6 +1025,7 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
setup_io_cache
(
to_file
);
*
maxbuffer
=
(
uint
)
(
lastbuff
-
buffpek
)
-
1
;
}
cleanup:
close_cached_file
(
to_file
);
// This holds old result
if
(
to_file
==
t_file
)
{
...
...
storage/myisam/sort.c
View file @
da10c5dd
...
...
@@ -773,7 +773,7 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
{
if
(
merge_buffers
(
info
,
keys
,
from_file
,
to_file
,
sort_keys
,
lastbuff
++
,
buffpek
+
i
,
buffpek
+
i
+
MERGEBUFF
-
1
))
break
;
/* purecov: inspected */
goto
cleanup
;
}
if
(
merge_buffers
(
info
,
keys
,
from_file
,
to_file
,
sort_keys
,
lastbuff
++
,
buffpek
+
i
,
buffpek
+
*
maxbuffer
))
...
...
@@ -783,6 +783,7 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
temp
=
from_file
;
from_file
=
to_file
;
to_file
=
temp
;
*
maxbuffer
=
(
int
)
(
lastbuff
-
buffpek
)
-
1
;
}
cleanup:
close_cached_file
(
to_file
);
/* This holds old result */
if
(
to_file
==
t_file
)
*
t_file
=
t_file2
;
/* Copy result file */
...
...
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