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
2530fcde
Commit
2530fcde
authored
Sep 20, 2005
by
pappa@c-1309e253.1238-1-64736c10.cust.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle default engine type better for
partitioned tables
parent
f8d8548a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
90 additions
and
24 deletions
+90
-24
mysql-test/r/partition.result
mysql-test/r/partition.result
+8
-0
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+34
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+5
-0
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+6
-0
sql/handler.h
sql/handler.h
+1
-1
sql/sql_partition.cc
sql/sql_partition.cc
+7
-1
sql/sql_show.cc
sql/sql_show.cc
+12
-9
sql/sql_table.cc
sql/sql_table.cc
+7
-11
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-1
sql/table.cc
sql/table.cc
+4
-1
sql/unireg.cc
sql/unireg.cc
+1
-0
No files found.
mysql-test/r/partition.result
View file @
2530fcde
...
...
@@ -8,6 +8,14 @@ partition by key (a);
select count(*) from t1;
count(*)
0
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a)
drop table t1;
CREATE TABLE t1 (
a int not null,
...
...
mysql-test/r/partition_range.result
View file @
2530fcde
...
...
@@ -19,6 +19,14 @@ a b c
6 1 1
10 1 1
15 1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
ALTER TABLE t1
partition by range (a)
partitions 3
...
...
@@ -31,6 +39,14 @@ a b c
6 1 1
10 1 1
15 1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
...
...
@@ -120,6 +136,24 @@ subpartition x22)
);
SELECT * from t1;
a b c
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN d int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) default NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM))
drop table t1;
CREATE TABLE t1 (
a int not null,
...
...
mysql-test/t/partition.test
View file @
2530fcde
...
...
@@ -23,6 +23,11 @@ partition by key (a);
#
select
count
(
*
)
from
t1
;
#
# Test SHOW CREATE TABLE
#
show
create
table
t1
;
drop
table
t1
;
#
# Partition by key no partition, list of fields
...
...
mysql-test/t/partition_range.test
View file @
2530fcde
...
...
@@ -30,6 +30,7 @@ INSERT into t1 values (10, 1, 1);
INSERT
into
t1
values
(
15
,
1
,
1
);
select
*
from
t1
;
show
create
table
t1
;
ALTER
TABLE
t1
partition
by
range
(
a
)
...
...
@@ -39,6 +40,7 @@ partitions 3
partition
x3
values
less
than
maxvalue
tablespace
ts3
);
select
*
from
t1
;
show
create
table
t1
;
drop
table
if
exists
t1
;
...
...
@@ -143,6 +145,10 @@ subpartition by hash (a+b)
);
SELECT
*
from
t1
;
show
create
table
t1
;
ALTER
TABLE
t1
ADD
COLUMN
d
int
;
show
create
table
t1
;
drop
table
t1
;
...
...
sql/handler.h
View file @
2530fcde
...
...
@@ -686,7 +686,7 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf,
const
key_range
*
key_spec
,
part_id_range
*
part_spec
);
bool
mysql_unpack_partition
(
File
file
,
THD
*
thd
,
uint
part_info_len
,
TABLE
*
table
);
TABLE
*
table
,
enum
db_type
default_db_type
);
#endif
...
...
sql/sql_partition.cc
View file @
2530fcde
...
...
@@ -3081,7 +3081,7 @@ void get_partition_set(const TABLE *table, byte *buf, const uint index,
*/
bool
mysql_unpack_partition
(
File
file
,
THD
*
thd
,
uint
part_info_len
,
TABLE
*
table
)
TABLE
*
table
,
enum
db_type
default_db_type
)
{
Item
*
thd_free_list
=
thd
->
free_list
;
bool
result
=
TRUE
;
...
...
@@ -3119,6 +3119,12 @@ bool mysql_unpack_partition(File file, THD *thd, uint part_info_len,
}
part_info
=
lex
.
part_info
;
table
->
s
->
part_info
=
part_info
;
if
(
part_info
->
default_engine_type
==
DB_TYPE_UNKNOWN
)
part_info
->
default_engine_type
=
default_db_type
;
else
{
DBUG_ASSERT
(
part_info
->
default_engine_type
==
default_db_type
);
}
part_info
->
item_free_list
=
thd
->
free_list
;
{
...
...
sql/sql_show.cc
View file @
2530fcde
...
...
@@ -961,16 +961,19 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet
->
append
(
"
\n
)"
,
2
);
if
(
!
(
thd
->
variables
.
sql_mode
&
MODE_NO_TABLE_OPTIONS
)
&&
!
foreign_db_mode
)
{
#if 0 //def HAVE_PARTITION_DB
if (!table->s->part_info)
#endif
{
if
(
thd
->
variables
.
sql_mode
&
(
MODE_MYSQL323
|
MODE_MYSQL40
))
packet
->
append
(
" TYPE="
,
6
);
else
packet
->
append
(
" ENGINE="
,
8
);
if
(
thd
->
variables
.
sql_mode
&
(
MODE_MYSQL323
|
MODE_MYSQL40
))
packet
->
append
(
" TYPE="
,
6
);
else
packet
->
append
(
" ENGINE="
,
8
);
#ifdef HAVE_PARTITION_DB
if
(
table
->
s
->
part_info
)
packet
->
append
(
ha_get_storage_engine
(
table
->
s
->
part_info
->
default_engine_type
));
else
packet
->
append
(
file
->
table_type
());
}
#else
packet
->
append
(
file
->
table_type
());
#endif
if
(
share
->
table_charset
&&
!
(
thd
->
variables
.
sql_mode
&
MODE_MYSQL323
)
&&
...
...
sql/sql_table.cc
View file @
2530fcde
...
...
@@ -1620,6 +1620,10 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
part_engine_type
=
ha_checktype
(
thd
,
part_info
->
default_engine_type
,
0
,
0
);
}
else
{
part_info
->
default_engine_type
=
create_info
->
db_type
;
}
if
(
check_partition_info
(
part_info
,
part_engine_type
,
file
,
create_info
->
max_rows
))
DBUG_RETURN
(
TRUE
);
...
...
@@ -3467,16 +3471,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_error
(
ER_PARTITION_MGMT_ON_NONPARTITIONED
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
{
List_iterator
<
partition_element
>
t_it
(
tab_part_info
->
partitions
);
partition_element
*
t_part_elem
=
t_it
++
;
if
(
is_sub_partitioned
(
tab_part_info
))
{
List_iterator
<
partition_element
>
s_it
(
t_part_elem
->
subpartitions
);
t_part_elem
=
s_it
++
;
}
default_engine_type
=
t_part_elem
->
engine_type
;
}
default_engine_type
=
tab_part_info
->
default_engine_type
;
/*
We are going to manipulate the partition info on the table object
so we need to ensure that the data structure of the table object
...
...
@@ -3860,7 +3855,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
*/
if
(
thd
->
lex
->
part_info
!=
table
->
s
->
part_info
)
partition_changed
=
TRUE
;
thd
->
lex
->
part_info
->
default_engine_type
=
create_info
->
db_type
;
if
(
create_info
->
db_type
!=
DB_TYPE_PARTITION_DB
)
thd
->
lex
->
part_info
->
default_engine_type
=
create_info
->
db_type
;
create_info
->
db_type
=
DB_TYPE_PARTITION_DB
;
}
}
...
...
sql/sql_yacc.yy
View file @
2530fcde
...
...
@@ -3038,7 +3038,11 @@ opt_part_option:
TABLESPACE opt_equal ident_or_text
{ Lex->part_info->curr_part_elem->tablespace_name= $3.str; }
| opt_storage ENGINE_SYM opt_equal storage_engines
{ Lex->part_info->curr_part_elem->engine_type= $4; }
{
LEX *lex= Lex;
lex->part_info->curr_part_elem->engine_type= $4;
lex->part_info->default_engine_type= $4;
}
| NODEGROUP_SYM opt_equal ulong_num
{ Lex->part_info->curr_part_elem->nodegroup_id= $3; }
| MAX_ROWS opt_equal ulonglong_num
...
...
sql/table.cc
View file @
2530fcde
...
...
@@ -87,6 +87,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
SQL_CRYPT
*
crypted
=
0
;
MEM_ROOT
**
root_ptr
,
*
old_root
;
TABLE_SHARE
*
share
;
enum
db_type
default_part_db_type
;
DBUG_ENTER
(
"openfrm"
);
DBUG_PRINT
(
"enter"
,(
"name: '%s' form: 0x%lx"
,
name
,
outparam
));
...
...
@@ -164,6 +165,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if
(
share
->
frm_version
==
FRM_VER_TRUE_VARCHAR
-
1
&&
head
[
33
]
==
5
)
share
->
frm_version
=
FRM_VER_TRUE_VARCHAR
;
default_part_db_type
=
ha_checktype
(
thd
,(
enum
db_type
)
(
uint
)
*
(
head
+
61
),
0
,
0
);
share
->
db_type
=
ha_checktype
(
thd
,(
enum
db_type
)
(
uint
)
*
(
head
+
3
),
0
,
0
);
share
->
db_create_options
=
db_create_options
=
uint2korr
(
head
+
30
);
share
->
db_options_in_use
=
share
->
db_create_options
;
...
...
@@ -452,7 +454,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if
(
part_info_len
>
0
)
{
#ifdef HAVE_PARTITION_DB
if
(
mysql_unpack_partition
(
file
,
thd
,
part_info_len
,
outparam
))
if
(
mysql_unpack_partition
(
file
,
thd
,
part_info_len
,
outparam
,
default_part_db_type
))
goto
err
;
#else
goto
err
;
...
...
sql/unireg.cc
View file @
2530fcde
...
...
@@ -149,6 +149,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
if
(
part_info
)
{
int4store
(
fileinfo
+
55
,
part_info
->
part_info_len
);
fileinfo
[
61
]
=
(
uchar
)
part_info
->
default_engine_type
;
}
#endif
int2store
(
fileinfo
+
59
,
db_file
->
extra_rec_buf_length
());
...
...
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