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
e1b44e91
Commit
e1b44e91
authored
Jul 27, 2005
by
pappa@c-8b0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed proper merge of partitioning with
WL #2301 ALTER TABLE optimisations
parent
4954b600
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
sql/sql_table.cc
sql/sql_table.cc
+16
-0
No files found.
sql/sql_table.cc
View file @
e1b44e91
...
...
@@ -3287,6 +3287,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint
db_create_options
,
used_fields
;
enum
db_type
old_db_type
,
new_db_type
;
uint
need_copy_table
=
0
;
#ifdef HAVE_PARTITION_DB
bool
partition_changed
=
FALSE
;
#endif
DBUG_ENTER
(
"mysql_alter_table"
);
thd
->
proc_info
=
"init"
;
...
...
@@ -3372,6 +3375,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
We use the new partitioning. The new partitioning is already
defined in the correct variable so no work is needed to
accomplish this.
We do however need to update partition_changed to ensure that not
only the frm file is changed in the ALTER TABLE command.
Case IIa:
There was a partitioning before and there is no new one defined.
...
...
@@ -3390,27 +3395,34 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
the old partitioning info and create a new table using the specified
engine. This is the reason for the extra check if old and new engine
is equal.
In this case the partition also is changed.
Case III:
There was no partitioning before altering the table, there is
partitioning defined in the altered table. Use the new partitioning.
No work needed since the partitioning info is already in the
correct variable.
Also here partition has changed and thus a new table must be
created.
Case IV:
There was no partitioning before and no partitioning defined. Obviously
no work needed.
*/
if
(
table
->
s
->
part_info
)
{
if
(
!
thd
->
lex
->
part_info
&&
create_info
->
db_type
==
old_db_type
)
thd
->
lex
->
part_info
=
table
->
s
->
part_info
;
}
if
(
thd
->
lex
->
part_info
)
{
/*
Need to cater for engine types that can handle partition without
using the partition handler.
*/
if
(
thd
->
lex
->
part_info
!=
table
->
s
->
part_info
)
partition_changed
=
TRUE
;
thd
->
lex
->
part_info
->
default_engine_type
=
create_info
->
db_type
;
create_info
->
db_type
=
DB_TYPE_PARTITION_DB
;
}
...
...
@@ -3780,7 +3792,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
set_table_default_charset
(
thd
,
create_info
,
db
);
#ifdef HAVE_PARTITION_DB
if
(
thd
->
variables
.
old_alter_table
||
partition_changed
)
#else
if
(
thd
->
variables
.
old_alter_table
)
#endif
need_copy_table
=
1
;
else
need_copy_table
=
compare_tables
(
table
,
&
create_list
,
&
key_list
,
...
...
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