summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-05-07 14:54:58 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-05-07 14:58:11 +0530
commit85cc6b70bd7e5db2c96c4f58344bab269343cf85 (patch)
treeffa0ab7a6a75996497ce75b65fe9d5d3b02c9bd0 /sql/handler.h
parenta0bc3b7eeef6a3bfd0e7eae1cceabcc73071a61a (diff)
downloadmariadb-git-85cc6b70bd7e5db2c96c4f58344bab269343cf85.tar.gz
MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT
Introduced new alter algorithm type called NOCOPY & INSTANT for inplace alter operation. NOCOPY - Algorithm refuses any alter operation that would rebuild the clustered index. It is a subset of INPLACE algorithm. INSTANT - Algorithm allow any alter operation that would modify only meta data. It is a subset of NOCOPY algorithm. Introduce new variable called alter_algorithm. The values are DEFAULT(0), COPY(1), INPLACE(2), NOCOPY(3), INSTANT(4) Message to deprecate old_alter_table variable and make it alias for alter_algorithm variable. alter_algorithm variable for slave is always set to default.
Diffstat (limited to 'sql/handler.h')
-rw-r--r--sql/handler.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/sql/handler.h b/sql/handler.h
index 549fcb264be..9c4766c4f39 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -73,11 +73,14 @@ class sequence_definition;
*/
enum enum_alter_inplace_result {
HA_ALTER_ERROR,
+ HA_ALTER_INPLACE_COPY_NO_LOCK,
+ HA_ALTER_INPLACE_COPY_LOCK,
+ HA_ALTER_INPLACE_NOCOPY_LOCK,
+ HA_ALTER_INPLACE_NOCOPY_NO_LOCK,
+ HA_ALTER_INPLACE_INSTANT,
HA_ALTER_INPLACE_NOT_SUPPORTED,
HA_ALTER_INPLACE_EXCLUSIVE_LOCK,
- HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE,
HA_ALTER_INPLACE_SHARED_LOCK,
- HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE,
HA_ALTER_INPLACE_NO_LOCK
};
@@ -2304,8 +2307,7 @@ public:
/**
Can be set by handler to describe why a given operation cannot be done
in-place (HA_ALTER_INPLACE_NOT_SUPPORTED) or why it cannot be done
- online (HA_ALTER_INPLACE_NO_LOCK or
- HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE)
+ online (HA_ALTER_INPLACE_NO_LOCK or HA_ALTER_INPLACE_COPY_NO_LOCK)
If set, it will be used with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON if
results from handler::check_if_supported_inplace_alter() doesn't match
requirements set by user. If not set, the more generic
@@ -2353,7 +2355,7 @@ public:
replace not_supported with.
*/
void report_unsupported_error(const char *not_supported,
- const char *try_instead);
+ const char *try_instead) const;
};
@@ -4060,8 +4062,8 @@ public:
*) As the first step, we acquire a lock corresponding to the concurrency
level which was returned by handler::check_if_supported_inplace_alter()
and requested by the user. This lock is held for most of the
- duration of in-place ALTER (if HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE
- or HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE were returned we acquire an
+ duration of in-place ALTER (if HA_ALTER_INPLACE_COPY_LOCK
+ or HA_ALTER_INPLACE_COPY_NO_LOCK were returned we acquire an
exclusive lock for duration of the next step only).
*) After that we call handler::ha_prepare_inplace_alter_table() to give the
storage engine a chance to update its internal structures with a higher
@@ -4105,12 +4107,12 @@ public:
@retval HA_ALTER_ERROR Unexpected error.
@retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported, must use copy.
@retval HA_ALTER_INPLACE_EXCLUSIVE_LOCK Supported, but requires X lock.
- @retval HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE
+ @retval HA_ALTER_INPLACE_COPY_LOCK
Supported, but requires SNW lock
during main phase. Prepare phase
requires X lock.
@retval HA_ALTER_INPLACE_SHARED_LOCK Supported, but requires SNW lock.
- @retval HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
+ @retval HA_ALTER_INPLACE_COPY_NO_LOCK
Supported, concurrent reads/writes
allowed. However, prepare phase
requires X lock.
@@ -4170,10 +4172,9 @@ protected:
/**
Allows the storage engine to update internal structures with concurrent
writes blocked. If check_if_supported_inplace_alter() returns
- HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE or
- HA_ALTER_INPLACE_SHARED_AFTER_PREPARE, this function is called with
- exclusive lock otherwise the same level of locking as for
- inplace_alter_table() will be used.
+ HA_ALTER_INPLACE_COPY_NO_LOCK or HA_ALTER_INPLACE_COPY_LOCK,
+ this function is called with exclusive lock otherwise the same level
+ of locking as for inplace_alter_table() will be used.
@note Storage engines are responsible for reporting any errors by
calling my_error()/print_error()