mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
050f14ac37
Fixed BUGS: #3300: "UPDATE statement with no index column in where condition locks all rows" Implement semi-consistent read to reduce lock conflicts at the cost of breaking serializability. ha_innobase::unlock_row(): reset the "did semi consistent read" flag ha_innobase::was_semi_consistent_read(), ha_innobase::try_semi_consistent_read(): new methods row_prebuilt_t, row_create_prebuilt(): add field row_read_type for keeping track of semi-consistent reads row_vers_build_for_semi_consistent_read(), row_sel_build_committed_vers_for_mysql(): new functions row_search_for_mysql(): implement semi-consistent reads #9802: "Foreign key checks disallow alter table". Added test cases. #12456: "Cursor shows incorrect data - DML does not affect, probably caching" This patch implements a high-granularity read view to be used with cursors. In this high-granularity consistent read view modifications done by the creating transaction after the cursor is created or future transactions are not visible. But those modifications that transaction did before the cursor was created are visible. #12701: "Support >4GB buffer pool and log files on 64-bit Windows" Do not call os_file_create_tmpfile() at runtime. Instead, create all tempfiles at startup and guard access to them with mutexes. #13778: "If FOREIGN_KEY_CHECKS=0, one can create inconsistent FOREIGN KEYs". When FOREIGN_KEY_CHECKS=0 we still need to check that datatypes between foreign key references are compatible. #14189: "VARBINARY and BINARY variables: trailing space ignored with InnoDB" innobase_init(): Assert that DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number. dtype_get_pad_char(): Do not pad VARBINARY or BINARY columns. row_ins_cascade_calc_update_vec(): Refuse ON UPDATE CASCADE when trying to change the length of a VARBINARY column that refers to or is referenced by a BINARY column. BINARY columns are no longer padded on comparison, and thus they cannot be padded on storage either. #14747: "Race condition can cause btr_search_drop_page_hash_index() to crash" Note that buf_block_t::index should be protected by btr_search_latch or an s-latch or x-latch on the index page. btr_search_drop_page_hash_index(): Read block->index while holding btr_search_latch and use the cached value in the loop. Remove some redundant assertions. #15108: "mysqld crashes when innodb_log_file_size is set > 4G" #15308: "Problem of Order with Enum Column in Primary Key" #15550: "mysqld crashes in printing a FOREIGN KEY error in InnoDB" row_ins_foreign_report_add_err(): When printing the parent record, use the index in the parent table rather than the index in the child table. #15653: "Slow inserts to InnoDB if many thousands of .ibd files" Keep track on unflushed modifications to file spaces. When there are tens of thousands of file spaces, flushing all files in fil_flush_file_spaces() would be very slow. fil_flush_file_spaces(): Only flush unflushed file spaces. fil_space_t, fil_system_t: Add a list of unflushed spaces. #15991: "innodb-file-per-table + symlink database + rename = cr" os_file_handle_error(): Map the error codes EXDEV, ENOTDIR, and EISDIR to the new code OS_FILE_PATH_ERROR. Treat this code as OS_FILE_PATH_ERROR. This fixes the crash on RENAME TABLE when the .ibd file is a symbolic link to a different file system. #16157: "InnoDB crashes when main location settings are empty" This patch is from Heikki. #16298: "InnoDB segfaults in INSERTs in upgrade of 4.0 -> 5.0 tables with VARCHAR BINARY" dict_load_columns(): Set the charset-collation code DATA_MYSQL_BINARY_CHARSET_COLL for those binary string columns that lack a charset-collation code, i.e., the tables were created with an older version of MySQL/InnoDB than 4.1.2. #16229: "MySQL/InnoDB uses full explicit table locks in trigger processing" Take a InnoDB table lock only if user has explicitly requested a table lock. Added some additional comments to store_lock() and external_lock(). #16387: "InnoDB crash when dropping a foreign key <table>_ibfk_0" Do not mistake TABLENAME_ibfk_0 for auto-generated id. dict_table_get_highest_foreign_id(): Ignore foreign constraint identifiers starting with the pattern TABLENAME_ibfk_0. #16582: "InnoDB: Error in an adaptive hash index pointer to page" Account for a race condition when dropping the adaptive hash index for a B-tree page. btr_search_drop_page_hash_index(): Retry the operation if a hash index with different parameters was built meanwhile. Add diagnostics for the case that hash node pointers to the page remain. btr_search_info_update_hash(), btr_search_info_update_slow(): Document the parameter "info" as in/out. #16814: "SHOW INNODB STATUS format error in LATEST FOREIGN KEY ERROR section" Add a missing newline to the LAST FOREIGN KEY ERROR section in SHOW INNODB STATUS output. dict_foreign_error_report(): Always print a newline after invoking dict_print_info_on_foreign_key_in_create_format(). #16827: "Better InnoDB error message if ibdata files omitted from my.cnf" #17126: "CHECK TABLE on InnoDB causes a short hang during check of adaptive hash" CHECK TABLE blocking other queries, by releasing the btr_search_latch periodically during the adaptive hash table validation. #17405: "Valgrind: conditional jump or move depends on unititialised values" buf_block_init(): Reset magic_n, buf_fix_count and io_fix to avoid testing uninitialized variables. mysql-test/r/innodb.result: Applied innodb-5.1-ss269 snapshot. mysql-test/t/innodb.test: Applied innodb-5.1-ss269 snapshot. sql/ha_innodb.cc: Applied innodb-5.1-ss269 snapshot. sql/ha_innodb.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/btr/btr0btr.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/btr/btr0cur.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/btr/btr0pcur.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/btr/btr0sea.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/buf/buf0buf.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/buf/buf0flu.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/buf/buf0lru.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/buf/buf0rea.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/data/data0data.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/data/data0type.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dict/dict0boot.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dict/dict0crea.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dict/dict0dict.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dict/dict0load.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dict/dict0mem.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/dyn/dyn0dyn.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/eval/eval0eval.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/eval/eval0proc.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/fil/fil0fil.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/fsp/fsp0fsp.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/fut/fut0lst.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ha/ha0ha.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ha/hash0hash.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ibuf/ibuf0ibuf.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0btr.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0btr.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0cur.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0cur.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0pcur.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0pcur.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0sea.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0sea.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/btr0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/buf0buf.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/buf0buf.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/buf0flu.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/buf0flu.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/buf0lru.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/data0data.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/data0data.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/data0type.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/data0type.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/db0err.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0boot.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0boot.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0crea.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0dict.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0dict.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0load.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dict0mem.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dyn0dyn.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/dyn0dyn.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/eval0eval.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/eval0eval.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/eval0proc.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/eval0proc.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/fil0fil.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/fsp0fsp.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/fut0lst.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ha0ha.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/hash0hash.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/hash0hash.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ibuf0ibuf.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ibuf0ibuf.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/lock0lock.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/lock0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/log0log.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/log0log.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/log0recv.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mach0data.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mach0data.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mem0dbg.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mem0dbg.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mem0mem.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mem0mem.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mem0pool.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mtr0log.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mtr0mtr.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/mtr0mtr.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/os0file.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/os0proc.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/os0sync.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/os0sync.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/os0thread.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/page0cur.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/page0cur.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/page0page.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/page0page.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/page0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/pars0grm.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/pars0opt.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/pars0pars.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/pars0sym.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/pars0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/que0que.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/que0que.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/que0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/read0read.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/read0read.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/rem0cmp.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/rem0cmp.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/rem0rec.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/rem0rec.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0ins.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0mysql.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0purge.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0row.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0row.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0sel.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0sel.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0uins.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0umod.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0undo.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0upd.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0upd.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/row0vers.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/srv0srv.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/srv0start.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/sync0arr.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/sync0rw.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/sync0rw.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/sync0sync.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/sync0sync.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0purge.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0purge.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0rec.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0roll.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0rseg.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0rseg.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0sys.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0sys.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0trx.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0trx.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0undo.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0undo.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/trx0xa.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/univ.i: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/usr0sess.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/usr0types.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0byte.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0byte.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0dbg.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0lst.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0mem.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0mem.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0rnd.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0rnd.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0sort.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0ut.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/include/ut0ut.ic: Applied innodb-5.1-ss269 snapshot. storage/innobase/lock/lock0lock.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/log/log0log.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/log/log0recv.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mach/mach0data.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mem/mem0dbg.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mem/mem0mem.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mem/mem0pool.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mtr/mtr0log.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/mtr/mtr0mtr.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/os/os0file.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/os/os0proc.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/os/os0sync.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/os/os0thread.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/page/page0cur.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/page/page0page.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/lexyy.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0grm.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0grm.h: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0grm.y: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0lex.l: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0opt.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0pars.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/pars/pars0sym.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/que/que0que.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/read/read0read.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/rem/rem0cmp.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/rem/rem0rec.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0ins.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0mysql.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0purge.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0row.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0sel.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0uins.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0umod.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0undo.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0upd.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/row/row0vers.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/srv/srv0que.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/srv/srv0srv.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/srv/srv0start.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/sync/sync0arr.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/sync/sync0rw.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/sync/sync0sync.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/thr/thr0loc.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0purge.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0rec.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0roll.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0rseg.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0sys.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0trx.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/trx/trx0undo.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/usr/usr0sess.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ut/ut0byte.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ut/ut0dbg.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ut/ut0mem.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ut/ut0rnd.c: Applied innodb-5.1-ss269 snapshot. storage/innobase/ut/ut0ut.c: Applied innodb-5.1-ss269 snapshot. mysql-test/r/innodb_unsafe_binlog.result: New BitKeeper file ``mysql-test/r/innodb_unsafe_binlog.result'' mysql-test/t/innodb_unsafe_binlog-master.opt: New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog-master.opt'' mysql-test/t/innodb_unsafe_binlog.test: New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog.test'' storage/innobase/pars/make_bison.sh: New BitKeeper file ``storage/innobase/pars/make_bison.sh''
585 lines
18 KiB
C
585 lines
18 KiB
C
/******************************************************
|
|
The server main program
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 10/10/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
|
|
#ifndef srv0srv_h
|
|
#define srv0srv_h
|
|
|
|
#include "univ.i"
|
|
#include "sync0sync.h"
|
|
#include "os0sync.h"
|
|
#include "que0types.h"
|
|
#include "trx0types.h"
|
|
|
|
extern const char* srv_main_thread_op_info;
|
|
|
|
/* When this event is set the lock timeout and InnoDB monitor
|
|
thread starts running */
|
|
extern os_event_t srv_lock_timeout_thread_event;
|
|
|
|
/* If the last data file is auto-extended, we add this many pages to it
|
|
at a time */
|
|
#define SRV_AUTO_EXTEND_INCREMENT \
|
|
(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
|
|
|
|
/* This is set to TRUE if the MySQL user has set it in MySQL */
|
|
extern ibool srv_lower_case_table_names;
|
|
|
|
/* Mutex for locking srv_monitor_file */
|
|
extern mutex_t srv_monitor_file_mutex;
|
|
/* Temporary file for innodb monitor output */
|
|
extern FILE* srv_monitor_file;
|
|
/* Mutex for locking srv_dict_tmpfile.
|
|
This mutex has a very high rank; threads reserving it should not
|
|
be holding any InnoDB latches. */
|
|
extern mutex_t srv_dict_tmpfile_mutex;
|
|
/* Temporary file for output from the data dictionary */
|
|
extern FILE* srv_dict_tmpfile;
|
|
/* Mutex for locking srv_misc_tmpfile.
|
|
This mutex has a very low rank; threads reserving it should not
|
|
acquire any further latches or sleep before releasing this one. */
|
|
extern mutex_t srv_misc_tmpfile_mutex;
|
|
/* Temporary file for miscellanous diagnostic output */
|
|
extern FILE* srv_misc_tmpfile;
|
|
|
|
/* Server parameters which are read from the initfile */
|
|
|
|
extern char* srv_data_home;
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
extern char* srv_arch_dir;
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
|
|
|
extern ibool srv_file_per_table;
|
|
extern ibool srv_locks_unsafe_for_binlog;
|
|
|
|
extern ulint srv_n_data_files;
|
|
extern char** srv_data_file_names;
|
|
extern ulint* srv_data_file_sizes;
|
|
extern ulint* srv_data_file_is_raw_partition;
|
|
|
|
extern ibool srv_auto_extend_last_data_file;
|
|
extern ulint srv_last_file_size_max;
|
|
extern ulong srv_auto_extend_increment;
|
|
|
|
extern ibool srv_created_new_raw;
|
|
|
|
#define SRV_NEW_RAW 1
|
|
#define SRV_OLD_RAW 2
|
|
|
|
extern char** srv_log_group_home_dirs;
|
|
|
|
extern ulint srv_n_log_groups;
|
|
extern ulint srv_n_log_files;
|
|
extern ulint srv_log_file_size;
|
|
extern ulint srv_log_buffer_size;
|
|
extern ulint srv_flush_log_at_trx_commit;
|
|
|
|
extern byte srv_latin1_ordering[256];/* The sort order table of the latin1
|
|
character set */
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_awe_window_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_n_file_io_threads;
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
extern ibool srv_log_archive_on;
|
|
extern ibool srv_archive_recovery;
|
|
extern dulint srv_archive_recovery_limit_lsn;
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
|
|
|
extern ulint srv_lock_wait_timeout;
|
|
|
|
extern char* srv_file_flush_method_str;
|
|
extern ulint srv_unix_file_flush_method;
|
|
extern ulint srv_win_file_flush_method;
|
|
|
|
extern ulint srv_max_n_open_files;
|
|
|
|
extern ulint srv_max_dirty_pages_pct;
|
|
|
|
extern ulint srv_force_recovery;
|
|
extern ulong srv_thread_concurrency;
|
|
extern ulong srv_commit_concurrency;
|
|
|
|
extern ulint srv_max_n_threads;
|
|
|
|
extern lint srv_conc_n_threads;
|
|
|
|
extern ulint srv_fast_shutdown; /* If this is 1, do not do a
|
|
purge and index buffer merge.
|
|
If this 2, do not even flush the
|
|
buffer pool to data files at the
|
|
shutdown: we effectively 'crash'
|
|
InnoDB (but lose no committed
|
|
transactions). */
|
|
extern ibool srv_innodb_status;
|
|
|
|
extern ibool srv_use_doublewrite_buf;
|
|
extern ibool srv_use_checksums;
|
|
|
|
extern ibool srv_set_thread_priorities;
|
|
extern int srv_query_thread_priority;
|
|
|
|
extern ulong srv_max_buf_pool_modified_pct;
|
|
extern ulong srv_max_purge_lag;
|
|
extern ibool srv_use_awe;
|
|
extern ibool srv_use_adaptive_hash_indexes;
|
|
/*-------------------------------------------*/
|
|
|
|
extern ulint srv_n_rows_inserted;
|
|
extern ulint srv_n_rows_updated;
|
|
extern ulint srv_n_rows_deleted;
|
|
extern ulint srv_n_rows_read;
|
|
|
|
extern ibool srv_print_innodb_monitor;
|
|
extern ibool srv_print_innodb_lock_monitor;
|
|
extern ibool srv_print_innodb_tablespace_monitor;
|
|
extern ibool srv_print_verbose_log;
|
|
extern ibool srv_print_innodb_table_monitor;
|
|
|
|
extern ibool srv_lock_timeout_and_monitor_active;
|
|
extern ibool srv_error_monitor_active;
|
|
|
|
extern ulong srv_n_spin_wait_rounds;
|
|
extern ulong srv_n_free_tickets_to_enter;
|
|
extern ulong srv_thread_sleep_delay;
|
|
extern ulint srv_spin_wait_delay;
|
|
extern ibool srv_priority_boost;
|
|
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_sim_disk_wait_pct;
|
|
extern ulint srv_sim_disk_wait_len;
|
|
extern ibool srv_sim_disk_wait_by_yield;
|
|
extern ibool srv_sim_disk_wait_by_wait;
|
|
|
|
extern ibool srv_measure_contention;
|
|
extern ibool srv_measure_by_spin;
|
|
|
|
extern ibool srv_print_thread_releases;
|
|
extern ibool srv_print_lock_waits;
|
|
extern ibool srv_print_buf_io;
|
|
extern ibool srv_print_log_io;
|
|
extern ibool srv_print_parsed_sql;
|
|
extern ibool srv_print_latch_waits;
|
|
|
|
extern ibool srv_test_nocache;
|
|
extern ibool srv_test_cache_evict;
|
|
|
|
extern ibool srv_test_extra_mutexes;
|
|
extern ibool srv_test_sync;
|
|
extern ulint srv_test_n_threads;
|
|
extern ulint srv_test_n_loops;
|
|
extern ulint srv_test_n_free_rnds;
|
|
extern ulint srv_test_n_reserved_rnds;
|
|
extern ulint srv_test_n_mutexes;
|
|
extern ulint srv_test_array_size;
|
|
|
|
extern ulint srv_activity_count;
|
|
extern ulint srv_fatal_semaphore_wait_threshold;
|
|
extern ulint srv_dml_needed_delay;
|
|
|
|
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
|
|
query threads, and lock table: we allocate
|
|
it from dynamic memory to get it to the
|
|
same DRAM page as other hotspot semaphores */
|
|
#define kernel_mutex (*kernel_mutex_temp)
|
|
|
|
#define SRV_MAX_N_IO_THREADS 100
|
|
|
|
/* Array of English strings describing the current state of an
|
|
i/o handler thread */
|
|
extern const char* srv_io_thread_op_info[];
|
|
extern const char* srv_io_thread_function[];
|
|
|
|
/* the number of the log write requests done */
|
|
extern ulint srv_log_write_requests;
|
|
|
|
/* the number of physical writes to the log performed */
|
|
extern ulint srv_log_writes;
|
|
|
|
/* amount of data written to the log files in bytes */
|
|
extern ulint srv_os_log_written;
|
|
|
|
/* amount of writes being done to the log files */
|
|
extern ulint srv_os_log_pending_writes;
|
|
|
|
/* we increase this counter, when there we don't have enough space in the
|
|
log buffer and have to flush it */
|
|
extern ulint srv_log_waits;
|
|
|
|
/* variable that counts amount of data read in total (in bytes) */
|
|
extern ulint srv_data_read;
|
|
|
|
/* here we count the amount of data written in total (in bytes) */
|
|
extern ulint srv_data_written;
|
|
|
|
/* this variable counts the amount of times, when the doublewrite buffer
|
|
was flushed */
|
|
extern ulint srv_dblwr_writes;
|
|
|
|
/* here we store the number of pages that have been flushed to the
|
|
doublewrite buffer */
|
|
extern ulint srv_dblwr_pages_written;
|
|
|
|
/* in this variable we store the number of write requests issued */
|
|
extern ulint srv_buf_pool_write_requests;
|
|
|
|
/* here we store the number of times when we had to wait for a free page
|
|
in the buffer pool. It happens when the buffer pool is full and we need
|
|
to make a flush, in order to be able to read or create a page. */
|
|
extern ulint srv_buf_pool_wait_free;
|
|
|
|
/* variable to count the number of pages that were written from the
|
|
buffer pool to disk */
|
|
extern ulint srv_buf_pool_flushed;
|
|
|
|
/* variable to count the number of buffer pool reads that led to the
|
|
reading of a disk page */
|
|
extern ulint srv_buf_pool_reads;
|
|
|
|
/* variable to count the number of sequential read-aheads were done */
|
|
extern ulint srv_read_ahead_seq;
|
|
|
|
/* variable to count the number of random read-aheads were done */
|
|
extern ulint srv_read_ahead_rnd;
|
|
|
|
/* In this structure we store status variables to be passed to MySQL */
|
|
typedef struct export_var_struct export_struc;
|
|
|
|
extern export_struc export_vars;
|
|
|
|
typedef struct srv_sys_struct srv_sys_t;
|
|
|
|
/* The server system */
|
|
extern srv_sys_t* srv_sys;
|
|
|
|
/* Alternatives for the file flush option in Unix; see the InnoDB manual
|
|
about what these mean */
|
|
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is
|
|
currently mapped to a call of
|
|
fsync() because fdatasync() seemed
|
|
to corrupt files in Linux and
|
|
Solaris */
|
|
#define SRV_UNIX_O_DSYNC 2
|
|
#define SRV_UNIX_LITTLESYNC 3
|
|
#define SRV_UNIX_NOSYNC 4
|
|
#define SRV_UNIX_O_DIRECT 5
|
|
|
|
/* Alternatives for file i/o in Windows */
|
|
#define SRV_WIN_IO_NORMAL 1
|
|
#define SRV_WIN_IO_UNBUFFERED 2 /* This is the default */
|
|
|
|
/* Alternatives for srv_force_recovery. Non-zero values are intended
|
|
to help the user get a damaged database up so that he can dump intact
|
|
tables and rows with SELECT INTO OUTFILE. The database must not otherwise
|
|
be used with these options! A bigger number below means that all precautions
|
|
of lower numbers are included. */
|
|
|
|
#define SRV_FORCE_IGNORE_CORRUPT 1 /* let the server run even if it
|
|
detects a corrupt page */
|
|
#define SRV_FORCE_NO_BACKGROUND 2 /* prevent the main thread from
|
|
running: if a crash would occur
|
|
in purge, this prevents it */
|
|
#define SRV_FORCE_NO_TRX_UNDO 3 /* do not run trx rollback after
|
|
recovery */
|
|
#define SRV_FORCE_NO_IBUF_MERGE 4 /* prevent also ibuf operations:
|
|
if they would cause a crash, better
|
|
not do them */
|
|
#define SRV_FORCE_NO_UNDO_LOG_SCAN 5 /* do not look at undo logs when
|
|
starting the database: InnoDB will
|
|
treat even incomplete transactions
|
|
as committed */
|
|
#define SRV_FORCE_NO_LOG_REDO 6 /* do not do the log roll-forward
|
|
in connection with recovery */
|
|
|
|
/*************************************************************************
|
|
Boots Innobase server. */
|
|
|
|
ulint
|
|
srv_boot(void);
|
|
/*==========*/
|
|
/* out: DB_SUCCESS or error code */
|
|
/*************************************************************************
|
|
Initializes the server. */
|
|
|
|
void
|
|
srv_init(void);
|
|
/*==========*/
|
|
/*************************************************************************
|
|
Frees the OS fast mutex created in srv_boot(). */
|
|
|
|
void
|
|
srv_free(void);
|
|
/*==========*/
|
|
/*************************************************************************
|
|
Initializes the synchronization primitives, memory system, and the thread
|
|
local storage. */
|
|
|
|
void
|
|
srv_general_init(void);
|
|
/*==================*/
|
|
/*************************************************************************
|
|
Gets the number of threads in the system. */
|
|
|
|
ulint
|
|
srv_get_n_threads(void);
|
|
/*===================*/
|
|
/*************************************************************************
|
|
Returns the calling thread type. */
|
|
|
|
ulint
|
|
srv_get_thread_type(void);
|
|
/*=====================*/
|
|
/* out: SRV_COM, ... */
|
|
/*************************************************************************
|
|
Sets the info describing an i/o thread current state. */
|
|
|
|
void
|
|
srv_set_io_thread_op_info(
|
|
/*======================*/
|
|
ulint i, /* in: the 'segment' of the i/o thread */
|
|
const char* str); /* in: constant char string describing the
|
|
state */
|
|
/*************************************************************************
|
|
Releases threads of the type given from suspension in the thread table.
|
|
NOTE! The server mutex has to be reserved by the caller! */
|
|
|
|
ulint
|
|
srv_release_threads(
|
|
/*================*/
|
|
/* out: number of threads released: this may be
|
|
< n if not enough threads were suspended at the
|
|
moment */
|
|
ulint type, /* in: thread type */
|
|
ulint n); /* in: number of threads to release */
|
|
/*************************************************************************
|
|
The master thread controlling the server. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_master_thread(
|
|
/*==============*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/***********************************************************************
|
|
Tells the Innobase server that there has been activity in the database
|
|
and wakes up the master thread if it is suspended (not sleeping). Used
|
|
in the MySQL interface. Note that there is a small chance that the master
|
|
thread stays suspended (we do not protect our operation with the kernel
|
|
mutex, for performace reasons). */
|
|
|
|
void
|
|
srv_active_wake_master_thread(void);
|
|
/*===============================*/
|
|
/***********************************************************************
|
|
Wakes up the master thread if it is suspended or being suspended. */
|
|
|
|
void
|
|
srv_wake_master_thread(void);
|
|
/*========================*/
|
|
/*************************************************************************
|
|
Puts an OS thread to wait if there are too many concurrent threads
|
|
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
|
|
|
|
void
|
|
srv_conc_enter_innodb(
|
|
/*==================*/
|
|
trx_t* trx); /* in: transaction object associated with the
|
|
thread */
|
|
/*************************************************************************
|
|
This lets a thread enter InnoDB regardless of the number of threads inside
|
|
InnoDB. This must be called when a thread ends a lock wait. */
|
|
|
|
void
|
|
srv_conc_force_enter_innodb(
|
|
/*========================*/
|
|
trx_t* trx); /* in: transaction object associated with the
|
|
thread */
|
|
/*************************************************************************
|
|
This must be called when a thread exits InnoDB in a lock wait or at the
|
|
end of an SQL statement. */
|
|
|
|
void
|
|
srv_conc_force_exit_innodb(
|
|
/*=======================*/
|
|
trx_t* trx); /* in: transaction object associated with the
|
|
thread */
|
|
/*************************************************************************
|
|
This must be called when a thread exits InnoDB. */
|
|
|
|
void
|
|
srv_conc_exit_innodb(
|
|
/*=================*/
|
|
trx_t* trx); /* in: transaction object associated with the
|
|
thread */
|
|
/*******************************************************************
|
|
Puts a MySQL OS thread to wait for a lock to be released. If an error
|
|
occurs during the wait trx->error_state associated with thr is
|
|
!= DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK
|
|
are possible errors. DB_DEADLOCK is returned if selective deadlock
|
|
resolution chose this transaction as a victim. */
|
|
|
|
void
|
|
srv_suspend_mysql_thread(
|
|
/*=====================*/
|
|
que_thr_t* thr); /* in: query thread associated with the MySQL
|
|
OS thread */
|
|
/************************************************************************
|
|
Releases a MySQL OS thread waiting for a lock to be released, if the
|
|
thread is already suspended. */
|
|
|
|
void
|
|
srv_release_mysql_thread_if_suspended(
|
|
/*==================================*/
|
|
que_thr_t* thr); /* in: query thread associated with the
|
|
MySQL OS thread */
|
|
/*************************************************************************
|
|
A thread which wakes up threads whose lock wait may have lasted too long.
|
|
This also prints the info output by various InnoDB monitors. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_lock_timeout_and_monitor_thread(
|
|
/*================================*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/*************************************************************************
|
|
A thread which prints warnings about semaphore waits which have lasted
|
|
too long. These can be used to track bugs which cause hangs. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_error_monitor_thread(
|
|
/*=====================*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/**********************************************************************
|
|
Outputs to a file the output of the InnoDB Monitor. */
|
|
|
|
void
|
|
srv_printf_innodb_monitor(
|
|
/*======================*/
|
|
FILE* file, /* in: output stream */
|
|
ulint* trx_start, /* out: file position of the start of
|
|
the list of active transactions */
|
|
ulint* trx_end); /* out: file position of the end of
|
|
the list of active transactions */
|
|
|
|
/**********************************************************************
|
|
Function to pass InnoDB status variables to MySQL */
|
|
|
|
void
|
|
srv_export_innodb_status(void);
|
|
/*=====================*/
|
|
|
|
/* Types for the threads existing in the system. Threads of types 4 - 9
|
|
are called utility threads. Note that utility threads are mainly disk
|
|
bound, except that version threads 6 - 7 may also be CPU bound, if
|
|
cleaning versions from the buffer pool. */
|
|
|
|
#define SRV_COM 1 /* threads serving communication and queries */
|
|
#define SRV_CONSOLE 2 /* thread serving console */
|
|
#define SRV_WORKER 3 /* threads serving parallelized queries and
|
|
queries released from lock wait */
|
|
#define SRV_BUFFER 4 /* thread flushing dirty buffer blocks,
|
|
not currently in use */
|
|
#define SRV_RECOVERY 5 /* threads finishing a recovery,
|
|
not currently in use */
|
|
#define SRV_INSERT 6 /* thread flushing the insert buffer to disk,
|
|
not currently in use */
|
|
#define SRV_MASTER 7 /* the master thread, (whose type number must
|
|
be biggest) */
|
|
|
|
/* Thread slot in the thread table */
|
|
typedef struct srv_slot_struct srv_slot_t;
|
|
|
|
/* Thread table is an array of slots */
|
|
typedef srv_slot_t srv_table_t;
|
|
|
|
/* In this structure we store status variables to be passed to MySQL */
|
|
struct export_var_struct{
|
|
ulint innodb_data_pending_reads;
|
|
ulint innodb_data_pending_writes;
|
|
ulint innodb_data_pending_fsyncs;
|
|
ulint innodb_data_fsyncs;
|
|
ulint innodb_data_read;
|
|
ulint innodb_data_writes;
|
|
ulint innodb_data_written;
|
|
ulint innodb_data_reads;
|
|
ulint innodb_buffer_pool_pages_total;
|
|
ulint innodb_buffer_pool_pages_data;
|
|
ulint innodb_buffer_pool_pages_dirty;
|
|
ulint innodb_buffer_pool_pages_misc;
|
|
ulint innodb_buffer_pool_pages_free;
|
|
ulint innodb_buffer_pool_pages_latched;
|
|
ulint innodb_buffer_pool_read_requests;
|
|
ulint innodb_buffer_pool_reads;
|
|
ulint innodb_buffer_pool_wait_free;
|
|
ulint innodb_buffer_pool_pages_flushed;
|
|
ulint innodb_buffer_pool_write_requests;
|
|
ulint innodb_buffer_pool_read_ahead_seq;
|
|
ulint innodb_buffer_pool_read_ahead_rnd;
|
|
ulint innodb_dblwr_pages_written;
|
|
ulint innodb_dblwr_writes;
|
|
ulint innodb_log_waits;
|
|
ulint innodb_log_write_requests;
|
|
ulint innodb_log_writes;
|
|
ulint innodb_os_log_written;
|
|
ulint innodb_os_log_fsyncs;
|
|
ulint innodb_os_log_pending_writes;
|
|
ulint innodb_os_log_pending_fsyncs;
|
|
ulint innodb_page_size;
|
|
ulint innodb_pages_created;
|
|
ulint innodb_pages_read;
|
|
ulint innodb_pages_written;
|
|
ulint innodb_row_lock_waits;
|
|
ulint innodb_row_lock_current_waits;
|
|
ib_longlong innodb_row_lock_time;
|
|
ulint innodb_row_lock_time_avg;
|
|
ulint innodb_row_lock_time_max;
|
|
ulint innodb_rows_read;
|
|
ulint innodb_rows_inserted;
|
|
ulint innodb_rows_updated;
|
|
ulint innodb_rows_deleted;
|
|
};
|
|
|
|
/* The server system struct */
|
|
struct srv_sys_struct{
|
|
os_event_t operational; /* created threads must wait for the
|
|
server to become operational by
|
|
waiting for this event */
|
|
srv_table_t* threads; /* server thread table */
|
|
UT_LIST_BASE_NODE_T(que_thr_t)
|
|
tasks; /* task queue */
|
|
dict_index_t* dummy_ind1; /* dummy index for old-style
|
|
supremum and infimum records */
|
|
dict_index_t* dummy_ind2; /* dummy index for new-style
|
|
supremum and infimum records */
|
|
};
|
|
|
|
extern ulint srv_n_threads_active[];
|
|
|
|
#endif
|
|
|