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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a3e8ae12
Commit
a3e8ae12
authored
May 11, 2010
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A temporary solution to make CREATE TABLE attributes
to work when a table is partitioned
parent
8792d8a3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
9 deletions
+86
-9
mysql-test/r/partition_example.result
mysql-test/r/partition_example.result
+31
-0
mysql-test/t/partition_example-master.opt
mysql-test/t/partition_example-master.opt
+1
-0
mysql-test/t/partition_example.test
mysql-test/t/partition_example.test
+23
-0
mysql-test/t/plugin.test
mysql-test/t/plugin.test
+1
-1
sql/ha_partition.cc
sql/ha_partition.cc
+1
-3
sql/ha_partition.h
sql/ha_partition.h
+23
-0
sql/handler.cc
sql/handler.cc
+0
-3
sql/handler.h
sql/handler.h
+4
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-1
sql/table.cc
sql/table.cc
+1
-1
No files found.
mysql-test/r/partition_example.result
0 → 100644
View file @
a3e8ae12
install plugin example soname 'ha_example.so';
create table t1 (a int not null)
engine=example
partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
drop table t1;
create table t1 (a int not null)
engine=example ull=12340
partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
/*!50100 PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
drop table t1;
select 1;
1
1
uninstall plugin example;
mysql-test/t/partition_example-master.opt
0 → 100644
View file @
a3e8ae12
$EXAMPLE_PLUGIN_OPT
mysql-test/t/partition_example.test
0 → 100644
View file @
a3e8ae12
--
source
include
/
not_windows_embedded
.
inc
--
source
include
/
have_example_plugin
.
inc
--
source
include
/
have_partition
.
inc
--
replace_regex
/
\
.
dll
/.
so
/
eval
install
plugin
example
soname
$HA_EXAMPLE_SO
;
create
table
t1
(
a
int
not
null
)
engine
=
example
partition
by
list
(
a
)
(
partition
p0
values
in
(
1
),
partition
p1
values
in
(
2
));
show
create
table
t1
;
drop
table
t1
;
create
table
t1
(
a
int
not
null
)
engine
=
example
ull
=
12340
partition
by
list
(
a
)
(
partition
p0
values
in
(
1
),
partition
p1
values
in
(
2
));
show
create
table
t1
;
drop
table
t1
;
select
1
;
uninstall
plugin
example
;
mysql-test/t/plugin.test
View file @
a3e8ae12
...
...
@@ -131,7 +131,7 @@ SET @@SQL_MODE=@OLD_SQL_MODE;
# The only preparable statement above was CREATE TABLE.
# We need to prepare another statement here to force the
# previous one to be deallocated (mysqltest reuses the same handle)
# and to unlock all thread-local plugin locks. Otherwise
it
won't
# and to unlock all thread-local plugin locks. Otherwise
the plugin
won't
# uninstall.
#
select
1
;
...
...
sql/ha_partition.cc
View file @
a3e8ae12
...
...
@@ -1219,9 +1219,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
DBUG_ENTER
(
"prepare_new_partition"
);
if
((
error
=
set_up_table_before_create
(
tbl
,
part_name
,
create_info
,
0
,
p_elem
))
||
parse_engine_table_options
(
ha_thd
(),
file
->
ht
,
file
->
table_share
))
0
,
p_elem
)))
goto
error_create
;
if
((
error
=
file
->
ha_create
(
part_name
,
tbl
,
create_info
)))
{
...
...
sql/ha_partition.h
View file @
a3e8ae12
...
...
@@ -1113,4 +1113,27 @@ public:
-------------------------------------------------------------------------
virtual void append_create_info(String *packet)
*/
/*
the following heavily relies on the fact that all partitions
are in the same storage engine.
When this limitation is lifted, the following hack should go away,
and a proper interface for engines needs to be introduced:
an PARTITION_SHARE structure that has a pointer to the TABLE_SHARE.
is given to engines everywhere where TABLE_SHARE is used now
has members like option_struct, ha_data
perhaps TABLE needs to be split the same way too...
this can also be done before partition will support a mix of engines,
but preferably together with other incompatible API changes.
*/
virtual
handlerton
*
partition_ht
()
const
{
handlerton
*
h
=
m_file
[
0
]
->
ht
;
for
(
int
i
=
1
;
i
<
m_tot_parts
;
i
++
)
DBUG_ASSERT
(
h
==
m_file
[
i
]
->
ht
);
return
h
;
}
};
sql/handler.cc
View file @
a3e8ae12
...
...
@@ -3720,9 +3720,6 @@ int ha_create_table(THD *thd, const char *path,
name
=
get_canonical_filename
(
table
.
file
,
share
.
path
.
str
,
name_buff
);
if
(
parse_engine_table_options
(
thd
,
table
.
file
->
ht
,
&
share
))
goto
err
;
error
=
table
.
file
->
ha_create
(
name
,
&
table
,
create_info
);
VOID
(
closefrm
(
&
table
,
0
));
...
...
sql/handler.h
View file @
a3e8ae12
...
...
@@ -2230,6 +2230,10 @@ private:
virtual
int
rename_partitions
(
const
char
*
path
)
{
return
HA_ERR_WRONG_COMMAND
;
}
friend
class
ha_partition
;
public:
/* XXX to be removed, see ha_partition::partition_ht() */
virtual
handlerton
*
partition_ht
()
const
{
return
ht
;
}
};
...
...
sql/sql_table.cc
View file @
a3e8ae12
...
...
@@ -3445,7 +3445,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if
(
parse_option_list
(
thd
,
&
create_info
->
option_struct
,
create_info
->
option_list
,
create_info
->
db_type
->
table_options
,
FALSE
,
file
->
partition_ht
()
->
table_options
,
FALSE
,
thd
->
mem_root
))
DBUG_RETURN
(
TRUE
);
...
...
sql/table.cc
View file @
a3e8ae12
...
...
@@ -1636,7 +1636,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if
(
engine_table_options_frm_read
(
options
,
options_len
,
share
))
goto
free_and_err
;
}
if
(
parse_engine_table_options
(
thd
,
handler_file
->
ht
,
share
))
if
(
parse_engine_table_options
(
thd
,
handler_file
->
partition_ht
()
,
share
))
goto
free_and_err
;
my_free
(
buff
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
...
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