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
490dcfd5
Commit
490dcfd5
authored
Jun 05, 2019
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19698: Cleanup READ_RECORD::record
https://github.com/MariaDB/server/pull/777#issuecomment-496469366
parent
f7579518
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
20 deletions
+15
-20
sql/item_subselect.cc
sql/item_subselect.cc
+0
-2
sql/records.cc
sql/records.cc
+8
-10
sql/records.h
sql/records.h
+3
-2
sql/sql_select.cc
sql/sql_select.cc
+3
-5
sql/sql_window.cc
sql/sql_window.cc
+1
-1
No files found.
sql/item_subselect.cc
View file @
490dcfd5
...
@@ -3877,7 +3877,6 @@ int subselect_single_select_engine::exec()
...
@@ -3877,7 +3877,6 @@ int subselect_single_select_engine::exec()
tab
->
save_read_record
=
tab
->
read_record
.
read_record_func
;
tab
->
save_read_record
=
tab
->
read_record
.
read_record_func
;
tab
->
read_record
.
read_record_func
=
rr_sequential
;
tab
->
read_record
.
read_record_func
=
rr_sequential
;
tab
->
read_first_record
=
read_first_record_seq
;
tab
->
read_first_record
=
read_first_record_seq
;
tab
->
read_record
.
record
=
tab
->
table
->
record
[
0
];
tab
->
read_record
.
thd
=
join
->
thd
;
tab
->
read_record
.
thd
=
join
->
thd
;
tab
->
read_record
.
ref_length
=
tab
->
table
->
file
->
ref_length
;
tab
->
read_record
.
ref_length
=
tab
->
table
->
file
->
ref_length
;
tab
->
read_record
.
unlock_row
=
rr_unlock_row
;
tab
->
read_record
.
unlock_row
=
rr_unlock_row
;
...
@@ -3895,7 +3894,6 @@ int subselect_single_select_engine::exec()
...
@@ -3895,7 +3894,6 @@ int subselect_single_select_engine::exec()
for
(
JOIN_TAB
**
ptab
=
changed_tabs
;
ptab
!=
last_changed_tab
;
ptab
++
)
for
(
JOIN_TAB
**
ptab
=
changed_tabs
;
ptab
!=
last_changed_tab
;
ptab
++
)
{
{
JOIN_TAB
*
tab
=
*
ptab
;
JOIN_TAB
*
tab
=
*
ptab
;
tab
->
read_record
.
record
=
0
;
tab
->
read_record
.
ref_length
=
0
;
tab
->
read_record
.
ref_length
=
0
;
tab
->
read_first_record
=
tab
->
save_read_first_record
;
tab
->
read_first_record
=
tab
->
save_read_first_record
;
tab
->
read_record
.
read_record_func
=
tab
->
save_read_record
;
tab
->
read_record
.
read_record_func
=
tab
->
save_read_record
;
...
...
sql/records.cc
View file @
490dcfd5
...
@@ -77,7 +77,6 @@ bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
...
@@ -77,7 +77,6 @@ bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
bzero
((
char
*
)
info
,
sizeof
(
*
info
));
bzero
((
char
*
)
info
,
sizeof
(
*
info
));
info
->
thd
=
thd
;
info
->
thd
=
thd
;
info
->
table
=
table
;
info
->
table
=
table
;
info
->
record
=
table
->
record
[
0
];
info
->
print_error
=
print_error
;
info
->
print_error
=
print_error
;
info
->
unlock_row
=
rr_unlock_row
;
info
->
unlock_row
=
rr_unlock_row
;
...
@@ -210,7 +209,6 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
...
@@ -210,7 +209,6 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
else
else
{
{
empty_record
(
table
);
empty_record
(
table
);
info
->
record
=
table
->
record
[
0
];
info
->
ref_length
=
(
uint
)
table
->
file
->
ref_length
;
info
->
ref_length
=
(
uint
)
table
->
file
->
ref_length
;
}
}
info
->
select
=
select
;
info
->
select
=
select
;
...
@@ -393,7 +391,7 @@ static int rr_index_first(READ_RECORD *info)
...
@@ -393,7 +391,7 @@ static int rr_index_first(READ_RECORD *info)
return
tmp
;
return
tmp
;
}
}
tmp
=
info
->
table
->
file
->
ha_index_first
(
info
->
record
);
tmp
=
info
->
table
->
file
->
ha_index_first
(
info
->
record
()
);
info
->
read_record_func
=
rr_index
;
info
->
read_record_func
=
rr_index
;
if
(
tmp
)
if
(
tmp
)
tmp
=
rr_handle_error
(
info
,
tmp
);
tmp
=
rr_handle_error
(
info
,
tmp
);
...
@@ -416,7 +414,7 @@ static int rr_index_first(READ_RECORD *info)
...
@@ -416,7 +414,7 @@ static int rr_index_first(READ_RECORD *info)
static
int
rr_index_last
(
READ_RECORD
*
info
)
static
int
rr_index_last
(
READ_RECORD
*
info
)
{
{
int
tmp
=
info
->
table
->
file
->
ha_index_last
(
info
->
record
);
int
tmp
=
info
->
table
->
file
->
ha_index_last
(
info
->
record
()
);
info
->
read_record_func
=
rr_index_desc
;
info
->
read_record_func
=
rr_index_desc
;
if
(
tmp
)
if
(
tmp
)
tmp
=
rr_handle_error
(
info
,
tmp
);
tmp
=
rr_handle_error
(
info
,
tmp
);
...
@@ -442,7 +440,7 @@ static int rr_index_last(READ_RECORD *info)
...
@@ -442,7 +440,7 @@ static int rr_index_last(READ_RECORD *info)
static
int
rr_index
(
READ_RECORD
*
info
)
static
int
rr_index
(
READ_RECORD
*
info
)
{
{
int
tmp
=
info
->
table
->
file
->
ha_index_next
(
info
->
record
);
int
tmp
=
info
->
table
->
file
->
ha_index_next
(
info
->
record
()
);
if
(
tmp
)
if
(
tmp
)
tmp
=
rr_handle_error
(
info
,
tmp
);
tmp
=
rr_handle_error
(
info
,
tmp
);
return
tmp
;
return
tmp
;
...
@@ -467,7 +465,7 @@ static int rr_index(READ_RECORD *info)
...
@@ -467,7 +465,7 @@ static int rr_index(READ_RECORD *info)
static
int
rr_index_desc
(
READ_RECORD
*
info
)
static
int
rr_index_desc
(
READ_RECORD
*
info
)
{
{
int
tmp
=
info
->
table
->
file
->
ha_index_prev
(
info
->
record
);
int
tmp
=
info
->
table
->
file
->
ha_index_prev
(
info
->
record
()
);
if
(
tmp
)
if
(
tmp
)
tmp
=
rr_handle_error
(
info
,
tmp
);
tmp
=
rr_handle_error
(
info
,
tmp
);
return
tmp
;
return
tmp
;
...
@@ -477,7 +475,7 @@ static int rr_index_desc(READ_RECORD *info)
...
@@ -477,7 +475,7 @@ static int rr_index_desc(READ_RECORD *info)
int
rr_sequential
(
READ_RECORD
*
info
)
int
rr_sequential
(
READ_RECORD
*
info
)
{
{
int
tmp
;
int
tmp
;
while
((
tmp
=
info
->
table
->
file
->
ha_rnd_next
(
info
->
record
)))
while
((
tmp
=
info
->
table
->
file
->
ha_rnd_next
(
info
->
record
()
)))
{
{
tmp
=
rr_handle_error
(
info
,
tmp
);
tmp
=
rr_handle_error
(
info
,
tmp
);
break
;
break
;
...
@@ -493,7 +491,7 @@ static int rr_from_tempfile(READ_RECORD *info)
...
@@ -493,7 +491,7 @@ static int rr_from_tempfile(READ_RECORD *info)
{
{
if
(
my_b_read
(
info
->
io_cache
,
info
->
ref_pos
,
info
->
ref_length
))
if
(
my_b_read
(
info
->
io_cache
,
info
->
ref_pos
,
info
->
ref_length
))
return
-
1
;
/* End of file */
return
-
1
;
/* End of file */
if
(
!
(
tmp
=
info
->
table
->
file
->
ha_rnd_pos
(
info
->
record
,
info
->
ref_pos
)))
if
(
!
(
tmp
=
info
->
table
->
file
->
ha_rnd_pos
(
info
->
record
(),
info
->
ref_pos
)))
break
;
break
;
/* The following is extremely unlikely to happen */
/* The following is extremely unlikely to happen */
if
(
tmp
==
HA_ERR_KEY_NOT_FOUND
)
if
(
tmp
==
HA_ERR_KEY_NOT_FOUND
)
...
@@ -543,7 +541,7 @@ int rr_from_pointers(READ_RECORD *info)
...
@@ -543,7 +541,7 @@ int rr_from_pointers(READ_RECORD *info)
cache_pos
=
info
->
cache_pos
;
cache_pos
=
info
->
cache_pos
;
info
->
cache_pos
+=
info
->
ref_length
;
info
->
cache_pos
+=
info
->
ref_length
;
if
(
!
(
tmp
=
info
->
table
->
file
->
ha_rnd_pos
(
info
->
record
,
cache_pos
)))
if
(
!
(
tmp
=
info
->
table
->
file
->
ha_rnd_pos
(
info
->
record
(),
cache_pos
)))
break
;
break
;
/* The following is extremely unlikely to happen */
/* The following is extremely unlikely to happen */
...
@@ -638,7 +636,7 @@ static int rr_from_cache(READ_RECORD *info)
...
@@ -638,7 +636,7 @@ static int rr_from_cache(READ_RECORD *info)
else
else
{
{
error
=
0
;
error
=
0
;
memcpy
(
info
->
record
,
info
->
cache_pos
,
memcpy
(
info
->
record
(),
info
->
cache_pos
,
(
size_t
)
info
->
table
->
s
->
reclength
);
(
size_t
)
info
->
table
->
s
->
reclength
);
}
}
info
->
cache_pos
+=
info
->
reclength
;
info
->
cache_pos
+=
info
->
reclength
;
...
...
sql/records.h
View file @
490dcfd5
...
@@ -19,9 +19,10 @@
...
@@ -19,9 +19,10 @@
#pragma interface
/* gcc class implementation */
#pragma interface
/* gcc class implementation */
#endif
#endif
#include "table.h"
struct
st_join_table
;
struct
st_join_table
;
class
handler
;
class
handler
;
struct
TABLE
;
class
THD
;
class
THD
;
class
SQL_SELECT
;
class
SQL_SELECT
;
class
Copy_field
;
class
Copy_field
;
...
@@ -58,7 +59,6 @@ struct READ_RECORD
...
@@ -58,7 +59,6 @@ struct READ_RECORD
SQL_SELECT
*
select
;
SQL_SELECT
*
select
;
uint
ref_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
*
rec_buf
;
/* to read field values after filesort */
uchar
*
rec_buf
;
/* to read field values after filesort */
uchar
*
cache
,
*
cache_pos
,
*
cache_end
,
*
read_positions
;
uchar
*
cache
,
*
cache_pos
,
*
cache_end
,
*
read_positions
;
struct
st_sort_addon_field
*
addon_field
;
/* Pointer to the fields info */
struct
st_sort_addon_field
*
addon_field
;
/* Pointer to the fields info */
...
@@ -67,6 +67,7 @@ struct READ_RECORD
...
@@ -67,6 +67,7 @@ struct READ_RECORD
void
(
*
unpack
)(
struct
st_sort_addon_field
*
,
uchar
*
,
uchar
*
);
void
(
*
unpack
)(
struct
st_sort_addon_field
*
,
uchar
*
,
uchar
*
);
int
read_record
()
{
return
read_record_func
(
this
);
}
int
read_record
()
{
return
read_record_func
(
this
);
}
uchar
*
record
()
const
{
return
table
->
record
[
0
];
}
/*
/*
SJ-Materialization runtime may need to read fields from the materialized
SJ-Materialization runtime may need to read fields from the materialized
...
...
sql/sql_select.cc
View file @
490dcfd5
...
@@ -20439,7 +20439,6 @@ join_read_first(JOIN_TAB *tab)
...
@@ -20439,7 +20439,6 @@ join_read_first(JOIN_TAB *tab)
tab
->
table
->
status
=
0
;
tab
->
table
->
status
=
0
;
tab
->
read_record
.
read_record_func
=
join_read_next
;
tab
->
read_record
.
read_record_func
=
join_read_next
;
tab
->
read_record
.
table
=
table
;
tab
->
read_record
.
table
=
table
;
tab
->
read_record
.
record
=
table
->
record
[
0
];
if
(
!
table
->
file
->
inited
)
if
(
!
table
->
file
->
inited
)
error
=
table
->
file
->
ha_index_init
(
tab
->
index
,
tab
->
sorted
);
error
=
table
->
file
->
ha_index_init
(
tab
->
index
,
tab
->
sorted
);
if
(
likely
(
!
error
))
if
(
likely
(
!
error
))
...
@@ -20459,7 +20458,7 @@ static int
...
@@ -20459,7 +20458,7 @@ static int
join_read_next
(
READ_RECORD
*
info
)
join_read_next
(
READ_RECORD
*
info
)
{
{
int
error
;
int
error
;
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_index_next
(
info
->
record
))))
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_index_next
(
info
->
record
()
))))
return
report_error
(
info
->
table
,
error
);
return
report_error
(
info
->
table
,
error
);
return
0
;
return
0
;
...
@@ -20479,7 +20478,6 @@ join_read_last(JOIN_TAB *tab)
...
@@ -20479,7 +20478,6 @@ join_read_last(JOIN_TAB *tab)
tab
->
table
->
status
=
0
;
tab
->
table
->
status
=
0
;
tab
->
read_record
.
read_record_func
=
join_read_prev
;
tab
->
read_record
.
read_record_func
=
join_read_prev
;
tab
->
read_record
.
table
=
table
;
tab
->
read_record
.
table
=
table
;
tab
->
read_record
.
record
=
table
->
record
[
0
];
if
(
!
table
->
file
->
inited
)
if
(
!
table
->
file
->
inited
)
error
=
table
->
file
->
ha_index_init
(
tab
->
index
,
1
);
error
=
table
->
file
->
ha_index_init
(
tab
->
index
,
1
);
if
(
likely
(
!
error
))
if
(
likely
(
!
error
))
...
@@ -20496,7 +20494,7 @@ static int
...
@@ -20496,7 +20494,7 @@ static int
join_read_prev
(
READ_RECORD
*
info
)
join_read_prev
(
READ_RECORD
*
info
)
{
{
int
error
;
int
error
;
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_index_prev
(
info
->
record
))))
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_index_prev
(
info
->
record
()
))))
return
report_error
(
info
->
table
,
error
);
return
report_error
(
info
->
table
,
error
);
return
0
;
return
0
;
}
}
...
@@ -20526,7 +20524,7 @@ static int
...
@@ -20526,7 +20524,7 @@ static int
join_ft_read_next
(
READ_RECORD
*
info
)
join_ft_read_next
(
READ_RECORD
*
info
)
{
{
int
error
;
int
error
;
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_ft_read
(
info
->
table
->
record
[
0
]
))))
if
(
unlikely
((
error
=
info
->
table
->
file
->
ha_ft_read
(
info
->
record
()
))))
return
report_error
(
info
->
table
,
error
);
return
report_error
(
info
->
table
,
error
);
return
0
;
return
0
;
}
}
...
...
sql/sql_window.cc
View file @
490dcfd5
...
@@ -898,7 +898,7 @@ class Table_read_cursor : public Rowid_seq_cursor
...
@@ -898,7 +898,7 @@ class Table_read_cursor : public Rowid_seq_cursor
{
{
Rowid_seq_cursor
::
init
(
info
);
Rowid_seq_cursor
::
init
(
info
);
table
=
info
->
table
;
table
=
info
->
table
;
record
=
info
->
record
;
record
=
info
->
record
()
;
}
}
virtual
int
fetch
()
virtual
int
fetch
()
...
...
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