同步操作将从 nwsuafzq/MySQLAdvisor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#ifndef HANDLER_INCLUDED#define HANDLER_INCLUDED/*Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; version 2 ofthe License.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*//* Definitions for parameters to do with handler-routines */#include "my_pthread.h"#include <algorithm>#include "sql_const.h"#include "mysqld.h" /* server_id */#include "structs.h" /* SHOW_COMP_OPTION */#include <my_global.h>#include <my_compare.h>#include <ft_global.h>class MY_LOCALE;struct TABLE_LIST;struct LEX;struct TABLE;typedef struct st_changed_table_list CHANGED_TABLE_LIST;typedef ulonglong sql_mode_t;/* Bits in table_flags() to show what database can do */#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file *//*The following should be set if the following is not true when scanninga table with rnd_next()- We will see all rows (including deleted ones)- Row positions are 'table->s->db_record_offset' apartIf this flag is not set, filesort will do a position() call for each matchedrow to be able to find the row later.*/#define HA_REC_NOT_IN_SEQ (1 << 3)#define HA_CAN_GEOMETRY (1 << 4)/*Reading keys in random order is as fast as reading keys in sort order(Used in records.cc to decide if we should use a record cache and byfilesort to decide if we should sort key + data or key + pointer-to-row*/#define HA_FAST_KEY_READ (1 << 5)/*Set the following flag if we on delete should force all key to be readand on update read all keys that changes*/#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */#define HA_DUPLICATE_POS (1 << 8) /* position() gives dup row */#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */#define HA_CAN_INDEX_BLOBS (1 << 10)#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact *//*INSERT_DELAYED only works with handlers that uses MySQL internal tablelevel locks*/#define HA_CAN_INSERT_DELAYED (1 << 14)/*If we get the primary key columns for free when we do an index read(usually, it also implies that HA_PRIMARY_KEY_REQUIRED_FOR_POSITIONflag is set).*/#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)/*If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()uses a primary key given by the record argument.Without primary key, we can't call position().If not set, the position is returned as the current rows positionregardless of what argument is given.*/#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)#define HA_CAN_RTREEKEYS (1 << 17)#define HA_NOT_DELETE_WITH_CACHE (1 << 18)/*The following is we need to a primary key to delete (and update) a row.If there is no primary key, all columns needs to be read on update and delete*/#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)#define HA_CAN_FULLTEXT (1 << 21)#define HA_CAN_SQL_HANDLER (1 << 22)#define HA_NO_AUTO_INCREMENT (1 << 23)#define HA_HAS_CHECKSUM (1 << 24)/* Table data are stored in separate files (for lower_case_table_names) */#define HA_FILE_BASED (1 << 26)#define HA_NO_VARCHAR (1 << 27)#define HA_CAN_BIT_FIELD (1 << 28) /* supports bit fields */#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)#define HA_NO_COPY_ON_ALTER (LL(1) << 31)#define HA_HAS_RECORDS (LL(1) << 32) /* records() gives exact count*//* Has it's own method of binlog logging */#define HA_HAS_OWN_BINLOGGING (LL(1) << 33)/*Note: the following includes binlog and closing 0.so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +example + csv + heap + blackhole + federated + 0(yes, the sum is deliberately inaccurate)TODO remove the limit, use dynarrays*/#define MAX_HA 15#define HA_LEX_CREATE_TMP_TABLE 1#define HA_LEX_CREATE_IF_NOT_EXISTS 2#define HA_LEX_CREATE_TABLE_LIKE 4#define HA_OPTION_NO_CHECKSUM (1L << 17)#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)#define HA_MAX_REC_LENGTH 65535U// WITH CONSISTENT SNAPSHOT optionstatic const uint MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT = 1;// READ ONLY optionstatic const uint MYSQL_START_TRANS_OPT_READ_ONLY = 2;// READ WRITE optionstatic const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4;enum legacy_db_type{DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,DB_TYPE_HASH,DB_TYPE_MISAM,DB_TYPE_PISAM,DB_TYPE_RMS_ISAM, DB_TYPE_HEAP, DB_TYPE_ISAM,DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM,DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,DB_TYPE_FEDERATED_DB,DB_TYPE_BLACKHOLE_DB,DB_TYPE_PARTITION_DB,DB_TYPE_BINLOG,DB_TYPE_SOLID,DB_TYPE_PBXT,DB_TYPE_TABLE_FUNCTION,DB_TYPE_MEMCACHE,DB_TYPE_FALCON,DB_TYPE_MARIA,/** Performance schema engine. */DB_TYPE_PERFORMANCE_SCHEMA,DB_TYPE_TOKUDB=41,DB_TYPE_FIRST_DYNAMIC=42,DB_TYPE_DEFAULT=127 // Must be last};enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT,/** Unused. Reserved for future versions. */ROW_TYPE_PAGE,ROW_TYPE_TOKU_UNCOMPRESSED, ROW_TYPE_TOKU_ZLIB,ROW_TYPE_TOKU_QUICKLZ, ROW_TYPE_TOKU_LZMA,ROW_TYPE_TOKU_FAST, ROW_TYPE_TOKU_SMALL };/* Specifies data storage format for individual columns */enum column_format_type {COLUMN_FORMAT_TYPE_DEFAULT= 0, /* Not specified (use engine default) */COLUMN_FORMAT_TYPE_FIXED= 1, /* FIXED format */COLUMN_FORMAT_TYPE_DYNAMIC= 2 /* DYNAMIC format */};/* struct to hold information about the table that should be created *//* Bits in used_fields */#define HA_CREATE_USED_AUTO (1L << 0)#define HA_CREATE_USED_RAID (1L << 1) //RAID is no longer availble#define HA_CREATE_USED_UNION (1L << 2)#define HA_CREATE_USED_INSERT_METHOD (1L << 3)#define HA_CREATE_USED_MIN_ROWS (1L << 4)#define HA_CREATE_USED_MAX_ROWS (1L << 5)#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6)#define HA_CREATE_USED_PACK_KEYS (1L << 7)#define HA_CREATE_USED_CHARSET (1L << 8)#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)#define HA_CREATE_USED_DATADIR (1L << 10)#define HA_CREATE_USED_INDEXDIR (1L << 11)#define HA_CREATE_USED_ENGINE (1L << 12)#define HA_CREATE_USED_CHECKSUM (1L << 13)#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14)#define HA_CREATE_USED_ROW_FORMAT (1L << 15)#define HA_CREATE_USED_COMMENT (1L << 16)#define HA_CREATE_USED_PASSWORD (1L << 17)#define HA_CREATE_USED_CONNECTION (1L << 18)#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)/** Unused. Reserved for future versions. */#define HA_CREATE_USED_TRANSACTIONAL (1L << 20)/** Unused. Reserved for future versions. */#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)/** This is set whenever STATS_PERSISTENT=0|1|default has beenspecified in CREATE/ALTER TABLE. See also HA_OPTION_STATS_PERSISTENT ininclude/my_base.h. It is possible to distinguish whetherSTATS_PERSISTENT=default has been specified or no STATS_PERSISTENT= isgiven at all. */#define HA_CREATE_USED_STATS_PERSISTENT (1L << 22)/**This is set whenever STATS_AUTO_RECALC=0|1|default has beenspecified in CREATE/ALTER TABLE. See enum_stats_auto_recalc.It is possible to distinguish whether STATS_AUTO_RECALC=defaulthas been specified or no STATS_AUTO_RECALC= is given at all.*/#define HA_CREATE_USED_STATS_AUTO_RECALC (1L << 23)/**This is set whenever STATS_SAMPLE_PAGES=N|default has beenspecified in CREATE/ALTER TABLE. It is possible to distinguish whetherSTATS_SAMPLE_PAGES=default has been specified or no STATS_SAMPLE_PAGES= isgiven at all.*/#define HA_CREATE_USED_STATS_SAMPLE_PAGES (1L << 24)typedef ulonglong my_xid; // this line is the same as in log_event.h#define MYSQL_XID_PREFIX "MySQLXid"#define MYSQL_XID_PREFIX_LEN 8 // must be a multiple of 8#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN)#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))#define XIDDATASIZE MYSQL_XIDDATASIZE#define MAXGTRIDSIZE 64#define MAXBQUALSIZE 64/**struct xid_t is binary compatible with the XID structure asin the X/Open CAE Specification, Distributed Transaction Processing:The XA Specification, X/Open Company Ltd., 1991.http://www.opengroup.org/bookstore/catalog/c193.htm@see MYSQL_XID in mysql/plugin.h*/struct xid_t {long formatID;long gtrid_length;long bqual_length;char data[XIDDATASIZE]; // not 0円-terminated !xid_t() {} /* Remove gcc warning */bool eq(struct xid_t *xid){ return eq(xid->gtrid_length, xid->bqual_length, xid->data); }bool eq(long g, long b, const char *d){ return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }void set(struct xid_t *xid){ memcpy(this, xid, xid->length()); }void set(long f, const char *g, long gl, const char *b, long bl){formatID= f;memcpy(data, g, gtrid_length= gl);memcpy(data+gl, b, bqual_length= bl);}void set(ulonglong xid){my_xid tmp;formatID= 1;set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);tmp= xid;memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));gtrid_length=MYSQL_XID_GTRID_LEN;}void set(long g, long b, const char *d){formatID= 1;gtrid_length= g;bqual_length= b;memcpy(data, d, g+b);}bool is_null() { return formatID == -1; }void null() { formatID= -1; }my_xid quick_get_my_xid(){my_xid tmp;memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp));return tmp;}my_xid get_my_xid(){return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?quick_get_my_xid() : 0;}uint length(){return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;}uchar *key(){return (uchar *)>rid_length;}uint key_length(){return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;}};typedef struct xid_t XID;/* for recover() handlerton call */#define MIN_XID_LIST_SIZE 128#define MAX_XID_LIST_SIZE (1024*128)/*These structures are used to pass information from a set of SQL commandson add/drop/change tablespace definitions to the proper hton.*/#define UNDEF_NODEGROUP 65535enum ts_command_type{TS_CMD_NOT_DEFINED = -1,CREATE_TABLESPACE = 0,ALTER_TABLESPACE = 1,CREATE_LOGFILE_GROUP = 2,ALTER_LOGFILE_GROUP = 3,DROP_TABLESPACE = 4,DROP_LOGFILE_GROUP = 5,CHANGE_FILE_TABLESPACE = 6,ALTER_ACCESS_MODE_TABLESPACE = 7};enum ts_alter_tablespace_type{TS_ALTER_TABLESPACE_TYPE_NOT_DEFINED = -1,ALTER_TABLESPACE_ADD_FILE = 1,ALTER_TABLESPACE_DROP_FILE = 2};enum tablespace_access_mode{TS_NOT_DEFINED= -1,TS_READ_ONLY = 0,TS_READ_WRITE = 1,TS_NOT_ACCESSIBLE = 2};struct handlerton;class st_alter_tablespace : public Sql_alloc{public:const char *tablespace_name;const char *logfile_group_name;enum ts_command_type ts_cmd_type;enum ts_alter_tablespace_type ts_alter_tablespace_type;const char *data_file_name;const char *undo_file_name;const char *redo_file_name;ulonglong extent_size;ulonglong undo_buffer_size;ulonglong redo_buffer_size;ulonglong initial_size;ulonglong autoextend_size;ulonglong max_size;uint nodegroup_id;handlerton *storage_engine;bool wait_until_completed;const char *ts_comment;enum tablespace_access_mode ts_access_mode;st_alter_tablespace(){tablespace_name= NULL;logfile_group_name= "DEFAULT_LG"; //Default log file groupts_cmd_type= TS_CMD_NOT_DEFINED;data_file_name= NULL;undo_file_name= NULL;redo_file_name= NULL;extent_size= 1024*1024; //Default 1 MByteundo_buffer_size= 8*1024*1024; //Default 8 MByteredo_buffer_size= 8*1024*1024; //Default 8 MByteinitial_size= 128*1024*1024; //Default 128 MByteautoextend_size= 0; //No autoextension as defaultmax_size= 0; //Max size == initial size => no extensionstorage_engine= NULL;nodegroup_id= UNDEF_NODEGROUP;wait_until_completed= TRUE;ts_comment= NULL;ts_access_mode= TS_NOT_DEFINED;}};/*Make sure that the order of schema_tables and enum_schema_tables are the same.*/enum enum_schema_tables{SCH_CHARSETS= 0,SCH_CLIENT_STATS,SCH_COLLATIONS,SCH_COLLATION_CHARACTER_SET_APPLICABILITY,SCH_COLUMNS,SCH_COLUMN_PRIVILEGES,SCH_INDEX_STATS,SCH_ENGINES,SCH_EVENTS,SCH_FILES,SCH_GLOBAL_STATUS,SCH_GLOBAL_TEMPORARY_TABLES,SCH_GLOBAL_VARIABLES,SCH_KEY_COLUMN_USAGE,SCH_OPEN_TABLES,SCH_OPTIMIZER_TRACE,SCH_PARAMETERS,SCH_PARTITIONS,SCH_PLUGINS,SCH_PROCESSLIST,SCH_PROFILES,SCH_REFERENTIAL_CONSTRAINTS,SCH_PROCEDURES,SCH_SCHEMATA,SCH_SCHEMA_PRIVILEGES,SCH_SESSION_STATUS,SCH_SESSION_VARIABLES,SCH_STATISTICS,SCH_STATUS,SCH_TABLES,SCH_TABLESPACES,SCH_TABLE_CONSTRAINTS,SCH_TABLE_NAMES,SCH_TABLE_PRIVILEGES,SCH_TABLE_STATS,SCH_TEMPORARY_TABLES,SCH_THREAD_STATS,SCH_TRIGGERS,SCH_USER_PRIVILEGES,SCH_USER_STATS,SCH_VARIABLES,SCH_VIEWS};class handler;/*handlerton is a singleton structure - one instance per storage engine -to provide access to storage engine functionality that works on the"global" level (unlike handler class that works on a per-table basis)usually handlerton instance is defined statically in ha_xxx.cc asstatic handlerton { ... } xxx_hton;savepoint_*, prepare, recover, and *_by_xid pointers can be 0.*/struct handlerton{/*Historical number used for frm file to determine the correct storage engine.This is going away and new engines will just use "name" for this.*/enum legacy_db_type db_type;/*each storage engine has it's own memory area (actually a pointer)in the thd, for storing per-connection information.It is accessed asthd->ha_data[xxx_hton.slot]slot number is initialized by MySQL after xxx_init() is called.*/uint slot;/*to store per-savepoint data storage engine is provided with an areaof a requested size (0 is ok here).savepoint_offset must be initialized statically to the size ofthe needed memory to store per-savepoint information.After xxx_init it is changed to be an offset to savepoint storagearea and need not be used by storage engine.see binlog_hton and binlog_savepoint_set/rollback for an example.*/uint savepoint_offset;uint32 flags; /* global handler flags */uint32 license; /* Flag for Engine License */void *data; /* Location for engines to keep personal structures */};/* In which table to INSERT rows */#define MERGE_INSERT_DISABLED 0#define MERGE_INSERT_TO_FIRST 1#define MERGE_INSERT_TO_LAST 2/* Possible flags of a handlerton (there can be 32 of them) */#define HTON_NO_FLAGS 0#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)#define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter#define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate#define HTON_HIDDEN (1 << 3) //Engine does not appear in lists#define HTON_FLUSH_AFTER_RENAME (1 << 4)#define HTON_NOT_USER_SELECTABLE (1 << 5)#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported#define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables#define HTON_NO_PARTITION (1 << 8) //You can not partition these tablestypedef struct {ulonglong data_file_length;ulonglong max_data_file_length;ulonglong index_file_length;ulonglong delete_length;ha_rows records;ulong mean_rec_length;ulong create_time;ulong check_time;ulong update_time;ulonglong check_sum;} PARTITION_STATS;#define UNDEF_NODEGROUP 65535class Item;struct st_table_log_memory_entry;class partition_info;struct st_partition_iter;enum enum_ha_unused { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };enum enum_stats_auto_recalc { HA_STATS_AUTO_RECALC_DEFAULT= 0,HA_STATS_AUTO_RECALC_ON,HA_STATS_AUTO_RECALC_OFF };typedef struct st_ha_create_information{const CHARSET_INFO *table_charset, *default_table_charset;LEX_STRING connect_string;const char *password, *tablespace;LEX_STRING comment;const char *data_file_name, *index_file_name;const char *alias;ulonglong max_rows,min_rows;ulonglong auto_increment_value;ulong table_options;ulong avg_row_length;ulong used_fields;ulong key_block_size;uint stats_sample_pages; /* number of pages to sample duringstats estimation, if used, otherwise 0. */enum_stats_auto_recalc stats_auto_recalc;SQL_I_List<TABLE_LIST> merge_list;handlerton *db_type;/**Row type of the table definition.Defaults to ROW_TYPE_DEFAULT for all non-ALTER statements.For ALTER TABLE defaults to ROW_TYPE_NOT_USED (means "keep the current").Can be changed either explicitly by the parser.If nothing speficied inherits the value of the original table (if present).*/enum row_type row_type;uint null_bits; /* NULL bits at start of record */uint options; /* OR of HA_CREATE_ options */uint merge_insert_method;uint extra_size; /* length of extra data segment */bool varchar; /* 1 if table has a VARCHAR */enum ha_storage_media storage_media; /* DEFAULT, DISK or MEMORY */} HA_CREATE_INFO;typedef struct st_key_create_information{enum ha_key_alg algorithm;ulong block_size;LEX_STRING parser_name;LEX_STRING comment;/**A flag to determine if we will check for duplicate indexes.This typically means that the key information was specifieddirectly by the user (set by the parser) or a columnassociated with it was dropped.*/bool check_for_duplicate_indexes;} KEY_CREATE_INFO;extern KEY_CREATE_INFO default_key_create_info;typedef struct st_ha_check_opt{st_ha_check_opt() {} /* Remove gcc warning */uint flags; /* isam layer flags (e.g. for myisamchk) */uint sql_flags; /* sql layer flags - for something myisamchk cannot do */void init(){flags= sql_flags= 0;}} HA_CHECK_OPT;#endif /* HANDLER_INCLUDED */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。