My Project
Public Types | Public Member Functions | Public Attributes | Static Public Attributes
Alter_inplace_info Class Reference

#include <handler.h>

List of all members.

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
static const HA_ALTER_FLAGS RECREATE_TABLE = 1L << 29

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.


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.

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.


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.

Member Data Documentation

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.

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.

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.

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.

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.

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

true for ALTER IGNORE TABLE ...

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

Size of index_add_buffer array.

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

Size of index_drop_buffer array.

Size of key_info_buffer array.

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().

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.

true for online operation (LOCK=NONE)

Recreate the table for ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE operations.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines