mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
e72124c4cc
New multi-key-cache handling. This was needed becasue the old one didn't work reliable with MERGE tables. ALTER TABLE table_name ... CHARACTER SET ... now changes all char/varchar/text columns to the given character set (One must use ALTER TABLE ... DEFAULT CHARACTER SET ... to change the default character set) Fixed that have_compress is detected properly (fixes problems with func_compress.test on platforms without zlib) New syntax for CACHE INDEX ('keys' is optional if no index name is given and one mentions the key cache name only ones) Removed compiler warnings Added mysql_set_server_option() to allow clients like PHP to easaily set/reset the multi-statement flag. BUILD/compile-pentium-valgrind-max: Add test of isam client/mysql.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS include/my_base.h: Remove HA_EXTRA_SET_KEY_CACHE include/my_no_pthread.h: Add defines to ignore rw-locks when running without threads include/my_sys.h: Added function for multi-key-caches include/myisam.h: Added function to handle multi-key-caches include/mysql.h: Added mysql_set_server_option include/mysql_com.h: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Added enum_mysql_set_option include/mysqld_error.h: Added error message for unknown key cache innobase/srv/srv0start.c: Removed warning that is confused for MySQL users libmysql/libmysql.c: Added mysql_set_server_option() libmysql/libmysql.def: Added mysql_set_server_option() myisam/ft_nlq_search.c: Removed compiler warning myisam/ft_static.c: Removed compiler warning and fixed wrong return value myisam/mi_check.c: Clean up multi-key-cache usage myisam/mi_checksum.c: Removed not used variable myisam/mi_close.c: keycache -> key_cache myisam/mi_delete_all.c: keycache -> key_cache myisam/mi_extra.c: keycache -> key_cache Removed HA_EXTRA_SET_KEY_CACHE myisam/mi_keycache.c: Changed logic so that it's MyISAM that is responsible for assign tables to different key caches instead of the upper level myisam/mi_locking.c: Don't change key cache on unlock (must be done before) myisam/mi_open.c: Fetch key cache to use from multi_key_cache_search() myisam/mi_page.c: keycache -> key_cache myisam/mi_panic.c: keycache -> key_cache myisam/mi_preload.c: keycache -> key_cache myisam/mi_test1.c: Use KEY_CACHE_BLOCK_SIZE myisam/mi_test2.c: Always test resize_key_cache() myisam/mi_test3.c: Use KEY_CACHE_BLOCK_SIZE instead of 512 myisam/myisamchk.c: update for multiple key caches myisam/myisamdef.h: Remove reg_keycache Add unique_name_length for storing length of unique_file_name myisam/myisamlog.c: Change how end_key_cache() is called mysql-test/mysql-test-run.sh: Fixed web link Added name of failed test to abort row. mysql-test/r/alter_table.result: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/r/case.result: Update result for DEFAULT CHARSET... mysql-test/r/cast.result: Update result for DEFAULT CHARSET... mysql-test/r/create.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_collate.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_latin1_de.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_many.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_mb.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_recoding.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_ucs.result: Update result for DEFAULT CHARSET... mysql-test/r/derived.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/r/fulltext.result: Update result for DEFAULT CHARSET... mysql-test/r/func_str.result: Update result for DEFAULT CHARSET... mysql-test/r/func_system.result: Update result for DEFAULT CHARSET... mysql-test/r/gis-rtree.result: Update result for DEFAULT CHARSET... mysql-test/r/innodb.result: Update result for DEFAULT CHARSET... mysql-test/r/key_cache.result: Update test for new key cache syntax. Added more tests mysql-test/r/merge.result: Update result for DEFAULT CHARSET... mysql-test/r/preload.result: New syntax mysql-test/r/show_check.result: Update result for DEFAULT CHARSET... mysql-test/r/sql_mode.result: Update result for DEFAULT CHARSET... mysql-test/r/subselect.result: Update result for DEFAULT CHARSET... mysql-test/r/type_blob.result: Update result for DEFAULT CHARSET... mysql-test/r/type_enum.result: Update result for DEFAULT CHARSET... mysql-test/r/type_nchar.result: Update result for DEFAULT CHARSET... mysql-test/r/type_set.result: Update result for DEFAULT CHARSET... mysql-test/r/union.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/alter_table.test: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/t/ctype_many.test: Update result for DEFAULT CHARSET... mysql-test/t/derived.test: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/isam.test: Use disable warnings for test loop mysql-test/t/join.test: Update test now when we only support 61 tables in join mysql-test/t/key_cache.test: Update test for new key cache syntax. Added more tests mysql-test/t/preload.test: Update for new syntax mysql-test/t/union.test: Use STRAIGHT_JOIN to make join order predictable mysys/Makefile.am: Added mf_keycaches.c mysys/hash.c: TRUE -> 1 mysys/mf_keycache.c: Removed compiler warnings Striped end space Fixed indentation and improved function comments TRUE -> 1 Changed parameters to end_key_cache() to make it easer to use Fixed bug when using key blocks size > 1024 bytes (First part of index file could be overwritten with wrong data) Split function flush_key_blocks into two functions to not get mutex used twice when called from flush_all_key_blocks() mysys/my_bitmap.c: More debugging Safe bitmap_free() Fixed indentation mysys/my_getopt.c: Ensure that we initialize option->value, option->max_value and value from GET_ASK_ADDR mysys/my_thr_init.c: Remove not used mutex THR_LOCK_keycache mysys/typelib.c: Fixed function comments sql-common/client.c: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Fixed the multi_result flag is set also on SELECT;s sql/ha_myisam.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/ha_myisammrg.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/handler.cc: New multi key cache handling sql/handler.h: New multi key cache handling Added support for default character set sql/item.h: Added function cleanup() (Needed for prepared statements / cursors) sql/item_cmpfunc.h: Added cleanup function sql/item_func.cc: Indentation cleanup sql/mysql_priv.h: New multi-key-cache functions Removed LOCK_assign sql/mysqld.cc: New multi-key-cache handling Fixed that variable have_compress is set correctly sql/protocol.cc: SELECT didn't work reliable in multi-statements sql/set_var.cc: Support for new key cache variables sql/set_var.h: Support for new key cache variables sql/share/czech/errmsg.txt: New error messages sql/share/danish/errmsg.txt: New error messages sql/share/dutch/errmsg.txt: New error messages sql/share/english/errmsg.txt: New error messages sql/share/estonian/errmsg.txt: New error messages sql/share/french/errmsg.txt: New error messages sql/share/german/errmsg.txt: New error messages sql/share/greek/errmsg.txt: New error messages sql/share/hungarian/errmsg.txt: New error messages sql/share/italian/errmsg.txt: New error messages sql/share/japanese/errmsg.txt: New error messages sql/share/korean/errmsg.txt: New error messages sql/share/norwegian-ny/errmsg.txt: New error messages sql/share/norwegian/errmsg.txt: New error messages sql/share/polish/errmsg.txt: New error messages sql/share/portuguese/errmsg.txt: New error messages sql/share/romanian/errmsg.txt: New error messages sql/share/russian/errmsg.txt: New error messages sql/share/serbian/errmsg.txt: New error messages sql/share/slovak/errmsg.txt: New error messages sql/share/spanish/errmsg.txt: New error messages sql/share/swedish/errmsg.txt: New error messages sql/share/ukrainian/errmsg.txt: New error messages sql/sql_base.cc: Removed all key_cache handling (this is now done on MyISAM level) Change table_charset -> default_table_charset sql/sql_db.cc: table_charset -> default_table_charset sql/sql_delete.cc: table_charset -> default_table_charset sql/sql_lex.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS sql/sql_lex.h: New option to store a name and length sql/sql_parse.cc: Support for mysql_set_server_option() Reset "default" keycache status variables in 'FLUSH STATUS' (Need to be improved later) sql/sql_show.cc: Add DEFAULT before CHARSET (for table character sets) Fetch key cache variables from 'sql_key_cache' sql/sql_table.cc: table_charset -> default_table_charset New multi-key-cache handling sql/sql_test.cc: Write information from all key caches sql/sql_yacc.yy: Changed syntax for CACHE INDEX ... Force user to use DEFAULT before database/table level character sets sql/structs.h: Added SHOW_KEY_CACHE_LONG (to get values from sql_key_cache) sql/table.cc: table_charset -> default_table_charset sql/table.h: New key cache handling (this is now done in mysys/mf_keycaches.c) sql/unireg.h: A
228 lines
7 KiB
C++
228 lines
7 KiB
C++
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
/* The old structures from unireg */
|
|
|
|
struct st_table;
|
|
class Field;
|
|
|
|
typedef struct lex_string {
|
|
char *str;
|
|
uint length;
|
|
} LEX_STRING;
|
|
|
|
|
|
typedef struct st_date_time_format {
|
|
uchar positions[8];
|
|
char time_separator; /* Separator between hour and minute */
|
|
uint flag; /* For future */
|
|
LEX_STRING format;
|
|
} DATE_TIME_FORMAT;
|
|
|
|
|
|
typedef struct st_keyfile_info { /* used with ha_info() */
|
|
byte ref[MAX_REFLENGTH]; /* Pointer to current row */
|
|
byte dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
|
|
uint ref_length; /* Length of ref (1-8) */
|
|
uint block_size; /* index block size */
|
|
File filenr; /* (uniq) filenr for table */
|
|
ha_rows records; /* Records i datafilen */
|
|
ha_rows deleted; /* Deleted records */
|
|
ulonglong data_file_length; /* Length off data file */
|
|
ulonglong max_data_file_length; /* Length off data file */
|
|
ulonglong index_file_length;
|
|
ulonglong max_index_file_length;
|
|
ulonglong delete_length; /* Free bytes */
|
|
ulonglong auto_increment_value;
|
|
int errkey,sortkey; /* Last errorkey and sorted by */
|
|
time_t create_time; /* When table was created */
|
|
time_t check_time;
|
|
time_t update_time;
|
|
ulong mean_rec_length; /* physical reclength */
|
|
} KEYFILE_INFO;
|
|
|
|
|
|
typedef struct st_key_part_info { /* Info about a key part */
|
|
Field *field;
|
|
uint offset; /* offset in record (from 0) */
|
|
uint null_offset; /* Offset to null_bit in record */
|
|
uint16 length; /* Length of key_part */
|
|
uint16 store_length;
|
|
uint16 key_type;
|
|
uint16 fieldnr; /* Fieldnum in UNIREG */
|
|
uint8 key_part_flag; /* 0 or HA_REVERSE_SORT */
|
|
uint8 type;
|
|
uint8 null_bit; /* Position to null_bit */
|
|
} KEY_PART_INFO ;
|
|
|
|
|
|
typedef struct st_key {
|
|
uint key_length; /* Tot length of key */
|
|
uint flags; /* dupp key and pack flags */
|
|
uint key_parts; /* How many key_parts */
|
|
uint extra_length;
|
|
uint usable_key_parts; /* Should normally be = key_parts */
|
|
enum ha_key_alg algorithm;
|
|
KEY_PART_INFO *key_part;
|
|
char *name; /* Name of key */
|
|
ulong *rec_per_key; /* Key part distribution */
|
|
union {
|
|
int bdb_return_if_eq;
|
|
} handler;
|
|
} KEY;
|
|
|
|
|
|
struct st_join_table;
|
|
|
|
typedef struct st_reginfo { /* Extra info about reg */
|
|
struct st_join_table *join_tab; /* Used by SELECT() */
|
|
enum thr_lock_type lock_type; /* How database is used */
|
|
bool not_exists_optimize;
|
|
bool impossible_range;
|
|
} REGINFO;
|
|
|
|
|
|
struct st_read_record; /* For referense later */
|
|
class SQL_SELECT;
|
|
class THD;
|
|
class handler;
|
|
|
|
typedef struct st_read_record { /* Parameter to read_record */
|
|
struct st_table *table; /* Head-form */
|
|
handler *file;
|
|
struct st_table **forms; /* head and ref forms */
|
|
int (*read_record)(struct st_read_record *);
|
|
THD *thd;
|
|
SQL_SELECT *select;
|
|
uint cache_records;
|
|
uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
|
|
uint index;
|
|
byte *ref_pos; /* pointer to form->refpos */
|
|
byte *record;
|
|
byte *rec_buf; /* to read field values after filesort */
|
|
byte *cache,*cache_pos,*cache_end,*read_positions;
|
|
IO_CACHE *io_cache;
|
|
bool print_error, ignore_not_found_rows;
|
|
} READ_RECORD;
|
|
|
|
|
|
enum timestamp_type
|
|
{
|
|
TIMESTAMP_NONE= -2, TIMESTAMP_DATETIME_ERROR= -1,
|
|
TIMESTAMP_DATE= 0, TIMESTAMP_DATETIME= 1, TIMESTAMP_TIME= 2
|
|
};
|
|
|
|
/* Parameters to str_to_TIME */
|
|
#define TIME_FUZZY_DATE 1
|
|
#define TIME_DATETIME_ONLY 2
|
|
|
|
|
|
typedef struct st_time {
|
|
uint year,month,day,hour,minute,second;
|
|
ulong second_part;
|
|
bool neg;
|
|
timestamp_type time_type;
|
|
} TIME;
|
|
|
|
|
|
typedef struct {
|
|
long year,month,day,hour,minute,second,second_part;
|
|
bool neg;
|
|
} INTERVAL;
|
|
|
|
|
|
typedef struct st_known_date_time_format {
|
|
const char *format_name;
|
|
const char *date_format;
|
|
const char *datetime_format;
|
|
const char *time_format;
|
|
} KNOWN_DATE_TIME_FORMAT;
|
|
|
|
|
|
enum SHOW_TYPE
|
|
{
|
|
SHOW_UNDEF,
|
|
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL,
|
|
SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
|
|
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
|
|
#ifdef HAVE_OPENSSL
|
|
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
|
|
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,
|
|
SHOW_SSL_CTX_SESS_CB_HITS, SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE,
|
|
SHOW_SSL_CTX_SESS_NUMBER, SHOW_SSL_SESSION_REUSED,
|
|
SHOW_SSL_CTX_SESS_GET_CACHE_SIZE, SHOW_SSL_GET_CIPHER,
|
|
SHOW_SSL_GET_DEFAULT_TIMEOUT, SHOW_SSL_GET_VERIFY_MODE,
|
|
SHOW_SSL_CTX_GET_VERIFY_MODE, SHOW_SSL_GET_VERIFY_DEPTH,
|
|
SHOW_SSL_CTX_GET_VERIFY_DEPTH, SHOW_SSL_CTX_SESS_CONNECT,
|
|
SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE, SHOW_SSL_CTX_SESS_CONNECT_GOOD,
|
|
SHOW_SSL_CTX_SESS_HITS, SHOW_SSL_CTX_SESS_MISSES,
|
|
SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
|
|
SHOW_SSL_GET_CIPHER_LIST,
|
|
#endif /* HAVE_OPENSSL */
|
|
SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_KEY_CACHE_LONG
|
|
};
|
|
|
|
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
|
|
|
|
extern const char *show_comp_option_name[];
|
|
|
|
typedef int *(*update_var)(THD *, struct show_var_st *);
|
|
|
|
|
|
typedef struct show_var_st {
|
|
const char *name;
|
|
char *value;
|
|
SHOW_TYPE type;
|
|
} SHOW_VAR;
|
|
|
|
|
|
typedef struct st_lex_user {
|
|
LEX_STRING user, host, password;
|
|
} LEX_USER;
|
|
|
|
|
|
typedef struct user_resources {
|
|
uint questions, updates, connections, bits;
|
|
} USER_RESOURCES;
|
|
|
|
typedef struct user_conn {
|
|
char *user, *host;
|
|
uint len, connections, conn_per_hour, updates, questions, user_len;
|
|
USER_RESOURCES user_resources;
|
|
time_t intime;
|
|
} USER_CONN;
|
|
/* Bits in form->update */
|
|
#define REG_MAKE_DUPP 1 /* Make a copy of record when read */
|
|
#define REG_NEW_RECORD 2 /* Write a new record if not found */
|
|
#define REG_UPDATE 4 /* Uppdate record */
|
|
#define REG_DELETE 8 /* Delete found record */
|
|
#define REG_PROG 16 /* User is updateing database */
|
|
#define REG_CLEAR_AFTER_WRITE 32
|
|
#define REG_MAY_BE_UPDATED 64
|
|
#define REG_AUTO_UPDATE 64 /* Used in D-forms for scroll-tables */
|
|
#define REG_OVERWRITE 128
|
|
#define REG_SKIP_DUP 256
|
|
|
|
/* Bits in form->status */
|
|
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */
|
|
#define STATUS_GARBAGE 1
|
|
#define STATUS_NOT_FOUND 2 /* No record in database when needed */
|
|
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
|
|
#define STATUS_NOT_READ 8 /* Record isn't read */
|
|
#define STATUS_UPDATED 16 /* Record is updated by formula */
|
|
#define STATUS_NULL_ROW 32 /* table->null_row is set */
|
|
#define STATUS_DELETED 64
|