diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/maria.h | 75 | ||||
-rw-r--r-- | include/my_base.h | 50 | ||||
-rw-r--r-- | include/my_sys.h | 12 | ||||
-rw-r--r-- | include/myisamchk.h | 5 | ||||
-rw-r--r-- | include/mysql_com.h | 12 |
5 files changed, 86 insertions, 68 deletions
diff --git a/include/maria.h b/include/maria.h index 1d7778f7c3d..49259915d16 100644 --- a/include/maria.h +++ b/include/maria.h @@ -110,7 +110,7 @@ extern "C" { typedef ulonglong MARIA_RECORD_POS; -typedef struct st_maria_isaminfo /* Struct from h_info */ +typedef struct st_maria_info { ha_rows records; /* Records in database */ ha_rows deleted; /* Deleted records in database */ @@ -126,7 +126,7 @@ typedef struct st_maria_isaminfo /* Struct from h_info */ time_t check_time; time_t update_time; ulong record_offset; - ulong *rec_per_key; /* for sql optimizing */ + double *rec_per_key; /* for sql optimizing */ ulong reclength; /* Recordlength */ ulong mean_reclength; /* Mean recordlength (if packed) */ char *data_file_name, *index_file_name; @@ -156,9 +156,9 @@ typedef struct st_maria_create_info my_bool with_auto_increment, transactional; } MARIA_CREATE_INFO; -struct st_maria_info; /* For referense */ struct st_maria_share; -typedef struct st_maria_info MARIA_HA; +struct st_maria_handler; /* For referense */ +typedef struct st_maria_handler MARIA_HA; struct st_maria_s_param; typedef struct st_maria_keydef /* Key definition with open & info */ @@ -178,7 +178,7 @@ typedef struct st_maria_keydef /* Key definition with open & info */ HA_KEYSEG *seg, *end; struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ - int (*bin_search)(struct st_maria_info *info, + int (*bin_search)(MARIA_HA *info, struct st_maria_keydef *keyinfo, uchar *page, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos, uchar *buff, my_bool *was_last_key); @@ -189,8 +189,8 @@ typedef struct st_maria_keydef /* Key definition with open & info */ const uchar *key, struct st_maria_s_param *s_temp); void (*store_key)(struct st_maria_keydef *keyinfo, uchar *key_pos, struct st_maria_s_param *s_temp); - int (*ck_insert)(struct st_maria_info *inf, uint k_nr, uchar *k, uint klen); - int (*ck_delete)(struct st_maria_info *inf, uint k_nr, uchar *k, uint klen); + int (*ck_insert)(MARIA_HA *inf, uint k_nr, uchar *k, uint klen); + int (*ck_delete)(MARIA_HA *inf, uint k_nr, uchar *k, uint klen); } MARIA_KEYDEF; @@ -222,9 +222,10 @@ struct st_maria_bit_buff; typedef struct st_maria_columndef /* column information */ { - uint64 offset; /* Offset to position in row */ enum en_fieldtype type; + uint32 offset; /* Offset to position in row */ uint16 length; /* length of field */ + uint16 column_nr; /* Intern variable (size of total storage area for the row) */ uint16 fill_length; uint16 null_pos; /* Position for null marker */ @@ -257,34 +258,34 @@ extern PAGECACHE maria_pagecache_var, *maria_pagecache; extern int maria_init(void); extern void maria_end(void); -extern int maria_close(struct st_maria_info *file); -extern int maria_delete(struct st_maria_info *file, const uchar *buff); -extern struct st_maria_info *maria_open(const char *name, int mode, +extern int maria_close(MARIA_HA *file); +extern int maria_delete(MARIA_HA *file, const uchar *buff); +extern MARIA_HA *maria_open(const char *name, int mode, uint wait_if_locked); -extern struct st_maria_info *maria_clone(struct st_maria_share *share, int mode); +extern MARIA_HA *maria_clone(struct st_maria_share *share, int mode); extern int maria_panic(enum ha_panic_function function); -extern int maria_rfirst(struct st_maria_info *file, uchar *buf, int inx); -extern int maria_rkey(struct st_maria_info *file, uchar *buf, int inx, +extern int maria_rfirst(MARIA_HA *file, uchar *buf, int inx); +extern int maria_rkey(MARIA_HA *file, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag); -extern int maria_rlast(struct st_maria_info *file, uchar *buf, int inx); -extern int maria_rnext(struct st_maria_info *file, uchar *buf, int inx); -extern int maria_rnext_same(struct st_maria_info *info, uchar *buf); -extern int maria_rprev(struct st_maria_info *file, uchar *buf, int inx); -extern int maria_rrnd(struct st_maria_info *file, uchar *buf, +extern int maria_rlast(MARIA_HA *file, uchar *buf, int inx); +extern int maria_rnext(MARIA_HA *file, uchar *buf, int inx); +extern int maria_rnext_same(MARIA_HA *info, uchar *buf); +extern int maria_rprev(MARIA_HA *file, uchar *buf, int inx); +extern int maria_rrnd(MARIA_HA *file, uchar *buf, MARIA_RECORD_POS pos); -extern int maria_scan_init(struct st_maria_info *file); -extern int maria_scan(struct st_maria_info *file, uchar *buf); -extern void maria_scan_end(struct st_maria_info *file); -extern int maria_rsame(struct st_maria_info *file, uchar *record, int inx); -extern int maria_rsame_with_pos(struct st_maria_info *file, uchar *record, +extern int maria_scan_init(MARIA_HA *file); +extern int maria_scan(MARIA_HA *file, uchar *buf); +extern void maria_scan_end(MARIA_HA *file); +extern int maria_rsame(MARIA_HA *file, uchar *record, int inx); +extern int maria_rsame_with_pos(MARIA_HA *file, uchar *record, int inx, MARIA_RECORD_POS pos); -extern int maria_update(struct st_maria_info *file, const uchar *old, +extern int maria_update(MARIA_HA *file, const uchar *old, uchar *new_record); -extern int maria_write(struct st_maria_info *file, uchar *buff); -extern MARIA_RECORD_POS maria_position(struct st_maria_info *file); -extern int maria_status(struct st_maria_info *info, MARIA_INFO *x, uint flag); -extern int maria_lock_database(struct st_maria_info *file, int lock_type); +extern int maria_write(MARIA_HA *file, uchar *buff); +extern MARIA_RECORD_POS maria_position(MARIA_HA *file); +extern int maria_status(MARIA_HA *info, MARIA_INFO *x, uint flag); +extern int maria_lock_database(MARIA_HA *file, int lock_type); extern int maria_create(const char *name, enum data_file_type record_type, uint keys, MARIA_KEYDEF *keydef, uint columns, MARIA_COLUMNDEF *columndef, @@ -292,16 +293,16 @@ extern int maria_create(const char *name, enum data_file_type record_type, MARIA_CREATE_INFO *create_info, uint flags); extern int maria_delete_table(const char *name); extern int maria_rename(const char *from, const char *to); -extern int maria_extra(struct st_maria_info *file, +extern int maria_extra(MARIA_HA *file, enum ha_extra_function function, void *extra_arg); -extern int maria_reset(struct st_maria_info *file); -extern ha_rows maria_records_in_range(struct st_maria_info *info, int inx, +extern int maria_reset(MARIA_HA *file); +extern ha_rows maria_records_in_range(MARIA_HA *info, int inx, key_range *min_key, key_range *max_key); -extern int maria_is_changed(struct st_maria_info *info); -extern int maria_delete_all_rows(struct st_maria_info *info); +extern int maria_is_changed(MARIA_HA *info); +extern int maria_delete_all_rows(MARIA_HA *info); extern uint maria_get_pointer_length(ulonglong file_length, uint def); -extern int maria_commit(struct st_maria_info *info); -extern int maria_begin(struct st_maria_info *info); +extern int maria_commit(MARIA_HA *info); +extern int maria_begin(MARIA_HA *info); /* this is used to pass to mysql_mariachk_table */ @@ -402,7 +403,7 @@ int maria_change_to_newfile(const char *filename, const char *old_ext, const char *new_ext, myf myflags); void maria_lock_memory(HA_CHECK *param); int maria_update_state_info(HA_CHECK *param, MARIA_HA *info, uint update); -void maria_update_key_parts(MARIA_KEYDEF *keyinfo, ulong *rec_per_key_part, +void maria_update_key_parts(MARIA_KEYDEF *keyinfo, double *rec_per_key_part, ulonglong *unique, ulonglong *notnull, ulonglong records); int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start, diff --git a/include/my_base.h b/include/my_base.h index 2ab1123ce76..f69d0dce977 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -293,6 +293,7 @@ enum ha_base_keytype { #define HA_OPTION_CREATE_FROM_ENGINE 256 #define HA_OPTION_RELIES_ON_SQL_LAYER 512 #define HA_OPTION_NULL_FIELDS 1024 +#define HA_OPTION_PAGE_CHECKSUM 2048 #define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */ #define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */ @@ -302,6 +303,7 @@ enum ha_base_keytype { #define HA_PACK_RECORD 2 /* Request packed record format */ #define HA_CREATE_TMP_TABLE 4 #define HA_CREATE_CHECKSUM 8 +#define HA_CREATE_PAGE_CHECKSUM 16 #define HA_CREATE_DELAY_KEY_WRITE 64 #define HA_CREATE_RELIES_ON_SQL_LAYER 128 @@ -348,12 +350,15 @@ enum ha_base_keytype { */ #define HA_STATUS_AUTO 64 - /* Errorcodes given by functions */ +/* + Errorcodes given by handler functions + + opt_sum_query() assumes these codes are > 1 + Do not add error numbers before HA_ERR_FIRST. + If necessary to add lower numbers, change HA_ERR_FIRST accordingly. +*/ +#define HA_ERR_FIRST 120 /* Copy of first error nr.*/ -/* opt_sum_query() assumes these codes are > 1 */ -/* Do not add error numbers before HA_ERR_FIRST. */ -/* If necessary to add lower numbers, change HA_ERR_FIRST accordingly. */ -#define HA_ERR_FIRST 120 /*Copy first error nr.*/ #define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ #define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ #define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ @@ -374,7 +379,7 @@ enum ha_base_keytype { #define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ #define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ #define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ -#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */ +#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */ #define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ #define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ #define HA_ERR_LOCK_WAIT_TIMEOUT 146 @@ -389,28 +394,33 @@ enum ha_base_keytype { #define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ #define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ -#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */ +/* NULLs are not supported in spatial index */ +#define HA_ERR_NULL_IN_SPATIAL 158 #define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ #define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for given value */ #define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ -#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr. */ -#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints - would lead to a duplicate key - error in some other table. */ -#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */ -#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ +#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */ +/* + Upholding foreign key constraints would lead to a duplicate key error + in some other table. +*/ +#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 +/* The table changed in storage engine */ +#define HA_ERR_TABLE_NEEDS_UPGRADE 164 +#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ #define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */ #define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */ #define HA_ERR_GENERIC 168 /* Generic error */ -#define HA_ERR_RECORD_IS_THE_SAME 169 /* row not actually updated : - new values same as the old values */ - -#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this - statement */ -#define HA_ERR_LAST 170 /*Copy last error nr.*/ -/* Add error numbers before HA_ERR_LAST and change it accordingly. */ +/* row not actually updated: new values same as the old values */ +#define HA_ERR_RECORD_IS_THE_SAME 169 +/* It is not possible to log this statement */ +#define HA_ERR_LOGGING_IMPOSSIBLE 170 +#define HA_ERR_NEW_FILE 171 /* New file format */ +#define HA_ERR_LAST 171 /* Copy of last error nr */ + +/* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) /* Other constants */ diff --git a/include/my_sys.h b/include/my_sys.h index ca44f9ed39b..65a8c9fdeda 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -902,6 +902,18 @@ int my_getpagesize(void); int my_msync(int, void *, size_t, int); +#define MY_UUID_SIZE 16 +void my_uuid_init(ulong seed1, ulong seed2); +void my_uuid(uchar *guid); + +struct my_rnd_struct { + unsigned long seed1,seed2,max_value; + double max_value_dbl; +}; + +void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2); +double my_rnd(struct my_rnd_struct *rand_st); + /* character sets */ extern uint get_charset_number(const char *cs_name, uint cs_flags); extern uint get_collation_number(const char *name); diff --git a/include/myisamchk.h b/include/myisamchk.h index 78350b60bb0..30b986a835a 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -128,9 +128,10 @@ typedef struct st_handler_check_param ha_checksum key_crc[HA_MAX_POSSIBLE_KEY]; ha_checksum tmp_key_crc[HA_MAX_POSSIBLE_KEY]; ha_checksum tmp_record_checksum; - ulong use_buffers, read_buffer_length, write_buffer_length; - ulong sort_buffer_length, sort_key_blocks; + size_t use_buffers, read_buffer_length, write_buffer_length; + size_t sort_buffer_length, sort_key_blocks; ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; + double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; uint out_flag, warning_printed, error_printed, verbose; uint opt_sort_key, total_files, max_level; uint testflag, key_cache_block_size, pagecache_block_size; diff --git a/include/mysql_com.h b/include/mysql_com.h index ae57e84a696..f05cf8e1068 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -365,11 +365,7 @@ void my_net_set_read_timeout(NET *net, uint timeout); struct sockaddr; int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, unsigned int timeout); - -struct rand_struct { - unsigned long seed1,seed2,max_value; - double max_value_dbl; -}; +struct my_rnd_struct; #ifdef __cplusplus } @@ -417,10 +413,8 @@ extern "C" { implemented in sql/password.c */ -void randominit(struct rand_struct *, unsigned long seed1, - unsigned long seed2); -double my_rnd(struct rand_struct *); -void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st); +void create_random_string(char *to, unsigned int length, + struct my_rnd_struct *rand_st); void hash_password(unsigned long *to, const char *password, unsigned int password_len); void make_scrambled_password_323(char *to, const char *password); |