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
fc74c4d9
Commit
fc74c4d9
authored
Oct 29, 2008
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
8b1f501c
65811a33
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
11 deletions
+101
-11
sql/ha_partition.cc
sql/ha_partition.cc
+83
-0
sql/ha_partition.h
sql/ha_partition.h
+13
-5
sql/handler.h
sql/handler.h
+1
-1
sql/sql_partition.cc
sql/sql_partition.cc
+1
-2
sql/sql_table.cc
sql/sql_table.cc
+3
-3
No files found.
sql/ha_partition.cc
View file @
fc74c4d9
...
...
@@ -5760,6 +5760,89 @@ bool ha_partition::get_error_message(int error, String *buf)
/****************************************************************************
MODULE handler characteristics
****************************************************************************/
/**
alter_table_flags must be on handler/table level, not on hton level
due to the ha_partition hton does not know what the underlying hton is.
*/
uint
ha_partition
::
alter_table_flags
(
uint
flags
)
{
DBUG_ENTER
(
"ha_partition::alter_table_flags"
);
DBUG_RETURN
(
ht
->
alter_table_flags
(
flags
)
|
m_file
[
0
]
->
alter_table_flags
(
flags
));
}
/**
check if copy of data is needed in alter table.
*/
bool
ha_partition
::
check_if_incompatible_data
(
HA_CREATE_INFO
*
create_info
,
uint
table_changes
)
{
handler
**
file
;
bool
ret
;
/*
The check for any partitioning related changes have already been done
in mysql_alter_table (by fix_partition_func), so it is only up to
the underlying handlers.
*/
for
(
file
=
m_file
;
*
file
;
file
++
)
if
((
ret
=
(
*
file
)
->
check_if_incompatible_data
(
create_info
,
table_changes
))
!=
COMPATIBLE_DATA_YES
)
break
;
return
ret
;
}
/**
Support of fast or online add/drop index
*/
int
ha_partition
::
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
)
{
handler
**
file
;
int
ret
;
/*
There has already been a check in fix_partition_func in mysql_alter_table
before this call, which checks for unique/primary key violations of the
partitioning function. So no need for extra check here.
*/
for
(
file
=
m_file
;
*
file
;
file
++
)
if
((
ret
=
(
*
file
)
->
add_index
(
table_arg
,
key_info
,
num_of_keys
)))
break
;
return
ret
;
}
int
ha_partition
::
prepare_drop_index
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
)
{
handler
**
file
;
int
ret
;
/*
DROP INDEX does not affect partitioning.
*/
for
(
file
=
m_file
;
*
file
;
file
++
)
if
((
ret
=
(
*
file
)
->
prepare_drop_index
(
table_arg
,
key_num
,
num_of_keys
)))
break
;
return
ret
;
}
int
ha_partition
::
final_drop_index
(
TABLE
*
table_arg
)
{
handler
**
file
;
int
ret
=
HA_ERR_WRONG_COMMAND
;
for
(
file
=
m_file
;
*
file
;
file
++
)
if
((
ret
=
(
*
file
)
->
final_drop_index
(
table_arg
)))
break
;
return
ret
;
}
/*
If frm_error() is called then we will use this to to find out what file
extensions exist for the storage engine. This is also used by the default
...
...
sql/ha_partition.h
View file @
fc74c4d9
...
...
@@ -224,6 +224,8 @@ class ha_partition :public handler
DBUG_RETURN
(
0
);
}
virtual
void
change_table_ptr
(
TABLE
*
table_arg
,
TABLE_SHARE
*
share
);
virtual
bool
check_if_incompatible_data
(
HA_CREATE_INFO
*
create_info
,
uint
table_changes
);
private:
int
prepare_for_rename
();
int
copy_partitions
(
ulonglong
*
const
copied
,
ulonglong
*
const
deleted
);
...
...
@@ -774,6 +776,11 @@ class ha_partition :public handler
return
m_file
[
0
]
->
index_flags
(
inx
,
part
,
all_parts
);
}
/**
wrapper function for handlerton alter_table_flags, since
the ha_partition_hton cannot know all its capabilities
*/
virtual
uint
alter_table_flags
(
uint
flags
);
/*
extensions of table handler files
*/
...
...
@@ -949,13 +956,14 @@ class ha_partition :public handler
-------------------------------------------------------------------------
MODULE on-line ALTER TABLE
-------------------------------------------------------------------------
These methods are in the handler interface
but never used (yet
)
They are
to be used by on-line
alter table add/drop index:
These methods are in the handler interface
. (used by innodb-plugin
)
They are
used for on-line/fast
alter table add/drop index:
-------------------------------------------------------------------------
virtual ulong index_ddl_flags(KEY *wanted_index) const
virtual int add_index(TABLE *table_arg,KEY *key_info,uint num_of_keys);
virtual int drop_index(TABLE *table_arg,uint *key_num,uint num_of_keys);
*/
virtual
int
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
);
virtual
int
prepare_drop_index
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
);
virtual
int
final_drop_index
(
TABLE
*
table_arg
);
/*
-------------------------------------------------------------------------
...
...
sql/handler.h
View file @
fc74c4d9
sql/sql_partition.cc
View file @
fc74c4d9
...
...
@@ -4251,8 +4251,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
alter_info
->
no_parts
=
curr_part_no
-
new_part_no
;
}
}
if
(
table
->
s
->
db_type
()
->
alter_table_flags
&&
(
!
(
flags
=
table
->
s
->
db_type
()
->
alter_table_flags
(
alter_info
->
flags
))))
if
(
!
(
flags
=
table
->
file
->
alter_table_flags
(
alter_info
->
flags
)))
{
my_error
(
ER_PARTITION_FUNCTION_FAILURE
,
MYF
(
0
));
DBUG_RETURN
(
1
);
...
...
sql/sql_table.cc
View file @
fc74c4d9
...
...
@@ -6454,8 +6454,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint
*
idx_p
;
uint
*
idx_end_p
;
if
(
table
->
s
->
db_type
()
->
alter_table_flags
)
alter_flags
=
table
->
s
->
db_type
()
->
alter_table_flags
(
alter_info
->
flags
);
alter_flags
=
table
->
file
->
alter_table_flags
(
alter_info
->
flags
);
DBUG_PRINT
(
"info"
,
(
"alter_flags: %lu"
,
alter_flags
));
/* Check dropped indexes. */
for
(
idx_p
=
index_drop_buffer
,
idx_end_p
=
idx_p
+
index_drop_count
;
...
...
@@ -6725,7 +6724,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Copy the data if necessary. */
thd
->
count_cuted_fields
=
CHECK_FIELD_WARN
;
// calc cuted fields
thd
->
cuted_fields
=
0L
;
thd_proc_info
(
thd
,
"copy to tmp table"
);
copied
=
deleted
=
0
;
/*
We do not copy data for MERGE tables. Only the children have data.
...
...
@@ -6736,6 +6734,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* We don't want update TIMESTAMP fields during ALTER TABLE. */
new_table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SET
;
new_table
->
next_number_field
=
new_table
->
found_next_number_field
;
thd_proc_info
(
thd
,
"copy to tmp table"
);
error
=
copy_data_between_tables
(
table
,
new_table
,
alter_info
->
create_list
,
ignore
,
order_num
,
order
,
&
copied
,
&
deleted
,
...
...
@@ -6747,6 +6746,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
thd_proc_info
(
thd
,
"manage keys"
);
alter_table_manage_keys
(
table
,
table
->
file
->
indexes_are_disabled
(),
alter_info
->
keys_onoff
);
error
=
ha_autocommit_or_rollback
(
thd
,
0
);
...
...
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