MySQL 9.0.0
Source Code Documentation
On-line ALTER TABLE interface

Functions

enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter (TABLE *altered_table, Alter_inplace_info *ha_alter_info) override
 Check if InnoDB supports a particular alter table in-place. More...
 
bool ha_innobase::prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
 Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK). More...
 
bool ha_innobase::inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
 Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information. More...
 
bool ha_innobase::commit_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
 Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine. More...
 

Detailed Description

See also
handler0alter.cc

Function Documentation

◆ check_if_supported_inplace_alter()

enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter ( TABLE altered_table,
Alter_inplace_info ha_alter_info 
)
overridevirtual

Check if InnoDB supports a particular alter table in-place.

Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
HA_ALTER_INPLACE_NOT_SUPPORTEDNot supported
HA_ALTER_INPLACE_NO_LOCKSupported
HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARESupported, but requires lock during main phase and exclusive lock during prepare phase.
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARESupported, prepare phase requires exclusive lock (any transactions that have accessed the table must commit or roll back first, and no transactions can access the table while prepare_inplace_alter_table() is executing)

Reimplemented from handler.

Reimplemented in ha_innopart.

◆ commit_inplace_alter_table()

bool ha_innobase::commit_inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
bool  commit,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)
overridevirtual

Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine.

Note that the allowed level of concurrency during this operation will be the same as for inplace_alter_table() and thus might be higher than during prepare_inplace_alter_table(). (E.g concurrent writes were blocked during prepare, but might not be during commit).

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]commitTrue to commit or false to rollback.
[in]old_dd_tabdd::Table object representing old version of the table
[in,out]new_dd_tabdd::Table object representing new version of the table. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

Reimplemented in ha_innopart.

◆ inplace_alter_table()

bool ha_innobase::inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)
overridevirtual

Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information.

The level of concurrency allowed during this operation depends on the return value from check_if_supported_inplace_alter().

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_dd_tabdd::Table object describing old version of the table.
[in,out]new_dd_tabdd::Table object for the new version of the table. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

Reimplemented in ha_innopart.

◆ prepare_inplace_alter_table()

bool ha_innobase::prepare_inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)
overridevirtual

Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK).

This will be invoked before inplace_alter_table().

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_dd_tabdd::Table object describing old version of the table.
[in,out]new_dd_tabdd::Table object for the new version of the table. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

Reimplemented in ha_innopart.