diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-11-07 22:35:02 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-12-12 20:27:42 +0100 |
commit | 1cae1af6f9286ca6695206ce20c63bb639c60310 (patch) | |
tree | 3877547f579596add5d757059d1e2f10dd8ef429 /sql/handler.h | |
parent | 7fca91f2b454db6e33d964a7484237793699f77d (diff) | |
download | mariadb-git-1cae1af6f9286ca6695206ce20c63bb639c60310.tar.gz |
MDEV-5800 InnoDB support for indexed vcols
* remove old 5.2+ InnoDB support for virtual columns
* enable corresponding parts of the innodb-5.7 sources
* copy corresponding test cases from 5.7
* copy detailed Alter_inplace_info::HA_ALTER_FLAGS flags from 5.7
- and more detailed detection of changes in fill_alter_inplace_info()
* more "innodb compatibility hooks" in sql_class.cc to
- create/destroy/reset a THD (used by background purge threads)
- find a prelocked table by name
- open a table (from a background purge thread)
* different from 5.7:
- new service thread "thd_destructor_proxy" to make sure all THDs are
destroyed at the correct point in time during the server shutdown
- proper opening/closing of tables for vcol evaluations in
+ FK checks (use already opened prelocked tables)
+ purge threads (open the table, MDLock it, add it to tdc, close
when not needed)
- cache open tables in vc_templ
- avoid unnecessary allocations, reuse table->record[0] and table->s->default_values
- not needed in 5.7, because it overcalculates:
+ tell the server to calculate vcols for an on-going inline ADD INDEX
+ calculate vcols for correct error messages
* update other engines (mroonga/tokudb) accordingly
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 103 |
1 files changed, 65 insertions, 38 deletions
diff --git a/sql/handler.h b/sql/handler.h index 112b9212e93..d7fa5061e87 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1838,34 +1838,50 @@ public: typedef ulonglong HA_ALTER_FLAGS; // Add non-unique, non-primary index - static const HA_ALTER_FLAGS ADD_INDEX = 1L << 0; + static const HA_ALTER_FLAGS ADD_INDEX = 1ULL << 0; + // + // Adds a spatial index. At the moment all engines treat it + // identically to the ADD_INDEX, so it gets the same code + static const HA_ALTER_FLAGS ADD_SPATIAL_INDEX = ADD_INDEX; // Drop non-unique, non-primary index - static const HA_ALTER_FLAGS DROP_INDEX = 1L << 1; + static const HA_ALTER_FLAGS DROP_INDEX = 1ULL << 1; // Add unique, non-primary index - static const HA_ALTER_FLAGS ADD_UNIQUE_INDEX = 1L << 2; + static const HA_ALTER_FLAGS ADD_UNIQUE_INDEX = 1ULL << 2; // Drop unique, non-primary index - static const HA_ALTER_FLAGS DROP_UNIQUE_INDEX = 1L << 3; + static const HA_ALTER_FLAGS DROP_UNIQUE_INDEX = 1ULL << 3; // Add primary index - static const HA_ALTER_FLAGS ADD_PK_INDEX = 1L << 4; + static const HA_ALTER_FLAGS ADD_PK_INDEX = 1ULL << 4; // Drop primary index - static const HA_ALTER_FLAGS DROP_PK_INDEX = 1L << 5; - - // Add column - static const HA_ALTER_FLAGS ADD_COLUMN = 1L << 6; + static const HA_ALTER_FLAGS DROP_PK_INDEX = 1ULL << 5; + + // Virtual generated column + static const HA_ALTER_FLAGS ADD_VIRTUAL_COLUMN = 1ULL << 6; + // Stored base (non-generated) column + static const HA_ALTER_FLAGS ADD_STORED_BASE_COLUMN = 1ULL << 7; + // Stored generated column + static const HA_ALTER_FLAGS ADD_STORED_GENERATED_COLUMN= 1ULL << 8; + // Add generic column (convience constant). + static const HA_ALTER_FLAGS ADD_COLUMN= ADD_VIRTUAL_COLUMN | + ADD_STORED_BASE_COLUMN | + ADD_STORED_GENERATED_COLUMN; // Drop column - static const HA_ALTER_FLAGS DROP_COLUMN = 1L << 7; + static const HA_ALTER_FLAGS DROP_VIRTUAL_COLUMN = 1ULL << 9; + static const HA_ALTER_FLAGS DROP_STORED_COLUMN = 1ULL << 10; + static const HA_ALTER_FLAGS DROP_COLUMN= DROP_VIRTUAL_COLUMN | + DROP_STORED_COLUMN; // Rename column - static const HA_ALTER_FLAGS ALTER_COLUMN_NAME = 1L << 8; + static const HA_ALTER_FLAGS ALTER_COLUMN_NAME = 1ULL << 11; // Change column datatype - static const HA_ALTER_FLAGS ALTER_COLUMN_TYPE = 1L << 9; + static const HA_ALTER_FLAGS ALTER_VIRTUAL_COLUMN_TYPE = 1ULL << 12; + static const HA_ALTER_FLAGS ALTER_STORED_COLUMN_TYPE = 1ULL << 13; /** Change column datatype in such way that new type has compatible @@ -1873,83 +1889,94 @@ public: possible to perform change by only updating data dictionary without changing table rows. */ - static const HA_ALTER_FLAGS ALTER_COLUMN_EQUAL_PACK_LENGTH = 1L << 10; + static const HA_ALTER_FLAGS ALTER_COLUMN_EQUAL_PACK_LENGTH = 1ULL << 14; + + // Reorder column + static const HA_ALTER_FLAGS ALTER_STORED_COLUMN_ORDER = 1ULL << 15; // Reorder column - static const HA_ALTER_FLAGS ALTER_COLUMN_ORDER = 1L << 11; + static const HA_ALTER_FLAGS ALTER_VIRTUAL_COLUMN_ORDER = 1ULL << 16; // Change column from NOT NULL to NULL - static const HA_ALTER_FLAGS ALTER_COLUMN_NULLABLE = 1L << 12; + static const HA_ALTER_FLAGS ALTER_COLUMN_NULLABLE = 1ULL << 17; // Change column from NULL to NOT NULL - static const HA_ALTER_FLAGS ALTER_COLUMN_NOT_NULLABLE = 1L << 13; + static const HA_ALTER_FLAGS ALTER_COLUMN_NOT_NULLABLE = 1ULL << 18; // Set or remove default column value - static const HA_ALTER_FLAGS ALTER_COLUMN_DEFAULT = 1L << 14; + static const HA_ALTER_FLAGS ALTER_COLUMN_DEFAULT = 1ULL << 19; + // Change column generation expression + static const HA_ALTER_FLAGS ALTER_VIRTUAL_GCOL_EXPR = 1ULL << 20; + static const HA_ALTER_FLAGS ALTER_STORED_GCOL_EXPR = 1ULL << 21; + // // Add foreign key - static const HA_ALTER_FLAGS ADD_FOREIGN_KEY = 1L << 15; + static const HA_ALTER_FLAGS ADD_FOREIGN_KEY = 1ULL << 22; // Drop foreign key - static const HA_ALTER_FLAGS DROP_FOREIGN_KEY = 1L << 16; + static const HA_ALTER_FLAGS DROP_FOREIGN_KEY = 1ULL << 23; // table_options changed, see HA_CREATE_INFO::used_fields for details. - static const HA_ALTER_FLAGS CHANGE_CREATE_OPTION = 1L << 17; + static const HA_ALTER_FLAGS CHANGE_CREATE_OPTION = 1ULL << 24; // Table is renamed - static const HA_ALTER_FLAGS ALTER_RENAME = 1L << 18; + static const HA_ALTER_FLAGS ALTER_RENAME = 1ULL << 25; // column's engine options changed, something in field->option_struct - static const HA_ALTER_FLAGS ALTER_COLUMN_OPTION = 1L << 19; + static const HA_ALTER_FLAGS ALTER_COLUMN_OPTION = 1ULL << 26; // MySQL alias for the same thing: - static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1L << 19; + static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1ULL << 26; // Change the column format of column - static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1L << 20; + static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1ULL << 27; // Add partition - static const HA_ALTER_FLAGS ADD_PARTITION = 1L << 21; + static const HA_ALTER_FLAGS ADD_PARTITION = 1ULL << 28; // Drop partition - static const HA_ALTER_FLAGS DROP_PARTITION = 1L << 22; + static const HA_ALTER_FLAGS DROP_PARTITION = 1ULL << 29; // Changing partition options - static const HA_ALTER_FLAGS ALTER_PARTITION = 1L << 23; + static const HA_ALTER_FLAGS ALTER_PARTITION = 1ULL << 30; // Coalesce partition - static const HA_ALTER_FLAGS COALESCE_PARTITION = 1L << 24; + static const HA_ALTER_FLAGS COALESCE_PARTITION = 1ULL << 31; // Reorganize partition ... into - static const HA_ALTER_FLAGS REORGANIZE_PARTITION = 1L << 25; + static const HA_ALTER_FLAGS REORGANIZE_PARTITION = 1ULL << 32; // Reorganize partition - static const HA_ALTER_FLAGS ALTER_TABLE_REORG = 1L << 26; + static const HA_ALTER_FLAGS ALTER_TABLE_REORG = 1ULL << 33; // Remove partitioning - static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING = 1L << 27; + static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING = 1ULL << 34; // Partition operation with ALL keyword - static const HA_ALTER_FLAGS ALTER_ALL_PARTITION = 1L << 28; + static const HA_ALTER_FLAGS ALTER_ALL_PARTITION = 1ULL << 35; /** Recreate the table for ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE operations. */ - static const HA_ALTER_FLAGS RECREATE_TABLE = 1L << 29; + static const HA_ALTER_FLAGS RECREATE_TABLE = 1ULL << 36; - // Virtual columns changed - static const HA_ALTER_FLAGS ALTER_COLUMN_VCOL = 1L << 30; + /** + Changes in generated columns that affect storage, + for example, when a vcol type or expression changes + and this vcol is indexed or used in a partitioning expression + */ + static const HA_ALTER_FLAGS ALTER_COLUMN_VCOL = 1ULL << 37; /** ALTER TABLE for a partitioned table. The engine needs to commit online alter of all partitions atomically (using group_commit_ctx) */ - static const HA_ALTER_FLAGS ALTER_PARTITIONED = 1L << 31; + static const HA_ALTER_FLAGS ALTER_PARTITIONED = 1ULL << 38; - static const HA_ALTER_FLAGS ALTER_ADD_CHECK_CONSTRAINT = 1LL << 32; + static const HA_ALTER_FLAGS ALTER_ADD_CHECK_CONSTRAINT = 1ULL << 39; - static const HA_ALTER_FLAGS ALTER_DROP_CHECK_CONSTRAINT= 1LL << 33; + static const HA_ALTER_FLAGS ALTER_DROP_CHECK_CONSTRAINT= 1ULL << 40; /** Create options (like MAX_ROWS) for the new version of table. |