MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Alter_inplace_info Class Reference

#include <handler.h>

Collaboration diagram for Alter_inplace_info:

Public Types

typedef ulong HA_ALTER_FLAGS

Public Member Functions

 Alter_inplace_info (HA_CREATE_INFO *create_info_arg, Alter_info *alter_info_arg, KEY *key_info_arg, uint key_count_arg, partition_info *modified_part_info_arg, bool ignore_arg)
void report_unsupported_error (const char *not_supported, const char *try_instead)

Public Attributes

HA_CREATE_INFOcreate_info
Alter_infoalter_info
KEYkey_info_buffer
uint key_count
uint index_drop_count
KEY ** index_drop_buffer
uint index_add_count
uint * index_add_buffer
inplace_alter_handler_ctxhandler_ctx
inplace_alter_handler_ctx ** group_commit_ctx
HA_ALTER_FLAGS handler_flags
partition_infomodified_part_info
const bool ignore
bool online
const char * unsupported_reason

Static Public Attributes

static const HA_ALTER_FLAGS ADD_INDEX = 1L << 0
static const HA_ALTER_FLAGS DROP_INDEX = 1L << 1
static const HA_ALTER_FLAGS ADD_UNIQUE_INDEX = 1L << 2
static const HA_ALTER_FLAGS DROP_UNIQUE_INDEX = 1L << 3
static const HA_ALTER_FLAGS ADD_PK_INDEX = 1L << 4
static const HA_ALTER_FLAGS DROP_PK_INDEX = 1L << 5
static const HA_ALTER_FLAGS ADD_COLUMN = 1L << 6
static const HA_ALTER_FLAGS DROP_COLUMN = 1L << 7
static const HA_ALTER_FLAGS ALTER_COLUMN_NAME = 1L << 8
static const HA_ALTER_FLAGS ALTER_COLUMN_TYPE = 1L << 9
static const HA_ALTER_FLAGS ALTER_COLUMN_EQUAL_PACK_LENGTH = 1L << 10
static const HA_ALTER_FLAGS ALTER_COLUMN_ORDER = 1L << 11
static const HA_ALTER_FLAGS ALTER_COLUMN_NULLABLE = 1L << 12
static const HA_ALTER_FLAGS ALTER_COLUMN_NOT_NULLABLE = 1L << 13
static const HA_ALTER_FLAGS ALTER_COLUMN_DEFAULT = 1L << 14
static const HA_ALTER_FLAGS ADD_FOREIGN_KEY = 1L << 15
static const HA_ALTER_FLAGS DROP_FOREIGN_KEY = 1L << 16
static const HA_ALTER_FLAGS CHANGE_CREATE_OPTION = 1L << 17
static const HA_ALTER_FLAGS ALTER_RENAME = 1L << 18
static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1L << 19
static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1L << 20
static const HA_ALTER_FLAGS ADD_PARTITION = 1L << 21
static const HA_ALTER_FLAGS DROP_PARTITION = 1L << 22
static const HA_ALTER_FLAGS ALTER_PARTITION = 1L << 23
static const HA_ALTER_FLAGS COALESCE_PARTITION = 1L << 24
static const HA_ALTER_FLAGS REORGANIZE_PARTITION = 1L << 25
static const HA_ALTER_FLAGS ALTER_TABLE_REORG = 1L << 26
static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING = 1L << 27
static const HA_ALTER_FLAGS ALTER_ALL_PARTITION = 1L << 28

Detailed Description

Class describing changes to be done by ALTER TABLE. Instance of this class is passed to storage engine in order to determine if this ALTER TABLE can be done using in-place algorithm. It is also used for executing the ALTER TABLE using in-place algorithm.

Definition at line 1097 of file handler.h.

Member Typedef Documentation

Bits to show in detail what operations the storage engine is to execute.

All these operations are supported as in-place operations by the SQL layer. This means that operations that by their nature must be performed by copying the table to a temporary table, will not have their own flags here (e.g. ALTER TABLE FORCE, ALTER TABLE ENGINE).

We generally try to specify handler flags only if there are real changes. But in cases when it is cumbersome to determine if some attribute has really changed we might choose to set flag pessimistically, for example, relying on parser output only.

Definition at line 1115 of file handler.h.

Member Function Documentation

void Alter_inplace_info::report_unsupported_error ( const char *  not_supported,
const char *  try_instead 
)

Used after check_if_supported_inplace_alter() to report error if the result does not match the LOCK/ALGORITHM requirements set by the user.

Parameters
not_supportedPart of statement that was not supported.
try_insteadSuggestion as to what the user should replace not_supported with.

Definition at line 4390 of file handler.cc.

Member Data Documentation

const HA_ALTER_FLAGS Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH = 1L << 10
static

Change column datatype in such way that new type has compatible packed representation with old type, so it is theoretically possible to perform change by only updating data dictionary without changing table rows.

Definition at line 1153 of file handler.h.

Alter_info* Alter_inplace_info::alter_info

Alter options, fields and keys for the new version of table.

Note
The referenced instance of Alter_info object was already used to create new .FRM file for table being altered. So it has been processed by mysql_prepare_create_table() already. In particular, this means that in Create_field objects for fields which were present in some form in the old version of table, Create_field::field member points to corresponding Field instance for old version of table.

Definition at line 1231 of file handler.h.

HA_CREATE_INFO* Alter_inplace_info::create_info

Create options (like MAX_ROWS) for the new version of table.

Note
The referenced instance of HA_CREATE_INFO object was already used to create new .FRM file for table being altered. So it has been processed by mysql_prepare_create_table() already. For example, this means that it has HA_OPTION_PACK_RECORD flag in HA_CREATE_INFO::table_options member correctly set.

Definition at line 1218 of file handler.h.

inplace_alter_handler_ctx** Alter_inplace_info::group_commit_ctx

If the table uses several handlers, like ha_partition uses one handler per partition, this contains a Null terminated array of ctx pointers that should all be committed together. Or NULL if only handler_ctx should be committed. Set to NULL if the low level handler::commit_inplace_alter_table uses it, to signal to the main handler that everything was committed as atomically.

See Also
inplace_alter_handler_ctx for information about object lifecycle.

Definition at line 1289 of file handler.h.

inplace_alter_handler_ctx* Alter_inplace_info::handler_ctx

Context information to allow handlers to keep context between in-place alter API calls.

See Also
inplace_alter_handler_ctx for information about object lifecycle.

Definition at line 1277 of file handler.h.

HA_ALTER_FLAGS Alter_inplace_info::handler_flags

Flags describing in detail which operations the storage engine is to execute.

Definition at line 1294 of file handler.h.

const bool Alter_inplace_info::ignore

true for ALTER IGNORE TABLE ...

Definition at line 1305 of file handler.h.

uint* Alter_inplace_info::index_add_buffer

Array of indexes into key_info_buffer for KEYs to be added, sorted in increasing order.

Definition at line 1269 of file handler.h.

uint Alter_inplace_info::index_add_count

Size of index_add_buffer array.

Definition at line 1263 of file handler.h.

KEY** Alter_inplace_info::index_drop_buffer

Array of pointers to KEYs to be dropped belonging to the TABLE instance for the old version of the table.

Definition at line 1260 of file handler.h.

uint Alter_inplace_info::index_drop_count

Size of index_drop_buffer array.

Definition at line 1254 of file handler.h.

uint Alter_inplace_info::key_count

Size of key_info_buffer array.

Definition at line 1251 of file handler.h.

KEY* Alter_inplace_info::key_info_buffer

Array of KEYs for new version of table - including KEYs to be added.

Note
Currently this array is produced as result of mysql_prepare_create_table() call. This means that it follows different convention for KEY_PART_INFO::fieldnr values than objects in TABLE::key_info array.
Todo:
This is mainly due to the fact that we need to keep compatibility with removed handler::add_index() call. We plan to switch to TABLE::key_info numbering later.

KEYs are sorted - see sort_keys().

Definition at line 1248 of file handler.h.

partition_info* Alter_inplace_info::modified_part_info

Partition_info taking into account the partition changes to be performed. Contains all partitions which are present in the old version of the table with partitions to be dropped or changed marked as such + all partitions to be added in the new version of table marked as such.

Definition at line 1302 of file handler.h.

bool Alter_inplace_info::online

true for online operation (LOCK=NONE)

Definition at line 1308 of file handler.h.

const char* Alter_inplace_info::unsupported_reason

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) 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 ER_ALTER_OPERATION_NOT_SUPPORTED will be used.

Please set to a properly localized string, for example using my_get_err_msg(), so that the error message as a whole is localized.

Definition at line 1322 of file handler.h.


The documentation for this class was generated from the following files: