mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-16288 ALTER TABLE…ALGORITHM=DEFAULT does not override alter_algorithm
- ALTER_ALGORITHM should be substituted when there is no mention of algorithm in alter statement. - Introduced algorithm(thd) in Alter_info. It returns the user requested algorithm. If user doesn't specify algorithm explicitly then it returns alter_algorithm variable. - changed algorithm() to get_algorithm(thd) to return algorithm name for displaying the error. - set_requested_algorithm(algo_value) to avoid direct assignment on requested_algorithm variable. - Avoid direct access of requested_algorithm to encapsulate requested_algorithm variable
This commit is contained in:
@ -57,7 +57,10 @@ public:
|
||||
ALTER_TABLE_ALGORITHM_NOCOPY,
|
||||
|
||||
// Instant should allow any operation that changes metadata only.
|
||||
ALTER_TABLE_ALGORITHM_INSTANT
|
||||
ALTER_TABLE_ALGORITHM_INSTANT,
|
||||
|
||||
// When there is no specification of algorithm during alter table.
|
||||
ALTER_TABLE_ALGORITHM_NONE
|
||||
};
|
||||
|
||||
|
||||
@ -104,8 +107,11 @@ public:
|
||||
List<const char> partition_names;
|
||||
// Number of partitions.
|
||||
uint num_parts;
|
||||
private:
|
||||
// Type of ALTER TABLE algorithm.
|
||||
enum_alter_table_algorithm requested_algorithm;
|
||||
|
||||
public:
|
||||
// Type of ALTER TABLE lock.
|
||||
enum_alter_table_lock requested_lock;
|
||||
|
||||
@ -114,7 +120,7 @@ public:
|
||||
flags(0), partition_flags(0),
|
||||
keys_onoff(LEAVE_AS_IS),
|
||||
num_parts(0),
|
||||
requested_algorithm(ALTER_TABLE_ALGORITHM_DEFAULT),
|
||||
requested_algorithm(ALTER_TABLE_ALGORITHM_NONE),
|
||||
requested_lock(ALTER_TABLE_LOCK_DEFAULT)
|
||||
{}
|
||||
|
||||
@ -130,7 +136,7 @@ public:
|
||||
keys_onoff= LEAVE_AS_IS;
|
||||
num_parts= 0;
|
||||
partition_names.empty();
|
||||
requested_algorithm= ALTER_TABLE_ALGORITHM_DEFAULT;
|
||||
requested_algorithm= ALTER_TABLE_ALGORITHM_NONE;
|
||||
requested_lock= ALTER_TABLE_LOCK_DEFAULT;
|
||||
}
|
||||
|
||||
@ -177,10 +183,16 @@ public:
|
||||
|
||||
bool set_requested_lock(const LEX_CSTRING *str);
|
||||
|
||||
/**
|
||||
Set the requested algorithm to the given algorithm value
|
||||
@param algo_value algorithm to be set
|
||||
*/
|
||||
void set_requested_algorithm(enum_alter_table_algorithm algo_value);
|
||||
|
||||
/**
|
||||
Returns the algorithm value in the format "algorithm=value"
|
||||
*/
|
||||
const char* algorithm() const;
|
||||
const char* algorithm_clause(THD *thd) const;
|
||||
|
||||
/**
|
||||
Returns the lock value in the format "lock=value"
|
||||
@ -216,6 +228,12 @@ public:
|
||||
bool supports_lock(THD *thd, enum_alter_inplace_result result,
|
||||
const Alter_inplace_info *ha_alter_info);
|
||||
|
||||
/**
|
||||
Return user requested algorithm. If user does not specify
|
||||
algorithm then return alter_algorithm variable value.
|
||||
*/
|
||||
enum_alter_table_algorithm algorithm(const THD *thd) const;
|
||||
|
||||
private:
|
||||
Alter_info &operator=(const Alter_info &rhs); // not implemented
|
||||
Alter_info(const Alter_info &rhs); // not implemented
|
||||
|
Reference in New Issue
Block a user