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
5694d5a6
Commit
5694d5a6
authored
Jun 22, 2006
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-kt
into mysql.com:/usr/home/bar/mysql-5.1.b20086
parents
5eea9720
bfae7303
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
15 deletions
+68
-15
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+15
-0
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+1
-1
mysql-test/t/partition_innodb.test
mysql-test/t/partition_innodb.test
+12
-0
sql/field.cc
sql/field.cc
+30
-0
sql/field.h
sql/field.h
+3
-0
sql/key.cc
sql/key.cc
+4
-0
sql/sql_partition.cc
sql/sql_partition.cc
+3
-14
No files found.
mysql-test/r/partition_innodb.result
View file @
5694d5a6
...
@@ -92,3 +92,18 @@ DROP TABLE IF EXISTS t1;
...
@@ -92,3 +92,18 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
DROP TABLE IF EXISTS t0_template;
create table t1 (id varchar(64) primary key) engine=innodb
partition by key(id) partitions 5;
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
select * from t1 where id = 'a';
id
a
select * from t1 where id = 'aa';
id
aa
select * from t1 where id = 'aaa';
id
aaa
drop table t1;
mysql-test/r/partition_pruning.result
View file @
5694d5a6
...
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
...
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t2 where a=1 and b=1;
explain partitions select * from t2 where a=1 and b=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL
3
Using where
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL
2
Using where
create table t3 (
create table t3 (
a int
a int
)
)
...
...
mysql-test/t/partition_innodb.test
View file @
5694d5a6
...
@@ -66,3 +66,15 @@ DROP TABLE IF EXISTS t0_definition;
...
@@ -66,3 +66,15 @@ DROP TABLE IF EXISTS t0_definition;
DROP
TABLE
IF
EXISTS
t0_template
;
DROP
TABLE
IF
EXISTS
t0_template
;
--
enable_warnings
--
enable_warnings
#
# Bug#20086: Can't get data from key partitioned tables with VARCHAR key
#
create
table
t1
(
id
varchar
(
64
)
primary
key
)
engine
=
innodb
partition
by
key
(
id
)
partitions
5
;
insert
into
t1
values
(
'a'
);
insert
into
t1
values
(
'aa'
);
insert
into
t1
values
(
'aaa'
);
select
*
from
t1
where
id
=
'a'
;
select
*
from
t1
where
id
=
'aa'
;
select
*
from
t1
where
id
=
'aaa'
;
drop
table
t1
;
sql/field.cc
View file @
5694d5a6
...
@@ -1243,6 +1243,21 @@ uint Field::offset()
...
@@ -1243,6 +1243,21 @@ uint Field::offset()
}
}
void
Field
::
hash
(
ulong
*
nr
,
ulong
*
nr2
)
{
if
(
is_null
())
{
*
nr
^=
(
*
nr
<<
1
)
|
1
;
}
else
{
uint
len
=
pack_length
();
CHARSET_INFO
*
cs
=
charset
();
cs
->
coll
->
hash_sort
(
cs
,
(
uchar
*
)
ptr
,
len
,
nr
,
nr2
);
}
}
void
Field
::
copy_from_tmp
(
int
row_offset
)
void
Field
::
copy_from_tmp
(
int
row_offset
)
{
{
memcpy
(
ptr
,
ptr
+
row_offset
,
pack_length
());
memcpy
(
ptr
,
ptr
+
row_offset
,
pack_length
());
...
@@ -6925,6 +6940,21 @@ uint Field_varstring::is_equal(create_field *new_field)
...
@@ -6925,6 +6940,21 @@ uint Field_varstring::is_equal(create_field *new_field)
}
}
void
Field_varstring
::
hash
(
ulong
*
nr
,
ulong
*
nr2
)
{
if
(
is_null
())
{
*
nr
^=
(
*
nr
<<
1
)
|
1
;
}
else
{
uint
len
=
length_bytes
==
1
?
(
uint
)
(
uchar
)
*
ptr
:
uint2korr
(
ptr
);
CHARSET_INFO
*
cs
=
charset
();
cs
->
coll
->
hash_sort
(
cs
,
(
uchar
*
)
ptr
+
length_bytes
,
len
,
nr
,
nr2
);
}
}
/****************************************************************************
/****************************************************************************
** blob type
** blob type
** A blob is saved as a length and a pointer. The length is stored in the
** A blob is saved as a length and a pointer. The length is stored in the
...
...
sql/field.h
View file @
5694d5a6
...
@@ -351,6 +351,8 @@ class Field
...
@@ -351,6 +351,8 @@ class Field
return
field_length
/
charset
()
->
mbmaxlen
;
return
field_length
/
charset
()
->
mbmaxlen
;
}
}
/* Hash value */
virtual
void
hash
(
ulong
*
nr
,
ulong
*
nr2
);
friend
bool
reopen_table
(
THD
*
,
struct
st_table
*
,
bool
);
friend
bool
reopen_table
(
THD
*
,
struct
st_table
*
,
bool
);
friend
int
cre_myisam
(
my_string
name
,
register
TABLE
*
form
,
uint
options
,
friend
int
cre_myisam
(
my_string
name
,
register
TABLE
*
form
,
uint
options
,
ulonglong
auto_increment_value
);
ulonglong
auto_increment_value
);
...
@@ -1120,6 +1122,7 @@ class Field_varstring :public Field_longstr {
...
@@ -1120,6 +1122,7 @@ class Field_varstring :public Field_longstr {
char
*
new_ptr
,
uchar
*
new_null_ptr
,
char
*
new_ptr
,
uchar
*
new_null_ptr
,
uint
new_null_bit
);
uint
new_null_bit
);
uint
is_equal
(
create_field
*
new_field
);
uint
is_equal
(
create_field
*
new_field
);
void
hash
(
ulong
*
nr
,
ulong
*
nr2
);
};
};
...
...
sql/key.cc
View file @
5694d5a6
...
@@ -210,9 +210,13 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
...
@@ -210,9 +210,13 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
}
}
else
if
(
key_part
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
else
if
(
key_part
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
{
{
my_bitmap_map
*
old_map
;
key_length
-=
HA_KEY_BLOB_LENGTH
;
key_length
-=
HA_KEY_BLOB_LENGTH
;
length
=
min
(
key_length
,
key_part
->
length
);
length
=
min
(
key_length
,
key_part
->
length
);
old_map
=
dbug_tmp_use_all_columns
(
key_part
->
field
->
table
,
key_part
->
field
->
table
->
write_set
);
key_part
->
field
->
set_key_image
((
char
*
)
from_key
,
length
);
key_part
->
field
->
set_key_image
((
char
*
)
from_key
,
length
);
dbug_tmp_restore_column_map
(
key_part
->
field
->
table
->
write_set
,
old_map
);
from_key
+=
HA_KEY_BLOB_LENGTH
;
from_key
+=
HA_KEY_BLOB_LENGTH
;
}
}
else
else
...
...
sql/sql_partition.cc
View file @
5694d5a6
...
@@ -2103,26 +2103,15 @@ static inline longlong part_val_int(Item *item_expr)
...
@@ -2103,26 +2103,15 @@ static inline longlong part_val_int(Item *item_expr)
static
uint32
calculate_key_value
(
Field
**
field_array
)
static
uint32
calculate_key_value
(
Field
**
field_array
)
{
{
u
int32
hashnr
=
0
;
u
long
nr1
=
1
;
ulong
nr2
=
4
;
ulong
nr2
=
4
;
do
do
{
{
Field
*
field
=
*
field_array
;
Field
*
field
=
*
field_array
;
if
(
field
->
is_null
())
field
->
hash
(
&
nr1
,
&
nr2
);
{
hashnr
^=
(
hashnr
<<
1
)
|
1
;
}
else
{
uint
len
=
field
->
pack_length
();
ulong
nr1
=
1
;
CHARSET_INFO
*
cs
=
field
->
charset
();
cs
->
coll
->
hash_sort
(
cs
,
(
uchar
*
)
field
->
ptr
,
len
,
&
nr1
,
&
nr2
);
hashnr
^=
(
uint32
)
nr1
;
}
}
while
(
*
(
++
field_array
));
}
while
(
*
(
++
field_array
));
return
hashnr
;
return
(
uint32
)
nr1
;
}
}
...
...
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