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
fcb68ffe
Commit
fcb68ffe
authored
May 29, 2018
by
Eugene Kosov
Committed by
Sergey Vojtovich
May 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified away READ_RECORD::struct_length
parent
5d46eeef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
sql/records.cc
sql/records.cc
+8
-8
sql/records.h
sql/records.h
+1
-1
No files found.
sql/records.cc
View file @
fcb68ffe
...
@@ -582,31 +582,32 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
...
@@ -582,31 +582,32 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
}
}
/* cacheing of records from a database */
/* cacheing of records from a database */
static
const
uint
STRUCT_LENGTH
=
3
+
MAX_REFLENGTH
;
static
int
init_rr_cache
(
THD
*
thd
,
READ_RECORD
*
info
)
static
int
init_rr_cache
(
THD
*
thd
,
READ_RECORD
*
info
)
{
{
uint
rec_cache_size
,
cache_records
;
uint
rec_cache_size
,
cache_records
;
DBUG_ENTER
(
"init_rr_cache"
);
DBUG_ENTER
(
"init_rr_cache"
);
info
->
struct_length
=
3
+
MAX_REFLENGTH
;
info
->
reclength
=
ALIGN_SIZE
(
info
->
table
->
s
->
reclength
+
1
);
info
->
reclength
=
ALIGN_SIZE
(
info
->
table
->
s
->
reclength
+
1
);
if
(
info
->
reclength
<
info
->
struct_length
)
if
(
info
->
reclength
<
STRUCT_LENGTH
)
info
->
reclength
=
ALIGN_SIZE
(
info
->
struct_length
);
info
->
reclength
=
ALIGN_SIZE
(
STRUCT_LENGTH
);
info
->
error_offset
=
info
->
table
->
s
->
reclength
;
info
->
error_offset
=
info
->
table
->
s
->
reclength
;
cache_records
=
thd
->
variables
.
read_rnd_buff_size
/
cache_records
=
thd
->
variables
.
read_rnd_buff_size
/
(
info
->
reclength
+
info
->
struct_length
);
(
info
->
reclength
+
STRUCT_LENGTH
);
rec_cache_size
=
cache_records
*
info
->
reclength
;
rec_cache_size
=
cache_records
*
info
->
reclength
;
info
->
rec_cache_size
=
cache_records
*
info
->
ref_length
;
info
->
rec_cache_size
=
cache_records
*
info
->
ref_length
;
// We have to allocate one more byte to use uint3korr (see comments for it)
// We have to allocate one more byte to use uint3korr (see comments for it)
if
(
cache_records
<=
2
||
if
(
cache_records
<=
2
||
!
(
info
->
cache
=
(
uchar
*
)
my_malloc_lock
(
rec_cache_size
+
cache_records
*
!
(
info
->
cache
=
(
uchar
*
)
my_malloc_lock
(
rec_cache_size
+
cache_records
*
info
->
struct_length
+
1
,
STRUCT_LENGTH
+
1
,
MYF
(
MY_THREAD_SPECIFIC
))))
MYF
(
MY_THREAD_SPECIFIC
))))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
#ifdef HAVE_valgrind
#ifdef HAVE_valgrind
// Avoid warnings in qsort
// Avoid warnings in qsort
bzero
(
info
->
cache
,
rec_cache_size
+
cache_records
*
info
->
struct_length
+
1
);
bzero
(
info
->
cache
,
rec_cache_size
+
cache_records
*
STRUCT_LENGTH
+
1
);
#endif
#endif
DBUG_PRINT
(
"info"
,
(
"Allocated buffer for %d records"
,
cache_records
));
DBUG_PRINT
(
"info"
,
(
"Allocated buffer for %d records"
,
cache_records
));
info
->
read_positions
=
info
->
cache
+
rec_cache_size
;
info
->
read_positions
=
info
->
cache
+
rec_cache_size
;
...
@@ -663,8 +664,7 @@ static int rr_from_cache(READ_RECORD *info)
...
@@ -663,8 +664,7 @@ static int rr_from_cache(READ_RECORD *info)
int3store
(
ref_position
,(
long
)
i
);
int3store
(
ref_position
,(
long
)
i
);
ref_position
+=
3
;
ref_position
+=
3
;
}
}
my_qsort
(
info
->
read_positions
,
length
,
info
->
struct_length
,
my_qsort
(
info
->
read_positions
,
length
,
STRUCT_LENGTH
,
(
qsort_cmp
)
rr_cmp
);
(
qsort_cmp
)
rr_cmp
);
position
=
info
->
read_positions
;
position
=
info
->
read_positions
;
for
(
i
=
0
;
i
<
length
;
i
++
)
for
(
i
=
0
;
i
<
length
;
i
++
)
...
...
sql/records.h
View file @
fcb68ffe
...
@@ -56,7 +56,7 @@ struct READ_RECORD
...
@@ -56,7 +56,7 @@ struct READ_RECORD
Read_func
read_record_func
;
Read_func
read_record_func
;
THD
*
thd
;
THD
*
thd
;
SQL_SELECT
*
select
;
SQL_SELECT
*
select
;
uint
ref_length
,
struct_length
,
reclength
,
rec_cache_size
,
error_offset
;
uint
ref_length
,
reclength
,
rec_cache_size
,
error_offset
;
uchar
*
ref_pos
;
/* pointer to form->refpos */
uchar
*
ref_pos
;
/* pointer to form->refpos */
uchar
*
record
;
uchar
*
record
;
uchar
*
rec_buf
;
/* to read field values after filesort */
uchar
*
rec_buf
;
/* to read field values after filesort */
...
...
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