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
2521ac0c
Commit
2521ac0c
authored
Feb 28, 2012
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed all review feedbacks for mwl #247.
parent
9db23c82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
17 deletions
+29
-17
sql/opt_range.cc
sql/opt_range.cc
+7
-6
sql/sql_select.cc
sql/sql_select.cc
+2
-2
sql/table.cc
sql/table.cc
+18
-7
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+2
-2
No files found.
sql/opt_range.cc
View file @
2521ac0c
...
...
@@ -2987,7 +2987,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
init_sql_alloc
(
&
alloc
,
thd
->
variables
.
range_alloc_block_size
,
0
);
if
(
!
(
param
.
key_parts
=
(
KEY_PART
*
)
alloc_root
(
&
alloc
,
sizeof
(
KEY_PART
)
*
sizeof
(
KEY_PART
)
*
head
->
s
->
actual_n_key_parts
(
thd
)))
||
fill_used_fields_bitmap
(
&
param
))
{
...
...
@@ -11717,7 +11717,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
if
(
!
table
->
covering_keys
.
is_set
(
cur_index
))
goto
next_index
;
/*
/*
Unless extended keys can be used for cur_index:
If the current storage manager is such that it appends the primary key to
each index, then the above condition is insufficient to check if the
...
...
@@ -11727,8 +11727,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
does not qualify as covering in our case. If this is the case, below
we check that all query fields are indeed covered by 'cur_index'.
*/
if
(
cur_index_info
->
key_parts
==
table
->
actual_n_key_parts
(
cur_index_info
)
&&
pk
<
MAX_KEY
&&
cur_index
!=
pk
&&
if
(
cur_index_info
->
key_parts
==
table
->
actual_n_key_parts
(
cur_index_info
)
&&
pk
<
MAX_KEY
&&
cur_index
!=
pk
&&
(
table
->
file
->
ha_table_flags
()
&
HA_PRIMARY_KEY_IN_READ_INDEX
))
{
/* For each table field */
...
...
@@ -11845,7 +11845,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
If there is no MIN/MAX, the keyparts after the last group part can be
referenced only in equalities with constants, and the referenced keyparts
must form a sequence without any gaps that starts immediately after the
last group keypar
y
t.
last group keypart.
*/
key_parts
=
table
->
actual_n_key_parts
(
cur_index_info
);
last_part
=
cur_index_info
->
key_part
+
key_parts
;
...
...
@@ -12299,7 +12299,8 @@ get_field_keypart(KEY *index, Field *field)
{
KEY_PART_INFO
*
part
,
*
end
;
for
(
part
=
index
->
key_part
,
end
=
part
+
field
->
table
->
actual_n_key_parts
(
index
);
for
(
part
=
index
->
key_part
,
end
=
part
+
field
->
table
->
actual_n_key_parts
(
index
);
part
<
end
;
part
++
)
{
if
(
field
->
eq
(
part
->
field
))
...
...
sql/sql_select.cc
View file @
2521ac0c
...
...
@@ -3406,7 +3406,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
The effect of this is that we don't do const substitution for
such tables.
*/
KEY
*
keyinfo
=
table
->
key_info
+
key
;
KEY
*
keyinfo
=
table
->
key_info
+
key
;
uint
key_parts
=
table
->
actual_n_key_parts
(
keyinfo
);
if
(
eq_part
.
is_prefix
(
key_parts
)
&&
!
table
->
fulltext_searched
&&
...
...
@@ -4746,7 +4746,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* fill keyuse with found key parts */
for
(
;
field
!=
end
;
field
++
)
{
if
(
add_key_part
(
keyuse
,
field
))
if
(
add_key_part
(
keyuse
,
field
))
return
TRUE
;
}
...
...
sql/table.cc
View file @
2521ac0c
...
...
@@ -809,6 +809,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share
->
keys_for_keyread
.
init
(
0
);
share
->
keys_in_use
.
init
(
keys
);
/*
At this point we don't have enough information read from the frm file
to get a proper handlerton for the interesting engine in order to get
properties of this engine.
*/
/* Currently only InnoDB can use extended keys */
share
->
set_use_ext_keys_flag
(
legacy_db_type
==
DB_TYPE_INNODB
);
...
...
@@ -830,6 +835,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
added that are not included in the proper key definition.
If after all it turns out that there is no primary key the
added components are removed from each key.
When in the future we support others schemes of extending of
secondary keys with components of the primary key we'll have
to change the type of this flag for an enumeration type.
*/
for
(
i
=
0
;
i
<
keys
;
i
++
,
keyinfo
++
)
...
...
@@ -857,16 +866,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
ext_key_parts
=
key_parts
+
(
share
->
use_ext_keys
?
first_keyinfo
.
key_parts
*
(
keys
-
1
)
:
0
);
n_length
=
keys
*
sizeof
(
KEY
)
+
ext_key_parts
*
sizeof
(
KEY_PART_INFO
);
n_length
=
keys
*
sizeof
(
KEY
)
+
ext_key_parts
*
sizeof
(
KEY_PART_INFO
);
if
(
!
(
keyinfo
=
(
KEY
*
)
alloc_root
(
&
share
->
mem_root
,
n_length
+
len
)))
goto
err
;
/* purecov: inspected */
bzero
((
char
*
)
keyinfo
,
n_length
);
share
->
key_info
=
keyinfo
;
key_part
=
my_reinterpret_cast
(
KEY_PART_INFO
*
)
(
keyinfo
+
keys
);
key_part
=
my_reinterpret_cast
(
KEY_PART_INFO
*
)
(
keyinfo
+
keys
);
if
(
!
(
rec_per_key
=
(
ulong
*
)
alloc_root
(
&
share
->
mem_root
,
sizeof
(
ulong
)
*
ext_key_parts
)))
sizeof
(
ulong
)
*
ext_key_parts
)))
goto
err
;
first_key_part
=
key_part
;
first_key_parts
=
first_keyinfo
.
key_parts
;
...
...
@@ -913,7 +922,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
keyinfo
->
ext_key_flags
=
keyinfo
->
flags
|
HA_NOSAME
;
keyinfo
->
ext_key_part_map
=
0
;
for
(
j
=
0
;
j
<
first_key_parts
&&
keyinfo
->
ext_key_parts
<
MAX_REF_PARTS
;
j
++
)
for
(
j
=
0
;
j
<
first_key_parts
&&
keyinfo
->
ext_key_parts
<
MAX_REF_PARTS
;
j
++
)
{
uint
key_parts
=
keyinfo
->
key_parts
;
KEY_PART_INFO
*
curr_key_part
=
keyinfo
->
key_part
;
...
...
@@ -1547,7 +1558,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if
(
ext_key_parts
>
share
->
key_parts
&&
key
)
{
KEY_PART_INFO
*
new_key_part
=
(
keyinfo
-
1
)
->
key_part
+
KEY_PART_INFO
*
new_key_part
=
(
keyinfo
-
1
)
->
key_part
+
(
keyinfo
-
1
)
->
ext_key_parts
;
/*
...
...
@@ -2370,7 +2381,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
key_info
->
key_parts
)
;
for
(
;
key_part
<
key_part_end
;
key_part
++
)
{
Field
*
field
=
key_part
->
field
=
outparam
->
field
[
key_part
->
fieldnr
-
1
];
Field
*
field
=
key_part
->
field
=
outparam
->
field
[
key_part
->
fieldnr
-
1
];
if
(
field
->
key_length
()
!=
key_part
->
length
&&
!
(
field
->
flags
&
BLOB_FLAG
))
...
...
@@ -2385,7 +2396,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
}
}
if
(
!
share
->
use_ext_keys
)
key_part
+=
key_info
->
ext_key_parts
-
key_info
->
key_parts
;
key_part
+=
key_info
->
ext_key_parts
-
key_info
->
key_parts
;
}
}
...
...
storage/xtradb/handler/ha_innodb.cc
View file @
2521ac0c
...
...
@@ -8080,10 +8080,10 @@ ha_innobase::records_in_range(
heap
=
mem_heap_create
(
2
*
(
key_parts
*
sizeof
(
dfield_t
)
+
sizeof
(
dtuple_t
)));
range_start
=
dtuple_create
(
heap
,
key_parts
);
range_start
=
dtuple_create
(
heap
,
key_parts
);
dict_index_copy_types
(
range_start
,
index
,
key_parts
);
range_end
=
dtuple_create
(
heap
,
key_parts
);
range_end
=
dtuple_create
(
heap
,
key_parts
);
dict_index_copy_types
(
range_end
,
index
,
key_parts
);
row_sel_convert_mysql_key_to_innobase
(
...
...
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