diff options
author | unknown <aivanov@mysql.com> | 2006-03-10 19:22:21 +0300 |
---|---|---|
committer | unknown <aivanov@mysql.com> | 2006-03-10 19:22:21 +0300 |
commit | 050f14ac371e03dc96b96e8a9b0cd8fa8e3a23e0 (patch) | |
tree | 8105d79f7267d8af93861befd1899063f1ad42c2 /storage/innobase/include | |
parent | 1cef1679a47bfbf744d656646770193ba07c30fe (diff) | |
download | mariadb-git-050f14ac371e03dc96b96e8a9b0cd8fa8e3a23e0.tar.gz |
Applied innodb-5.1-ss269 snapshot.
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''
Diffstat (limited to 'storage/innobase/include')
128 files changed, 2017 insertions, 1732 deletions
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index d28b0b129a1..288b0459b13 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -43,7 +43,7 @@ optimization */ /* This flag ORed to latch mode says that we can ignore possible UNIQUE definition on secondary indexes when we decide if we can use the insert buffer to speed up inserts */ -#define BTR_IGNORE_SEC_UNIQUE 2048 +#define BTR_IGNORE_SEC_UNIQUE 2048 /****************************************************************** Gets the root node of a tree and x-latches it. */ @@ -144,7 +144,7 @@ UNIV_INLINE ulint btr_node_ptr_get_child_page_no( /*===========================*/ - /* out: child node address */ + /* out: child node address */ rec_t* rec, /* in: node pointer record */ const ulint* offsets);/* in: array returned by rec_get_offsets() */ /**************************************************************** @@ -277,6 +277,7 @@ btr_node_ptr_delete( dict_tree_t* tree, /* in: index tree */ page_t* page, /* in: page whose node pointer is deleted */ mtr_t* mtr); /* in: mtr */ +#ifdef UNIV_DEBUG /**************************************************************** Checks that the node pointer to a page is appropriate. */ @@ -287,6 +288,7 @@ btr_check_node_ptr( dict_tree_t* tree, /* in: index tree */ page_t* page, /* in: index page */ mtr_t* mtr); /* in: mtr */ +#endif /* UNIV_DEBUG */ /***************************************************************** Tries to merge the page first to the left immediate brother if such a brother exists, and the node pointers to the current page and to the @@ -374,7 +376,7 @@ void btr_page_free( /*==========*/ dict_tree_t* tree, /* in: index tree */ - page_t* page, /* in: page to be freed, x-latched */ + page_t* page, /* in: page to be freed, x-latched */ mtr_t* mtr); /* in: mtr */ /****************************************************************** Frees a file page used in an index tree. Can be used also to BLOB @@ -385,7 +387,7 @@ void btr_page_free_low( /*==============*/ dict_tree_t* tree, /* in: index tree */ - page_t* page, /* in: page to be freed, x-latched */ + page_t* page, /* in: page to be freed, x-latched */ ulint level, /* in: page level */ mtr_t* mtr); /* in: mtr */ #ifdef UNIV_BTR_PRINT @@ -412,7 +414,7 @@ the index. */ ibool btr_index_rec_validate( -/*====================*/ +/*===================*/ /* out: TRUE if ok */ rec_t* rec, /* in: index record */ dict_index_t* index, /* in: index */ @@ -429,11 +431,11 @@ btr_validate_tree( dict_tree_t* tree, /* in: tree */ trx_t* trx); /* in: transaction or NULL */ -#define BTR_N_LEAF_PAGES 1 +#define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 #ifndef UNIV_NONINL #include "btr0btr.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index a0860b1c3a7..c24b1603bd2 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -28,7 +28,7 @@ btr_page_get( page = buf_page_get(space, page_no, mode, mtr); #ifdef UNIV_SYNC_DEBUG if (mode != RW_NO_LATCH) { - + buf_page_dbg_add_level(page, SYNC_TREE_NODE); } #endif @@ -72,7 +72,7 @@ btr_page_get_level_low( ulint level; ut_ad(page); - + level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL); ut_ad(level <= BTR_MAX_NODE_LEVEL); @@ -92,7 +92,7 @@ btr_page_get_level( { ut_ad(page && mtr); - return(btr_page_get_level_low(page)); + return(btr_page_get_level_low(page)); } /************************************************************ @@ -124,9 +124,9 @@ btr_page_get_next( { ut_ad(page && mtr); ut_ad(mtr_memo_contains(mtr, buf_block_align(page), - MTR_MEMO_PAGE_X_FIX) - || mtr_memo_contains(mtr, buf_block_align(page), - MTR_MEMO_PAGE_S_FIX)); + MTR_MEMO_PAGE_X_FIX) + || mtr_memo_contains(mtr, buf_block_align(page), + MTR_MEMO_PAGE_S_FIX)); return(mach_read_from_4(page + FIL_PAGE_NEXT)); } @@ -157,7 +157,7 @@ btr_page_get_prev( mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */ { ut_ad(page && mtr); - + return(mach_read_from_4(page + FIL_PAGE_PREV)); } @@ -182,7 +182,7 @@ UNIV_INLINE ulint btr_node_ptr_get_child_page_no( /*===========================*/ - /* out: child node address */ + /* out: child node address */ rec_t* rec, /* in: node pointer record */ const ulint* offsets)/* in: array returned by rec_get_offsets() */ { @@ -192,12 +192,12 @@ btr_node_ptr_get_child_page_no( ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec)); - /* The child address is in the last field */ + /* The child address is in the last field */ field = rec_get_nth_field(rec, offsets, rec_offs_n_fields(offsets) - 1, &len); ut_ad(len == 4); - + page_no = mach_read_from_4(field); if (UNIV_UNLIKELY(page_no == 0)) { @@ -223,11 +223,11 @@ btr_leaf_page_release( ut_ad(!mtr_memo_contains(mtr, buf_block_align(page), MTR_MEMO_MODIFY)); if (latch_mode == BTR_SEARCH_LEAF) { - mtr_memo_release(mtr, buf_block_align(page), + mtr_memo_release(mtr, buf_block_align(page), MTR_MEMO_PAGE_S_FIX); } else { ut_ad(latch_mode == BTR_MODIFY_LEAF); - mtr_memo_release(mtr, buf_block_align(page), + mtr_memo_release(mtr, buf_block_align(page), MTR_MEMO_PAGE_X_FIX); } } diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 352d1739b6a..cb6cb1b1a4d 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -72,7 +72,7 @@ UNIV_INLINE void btr_cur_position( /*=============*/ - dict_index_t* index, /* in: index */ + dict_index_t* index, /* in: index */ rec_t* rec, /* in: record in tree */ btr_cur_t* cursor);/* in: cursor */ /************************************************************************ @@ -550,7 +550,7 @@ btr_push_update_extern_fields( to have space for all fields in rec */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ upd_t* update);/* in: update vector or NULL */ - + /*######################################################################*/ @@ -697,5 +697,5 @@ extern ulint btr_cur_n_sea_old; #ifndef UNIV_NONINL #include "btr0cur.ic" #endif - + #endif diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic index bf8a6efb68d..5d2ae768416 100644 --- a/storage/innobase/include/btr0cur.ic +++ b/storage/innobase/include/btr0cur.ic @@ -53,7 +53,8 @@ btr_cur_get_page( btr_cur_t* cursor) /* in: tree cursor */ { page_t* page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur))); - ut_ad(!!page_is_comp(page) == cursor->index->table->comp); + ut_ad(!!page_is_comp(page) + == dict_table_is_comp(cursor->index->table)); return(page); } @@ -75,7 +76,7 @@ UNIV_INLINE void btr_cur_position( /*=============*/ - dict_index_t* index, /* in: index */ + dict_index_t* index, /* in: index */ rec_t* rec, /* in: record in tree */ btr_cur_t* cursor) /* in: cursor */ { @@ -96,7 +97,7 @@ btr_cur_compress_recommendation( mtr_t* mtr) /* in: mtr */ { page_t* page; - + ut_ad(mtr_memo_contains(mtr, buf_block_align( btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); @@ -104,27 +105,27 @@ btr_cur_compress_recommendation( page = btr_cur_get_page(cursor); if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT) - || ((btr_page_get_next(page, mtr) == FIL_NULL) - && (btr_page_get_prev(page, mtr) == FIL_NULL))) { + || ((btr_page_get_next(page, mtr) == FIL_NULL) + && (btr_page_get_prev(page, mtr) == FIL_NULL))) { /* The page fillfactor has dropped below a predefined minimum value OR the level in the B-tree contains just one page: we recommend compression if this is not the root page. */ - + if (dict_tree_get_page((cursor->index)->tree) - == buf_frame_get_page_no(page)) { + == buf_frame_get_page_no(page)) { - /* It is the root page */ + /* It is the root page */ - return(FALSE); + return(FALSE); } return(TRUE); } return(FALSE); -} +} /************************************************************************* Checks if the record on which the cursor is placed can be deleted without @@ -140,7 +141,7 @@ btr_cur_can_delete_without_compress( mtr_t* mtr) /* in: mtr */ { page_t* page; - + ut_ad(mtr_memo_contains(mtr, buf_block_align( btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); @@ -148,21 +149,21 @@ btr_cur_can_delete_without_compress( page = btr_cur_get_page(cursor); if ((page_get_data_size(page) - rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT) - || ((btr_page_get_next(page, mtr) == FIL_NULL) - && (btr_page_get_prev(page, mtr) == FIL_NULL)) - || (page_get_n_recs(page) < 2)) { + || ((btr_page_get_next(page, mtr) == FIL_NULL) + && (btr_page_get_prev(page, mtr) == FIL_NULL)) + || (page_get_n_recs(page) < 2)) { /* The page fillfactor will drop below a predefined minimum value, OR the level in the B-tree contains just one page, OR the page will become empty: we recommend compression if this is not the root page. */ - + if (dict_tree_get_page((cursor->index)->tree) - == buf_frame_get_page_no(page)) { + == buf_frame_get_page_no(page)) { - /* It is the root page */ + /* It is the root page */ - return(TRUE); + return(TRUE); } return(FALSE); diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index eb3822aab7a..0276fe45922 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -152,7 +152,7 @@ btr_pcur_open_on_user_rec( ulint mode, /* in: PAGE_CUR_L, ... */ ulint latch_mode, /* in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF */ - btr_pcur_t* cursor, /* in: memory buffer for persistent + btr_pcur_t* cursor, /* in: memory buffer for persistent cursor */ mtr_t* mtr); /* in: mtr */ /************************************************************************** @@ -208,7 +208,7 @@ btr_pcur_restore_position( whose ordering fields are identical to the ones of the original user record */ ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /* in: detached persistent cursor */ + btr_pcur_t* cursor, /* in: detached persistent cursor */ mtr_t* mtr); /* in: mtr */ /****************************************************************** If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY, @@ -387,7 +387,7 @@ btr_pcur_is_on_user_rec( btr_pcur_t* cursor, /* in: persistent cursor */ mtr_t* mtr); /* in: mtr */ /************************************************************* -Checks if the persistent cursor is after the last user record on +Checks if the persistent cursor is after the last user record on a page. */ UNIV_INLINE ibool @@ -396,7 +396,7 @@ btr_pcur_is_after_last_on_page( btr_pcur_t* cursor, /* in: persistent cursor */ mtr_t* mtr); /* in: mtr */ /************************************************************* -Checks if the persistent cursor is before the first user record on +Checks if the persistent cursor is before the first user record on a page. */ UNIV_INLINE ibool @@ -512,5 +512,5 @@ struct btr_pcur_struct{ #ifndef UNIV_NONINL #include "btr0pcur.ic" #endif - + #endif diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 9a7d7867025..a8aa82cf203 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -102,7 +102,7 @@ btr_pcur_get_rec( { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + return(page_cur_get_rec(btr_pcur_get_page_cur(cursor))); } @@ -152,7 +152,7 @@ btr_pcur_get_low_match( } /************************************************************* -Checks if the persistent cursor is after the last user record on +Checks if the persistent cursor is after the last user record on a page. */ UNIV_INLINE ibool @@ -164,12 +164,12 @@ btr_pcur_is_after_last_on_page( UT_NOT_USED(mtr); ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + return(page_cur_is_after_last(btr_pcur_get_page_cur(cursor))); } /************************************************************* -Checks if the persistent cursor is before the first user record on +Checks if the persistent cursor is before the first user record on a page. */ UNIV_INLINE ibool @@ -181,7 +181,7 @@ btr_pcur_is_before_first_on_page( UT_NOT_USED(mtr); ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + return(page_cur_is_before_first(btr_pcur_get_page_cur(cursor))); } @@ -196,9 +196,9 @@ btr_pcur_is_on_user_rec( { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + if ((btr_pcur_is_before_first_on_page(cursor, mtr)) - || (btr_pcur_is_after_last_on_page(cursor, mtr))) { + || (btr_pcur_is_after_last_on_page(cursor, mtr))) { return(FALSE); } @@ -218,7 +218,7 @@ btr_pcur_is_before_first_in_tree( { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + if (btr_page_get_prev(btr_pcur_get_page(cursor), mtr) != FIL_NULL) { return(FALSE); @@ -239,7 +239,7 @@ btr_pcur_is_after_last_in_tree( { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + if (btr_page_get_next(btr_pcur_get_page(cursor), mtr) != FIL_NULL) { return(FALSE); @@ -260,7 +260,7 @@ btr_pcur_move_to_next_on_page( UT_NOT_USED(mtr); ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + page_cur_move_to_next(btr_pcur_get_page_cur(cursor)); cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; @@ -278,7 +278,7 @@ btr_pcur_move_to_prev_on_page( UT_NOT_USED(mtr); ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + page_cur_move_to_prev(btr_pcur_get_page_cur(cursor)); cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; @@ -295,7 +295,7 @@ btr_pcur_move_to_last_on_page( { UT_NOT_USED(mtr); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - + page_cur_set_after_last(buf_frame_align(btr_pcur_get_rec(cursor)), btr_pcur_get_page_cur(cursor)); @@ -356,14 +356,14 @@ btr_pcur_move_to_next( ut_ad(cursor->latch_mode != BTR_NO_LATCHES); cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; - + if (btr_pcur_is_after_last_on_page(cursor, mtr)) { if (btr_pcur_is_after_last_in_tree(cursor, mtr)) { return(FALSE); } - + btr_pcur_move_to_next_page(cursor, mtr); return(TRUE); @@ -371,7 +371,7 @@ btr_pcur_move_to_next( btr_pcur_move_to_next_on_page(cursor, mtr); - return(TRUE); + return(TRUE); } /****************************************************************** @@ -388,12 +388,12 @@ btr_pcur_commit( { ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - pcur->latch_mode = BTR_NO_LATCHES; + pcur->latch_mode = BTR_NO_LATCHES; mtr_commit(pcur->mtr); pcur->pos_state = BTR_PCUR_WAS_POSITIONED; -} +} /****************************************************************** Differs from btr_pcur_commit in that we can specify the mtr to commit. */ @@ -406,12 +406,12 @@ btr_pcur_commit_specify_mtr( { ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - pcur->latch_mode = BTR_NO_LATCHES; + pcur->latch_mode = BTR_NO_LATCHES; mtr_commit(mtr); pcur->pos_state = BTR_PCUR_WAS_POSITIONED; -} +} /****************************************************************** Sets the pcur latch mode to BTR_NO_LATCHES. */ @@ -422,7 +422,7 @@ btr_pcur_detach( btr_pcur_t* pcur) /* in: persistent cursor */ { ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - + pcur->latch_mode = BTR_NO_LATCHES; pcur->pos_state = BTR_PCUR_WAS_POSITIONED; @@ -440,7 +440,7 @@ btr_pcur_is_detached( if (pcur->latch_mode == BTR_NO_LATCHES) { return(TRUE); - } + } return(FALSE); } @@ -452,7 +452,7 @@ void btr_pcur_init( /*==========*/ btr_pcur_t* pcur) /* in: persistent cursor */ -{ +{ pcur->old_stored = BTR_PCUR_OLD_NOT_STORED; pcur->old_rec_buf = NULL; pcur->old_rec = NULL; @@ -485,7 +485,7 @@ btr_pcur_open( cursor->latch_mode = latch_mode; cursor->search_mode = mode; - + /* Search with the tree cursor */ btr_cursor = btr_pcur_get_btr_cur(cursor); @@ -527,7 +527,7 @@ btr_pcur_open_with_no_init( cursor->latch_mode = latch_mode; cursor->search_mode = mode; - + /* Search with the tree cursor */ btr_cursor = btr_pcur_get_btr_cur(cursor); @@ -591,7 +591,7 @@ btr_pcur_open_at_rnd_pos( cursor->latch_mode = latch_mode; cursor->search_mode = PAGE_CUR_G; - + btr_pcur_init(cursor); btr_cur_open_at_rnd_pos(index, latch_mode, @@ -601,7 +601,7 @@ btr_pcur_open_at_rnd_pos( cursor->trx_if_known = NULL; } - + /****************************************************************** Frees the possible memory heap of a persistent cursor and sets the latch mode of the persistent cursor to BTR_NO_LATCHES. */ @@ -622,7 +622,7 @@ btr_pcur_close( cursor->btr_cur.page_cur.rec = NULL; cursor->old_rec = NULL; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; - + cursor->latch_mode = BTR_NO_LATCHES; cursor->pos_state = BTR_PCUR_NOT_POSITIONED; diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 78e88a24083..b64d5e62e03 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -57,13 +57,13 @@ both have sensible values. */ ibool btr_search_guess_on_hash( /*=====================*/ - /* out: TRUE if succeeded */ + /* out: TRUE if succeeded */ dict_index_t* index, /* in: index */ btr_search_t* info, /* in: index search info */ dtuple_t* tuple, /* in: logical record */ ulint mode, /* in: PAGE_CUR_L, ... */ - ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */ - btr_cur_t* cursor, /* out: tree cursor */ + ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */ + btr_cur_t* cursor, /* out: tree cursor */ ulint has_search_latch,/* in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, RW_X_LATCH, or 0 */ @@ -169,7 +169,7 @@ struct btr_search_struct{ ulint n_hash_potential;/* number of consecutive searches which would have succeeded, or did succeed, using the hash index */ - /*----------------------*/ + /*----------------------*/ ulint n_fields; /* recommended prefix length for hash search: number of full fields */ ulint n_bytes; /* recommended prefix: number of bytes in @@ -250,4 +250,4 @@ much timeout. This is to reduce contention. */ #include "btr0sea.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.ic index 8a41042f713..f4e33027c25 100644 --- a/storage/innobase/include/btr0sea.ic +++ b/storage/innobase/include/btr0sea.ic @@ -16,7 +16,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor);/* in: cursor which was just positioned */ /************************************************************************ diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 03a61480e2e..8fa0bf0602d 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -15,7 +15,7 @@ Created 2/17/1996 Heikki Tuuri #include "page0types.h" typedef struct btr_pcur_struct btr_pcur_t; -typedef struct btr_cur_struct btr_cur_t; +typedef struct btr_cur_struct btr_cur_t; typedef struct btr_search_struct btr_search_t; -#endif +#endif diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index ae8d0411c12..12aac878614 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1,14 +1,14 @@ /* Innobase relational database engine; Copyright (C) 2001 Innobase Oy - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License 2 as published by the Free Software Foundation in June 1991. - + 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 2 along with this program (in file COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -55,14 +55,14 @@ Created 11/5/1995 Heikki Tuuri /* Magic value to use instead of checksums when they are disabled */ #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL -extern buf_pool_t* buf_pool; /* The buffer pool of the database */ +extern buf_pool_t* buf_pool; /* The buffer pool of the database */ #ifdef UNIV_DEBUG extern ibool buf_debug_prints;/* If this is set TRUE, the program prints info whenever read or flush occurs */ #endif /* UNIV_DEBUG */ extern ulint srv_buf_pool_write_requests; /* variable to count write request - issued */ + issued */ /************************************************************************ Creates the buffer pool. */ @@ -134,7 +134,7 @@ buf_frame_copy( NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed in LA! */ -#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\ +#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\ SP, OF, LA, NULL,\ BUF_GET, __FILE__, __LINE__, MTR) /****************************************************************** @@ -143,13 +143,13 @@ read the contents of the page unless you know it is safe. Do not modify the contents of the page! We have separated this case, because it is error-prone programming not to set a latch, and it should be used with care. */ -#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\ +#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\ SP, OF, RW_NO_LATCH, NULL,\ BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) /****************************************************************** NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ -#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\ +#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\ SP, OF, LA, NULL,\ BUF_GET_NOWAIT, __FILE__, __LINE__, MTR) /****************************************************************** @@ -266,7 +266,7 @@ the buffer pool. */ void buf_page_make_young( -/*=================*/ +/*================*/ buf_frame_t* frame); /* in: buffer frame of a file page */ /************************************************************************ Returns TRUE if the page can be found in the buffer pool hash table. NOTE @@ -380,7 +380,7 @@ buf_block_modify_clock_inc( /* out: new value */ buf_block_t* block); /* in: block */ /************************************************************************ -Returns the value of the modify clock. The caller must have an s-lock +Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ UNIV_INLINE dulint @@ -396,12 +396,12 @@ on 32-bit and 64-bit architectures. */ ulint buf_calc_page_new_checksum( /*=======================*/ - /* out: checksum */ - byte* page); /* in: buffer page */ + /* out: checksum */ + byte* page); /* in: buffer page */ /************************************************************************ In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. This calculates that old -checksum. +checksum. NOTE: we must first store the new formula checksum to FIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksum because this takes that field as an input! */ @@ -409,8 +409,8 @@ because this takes that field as an input! */ ulint buf_calc_page_old_checksum( /*=======================*/ - /* out: checksum */ - byte* page); /* in: buffer page */ + /* out: checksum */ + byte* page); /* in: buffer page */ /************************************************************************ Checks if a page is corrupt. */ @@ -648,7 +648,7 @@ Sets the io_fix flag to BUF_IO_READ and sets a non-recursive exclusive lock on the buffer frame. The io-handler must take care that the flag is cleared and the lock released later. This is one of the functions which perform the state transition NOT_USED => FILE_PAGE to a block (the other is -buf_page_create). */ +buf_page_create). */ buf_block_t* buf_page_init_for_read( @@ -704,7 +704,7 @@ buf_get_free_list_len(void); /*=======================*/ - + /* The buffer control block structure */ struct buf_block_struct{ @@ -745,8 +745,6 @@ struct buf_block_struct{ buffer pool which are index pages, but this flag is not set because we do not keep track of all pages */ - dict_index_t* index; /* index for which the adaptive - hash index has been created */ /* 2. Page flushing fields */ UT_LIST_NODE_T(buf_block_t) flush_list; @@ -820,7 +818,7 @@ struct buf_block_struct{ /* 5. Hash search fields: NOTE that the first 4 fields are NOT protected by any semaphore! */ - + ulint n_hash_helps; /* counter which controls building of a new hash index for the page */ ulint n_fields; /* recommended prefix length for hash @@ -832,8 +830,14 @@ struct buf_block_struct{ whether the leftmost record of several records with the same prefix should be indexed in the hash index */ - - /* The following 4 fields are protected by btr_search_latch: */ + + /* These 6 fields may only be modified when we have + an x-latch on btr_search_latch AND + a) we are holding an s-latch or x-latch on block->lock or + b) we know that block->buf_fix_count == 0. + + An exception to this is when we init or create a page + in the buffer pool in buf0buf.c. */ ibool is_hashed; /* TRUE if hash index has already been built on this page; note that it does @@ -850,6 +854,8 @@ struct buf_block_struct{ ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or BTR_SEARCH_RIGHT_SIDE in hash indexing */ + dict_index_t* index; /* Index for which the adaptive + hash index has been created. */ /* 6. Debug fields */ #ifdef UNIV_SYNC_DEBUG rw_lock_t debug_latch; /* in the debug version, each thread @@ -857,9 +863,9 @@ struct buf_block_struct{ an s-latch here; so we can use the debug utilities in sync0rw */ #endif - ibool file_page_was_freed; - /* this is set to TRUE when fsp - frees a page in buffer pool */ + ibool file_page_was_freed; + /* this is set to TRUE when fsp + frees a page in buffer pool */ }; #define BUF_BLOCK_MAGIC_N 41526563 @@ -971,7 +977,7 @@ struct buf_pool_struct{ physical memory is mapped to a frame */ UT_LIST_BASE_NODE_T(buf_block_t) LRU; /* base node of the LRU list */ - buf_block_t* LRU_old; /* pointer to the about 3/8 oldest + buf_block_t* LRU_old; /* pointer to the about 3/8 oldest blocks in the LRU list; NULL if LRU length less than BUF_LRU_OLD_MIN_LEN */ ulint LRU_old_len; /* length of the LRU list from @@ -1013,8 +1019,8 @@ MEMORY: is not in free list, LRU list, or flush list, nor page FILE_PAGE: space and offset are defined, is in page hash table if io_fix == BUF_IO_WRITE, pool: no_flush[block->flush_type] is in reset state, - pool: n_flush[block->flush_type] > 0 - + pool: n_flush[block->flush_type] > 0 + (1) if buf_fix_count == 0, then is in LRU list, not in free list is in flush list, @@ -1023,23 +1029,23 @@ FILE_PAGE: space and offset are defined, is in page hash table if and only if io_fix == BUF_IO_READ is s-locked, if and only if io_fix == BUF_IO_WRITE - + (2) if buf_fix_count > 0, then is not in LRU list, not in free list is in flush list, if and only if oldest_modification > 0 - if io_fix == BUF_IO_READ, + if io_fix == BUF_IO_READ, is x-locked if io_fix == BUF_IO_WRITE, is s-locked - + State transitions: NOT_USED => READY_FOR_USE READY_FOR_USE => MEMORY READY_FOR_USE => FILE_PAGE MEMORY => NOT_USED -FILE_PAGE => NOT_USED NOTE: This transition is allowed if and only if +FILE_PAGE => NOT_USED NOTE: This transition is allowed if and only if (1) buf_fix_count == 0, (2) oldest_modification == 0, and (3) io_fix == 0. diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index d949254d47d..15187c03636 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -41,7 +41,7 @@ buf_pool_get_curr_size(void) /* out: size in bytes */ { return((buf_pool->n_frames) * UNIV_PAGE_SIZE); -} +} /************************************************************************* Gets the maximum size of buffer buf_pool in bytes. In the case of AWE, the @@ -53,7 +53,7 @@ buf_pool_get_max_size(void) /* out: size in bytes */ { return((buf_pool->n_frames) * UNIV_PAGE_SIZE); -} +} /*********************************************************************** Accessor function for block array. */ @@ -69,7 +69,7 @@ buf_pool_get_nth_block( ut_ad(i < buf_pool->max_size); return(i + buf_pool->blocks); -} +} /*********************************************************************** Checks if a pointer points to the block array of the buffer pool (blocks, not @@ -82,13 +82,14 @@ buf_pool_is_block( void* ptr) /* in: pointer to memory */ { if ((buf_pool->blocks <= (buf_block_t*)ptr) - && ((buf_block_t*)ptr < buf_pool->blocks + buf_pool->max_size)) { + && ((buf_block_t*)ptr < buf_pool->blocks + + buf_pool->max_size)) { return(TRUE); } return(FALSE); -} +} /************************************************************************ Gets the smallest oldest_modification lsn for any page in the pool. Returns @@ -102,7 +103,7 @@ buf_pool_get_oldest_modification(void) { buf_block_t* block; dulint lsn; - + mutex_enter(&(buf_pool->mutex)); block = UT_LIST_GET_LAST(buf_pool->flush_list); @@ -130,7 +131,7 @@ buf_pool_clock_tic(void) #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); #endif /* UNIV_SYNC_DEBUG */ - + buf_pool->ulint_clock++; return(buf_pool->ulint_clock); @@ -148,12 +149,12 @@ buf_block_get_frame( ut_ad(block); ut_ad(block >= buf_pool->blocks); ut_ad(block < buf_pool->blocks + buf_pool->max_size); - ut_ad(block->state != BUF_BLOCK_NOT_USED); - ut_ad((block->state != BUF_BLOCK_FILE_PAGE) - || (block->buf_fix_count > 0)); - + ut_ad(block->state != BUF_BLOCK_NOT_USED); + ut_ad((block->state != BUF_BLOCK_FILE_PAGE) + || (block->buf_fix_count > 0)); + return(block->frame); -} +} /************************************************************************* Gets the space id of a block. */ @@ -169,9 +170,9 @@ buf_block_get_space( ut_ad(block < buf_pool->blocks + buf_pool->max_size); ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_ad(block->buf_fix_count > 0); - + return(block->space); -} +} /************************************************************************* Gets the page number of a block. */ @@ -187,9 +188,9 @@ buf_block_get_page_no( ut_ad(block < buf_pool->blocks + buf_pool->max_size); ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_ad(block->buf_fix_count > 0); - + return(block->offset); -} +} /*********************************************************************** Gets the block to whose frame the pointer is pointing to. */ @@ -208,9 +209,9 @@ buf_block_align( frame_zero = buf_pool->frame_zero; if (UNIV_UNLIKELY((ulint)ptr < (ulint)frame_zero) - || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) { + || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) { - ut_print_timestamp(stderr); + ut_print_timestamp(stderr); fprintf(stderr, "InnoDB: Error: trying to access a stray pointer %p\n" "InnoDB: buf pool start is at %p, end at %p\n" @@ -218,15 +219,15 @@ buf_block_align( "InnoDB: corruption. If this happens in an InnoDB database recovery,\n" "InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" "InnoDB: how to force recovery.\n", - ptr, frame_zero, + ptr, frame_zero, buf_pool->high_end); ut_error; } - + block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero)) >> UNIV_PAGE_SIZE_SHIFT)); return(block); -} +} /*********************************************************************** Gets the frame the pointer is pointing to. */ @@ -244,9 +245,9 @@ buf_frame_align( frame = ut_align_down(ptr, UNIV_PAGE_SIZE); if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero)) - || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) { + || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) { - ut_print_timestamp(stderr); + ut_print_timestamp(stderr); fprintf(stderr, "InnoDB: Error: trying to access a stray pointer %p\n" "InnoDB: buf pool start is at %p, end at %p\n" @@ -254,7 +255,7 @@ buf_frame_align( "InnoDB: corruption. If this happens in an InnoDB database recovery,\n" "InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" "InnoDB: how to force recovery.\n", - ptr, buf_pool->frame_zero, + ptr, buf_pool->frame_zero, buf_pool->high_end); ut_error; } @@ -371,7 +372,7 @@ buf_page_address_fold( ulint offset) /* in: offset of the page within space */ { return((space << 20) + space + offset); -} +} /************************************************************************ This function is used to get info if there is an io operation @@ -411,7 +412,7 @@ buf_frame_get_newest_modification( { buf_block_t* block; dulint lsn; - + ut_ad(frame); block = buf_block_align(frame); @@ -448,7 +449,7 @@ buf_frame_modify_clock_inc( #ifdef UNIV_SYNC_DEBUG ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) - || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); + || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); #endif /*UNIV_SYNC_DEBUG */ UT_DULINT_INC(block->modify_clock); @@ -469,7 +470,7 @@ buf_block_modify_clock_inc( { #ifdef UNIV_SYNC_DEBUG ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) - || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); + || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); #endif /* UNIV_SYNC_DEBUG */ UT_DULINT_INC(block->modify_clock); @@ -478,7 +479,7 @@ buf_block_modify_clock_inc( } /************************************************************************ -Returns the value of the modify clock. The caller must have an s-lock +Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ UNIV_INLINE dulint @@ -489,7 +490,7 @@ buf_block_get_modify_clock( { #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) - || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); + || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); #endif /* UNIV_SYNC_DEBUG */ return(block->modify_clock); @@ -506,7 +507,7 @@ buf_block_buf_fix_inc_debug( const char* file __attribute__ ((unused)), /* in: file name */ ulint line __attribute__ ((unused))) /* in: line */ { -#ifdef UNIV_SYNC_DEBUG +#ifdef UNIV_SYNC_DEBUG ibool ret; ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line); @@ -539,7 +540,7 @@ buf_page_hash_get( { buf_block_t* block; ulint fold; - + ut_ad(buf_pool); #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); @@ -552,7 +553,7 @@ buf_page_hash_get( HASH_SEARCH(hash, buf_pool->page_hash, fold, block, (block->space == space) && (block->offset == offset)); ut_a(block == NULL || block->state == BUF_BLOCK_FILE_PAGE); - + return(block); } @@ -589,16 +590,16 @@ buf_page_get_release_on_io( /* The page was not in the buffer buf_pool: release the latches down to the savepoint */ - + mtr_rollback_to_savepoint(mtr, savepoint); - + buf_page_get(space, offset, RW_S_LATCH, mtr); - + /* When we get here, the page is in buffer, but we release the latches again down to the savepoint, before returning */ mtr_rollback_to_savepoint(mtr, savepoint); - + return(NULL); } @@ -615,7 +616,7 @@ buf_page_release( mtr_t* mtr) /* in: mtr */ { ulint buf_fix_count; - + ut_ad(block); mutex_enter_fast(&(buf_pool->mutex)); @@ -654,9 +655,9 @@ void buf_page_dbg_add_level( /*===================*/ buf_frame_t* frame __attribute__((unused)), /* in: buffer page - where we have acquired latch */ + where we have acquired latch */ ulint level __attribute__((unused))) /* in: latching order - level */ + level */ { sync_thread_add_level(&(buf_block_align(frame)->lock), level); } diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 1b40acaa269..322848509f4 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -110,11 +110,11 @@ available to replacement in the free list and at the end of the LRU list (to make sure that a read-ahead batch can be read efficiently in a single sweep). */ -#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA) -#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100) +#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA) +#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100) #ifndef UNIV_NONINL #include "buf0flu.ic" #endif - + #endif diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic index 9a8a021e029..ea619cd4063 100644 --- a/storage/innobase/include/buf0flu.ic +++ b/storage/innobase/include/buf0flu.ic @@ -48,11 +48,11 @@ buf_flush_note_modification( ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0); ut_ad(mtr->modifications); ut_ad(ut_dulint_cmp(block->newest_modification, mtr->end_lsn) <= 0); - + block->newest_modification = mtr->end_lsn; if (ut_dulint_is_zero(block->oldest_modification)) { - + block->oldest_modification = mtr->start_lsn; ut_ad(!ut_dulint_is_zero(block->oldest_modification)); @@ -62,7 +62,7 @@ buf_flush_note_modification( mtr->start_lsn) <= 0); } - ++srv_buf_pool_write_requests; + ++srv_buf_pool_write_requests; } /************************************************************************ @@ -85,13 +85,13 @@ buf_flush_recv_note_modification( #endif /* UNIV_SYNC_DEBUG */ mutex_enter(&(buf_pool->mutex)); - + ut_ad(ut_dulint_cmp(block->newest_modification, end_lsn) <= 0); - + block->newest_modification = end_lsn; if (ut_dulint_is_zero(block->oldest_modification)) { - + block->oldest_modification = start_lsn; ut_ad(!ut_dulint_is_zero(block->oldest_modification)); diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index fb29b44ba98..f8150db0437 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -73,7 +73,7 @@ ibool buf_LRU_search_and_free_block( /*==========================*/ /* out: TRUE if freed */ - ulint n_iterations); /* in: how many times this has been called + ulint n_iterations); /* in: how many times this has been called repeatedly without result: a high value means that we should search farther; if value is k < 10, then we only search k/10 * number diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 2136de0f9b3..8e906fcb2e5 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -19,23 +19,23 @@ Created 5/30/1994 Heikki Tuuri typedef struct big_rec_struct big_rec_t; /* Some non-inlined functions used in the MySQL interface: */ -void +void dfield_set_data_noninline( - dfield_t* field, /* in: field */ + dfield_t* field, /* in: field */ void* data, /* in: data */ ulint len); /* in: length or UNIV_SQL_NULL */ -void* +void* dfield_get_data_noninline( dfield_t* field); /* in: field */ ulint dfield_get_len_noninline( dfield_t* field); /* in: field */ -ulint +ulint dtuple_get_n_fields_noninline( - dtuple_t* tuple); /* in: tuple */ -dfield_t* + dtuple_t* tuple); /* in: tuple */ +dfield_t* dtuple_get_nth_field_noninline( - dtuple_t* tuple, /* in: tuple */ + dtuple_t* tuple, /* in: tuple */ ulint n); /* in: index of field */ /************************************************************************* @@ -57,7 +57,7 @@ dfield_set_type( /************************************************************************* Gets pointer to the data in a field. */ UNIV_INLINE -void* +void* dfield_get_data( /*============*/ /* out: pointer to data */ @@ -68,24 +68,24 @@ UNIV_INLINE ulint dfield_get_len( /*===========*/ - /* out: length of data; UNIV_SQL_NULL if + /* out: length of data; UNIV_SQL_NULL if SQL null data */ dfield_t* field); /* in: field */ /************************************************************************* Sets length in a field. */ UNIV_INLINE -void +void dfield_set_len( /*===========*/ - dfield_t* field, /* in: field */ + dfield_t* field, /* in: field */ ulint len); /* in: length or UNIV_SQL_NULL */ /************************************************************************* Sets pointer to the data and length in a field. */ UNIV_INLINE -void +void dfield_set_data( /*============*/ - dfield_t* field, /* in: field */ + dfield_t* field, /* in: field */ const void* data, /* in: data */ ulint len); /* in: length or UNIV_SQL_NULL */ /************************************************************************** @@ -99,10 +99,10 @@ data_write_sql_null( /************************************************************************* Copies the data and len fields. */ UNIV_INLINE -void +void dfield_copy_data( /*=============*/ - dfield_t* field1, /* in: field to copy to */ + dfield_t* field1, /* in: field to copy to */ dfield_t* field2);/* in: field to copy from */ /************************************************************************* Copies a data field to another. */ @@ -134,19 +134,19 @@ dfield_data_is_binary_equal( /************************************************************************* Gets number of fields in a data tuple. */ UNIV_INLINE -ulint +ulint dtuple_get_n_fields( /*================*/ /* out: number of fields */ - dtuple_t* tuple); /* in: tuple */ + dtuple_t* tuple); /* in: tuple */ /************************************************************************* Gets nth field of a tuple. */ UNIV_INLINE -dfield_t* +dfield_t* dtuple_get_nth_field( /*=================*/ /* out: nth field */ - dtuple_t* tuple, /* in: tuple */ + dtuple_t* tuple, /* in: tuple */ ulint n); /* in: index of field */ /************************************************************************* Gets info bits in a data tuple. */ @@ -155,14 +155,14 @@ ulint dtuple_get_info_bits( /*=================*/ /* out: info bits */ - dtuple_t* tuple); /* in: tuple */ + dtuple_t* tuple); /* in: tuple */ /************************************************************************* Sets info bits in a data tuple. */ UNIV_INLINE void dtuple_set_info_bits( /*=================*/ - dtuple_t* tuple, /* in: tuple */ + dtuple_t* tuple, /* in: tuple */ ulint info_bits); /* in: info bits */ /************************************************************************* Gets number of fields used in record comparisons. */ @@ -189,10 +189,10 @@ UNIV_INLINE dtuple_t* dtuple_create( /*==========*/ - /* out, own: created tuple */ + /* out, own: created tuple */ mem_heap_t* heap, /* in: memory heap where the tuple is created */ - ulint n_fields); /* in: number of fields */ + ulint n_fields); /* in: number of fields */ /************************************************************************* Creates a dtuple for use in MySQL. */ @@ -201,7 +201,7 @@ dtuple_t* dtuple_create_for_mysql( /*====================*/ /* out, own created dtuple */ - void** heap, /* out: created memory heap */ + void** heap, /* out: created memory heap */ ulint n_fields); /* in: number of fields */ /************************************************************************* Frees a dtuple used in MySQL. */ @@ -212,7 +212,7 @@ dtuple_free_for_mysql( void* heap); /************************************************************************* Sets number of fields used in a tuple. Normally this is set in -dtuple_create, but if you want later to set it smaller, you can use this. */ +dtuple_create, but if you want later to set it smaller, you can use this. */ void dtuple_set_n_fields( @@ -314,12 +314,20 @@ dfield_print( dfield_t* dfield);/* in: dfield */ /***************************************************************** Pretty prints a dfield value according to its data type. Also the hex string -is printed if a string contains non-printable characters. */ +is printed if a string contains non-printable characters. */ void dfield_print_also_hex( /*==================*/ dfield_t* dfield); /* in: dfield */ +/***************************************************************** +Print a dfield value using ut_print_buf. */ + +void +dfield_print_raw( +/*=============*/ + FILE* f, /* in: output stream */ + dfield_t* dfield); /* in: dfield */ /************************************************************** The following function prints the contents of a tuple. */ @@ -395,13 +403,13 @@ struct dtuple_struct { UT_LIST_NODE_T(dtuple_t) tuple_list; /* data tuples can be linked into a list using this field */ - ulint magic_n; + ulint magic_n; }; #define DATA_TUPLE_MAGIC_N 65478679 /* A slot for a field in a big rec vector */ -typedef struct big_rec_field_struct big_rec_field_t; +typedef struct big_rec_field_struct big_rec_field_t; struct big_rec_field_struct { ulint field_no; /* field number in record */ ulint len; /* stored data len */ @@ -416,7 +424,7 @@ struct big_rec_struct { ulint n_fields; /* number of stored fields */ big_rec_field_t* fields; /* stored fields */ }; - + #ifndef UNIV_NONINL #include "data0data.ic" #endif diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic index 0769372e16f..6b07ade2934 100644 --- a/storage/innobase/include/data0data.ic +++ b/storage/innobase/include/data0data.ic @@ -9,7 +9,9 @@ Created 5/30/1994 Heikki Tuuri #include "mem0mem.h" #include "ut0rnd.h" +#ifdef UNIV_DEBUG extern byte data_error; +#endif /* UNIV_DEBUG */ /************************************************************************* Gets pointer to the type struct of SQL data field. */ @@ -42,7 +44,7 @@ dfield_set_type( /************************************************************************* Gets pointer to the data in a field. */ UNIV_INLINE -void* +void* dfield_get_data( /*============*/ /* out: pointer to data */ @@ -50,7 +52,7 @@ dfield_get_data( { ut_ad(field); ut_ad((field->len == UNIV_SQL_NULL) - || (field->data != &data_error)); + || (field->data != &data_error)); return(field->data); } @@ -61,13 +63,13 @@ UNIV_INLINE ulint dfield_get_len( /*===========*/ - /* out: length of data; UNIV_SQL_NULL if + /* out: length of data; UNIV_SQL_NULL if SQL null data */ dfield_t* field) /* in: field */ { ut_ad(field); ut_ad((field->len == UNIV_SQL_NULL) - || (field->data != &data_error)); + || (field->data != &data_error)); return(field->len); } @@ -75,10 +77,10 @@ dfield_get_len( /************************************************************************* Sets length in a field. */ UNIV_INLINE -void +void dfield_set_len( /*===========*/ - dfield_t* field, /* in: field */ + dfield_t* field, /* in: field */ ulint len) /* in: length or UNIV_SQL_NULL */ { ut_ad(field); @@ -89,10 +91,10 @@ dfield_set_len( /************************************************************************* Sets pointer to the data and length in a field. */ UNIV_INLINE -void +void dfield_set_data( /*============*/ - dfield_t* field, /* in: field */ + dfield_t* field, /* in: field */ const void* data, /* in: data */ ulint len) /* in: length or UNIV_SQL_NULL */ { @@ -105,10 +107,10 @@ dfield_set_data( /************************************************************************* Copies the data and len fields. */ UNIV_INLINE -void +void dfield_copy_data( /*=============*/ - dfield_t* field1, /* in: field to copy to */ + dfield_t* field1, /* in: field to copy to */ dfield_t* field2) /* in: field to copy from */ { ut_ad(field1 && field2); @@ -142,11 +144,12 @@ dfield_datas_are_binary_equal( ulint len; len = field1->len; - + if ((len != field2->len) - || ((len != UNIV_SQL_NULL) - && (0 != ut_memcmp(field1->data, field2->data, len)))) { - + || ((len != UNIV_SQL_NULL) + && (0 != ut_memcmp(field1->data, field2->data, + len)))) { + return(FALSE); } @@ -160,7 +163,7 @@ ulint dtuple_get_info_bits( /*=================*/ /* out: info bits */ - dtuple_t* tuple) /* in: tuple */ + dtuple_t* tuple) /* in: tuple */ { ut_ad(tuple); @@ -173,7 +176,7 @@ UNIV_INLINE void dtuple_set_info_bits( /*=================*/ - dtuple_t* tuple, /* in: tuple */ + dtuple_t* tuple, /* in: tuple */ ulint info_bits) /* in: info bits */ { ut_ad(tuple); @@ -219,7 +222,7 @@ ulint dtuple_get_n_fields( /*================*/ /* out: number of fields */ - dtuple_t* tuple) /* in: tuple */ + dtuple_t* tuple) /* in: tuple */ { ut_ad(tuple); @@ -229,11 +232,11 @@ dtuple_get_n_fields( /************************************************************************* Gets nth field of a tuple. */ UNIV_INLINE -dfield_t* +dfield_t* dtuple_get_nth_field( /*=================*/ /* out: nth field */ - dtuple_t* tuple, /* in: tuple */ + dtuple_t* tuple, /* in: tuple */ ulint n) /* in: index of field */ { ut_ad(tuple); @@ -249,17 +252,17 @@ UNIV_INLINE dtuple_t* dtuple_create( /*==========*/ - /* out, own: created tuple */ + /* out, own: created tuple */ mem_heap_t* heap, /* in: memory heap where the tuple is created */ - ulint n_fields) /* in: number of fields */ + ulint n_fields) /* in: number of fields */ { - dtuple_t* tuple; + dtuple_t* tuple; ut_ad(heap); tuple = (dtuple_t*) mem_heap_alloc(heap, sizeof(dtuple_t) - + n_fields * sizeof(dfield_t)); + + n_fields * sizeof(dfield_t)); tuple->info_bits = 0; tuple->n_fields = n_fields; tuple->n_fields_cmp = n_fields; @@ -270,14 +273,14 @@ dtuple_create( { /* In the debug version, initialize fields to an error value */ ulint i; - + for (i = 0; i < n_fields; i++) { (tuple->fields + i)->data = &data_error; dfield_get_type(tuple->fields + i)->mtype = DATA_ERROR; } } #endif - return(tuple); + return(tuple); } /************************************************************** @@ -292,10 +295,10 @@ dtuple_get_data_size( dtuple_t* tuple) /* in: typed data tuple */ { dfield_t* field; - ulint n_fields; - ulint len; - ulint i; - ulint sum = 0; + ulint n_fields; + ulint len; + ulint i; + ulint sum = 0; ut_ad(tuple); ut_ad(dtuple_check_typed(tuple)); @@ -313,7 +316,7 @@ dtuple_get_data_size( sum += len; } - + return(sum); } @@ -328,7 +331,7 @@ dtuple_set_types_binary( { dtype_t* dfield_type; ulint i; - + for (i = 0; i < n; i++) { dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i)); dtype_set(dfield_type, DATA_BINARY, 0, 0, 0); @@ -364,10 +367,10 @@ dtuple_fold( field = dtuple_get_nth_field(tuple, i); data = (byte*) dfield_get_data(field); - len = dfield_get_len(field); - + len = dfield_get_len(field); + if (len != UNIV_SQL_NULL) { - fold = ut_fold_ulint_pair(fold, + fold = ut_fold_ulint_pair(fold, ut_fold_binary(data, len)); } } @@ -376,17 +379,17 @@ dtuple_fold( field = dtuple_get_nth_field(tuple, i); data = (byte*) dfield_get_data(field); - len = dfield_get_len(field); - + len = dfield_get_len(field); + if (len != UNIV_SQL_NULL) { if (len > n_bytes) { len = n_bytes; } - fold = ut_fold_ulint_pair(fold, + fold = ut_fold_ulint_pair(fold, ut_fold_binary(data, len)); } - } + } return(fold); } @@ -423,7 +426,7 @@ dtuple_contains_null( for (i = 0; i < n; i++) { if (dfield_get_len(dtuple_get_nth_field(tuple, i)) - == UNIV_SQL_NULL) { + == UNIV_SQL_NULL) { return(TRUE); } diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 7e9692eca5a..d7c9dcb45a2 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -13,13 +13,14 @@ Created 1/16/1996 Heikki Tuuri extern ulint data_mysql_default_charset_coll; #define DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL 8 +#define DATA_MYSQL_BINARY_CHARSET_COLL 63 /* SQL data type struct */ typedef struct dtype_struct dtype_t; /* This variable is initialized as the standard binary variable length data type */ -extern dtype_t* dtype_binary; +extern dtype_t* dtype_binary; /*-------------------------------------------*/ /* The 'MAIN TYPE' of a column */ @@ -101,7 +102,7 @@ InnoDB's own internal system tables have different precise types for their columns, and for them the precise type is usually not used at all. */ -#define DATA_ENGLISH 4 /* English language character string: this +#define DATA_ENGLISH 4 /* English language character string: this is a relic from pre-MySQL time and only used for InnoDB's own system tables */ #define DATA_ERROR 111 /* another relic from pre-MySQL time */ @@ -127,7 +128,7 @@ be less than 256 */ a row in a compressed form */ #define DATA_MIX_ID_LEN 9 /* maximum stored length for mix id (in a compressed dulint form) */ -#define DATA_N_SYS_COLS 4 /* number of system columns defined above */ +#define DATA_N_SYS_COLS 4 /* number of system columns defined above */ /* Flags ORed to the precise data type */ #define DATA_NOT_NULL 256 /* this is ORed to the precise type when @@ -311,7 +312,7 @@ dtype_get_pad_char( /*===============*/ /* out: padding character code, or ULINT_UNDEFINED if no padding specified */ - dtype_t* type); /* in: type */ + const dtype_t* type); /* in: type */ /*************************************************************************** Returns the size of a fixed size data type, 0 if not a fixed size type. */ UNIV_INLINE diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index d4a7b3c64b8..aabf471a70c 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -8,6 +8,7 @@ Created 1/16/1996 Heikki Tuuri #include "mach0data.h" +#ifndef UNIV_HOTBACKUP /********************************************************************** Get the variable length bounds of the given character set. @@ -20,6 +21,7 @@ innobase_get_cset_width( ulint cset, /* in: MySQL charset-collation code */ ulint* mbminlen, /* out: minimum length of a char (in bytes) */ ulint* mbmaxlen); /* out: maximum length of a char (in bytes) */ +#endif /* !UNIV_HOTBACKUP */ /************************************************************************* Gets the MySQL charset-collation code for MySQL string types. */ @@ -55,9 +57,21 @@ dtype_set_mblen( { ut_ad(type); if (dtype_is_string_type(type->mtype)) { +#ifndef UNIV_HOTBACKUP innobase_get_cset_width(dtype_get_charset_coll(type->prtype), &type->mbminlen, &type->mbmaxlen); ut_ad(type->mbminlen <= type->mbmaxlen); +#else /* !UNIV_HOTBACKUP */ +#ifdef notdefined +printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n", + type->mtype, type->prtype); +#endif + ut_a(type->mtype <= DATA_BINARY); +#ifdef notdefined + ut_a(type->prtype == (DATA_BINARY | DATA_NOT_NULL)); +#endif + type->mbminlen = type->mbmaxlen = 1; +#endif /* !UNIV_HOTBACKUP */ } else { type->mbminlen = type->mbmaxlen = 0; } @@ -77,7 +91,7 @@ dtype_set( { ut_ad(type); ut_ad(mtype <= DATA_MTYPE_MAX); - + type->mtype = mtype; type->prtype = prtype; type->len = len; @@ -188,26 +202,35 @@ dtype_get_pad_char( /*===============*/ /* out: padding character code, or ULINT_UNDEFINED if no padding specified */ - dtype_t* type) /* in: type */ + const dtype_t* type) /* in: type */ { - if (type->mtype == DATA_CHAR - || type->mtype == DATA_VARCHAR - || type->mtype == DATA_BINARY - || type->mtype == DATA_FIXBINARY - || type->mtype == DATA_MYSQL - || type->mtype == DATA_VARMYSQL - || (type->mtype == DATA_BLOB - && (type->prtype & DATA_BINARY_TYPE) == 0)) { - + switch (type->mtype) { + case DATA_FIXBINARY: + case DATA_BINARY: + if (UNIV_UNLIKELY(dtype_get_charset_coll(type->prtype) + == DATA_MYSQL_BINARY_CHARSET_COLL)) { + /* Starting from 5.0.18, do not pad + VARBINARY or BINARY columns. */ + return(ULINT_UNDEFINED); + } + /* Fall through */ + case DATA_CHAR: + case DATA_VARCHAR: + case DATA_MYSQL: + case DATA_VARMYSQL: /* Space is the padding character for all char and binary - strings, and starting from 5.0.3, also for TEXT strings. */ + strings, and starting from 5.0.3, also for TEXT strings. */ - return((ulint)' '); + return(0x20); + case DATA_BLOB: + if ((type->prtype & DATA_BINARY_TYPE) == 0) { + return(0x20); + } + /* Fall through */ + default: + /* No padding specified */ + return(ULINT_UNDEFINED); } - - /* No padding specified */ - - return(ULINT_UNDEFINED); } /************************************************************************** @@ -233,7 +256,7 @@ dtype_new_store_for_order_and_null_size( buf[0] = buf[0] | 128; } - /* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) { + /* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) { buf[0] = buf[0] | 64; } */ @@ -262,20 +285,20 @@ dtype_read_for_order_and_null_size( byte* buf) /* in: buffer for stored type order info */ { ut_ad(4 == DATA_ORDER_NULL_TYPE_BUF_SIZE); - + type->mtype = buf[0] & 63; type->prtype = buf[1]; if (buf[0] & 128) { - type->prtype = type->prtype | DATA_BINARY_TYPE; + type->prtype = type->prtype | DATA_BINARY_TYPE; } type->len = mach_read_from_2(buf + 2); - + type->prtype = dtype_form_prtype(type->prtype, data_mysql_default_charset_coll); dtype_set_mblen(type); -} +} /************************************************************************** Reads to a type the stored information which determines its alphabetical @@ -293,7 +316,7 @@ dtype_new_read_for_order_and_null_size( #if 6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE #error "6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE" #endif - + type->mtype = buf[0] & 63; type->prtype = buf[1]; @@ -323,13 +346,12 @@ dtype_new_read_for_order_and_null_size( charset_coll = data_mysql_default_charset_coll; } - + type->prtype = dtype_form_prtype(type->prtype, charset_coll); - } + } dtype_set_mblen(type); } -#ifndef UNIV_HOTBACKUP /*************************************************************************** Returns the size of a fixed size data type, 0 if not a fixed size type. */ UNIV_INLINE @@ -374,8 +396,13 @@ dtype_get_fixed_size( if (type->prtype & DATA_BINARY_TYPE) { return(dtype_get_len(type)); } else { +#ifdef UNIV_HOTBACKUP + if (type->mbminlen == type->mbmaxlen) { + return(dtype_get_len(type)); + } +#else /* UNIV_HOTBACKUP */ /* We play it safe here and ask MySQL for - mbminlen and mbmaxlen. Although + mbminlen and mbmaxlen. Although type->mbminlen and type->mbmaxlen are initialized if and only if type->prtype is (in one of the 3 functions in this file), @@ -405,6 +432,7 @@ dtype_get_fixed_size( if (mbminlen == mbmaxlen) { return(dtype_get_len(type)); } +#endif /* !UNIV_HOTBACKUP */ } /* fall through for variable-length charsets */ case DATA_VARCHAR: @@ -412,7 +440,7 @@ dtype_get_fixed_size( case DATA_DECIMAL: case DATA_VARMYSQL: case DATA_BLOB: - return(0); + return(0); default: ut_error; } @@ -470,13 +498,12 @@ dtype_get_min_size( case DATA_DECIMAL: case DATA_VARMYSQL: case DATA_BLOB: - return(0); + return(0); default: ut_error; } return(0); } -#endif /* !UNIV_HOTBACKUP */ /*************************************************************************** Returns a stored SQL NULL size for a type. For fixed length types it is diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 7f75e7e10a6..843c70af577 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -42,14 +42,14 @@ Created 5/24/1996 Heikki Tuuri #define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint to a table failed */ #define DB_CORRUPTION 39 /* data structure corruption noticed */ -#define DB_COL_APPEARS_TWICE_IN_INDEX 40 /* InnoDB cannot handle an index - where same column appears twice */ +#define DB_COL_APPEARS_TWICE_IN_INDEX 40/* InnoDB cannot handle an index + where same column appears twice */ #define DB_CANNOT_DROP_CONSTRAINT 41 /* dropping a foreign key constraint from a table failed */ #define DB_NO_SAVEPOINT 42 /* no savepoint exists with the given name */ #define DB_TABLESPACE_ALREADY_EXISTS 43 /* we cannot create a new single-table - tablespace because a file of the same + tablespace because a file of the same name already exists */ #define DB_TABLESPACE_DELETED 44 /* tablespace does not exist or is being dropped right now */ @@ -63,11 +63,11 @@ Created 5/24/1996 Heikki Tuuri table */ /* The following are partial failure codes */ -#define DB_FAIL 1000 -#define DB_OVERFLOW 1001 -#define DB_UNDERFLOW 1002 +#define DB_FAIL 1000 +#define DB_OVERFLOW 1001 +#define DB_UNDERFLOW 1002 #define DB_STRONG_FAIL 1003 #define DB_RECORD_NOT_FOUND 1500 #define DB_END_OF_INDEX 1501 -#endif +#endif diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index 86702cbca05..39e3bdf72b0 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -26,7 +26,7 @@ Gets a pointer to the dictionary header and x-latches its page. */ dict_hdr_t* dict_hdr_get( /*=========*/ - /* out: pointer to the dictionary header, + /* out: pointer to the dictionary header, page x-latched */ mtr_t* mtr); /* in: mtr */ /************************************************************************** @@ -94,7 +94,7 @@ dict_create(void); assigned as the id the number DICT_IBUF_ID_MIN plus the space id */ #define DICT_IBUF_ID_MIN ut_dulint_create(0xFFFFFFFFUL, 0) - + /* The offset of the dictionary header on the page */ #define DICT_HDR FSEG_PAGE_DATA @@ -120,7 +120,7 @@ clustered index */ #define DICT_SYS_INDEXES_PAGE_NO_FIELD 8 #define DICT_SYS_INDEXES_SPACE_NO_FIELD 7 #define DICT_SYS_INDEXES_TYPE_FIELD 6 - + /* When a row id which is zero modulo this number (which must be a power of two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is updated */ @@ -130,4 +130,4 @@ updated */ #include "dict0boot.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/dict0boot.ic b/storage/innobase/include/dict0boot.ic index 8a91feed018..fe2a9e36653 100644 --- a/storage/innobase/include/dict0boot.ic +++ b/storage/innobase/include/dict0boot.ic @@ -28,7 +28,7 @@ dict_sys_get_new_row_id(void) mutex_enter(&(dict_sys->mutex)); id = dict_sys->row_id; - + if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) { dict_hdr_flush_row_id(); @@ -39,7 +39,7 @@ dict_sys_get_new_row_id(void) mutex_exit(&(dict_sys->mutex)); return(id); -} +} /************************************************************************** Reads a row id from a record or other 6-byte stored form. */ @@ -50,10 +50,12 @@ dict_sys_read_row_id( /* out: row id */ byte* field) /* in: record field */ { - ut_ad(DATA_ROW_ID_LEN == 6); +#if DATA_ROW_ID_LEN != 6 +# error "DATA_ROW_ID_LEN != 6" +#endif return(mach_read_from_6(field)); -} +} /************************************************************************** Writes a row id to a record or other 6-byte stored form. */ @@ -64,9 +66,11 @@ dict_sys_write_row_id( byte* field, /* in: record field */ dulint row_id) /* in: row id */ { - ut_ad(DATA_ROW_ID_LEN == 6); +#if DATA_ROW_ID_LEN != 6 +# error "DATA_ROW_ID_LEN != 6" +#endif mach_write_to_6(field, row_id); -} +} diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 5dd571be59c..bd0890dbfa7 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -15,7 +15,7 @@ Created 1/8/1996 Heikki Tuuri #include "que0types.h" #include "row0types.h" #include "mtr0mtr.h" - + /************************************************************************* Creates a table create graph. */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 5215d51cabe..dc8c72b0e7d 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -26,6 +26,7 @@ Created 1/8/1996 Heikki Tuuri #include "ut0byte.h" #include "trx0types.h" +#ifndef UNIV_HOTBACKUP /********************************************************************** Makes all characters in a NUL-terminated UTF-8 string lower case. */ @@ -33,6 +34,7 @@ void dict_casedn_str( /*============*/ char* a); /* in/out: string to put in lower case */ +#endif /* !UNIV_HOTBACKUP */ /************************************************************************ Get the database name length in a table name. */ @@ -197,7 +199,8 @@ dict_foreign_add_to_cache( /*======================*/ /* out: DB_SUCCESS or error code */ dict_foreign_t* foreign, /* in, own: foreign key constraint */ - ibool check_types); /* in: TRUE=check type compatibility */ + ibool check_charsets);/* in: TRUE=check charset + compatibility */ /************************************************************************* Checks if a table is referenced by foreign keys. */ @@ -305,7 +308,7 @@ Checks if a table is in the dictionary cache. */ UNIV_INLINE dict_table_t* dict_table_check_if_in_cache_low( -/*==============================*/ +/*=============================*/ /* out: table, NULL if not found */ const char* table_name); /* in: table name */ /************************************************************************** @@ -484,6 +487,15 @@ dict_table_get_sys_col_no( dict_table_t* table, /* in: table */ ulint sys); /* in: DATA_ROW_ID, ... */ /************************************************************************ +Check whether the table uses the compact page format. */ +UNIV_INLINE +ibool +dict_table_is_comp( +/*===============*/ + /* out: TRUE if table uses the + compact page format */ + const dict_table_t* table); /* in: table */ +/************************************************************************ Checks if a column is in the ordering columns of the clustered index of a table. Column prefixes are treated like whole columns. */ @@ -659,7 +671,6 @@ dict_index_add_col( /*===============*/ dict_index_t* index, /* in: index */ dict_col_t* col, /* in: column */ - ulint order, /* in: order criterion */ ulint prefix_len); /* in: column prefix length */ /*********************************************************************** Copies types of fields contained in index to tuple. */ @@ -679,13 +690,6 @@ dict_index_get_tree( /* out: index tree */ dict_index_t* index); /* in: index */ /************************************************************************* -Gets the field order criterion. */ -UNIV_INLINE -ulint -dict_field_get_order( -/*=================*/ - dict_field_t* field); -/************************************************************************* Gets the field column. */ UNIV_INLINE dict_col_t* @@ -770,7 +774,7 @@ dict_tree_build_node_ptr( pointer */ ulint page_no,/* in: page number to put in node pointer */ mem_heap_t* heap, /* in: memory heap where pointer created */ - ulint level); /* in: level of rec in tree: 0 means leaf + ulint level); /* in: level of rec in tree: 0 means leaf level */ /************************************************************************** Copies an initial segment of a physical record, long enough to specify an @@ -872,7 +876,7 @@ dict_update_statistics_low( /*=======================*/ dict_table_t* table, /* in: table */ ibool has_dict_mutex);/* in: TRUE if the caller has the - dictionary mutex */ + dictionary mutex */ /************************************************************************* Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ @@ -940,13 +944,13 @@ struct dict_sys_struct{ header and flushed to a file; in recovery this must be derived from the log records */ - hash_table_t* table_hash; /* hash table of the tables, based + hash_table_t* table_hash; /* hash table of the tables, based on name */ - hash_table_t* table_id_hash; /* hash table of the tables, based + hash_table_t* table_id_hash; /* hash table of the tables, based on id */ - hash_table_t* col_hash; /* hash table of the columns */ + hash_table_t* col_hash; /* hash table of the columns */ UT_LIST_BASE_NODE_T(dict_table_t) - table_LRU; /* LRU list of tables */ + table_LRU; /* LRU list of tables */ ulint size; /* varying space in bytes occupied by the data dictionary table and index objects */ diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 928a693f860..b99ca7815a8 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -93,7 +93,7 @@ dict_table_get_n_user_cols( ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->cached); - + return(table->n_cols - DATA_N_SYS_COLS); } @@ -127,7 +127,7 @@ dict_table_get_n_cols( ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->cached); - + return(table->n_cols); } @@ -164,7 +164,7 @@ dict_table_get_sys_col( ut_ad(sys < DATA_N_SYS_COLS); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - col = dict_table_get_nth_col(table, table->n_cols + col = dict_table_get_nth_col(table, table->n_cols - DATA_N_SYS_COLS + sys); ut_ad(col->type.mtype == DATA_SYS); ut_ad(col->type.prtype == (sys | DATA_NOT_NULL)); @@ -190,6 +190,25 @@ dict_table_get_sys_col_no( } /************************************************************************ +Check whether the table uses the compact page format. */ +UNIV_INLINE +ibool +dict_table_is_comp( +/*===============*/ + /* out: TRUE if table uses the + compact page format */ + const dict_table_t* table) /* in: table */ +{ + ut_ad(table); + +#if DICT_TF_COMPACT != TRUE +#error +#endif + + return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT)); +} + +/************************************************************************ Gets the number of fields in the internal representation of an index, including fields added by the dictionary system. */ UNIV_INLINE @@ -202,7 +221,7 @@ dict_index_get_n_fields( { ut_ad(index); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - + return(index->n_fields); } @@ -222,7 +241,7 @@ dict_index_get_n_unique( ut_ad(index); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->cached); - + return(index->n_uniq); } @@ -241,7 +260,7 @@ dict_index_get_n_unique_in_tree( ut_ad(index); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->cached); - + if (index->type & DICT_CLUSTERED) { return(dict_index_get_n_unique(index)); @@ -324,19 +343,6 @@ dict_index_get_tree( ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); return(index->tree); -} - -/************************************************************************* -Gets the field order criterion. */ -UNIV_INLINE -ulint -dict_field_get_order( -/*=================*/ - dict_field_t* field) -{ - ut_ad(field); - - return(field->order); } /************************************************************************* @@ -494,13 +500,13 @@ Checks if a table is in the dictionary cache. */ UNIV_INLINE dict_table_t* dict_table_check_if_in_cache_low( -/*==============================*/ +/*=============================*/ /* out: table, NULL if not found */ const char* table_name) /* in: table name */ { dict_table_t* table; ulint table_fold; - + ut_ad(table_name); #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(dict_sys->mutex))); @@ -525,14 +531,14 @@ dict_table_get_low( const char* table_name) /* in: table name */ { dict_table_t* table; - + ut_ad(table_name); #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(dict_sys->mutex))); #endif /* UNIV_SYNC_DEBUG */ table = dict_table_check_if_in_cache_low(table_name); - + if (table == NULL) { table = dict_load_table(table_name); } @@ -557,7 +563,7 @@ dict_table_get_on_id_low( ut_ad(mutex_own(&(dict_sys->mutex))); #endif /* UNIV_SYNC_DEBUG */ UT_NOT_USED(trx); - + /* Look for the table name in the hash table */ fold = ut_fold_dulint(table_id); @@ -572,9 +578,9 @@ dict_table_get_on_id_low( /* lock_push(trx, table, LOCK_DICT_MEM_FIX) */ } - + /* TODO: should get the type information from MySQL */ - + return(table); } @@ -587,9 +593,9 @@ dict_table_release( dict_table_t* table) /* in: table to be released */ { mutex_enter(&(dict_sys->mutex)); - - table->mem_fix--; - + + table->mem_fix--; + mutex_exit(&(dict_sys->mutex)); } @@ -604,7 +610,7 @@ dict_table_get_index( const char* name) /* in: index name */ { dict_index_t* index = NULL; - + index = dict_table_get_first_index(table); while (index != NULL) { @@ -614,7 +620,7 @@ dict_table_get_index( } index = dict_table_get_next_index(index); - } - + } + return(index); } diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index f13620bc6e8..7e19c2eb3c0 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -60,7 +60,7 @@ dict_table_t* dict_load_table_on_id( /*==================*/ /* out: table; NULL if table does not exist */ - dulint table_id); /* in: table id */ + dulint table_id); /* in: table id */ /************************************************************************ This function is called when the database is booted. Loads system table index definitions except for the clustered index which @@ -82,7 +82,8 @@ dict_load_foreigns( /*===============*/ /* out: DB_SUCCESS or error code */ const char* table_name, /* in: table name */ - ibool check_types); /* in: TRUE=check type compatibility */ + ibool check_charsets);/* in: TRUE=check charsets + compatibility */ /************************************************************************ Prints to the standard output information on all tables found in the data dictionary system table. */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 7eec86d0bcb..ab07213de3b 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -29,12 +29,9 @@ Created 1/8/1996 Heikki Tuuri combination of types */ #define DICT_CLUSTERED 1 /* clustered index */ #define DICT_UNIQUE 2 /* unique index */ -#define DICT_UNIVERSAL 4 /* index which can contain records from any +#define DICT_UNIVERSAL 4 /* index which can contain records from any other index */ -#define DICT_IBUF 8 /* insert buffer tree */ - -/* Flags for ordering an index field: OR'ing of the flags allowed */ -#define DICT_DESCEND 1 /* in descending order (default ascending) */ +#define DICT_IBUF 8 /* insert buffer tree */ /* Types for a table object */ #define DICT_TABLE_ORDINARY 1 @@ -42,6 +39,9 @@ combination of types */ #define DICT_TABLE_CLUSTER 3 /* this means that the table is really a cluster definition */ +/* Table flags */ +#define DICT_TF_COMPACT 1 /* compact page format */ + /************************************************************************** Creates a table memory object. */ @@ -55,7 +55,7 @@ dict_mem_table_create( is ignored if the table is made a member of a cluster */ ulint n_cols, /* in: number of columns */ - ibool comp); /* in: TRUE=compact page format */ + ulint flags); /* in: table flags */ /************************************************************************** Creates a cluster memory object. */ @@ -116,8 +116,6 @@ dict_mem_index_add_field( /*=====================*/ dict_index_t* index, /* in: index */ const char* name, /* in: column name */ - ulint order, /* in: order criterion; 0 means an - ascending order */ ulint prefix_len); /* in: 0 or the column prefix length in a MySQL index like INDEX (textcol(25)) */ @@ -148,7 +146,7 @@ struct dict_col_struct{ const char* name; /* name */ dtype_t type; /* data type */ dict_table_t* table; /* back pointer to table of this column */ - ulint aux; /* this is used as an auxiliary variable + ulint aux; /* this is used as an auxiliary variable in some of the functions below */ }; @@ -163,8 +161,6 @@ UTF-8 charset. In that charset, a character may take at most 3 bytes. */ struct dict_field_struct{ dict_col_t* col; /* pointer to the table column */ const char* name; /* name of the column */ - ulint order; /* flags for ordering this field: - DICT_DESCEND, ... */ ulint prefix_len; /* 0 or the length of the column prefix in bytes in a MySQL index of type, e.g., INDEX (textcol(25)); @@ -175,10 +171,6 @@ struct dict_field_struct{ ulint fixed_len; /* 0 or the fixed length of the column if smaller than DICT_MAX_INDEX_COL_LEN */ - ulint fixed_offs; /* offset to the field, or - ULINT_UNDEFINED if it is not fixed - within the record (due to preceding - variable-length fields) */ }; /* Data structure for an index tree */ @@ -280,7 +272,7 @@ struct dict_foreign_struct{ constraint is defined: we allow the indexes to contain more fields than mentioned in the constraint, as long - as the first fields are as mentioned */ + as the first fields are as mentioned */ dict_index_t* foreign_index; /* foreign index; we require that both tables contain explicitly defined indexes for the constraint: InnoDB @@ -311,6 +303,7 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */ struct dict_table_struct{ dulint id; /* id of the table or cluster */ ulint type; /* DICT_TABLE_ORDINARY, ... */ + ulint flags; /* DICT_TF_COMPACT, ... */ mem_heap_t* heap; /* memory heap */ const char* name; /* table name */ const char* dir_path_of_temp_table;/* NULL or the directory path @@ -328,7 +321,6 @@ struct dict_table_struct{ ibool tablespace_discarded;/* this flag is set TRUE when the user calls DISCARD TABLESPACE on this table, and reset to FALSE in IMPORT TABLESPACE */ - ibool comp; /* flag: TRUE=compact page format */ hash_node_t name_hash; /* hash chain node */ hash_node_t id_hash; /* hash chain node */ ulint n_def; /* number of columns defined so far */ @@ -345,7 +337,7 @@ struct dict_table_struct{ which refer to this table */ UT_LIST_NODE_T(dict_table_t) table_LRU; /* node of the LRU list of tables */ - ulint mem_fix;/* count of how many times the table + ulint mem_fix;/* count of how many times the table and its indexes has been fixed in memory; currently NOT used */ ulint n_mysql_handles_opened; @@ -408,9 +400,9 @@ struct dict_table_struct{ database pages */ ulint stat_sum_of_other_index_sizes; /* other indexes in database pages */ - ibool stat_initialized; /* TRUE if statistics have + ibool stat_initialized; /* TRUE if statistics have been calculated the first time - after database startup or table creation */ + after database startup or table creation */ ulint stat_modified_counter; /* when a row is inserted, updated, or deleted, we add 1 to this number; we calculate new @@ -432,11 +424,11 @@ struct dict_table_struct{ inited; MySQL gets the init value by executing SELECT MAX(auto inc column) */ ib_longlong autoinc;/* autoinc counter value to give to the - next inserted row */ + next inserted row */ ulint magic_n;/* magic number */ }; #define DICT_TABLE_MAGIC_N 76333786 - + #ifndef UNIV_NONINL #include "dict0mem.ic" #endif diff --git a/storage/innobase/include/dyn0dyn.h b/storage/innobase/include/dyn0dyn.h index 1df976a5301..7affccbf67e 100644 --- a/storage/innobase/include/dyn0dyn.h +++ b/storage/innobase/include/dyn0dyn.h @@ -76,7 +76,7 @@ dyn_array_get_element( /*==================*/ /* out: pointer to element */ dyn_array_t* arr, /* in: dyn array */ - ulint pos); /* in: position of element as bytes + ulint pos); /* in: position of element as bytes from array start */ /**************************************************************** Returns the size of stored data in a dyn array. */ @@ -140,11 +140,11 @@ dyn_push_string( /* NOTE! Do not use the fields of the struct directly: the definition appears here only for the compiler to know its size! */ struct dyn_block_struct{ - mem_heap_t* heap; /* in the first block this is != NULL + mem_heap_t* heap; /* in the first block this is != NULL if dynamic allocation has been needed */ ulint used; /* number of data bytes used in this block */ byte data[DYN_ARRAY_DATA_SIZE]; - /* storage for array elements */ + /* storage for array elements */ UT_LIST_BASE_NODE_T(dyn_block_t) base; /* linear list of dyn blocks: this node is used only in the first block */ @@ -163,4 +163,4 @@ struct dyn_block_struct{ #include "dyn0dyn.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/dyn0dyn.ic b/storage/innobase/include/dyn0dyn.ic index c1b8f2cb8ce..fcb3c17287a 100644 --- a/storage/innobase/include/dyn0dyn.ic +++ b/storage/innobase/include/dyn0dyn.ic @@ -41,7 +41,7 @@ dyn_array_get_last_block( if (arr->heap == NULL) { return(arr); - } + } return(UT_LIST_GET_LAST(arr->base)); } @@ -57,13 +57,13 @@ dyn_array_get_next_block( dyn_block_t* block) /* in: dyn array block */ { ut_ad(arr && block); - + if (arr->heap == NULL) { ut_ad(arr == block); - + return(NULL); } - + return(UT_LIST_GET_NEXT(list, block)); } @@ -106,7 +106,9 @@ dyn_array_create( size sizeof(dyn_array_t) */ { ut_ad(arr); - ut_ad(DYN_ARRAY_DATA_SIZE < DYN_BLOCK_FULL_FLAG); +#if DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG +# error "DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG" +#endif arr->heap = NULL; arr->used = 0; @@ -153,13 +155,13 @@ dyn_array_push( ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); ut_ad(size <= DYN_ARRAY_DATA_SIZE); ut_ad(size); - + block = arr; used = block->used; if (used + size > DYN_ARRAY_DATA_SIZE) { /* Get the last array block */ - + block = dyn_array_get_last_block(arr); used = block->used; @@ -195,13 +197,13 @@ dyn_array_open( ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); ut_ad(size <= DYN_ARRAY_DATA_SIZE); ut_ad(size); - + block = arr; used = block->used; if (used + size > DYN_ARRAY_DATA_SIZE) { /* Get the last array block */ - + block = dyn_array_get_last_block(arr); used = block->used; @@ -217,7 +219,7 @@ dyn_array_open( ut_ad(arr->buf_end == 0); arr->buf_end = used + size; -#endif +#endif return((block->data) + used); } @@ -234,13 +236,13 @@ dyn_array_close( ut_ad(arr); ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); - + block = dyn_array_get_last_block(arr); ut_ad(arr->buf_end + block->data >= ptr); block->used = ptr - block->data; - + ut_ad(block->used <= DYN_ARRAY_DATA_SIZE); #ifdef UNIV_DEBUG @@ -256,7 +258,7 @@ dyn_array_get_element( /*==================*/ /* out: pointer to element */ dyn_array_t* arr, /* in: dyn array */ - ulint pos) /* in: position of element as bytes + ulint pos) /* in: position of element as bytes from array start */ { dyn_block_t* block; @@ -267,7 +269,7 @@ dyn_array_get_element( /* Get the first array block */ block = dyn_array_get_first_block(arr); - + if (arr->heap != NULL) { used = dyn_block_get_used(block); @@ -282,7 +284,7 @@ dyn_array_get_element( ut_ad(block); ut_ad(dyn_block_get_used(block) >= pos); - + return(block->data + pos); } @@ -296,7 +298,7 @@ dyn_array_get_data_size( dyn_array_t* arr) /* in: dyn array */ { dyn_block_t* block; - ulint sum = 0; + ulint sum = 0; ut_ad(arr); ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); @@ -305,7 +307,7 @@ dyn_array_get_data_size( return(arr->used); } - + /* Get the first array block */ block = dyn_array_get_first_block(arr); @@ -334,10 +336,10 @@ dyn_push_string( n_copied = DYN_ARRAY_DATA_SIZE; } else { n_copied = len; - } + } memcpy(dyn_array_push(arr, n_copied), str, n_copied); - + str += n_copied; len -= n_copied; } diff --git a/storage/innobase/include/eval0eval.h b/storage/innobase/include/eval0eval.h index 6561f0c8ae7..f950512adfd 100644 --- a/storage/innobase/include/eval0eval.h +++ b/storage/innobase/include/eval0eval.h @@ -77,7 +77,7 @@ Gets a iboolean value from a query node. */ UNIV_INLINE ibool eval_node_get_ibool_val( -/*===================*/ +/*====================*/ /* out: iboolean value */ que_node_t* node); /* in: query graph node */ /********************************************************************* @@ -94,4 +94,4 @@ eval_cmp( #include "eval0eval.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/eval0eval.ic b/storage/innobase/include/eval0eval.ic index 069cbfe5f37..26e9b8e41fe 100644 --- a/storage/innobase/include/eval0eval.ic +++ b/storage/innobase/include/eval0eval.ic @@ -54,7 +54,7 @@ eval_node_ensure_val_buf( dfield_set_len(dfield, size); data = dfield_get_data(dfield); - + if (!data || que_node_get_val_buf_size(node) < size) { data = eval_node_alloc_val_buf(node, size); @@ -77,7 +77,7 @@ eval_sym( if (sym_node->indirection) { /* The symbol table node is an alias for a variable or a column */ - + dfield_copy_data(que_node_get_val(sym_node), que_node_get_val(sym_node->indirection)); } @@ -97,7 +97,7 @@ eval_exp( return; } - + eval_func(exp_node); } @@ -116,13 +116,13 @@ eval_node_set_int_val( dfield = que_node_get_val(node); data = dfield_get_data(dfield); - + if (data == NULL) { data = eval_node_alloc_val_buf(node, 4); } ut_ad(dfield_get_len(dfield) == 4); - + mach_write_to_4(data, (ulint)val); } @@ -141,7 +141,7 @@ eval_node_get_int_val( ut_ad(dfield_get_len(dfield) == 4); - return((int)mach_read_from_4(dfield_get_data(dfield))); + return((int)mach_read_from_4(dfield_get_data(dfield))); } /********************************************************************* @@ -149,7 +149,7 @@ Gets a iboolean value from a query node. */ UNIV_INLINE ibool eval_node_get_ibool_val( -/*===================*/ +/*====================*/ /* out: iboolean value */ que_node_t* node) /* in: query graph node */ { @@ -159,7 +159,7 @@ eval_node_get_ibool_val( dfield = que_node_get_val(node); data = dfield_get_data(dfield); - + ut_ad(data != NULL); return(mach_read_from_1(data)); @@ -170,7 +170,7 @@ Sets a iboolean value as the value of a function node. */ UNIV_INLINE void eval_node_set_ibool_val( -/*===================*/ +/*====================*/ func_node_t* func_node, /* in: function node */ ibool val) /* in: value to set */ { @@ -180,7 +180,7 @@ eval_node_set_ibool_val( dfield = que_node_get_val(func_node); data = dfield_get_data(dfield); - + if (data == NULL) { /* Allocate 1 byte to hold the value */ @@ -188,7 +188,7 @@ eval_node_set_ibool_val( } ut_ad(dfield_get_len(dfield) == 1); - + mach_write_to_1(data, val); } @@ -204,7 +204,7 @@ eval_node_copy_and_alloc_val( ulint len) /* in: string length or UNIV_SQL_NULL */ { byte* data; - + if (len == UNIV_SQL_NULL) { dfield_set_len(que_node_get_val(node), len); @@ -212,7 +212,7 @@ eval_node_copy_and_alloc_val( } data = eval_node_ensure_val_buf(node, len); - + ut_memcpy(data, str, len); } @@ -226,7 +226,7 @@ eval_node_copy_val( que_node_t* node2) /* in: node to copy from */ { dfield_t* dfield2; - + dfield2 = que_node_get_val(node2); eval_node_copy_and_alloc_val(node1, dfield_get_data(dfield2), diff --git a/storage/innobase/include/eval0proc.h b/storage/innobase/include/eval0proc.h index 5d685ad9076..2cf98f26265 100644 --- a/storage/innobase/include/eval0proc.h +++ b/storage/innobase/include/eval0proc.h @@ -76,4 +76,4 @@ return_step( #include "eval0proc.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/eval0proc.ic b/storage/innobase/include/eval0proc.ic index 0d7ecb6d1dc..cf738056576 100644 --- a/storage/innobase/include/eval0proc.ic +++ b/storage/innobase/include/eval0proc.ic @@ -22,19 +22,19 @@ proc_step( proc_node_t* node; ut_ad(thr); - + node = thr->run_node; ut_ad(que_node_get_type(node) == QUE_NODE_PROC); if (thr->prev_node == que_node_get_parent(node)) { /* Start execution from the first statement in the statement list */ - + thr->run_node = node->stat_list; } else { /* Move to the next statement */ ut_ad(que_node_get_next(thr->prev_node) == NULL); - + thr->run_node = NULL; } @@ -43,7 +43,7 @@ proc_step( } return(thr); -} +} /************************************************************************** Performs an execution step of a procedure call node. */ @@ -57,15 +57,15 @@ proc_eval_step( func_node_t* node; ut_ad(thr); - + node = thr->run_node; ut_ad(que_node_get_type(node) == QUE_NODE_FUNC); /* Evaluate the procedure */ eval_exp(node); - + thr->run_node = que_node_get_parent(node); return(thr); -} +} diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index aa1ec5c25a5..53bb496c190 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -63,7 +63,20 @@ extern fil_addr_t fil_addr_null; #define FIL_PAGE_LSN 16 /* lsn of the end of the newest modification log record to the page */ #define FIL_PAGE_TYPE 24 /* file page type: FIL_PAGE_INDEX,..., - 2 bytes */ + 2 bytes. + + The contents of this field can only + be trusted in the following case: + if the page is an uncompressed + B-tree index page, then it is + guaranteed that the value is + FIL_PAGE_INDEX. + The opposite does not hold. + + In tablespaces created by + MySQL/InnoDB 5.1.7 or later, the + contents of this field is valid + for all uncompressed pages. */ #define FIL_PAGE_FILE_FLUSH_LSN 26 /* this is only defined for the first page in a data file: the file has been flushed to disk at least up @@ -79,14 +92,22 @@ extern fil_addr_t fil_addr_null; to the last 4 bytes of FIL_PAGE_LSN */ #define FIL_PAGE_DATA_END 8 -/* File page types */ -#define FIL_PAGE_INDEX 17855 -#define FIL_PAGE_UNDO_LOG 2 -#define FIL_PAGE_INODE 3 -#define FIL_PAGE_IBUF_FREE_LIST 4 +/* File page types (values of FIL_PAGE_TYPE) */ +#define FIL_PAGE_INDEX 17855 /* B-tree node */ +#define FIL_PAGE_UNDO_LOG 2 /* Undo log page */ +#define FIL_PAGE_INODE 3 /* Index node */ +#define FIL_PAGE_IBUF_FREE_LIST 4 /* Insert buffer free list */ +/* File page types introduced in MySQL/InnoDB 5.1.7 */ +#define FIL_PAGE_TYPE_ALLOCATED 0 /* Freshly allocated page */ +#define FIL_PAGE_IBUF_BITMAP 5 /* Insert buffer bitmap */ +#define FIL_PAGE_TYPE_SYS 6 /* System page */ +#define FIL_PAGE_TYPE_TRX_SYS 7 /* Transaction system data */ +#define FIL_PAGE_TYPE_FSP_HDR 8 /* File space header */ +#define FIL_PAGE_TYPE_XDES 9 /* Extent descriptor page */ +#define FIL_PAGE_TYPE_BLOB 10 /* Uncompressed BLOB page */ /* Space types */ -#define FIL_TABLESPACE 501 +#define FIL_TABLESPACE 501 #define FIL_LOG 502 extern ulint fil_n_log_flushes; @@ -271,7 +292,7 @@ Decrements the count of pending insert buffer page merges. */ void fil_decr_pending_ibuf_merges( -/*========================*/ +/*=========================*/ ulint id); /* in: space id */ /*********************************************************************** Parses the body of a log record written about an .ibd file operation. That is, @@ -289,13 +310,13 @@ datadir that we should use in replaying the file operations. */ byte* fil_op_log_parse_or_replay( /*=======================*/ - /* out: end of log record, or NULL if the + /* out: end of log record, or NULL if the record was not completely contained between ptr and end_ptr */ - byte* ptr, /* in: buffer containing the log record body, + byte* ptr, /* in: buffer containing the log record body, or an initial segment of it, if the record does not fir completely between ptr and end_ptr */ - byte* end_ptr, /* in: buffer end */ + byte* end_ptr, /* in: buffer end */ ulint type, /* in: the type of this log record */ ibool do_replay, /* in: TRUE if we want to replay the operation, and not just parse the log record */ @@ -619,7 +640,7 @@ void fil_aio_wait( /*=========*/ ulint segment); /* in: the number of the segment in the aio - array to wait for */ + array to wait for */ /************************************************************************** Flushes to disk possible writes cached by the OS. If the space does not exist or is being dropped, does not do anything. */ @@ -665,7 +686,7 @@ Sets the file page type. */ void fil_page_set_type( /*==============*/ - byte* page, /* in: file page */ + byte* page, /* in: file page */ ulint type); /* in: type */ /************************************************************************* Gets the file page type. */ @@ -675,7 +696,7 @@ fil_page_get_type( /*==============*/ /* out: type; NOTE that if the type has not been written to page, the return value not defined */ - byte* page); /* in: file page */ + byte* page); /* in: file page */ typedef struct fil_space_struct fil_space_t; diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 2fcde882df7..11b664b6826 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -80,8 +80,8 @@ Reads the space id from the first page of a tablespace. */ ulint fsp_header_get_space_id( /*====================*/ - /* out: space id, ULINT UNDEFINED if error */ - page_t* page); /* in: first page of a tablespace */ + /* out: space id, ULINT UNDEFINED if error */ + page_t* page); /* in: first page of a tablespace */ /************************************************************************** Writes the space id to a tablespace header. This function is used past the buffer pool when we in fil0fil.c create a new single-table tablespace. */ @@ -100,7 +100,7 @@ fsp_header_init( /*============*/ ulint space, /* in: space id */ ulint size, /* in: current size in blocks */ - mtr_t* mtr); /* in: mini-transaction handle */ + mtr_t* mtr); /* in: mini-transaction handle */ /************************************************************************** Increases the space size field of a space. */ @@ -109,7 +109,7 @@ fsp_header_inc_size( /*================*/ ulint space, /* in: space id */ ulint size_inc,/* in: size increment in pages */ - mtr_t* mtr); /* in: mini-transaction handle */ + mtr_t* mtr); /* in: mini-transaction handle */ /************************************************************************** Creates a new segment. */ @@ -158,7 +158,7 @@ ulint fseg_n_reserved_pages( /*==================*/ /* out: number of reserved pages */ - fseg_header_t* header, /* in: segment header */ + fseg_header_t* header, /* in: segment header */ ulint* used, /* out: number of pages used (<= reserved) */ mtr_t* mtr); /* in: mtr handle */ /************************************************************************** @@ -232,9 +232,9 @@ ibool fsp_reserve_free_extents( /*=====================*/ /* out: TRUE if we were able to make the reservation */ - ulint* n_reserved,/* out: number of extents actually reserved; if we - return TRUE and the tablespace size is < 64 pages, - then this can be 0, otherwise it is n_ext */ + ulint* n_reserved,/* out: number of extents actually reserved; if we + return TRUE and the tablespace size is < 64 pages, + then this can be 0, otherwise it is n_ext */ ulint space, /* in: space id */ ulint n_ext, /* in: number of extents to reserve */ ulint alloc_type,/* in: FSP_NORMAL, FSP_UNDO, or FSP_CLEANING */ diff --git a/storage/innobase/include/fut0lst.ic b/storage/innobase/include/fut0lst.ic index c0d61833b48..4681a1ce509 100644 --- a/storage/innobase/include/fut0lst.ic +++ b/storage/innobase/include/fut0lst.ic @@ -40,9 +40,9 @@ flst_write_addr( ut_ad(mtr_memo_contains(mtr, buf_block_align(faddr), MTR_MEMO_PAGE_X_FIX)); - mlog_write_ulint(faddr + FIL_ADDR_PAGE, addr.page, MLOG_4BYTES, mtr); + mlog_write_ulint(faddr + FIL_ADDR_PAGE, addr.page, MLOG_4BYTES, mtr); mlog_write_ulint(faddr + FIL_ADDR_BYTE, addr.boffset, - MLOG_2BYTES, mtr); + MLOG_2BYTES, mtr); } /************************************************************************ @@ -59,10 +59,10 @@ flst_read_addr( ut_ad(faddr && mtr); - addr.page = mtr_read_ulint(faddr + FIL_ADDR_PAGE, MLOG_4BYTES, mtr); - addr.boffset = mtr_read_ulint(faddr + FIL_ADDR_BYTE, MLOG_2BYTES, + addr.page = mtr_read_ulint(faddr + FIL_ADDR_PAGE, MLOG_4BYTES, mtr); + addr.boffset = mtr_read_ulint(faddr + FIL_ADDR_BYTE, MLOG_2BYTES, mtr); - return(addr); + return(addr); } /************************************************************************ @@ -76,9 +76,9 @@ flst_init( { ut_ad(mtr_memo_contains(mtr, buf_block_align(base), MTR_MEMO_PAGE_X_FIX)); - mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr); - flst_write_addr(base + FLST_FIRST, fil_addr_null, mtr); - flst_write_addr(base + FLST_LAST, fil_addr_null, mtr); + mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr); + flst_write_addr(base + FLST_FIRST, fil_addr_null, mtr); + flst_write_addr(base + FLST_LAST, fil_addr_null, mtr); } /************************************************************************ diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 60ccb0be5d5..9fc80ed301c 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -99,13 +99,15 @@ ha_remove_all_nodes_to_page( ulint fold, /* in: fold value */ page_t* page); /* in: buffer page */ /***************************************************************** -Validates a hash table. */ +Validates a given range of the cells in hash table. */ ibool ha_validate( /*========*/ - /* out: TRUE if ok */ - hash_table_t* table); /* in: hash table */ + /* out: TRUE if ok */ + hash_table_t* table, /* in: hash table */ + ulint start_index, /* in: start index */ + ulint end_index); /* in: end index */ /***************************************************************** Prints info of a hash table. */ @@ -128,4 +130,4 @@ struct ha_node_struct { #include "ha0ha.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index 51315e40875..a5cd32d956f 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -109,8 +109,8 @@ do {\ \ while (struct3333->NAME != DATA) {\ \ - ut_a(struct3333);\ struct3333 = struct3333->NAME;\ + ut_a(struct3333);\ }\ \ struct3333->NAME = DATA->NAME;\ @@ -153,8 +153,8 @@ hash_cell_t* hash_get_nth_cell( /*==============*/ /* out: pointer to cell */ - hash_table_t* table, /* in: hash table */ - ulint n); /* in: cell index */ + hash_table_t* table, /* in: hash table */ + ulint n); /* in: cell index */ /***************************************************************** Returns the number of cells in a hash table. */ UNIV_INLINE @@ -229,8 +229,8 @@ ulint hash_get_mutex_no( /*==============*/ /* out: mutex number */ - hash_table_t* table, /* in: hash table */ - ulint fold); /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold); /* in: fold */ /**************************************************************** Gets the nth heap in a hash table. */ UNIV_INLINE @@ -238,8 +238,8 @@ mem_heap_t* hash_get_nth_heap( /*==============*/ /* out: mem heap */ - hash_table_t* table, /* in: hash table */ - ulint i); /* in: index of the heap */ + hash_table_t* table, /* in: hash table */ + ulint i); /* in: index of the heap */ /**************************************************************** Gets the heap for a fold value in a hash table. */ UNIV_INLINE @@ -247,8 +247,8 @@ mem_heap_t* hash_get_heap( /*==========*/ /* out: mem heap */ - hash_table_t* table, /* in: hash table */ - ulint fold); /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold); /* in: fold */ /**************************************************************** Gets the nth mutex in a hash table. */ UNIV_INLINE @@ -256,8 +256,8 @@ mutex_t* hash_get_nth_mutex( /*===============*/ /* out: mutex */ - hash_table_t* table, /* in: hash table */ - ulint i); /* in: index of the mutex */ + hash_table_t* table, /* in: hash table */ + ulint i); /* in: index of the mutex */ /**************************************************************** Gets the mutex for a fold value in a hash table. */ UNIV_INLINE @@ -265,38 +265,38 @@ mutex_t* hash_get_mutex( /*===========*/ /* out: mutex */ - hash_table_t* table, /* in: hash table */ - ulint fold); /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold); /* in: fold */ /**************************************************************** Reserves the mutex for a fold value in a hash table. */ void hash_mutex_enter( /*=============*/ - hash_table_t* table, /* in: hash table */ - ulint fold); /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold); /* in: fold */ /**************************************************************** Releases the mutex for a fold value in a hash table. */ void hash_mutex_exit( /*============*/ - hash_table_t* table, /* in: hash table */ - ulint fold); /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold); /* in: fold */ /**************************************************************** Reserves all the mutexes of a hash table, in an ascending order. */ void hash_mutex_enter_all( /*=================*/ - hash_table_t* table); /* in: hash table */ + hash_table_t* table); /* in: hash table */ /**************************************************************** Releases all the mutexes of a hash table. */ void hash_mutex_exit_all( /*================*/ - hash_table_t* table); /* in: hash table */ + hash_table_t* table); /* in: hash table */ struct hash_cell_struct{ diff --git a/storage/innobase/include/hash0hash.ic b/storage/innobase/include/hash0hash.ic index 0d713140c13..49bcc7b31d0 100644 --- a/storage/innobase/include/hash0hash.ic +++ b/storage/innobase/include/hash0hash.ic @@ -15,8 +15,8 @@ hash_cell_t* hash_get_nth_cell( /*==============*/ /* out: pointer to cell */ - hash_table_t* table, /* in: hash table */ - ulint n) /* in: cell index */ + hash_table_t* table, /* in: hash table */ + ulint n) /* in: cell index */ { ut_ad(n < table->n_cells); @@ -55,8 +55,8 @@ ulint hash_get_mutex_no( /*==============*/ /* out: mutex number */ - hash_table_t* table, /* in: hash table */ - ulint fold) /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold) /* in: fold */ { return(ut_2pow_remainder(fold, table->n_mutexes)); } @@ -68,8 +68,8 @@ mem_heap_t* hash_get_nth_heap( /*==============*/ /* out: mem heap */ - hash_table_t* table, /* in: hash table */ - ulint i) /* in: index of the heap */ + hash_table_t* table, /* in: hash table */ + ulint i) /* in: index of the heap */ { ut_ad(i < table->n_mutexes); @@ -83,8 +83,8 @@ mem_heap_t* hash_get_heap( /*==========*/ /* out: mem heap */ - hash_table_t* table, /* in: hash table */ - ulint fold) /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold) /* in: fold */ { ulint i; @@ -104,11 +104,11 @@ mutex_t* hash_get_nth_mutex( /*===============*/ /* out: mutex */ - hash_table_t* table, /* in: hash table */ - ulint i) /* in: index of the mutex */ + hash_table_t* table, /* in: hash table */ + ulint i) /* in: index of the mutex */ { ut_ad(i < table->n_mutexes); - + return(table->mutexes + i); } @@ -119,8 +119,8 @@ mutex_t* hash_get_mutex( /*===========*/ /* out: mutex */ - hash_table_t* table, /* in: hash table */ - ulint fold) /* in: fold */ + hash_table_t* table, /* in: hash table */ + ulint fold) /* in: fold */ { ulint i; diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 4f38ab4f1e9..34f29ae5dec 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -180,7 +180,7 @@ ibuf_page_low( /*************************************************************************** Frees excess pages from the ibuf free list. This function is called when an OS thread calls fsp services to allocate a new file segment, or a new page to a -file segment, and the thread did not own the fsp latch before this call. */ +file segment, and the thread did not own the fsp latch before this call. */ void ibuf_free_excess_pages( @@ -304,4 +304,4 @@ for the file segment from which the pages for the ibuf tree are allocated */ #include "ibuf0ibuf.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic index 68f7ce9c1d0..4eea8f41e32 100644 --- a/storage/innobase/include/ibuf0ibuf.ic +++ b/storage/innobase/include/ibuf0ibuf.ic @@ -41,7 +41,7 @@ struct ibuf_data_struct{ /* If the ibuf meter exceeds this value, then the suitable inserts are made to the insert buffer instead of directly to the disk page */ -#define IBUF_THRESHOLD 50 +#define IBUF_THRESHOLD 50 struct ibuf_struct{ ulint size; /* current size of the ibuf index @@ -88,13 +88,13 @@ ibuf_should_try( decide */ { if (!(index->type & DICT_CLUSTERED) - && (ignore_sec_unique || !(index->type & DICT_UNIQUE)) - && ibuf->meter > IBUF_THRESHOLD) { + && (ignore_sec_unique || !(index->type & DICT_UNIQUE)) + && ibuf->meter > IBUF_THRESHOLD) { ibuf_flush_count++; if (ibuf_flush_count % 8 == 0) { - + buf_LRU_try_free_flushed_blocks(); } @@ -132,13 +132,13 @@ ibuf_index_page_calc_free_bits( for the page */ { ulint n; - + n = max_ins_size / (UNIV_PAGE_SIZE / IBUF_PAGE_SIZE_PER_FREE_SPACE); if (n == 3) { n = 2; } - + if (n > 3) { n = 3; } @@ -206,8 +206,9 @@ ibuf_update_free_bits_if_full( before = ibuf_index_page_calc_free_bits(max_ins_size); if (max_ins_size >= increase) { - ut_ad(ULINT_UNDEFINED > UNIV_PAGE_SIZE); - +#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE +# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE" +#endif after = ibuf_index_page_calc_free_bits(max_ins_size - increase); #ifdef UNIV_IBUF_DEBUG diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 86e579bc007..3dda3a7cca8 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -224,7 +224,7 @@ lock_rec_restore_from_page_infimum( rec_t* rec, /* in: record whose lock state is restored */ page_t* page); /* in: page (rec is not necessarily on this page) whose infimum stored the lock state; lock bits are - reset on the infimum */ + reset on the infimum */ /************************************************************************* Returns TRUE if there are explicit record locks on a page. */ @@ -427,7 +427,7 @@ to a lock. */ void lock_rec_unlock( /*============*/ - trx_t* trx, /* in: transaction that has set a record + trx_t* trx, /* in: transaction that has set a record lock */ rec_t* rec, /* in: record */ ulint lock_mode); /* in: LOCK_S or LOCK_X */ @@ -477,7 +477,7 @@ searching for a lock in the hash table. */ UNIV_INLINE ulint lock_rec_fold( -/*===========*/ +/*==========*/ /* out: folded value */ ulint space, /* in: space */ ulint page_no);/* in: page number */ @@ -624,7 +624,7 @@ extern lock_sys_t* lock_sys; waiting for its turn in the wait queue */ /* Precise modes */ #define LOCK_ORDINARY 0 /* this flag denotes an ordinary next-key lock - in contrast to LOCK_GAP or LOCK_REC_NOT_GAP */ + in contrast to LOCK_GAP or LOCK_REC_NOT_GAP */ #define LOCK_GAP 512 /* this gap bit should be so high that it can be ORed to the other flags; when this bit is set, it means that the @@ -634,7 +634,7 @@ extern lock_sys_t* lock_sys; the bit is set; locks of this type are created when records are removed from the index chain of records */ -#define LOCK_REC_NOT_GAP 1024 /* this bit means that the lock is only on +#define LOCK_REC_NOT_GAP 1024 /* this bit means that the lock is only on the index record and does NOT block inserts to the gap before the index record; this is used in the case when we retrieve a record @@ -650,7 +650,7 @@ extern lock_sys_t* lock_sys; remains set when the waiting lock is granted, or if the lock is inherited to a neighboring record */ - + /* When lock bits are reset, the following flags are available: */ #define LOCK_RELEASE_WAIT 1 #define LOCK_NOT_RELEASE_WAIT 2 @@ -678,4 +678,4 @@ extern lock_sys_t* lock_sys; #include "lock0lock.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/lock0types.h b/storage/innobase/include/lock0types.h index 6c3e54ee1fc..43fd2d60da5 100644 --- a/storage/innobase/include/lock0types.h +++ b/storage/innobase/include/lock0types.h @@ -13,4 +13,4 @@ Created 5/7/1996 Heikki Tuuri typedef struct lock_struct lock_t; typedef struct lock_sys_struct lock_sys_t; -#endif +#endif diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 7f3f10438b4..43662d02a34 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -19,7 +19,7 @@ typedef struct log_group_struct log_group_t; #ifdef UNIV_DEBUG extern ibool log_do_write; -extern ibool log_debug_writes; +extern ibool log_debug_writes; #else /* UNIV_DEBUG */ # define log_do_write TRUE #endif /* UNIV_DEBUG */ @@ -493,9 +493,9 @@ Peeks the current lsn. */ ibool log_peek_lsn( /*=========*/ - /* out: TRUE if success, FALSE if could not get the - log system mutex */ - dulint* lsn); /* out: if returns TRUE, current lsn is here */ + /* out: TRUE if success, FALSE if could not get the + log system mutex */ + dulint* lsn); /* out: if returns TRUE, current lsn is here */ /************************************************************************** Refreshes the statistics used to print per-second averages. */ @@ -514,7 +514,7 @@ extern log_t* log_sys; /* The counting of lsn's starts from this value: this must be non-zero */ #define LOG_START_LSN ut_dulint_create(0, 16 * OS_FILE_LOG_BLOCK_SIZE) -#define LOG_BUFFER_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE) +#define LOG_BUFFER_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE) #define LOG_ARCHIVE_BUF_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE / 4) /* Offsets of a log block header */ @@ -571,8 +571,8 @@ extern log_t* log_sys; #define LOG_CHECKPOINT_ARRAY_END (LOG_CHECKPOINT_GROUP_ARRAY\ + LOG_MAX_N_GROUPS * 8) -#define LOG_CHECKPOINT_CHECKSUM_1 LOG_CHECKPOINT_ARRAY_END -#define LOG_CHECKPOINT_CHECKSUM_2 (4 + LOG_CHECKPOINT_ARRAY_END) +#define LOG_CHECKPOINT_CHECKSUM_1 LOG_CHECKPOINT_ARRAY_END +#define LOG_CHECKPOINT_CHECKSUM_2 (4 + LOG_CHECKPOINT_ARRAY_END) #define LOG_CHECKPOINT_FSP_FREE_LIMIT (8 + LOG_CHECKPOINT_ARRAY_END) /* current fsp free limit in tablespace 0, in units of one @@ -678,7 +678,7 @@ struct log_group_struct{ this buffer to the group */ UT_LIST_NODE_T(log_group_t) log_groups; /* list of log groups */ -}; +}; struct log_struct{ byte pad[64]; /* padding to prevent other memory @@ -731,13 +731,13 @@ struct log_struct{ be advanced, it is enough that the write i/o has been completed for all log groups */ - dulint write_lsn; /* end lsn for the current running + dulint write_lsn; /* end lsn for the current running write */ ulint write_end_offset;/* the data in buffer has been written up to this offset when the current write ends: this field will then be copied to buf_next_to_write */ - dulint current_flush_lsn;/* end lsn for the current running + dulint current_flush_lsn;/* end lsn for the current running write + flush operation */ dulint flushed_to_disk_lsn; /* how far we have written the log @@ -774,11 +774,11 @@ struct log_struct{ called */ /* Fields involved in checkpoints */ - ulint log_group_capacity; /* capacity of the log group; if - the checkpoint age exceeds this, it is - a serious error because it is possible - we will then overwrite log and spoil - crash recovery */ + ulint log_group_capacity; /* capacity of the log group; if + the checkpoint age exceeds this, it is + a serious error because it is possible + we will then overwrite log and spoil + crash recovery */ ulint max_modified_age_async; /* when this recommended value for lsn - buf_pool_get_oldest_modification() diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic index ca7531783a2..898a8f3b6e3 100644 --- a/storage/innobase/include/log0log.ic +++ b/storage/innobase/include/log0log.ic @@ -61,7 +61,7 @@ log_block_set_flush_bit( } mach_write_to_4(log_block + LOG_BLOCK_HDR_NO, field); -} +} /**************************************************************** Gets a log block number stored in the header. */ @@ -73,7 +73,7 @@ log_block_get_hdr_no( header */ byte* log_block) /* in: log block */ { - return(~LOG_BLOCK_FLUSH_BIT_MASK + return(~LOG_BLOCK_FLUSH_BIT_MASK & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)); } @@ -90,7 +90,7 @@ log_block_set_hdr_no( { ut_ad(n > 0); ut_ad(n < LOG_BLOCK_FLUSH_BIT_MASK); - + mach_write_to_4(log_block + LOG_BLOCK_HDR_NO, n); } @@ -183,7 +183,7 @@ log_block_convert_lsn_to_no( no = ut_dulint_get_low(lsn) / OS_FILE_LOG_BLOCK_SIZE; no += (ut_dulint_get_high(lsn) % OS_FILE_LOG_BLOCK_SIZE) * 2 * (0x80000000UL / OS_FILE_LOG_BLOCK_SIZE); - + no = no & 0x3FFFFFFFUL; return(no + 1); @@ -201,10 +201,10 @@ log_block_calc_checksum( ulint sum; ulint sh; ulint i; - + sum = 1; sh = 0; - + for (i = 0; i < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE; i++) { sum = sum & 0x7FFFFFFFUL; sum += (((ulint)(*(block + i))) << sh) + (ulint)(*(block + i)); @@ -260,7 +260,7 @@ log_block_init( #endif /* UNIV_SYNC_DEBUG */ no = log_block_convert_lsn_to_no(lsn); - + log_block_set_hdr_no(log_block, no); log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE); @@ -284,14 +284,14 @@ log_block_init_in_old_format( #endif /* UNIV_SYNC_DEBUG */ no = log_block_convert_lsn_to_no(lsn); - + log_block_set_hdr_no(log_block, no); mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM, no); log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE); log_block_set_first_rec_group(log_block, 0); } - + /**************************************************************** Writes to the log the string given. The log must be released with log_release. */ @@ -318,29 +318,29 @@ log_reserve_and_write_fast( if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) { - /* The string does not fit within the current log block - or the log block would become full */ + /* The string does not fit within the current log block + or the log block would become full */ - *success = FALSE; + *success = FALSE; mutex_exit(&(log->mutex)); - return(ut_dulint_zero); + return(ut_dulint_zero); } *start_lsn = log->lsn; - + ut_memcpy(log->buf + log->buf_free, str, len); log_block_set_data_len(ut_align_down(log->buf + log->buf_free, - OS_FILE_LOG_BLOCK_SIZE), + OS_FILE_LOG_BLOCK_SIZE), data_len); #ifdef UNIV_LOG_DEBUG log->old_buf_free = log->buf_free; log->old_lsn = log->lsn; #endif log->buf_free += len; - + ut_ad(log->buf_free <= log->buf_size); lsn = ut_dulint_add(log->lsn, len); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 658df4d5586..7bdf8bf6100 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -341,14 +341,14 @@ extern ibool recv_recovery_on; extern ibool recv_no_ibuf_operations; extern ibool recv_needed_recovery; -extern ibool recv_lsn_checks_on; +extern ibool recv_lsn_checks_on; #ifdef UNIV_HOTBACKUP extern ibool recv_is_making_a_backup; #endif /* UNIV_HOTBACKUP */ extern ulint recv_max_parsed_page_no; /* Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many -times! */ +times! */ #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024) /* Size of block reads when the log groups are scanned forward to do a diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index f9a3ff521d5..8377114a723 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -1,6 +1,6 @@ /********************************************************************** Utilities for converting data from the database file -to the machine format. +to the machine format. (c) 1995 Innobase Oy @@ -21,37 +21,37 @@ module. */ /*********************************************************** The following function is used to store data in one byte. */ UNIV_INLINE -void +void mach_write_to_1( /*============*/ - byte* b, /* in: pointer to byte where to store */ - ulint n); /* in: ulint integer to be stored, >= 0, < 256 */ + byte* b, /* in: pointer to byte where to store */ + ulint n); /* in: ulint integer to be stored, >= 0, < 256 */ /************************************************************ The following function is used to fetch data from one byte. */ UNIV_INLINE -ulint +ulint mach_read_from_1( /*=============*/ /* out: ulint integer, >= 0, < 256 */ - byte* b); /* in: pointer to byte */ + byte* b); /* in: pointer to byte */ /*********************************************************** The following function is used to store data in two consecutive bytes. We store the most significant byte to the lower address. */ UNIV_INLINE -void +void mach_write_to_2( /*============*/ - byte* b, /* in: pointer to two bytes where to store */ - ulint n); /* in: ulint integer to be stored, >= 0, < 64k */ + byte* b, /* in: pointer to two bytes where to store */ + ulint n); /* in: ulint integer to be stored, >= 0, < 64k */ /************************************************************ The following function is used to fetch data from two consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_2( /*=============*/ /* out: ulint integer, >= 0, < 64k */ - byte* b); /* in: pointer to two bytes */ + byte* b); /* in: pointer to two bytes */ /************************************************************ The following function is used to convert a 16-bit data item @@ -77,38 +77,38 @@ mach_decode_2( The following function is used to store data in 3 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_3( /*============*/ - byte* b, /* in: pointer to 3 bytes where to store */ - ulint n); /* in: ulint integer to be stored */ + byte* b, /* in: pointer to 3 bytes where to store */ + ulint n); /* in: ulint integer to be stored */ /************************************************************ The following function is used to fetch data from 3 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_3( /*=============*/ /* out: ulint integer */ - byte* b); /* in: pointer to 3 bytes */ + byte* b); /* in: pointer to 3 bytes */ /*********************************************************** The following function is used to store data in four consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_4( /*============*/ - byte* b, /* in: pointer to four bytes where to store */ - ulint n); /* in: ulint integer to be stored */ + byte* b, /* in: pointer to four bytes where to store */ + ulint n); /* in: ulint integer to be stored */ /************************************************************ The following function is used to fetch data from 4 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_4( /*=============*/ /* out: ulint integer */ - byte* b); /* in: pointer to four bytes */ + byte* b); /* in: pointer to four bytes */ /************************************************************* Writes a ulint in a compressed form (1..5 bytes). */ UNIV_INLINE @@ -116,8 +116,8 @@ ulint mach_write_compressed( /*==================*/ /* out: stored size in bytes */ - byte* b, /* in: pointer to memory where to store */ - ulint n); /* in: ulint integer to be stored */ + byte* b, /* in: pointer to memory where to store */ + ulint n); /* in: ulint integer to be stored */ /************************************************************* Returns the size of an ulint when written in the compressed form. */ UNIV_INLINE @@ -125,7 +125,7 @@ ulint mach_get_compressed_size( /*=====================*/ /* out: compressed size in bytes */ - ulint n); /* in: ulint integer to be stored */ + ulint n); /* in: ulint integer to be stored */ /************************************************************* Reads a ulint in a compressed form. */ UNIV_INLINE @@ -133,61 +133,61 @@ ulint mach_read_compressed( /*=================*/ /* out: read integer */ - byte* b); /* in: pointer to memory from where to read */ + byte* b); /* in: pointer to memory from where to read */ /*********************************************************** The following function is used to store data in 6 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_6( /*============*/ - byte* b, /* in: pointer to 6 bytes where to store */ - dulint n); /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 6 bytes where to store */ + dulint n); /* in: dulint integer to be stored */ /************************************************************ The following function is used to fetch data from 6 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_6( /*=============*/ /* out: dulint integer */ - byte* b); /* in: pointer to 6 bytes */ + byte* b); /* in: pointer to 6 bytes */ /*********************************************************** The following function is used to store data in 7 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_7( /*============*/ - byte* b, /* in: pointer to 7 bytes where to store */ - dulint n); /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 7 bytes where to store */ + dulint n); /* in: dulint integer to be stored */ /************************************************************ The following function is used to fetch data from 7 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_7( /*=============*/ /* out: dulint integer */ - byte* b); /* in: pointer to 7 bytes */ + byte* b); /* in: pointer to 7 bytes */ /*********************************************************** The following function is used to store data in 8 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_8( /*============*/ - byte* b, /* in: pointer to 8 bytes where to store */ - dulint n); /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 8 bytes where to store */ + dulint n); /* in: dulint integer to be stored */ /************************************************************ The following function is used to fetch data from 8 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_8( /*=============*/ /* out: dulint integer */ - byte* b); /* in: pointer to 8 bytes */ + byte* b); /* in: pointer to 8 bytes */ /************************************************************* Writes a dulint in a compressed form (5..9 bytes). */ UNIV_INLINE @@ -195,8 +195,8 @@ ulint mach_dulint_write_compressed( /*=========================*/ /* out: size in bytes */ - byte* b, /* in: pointer to memory where to store */ - dulint n); /* in: dulint integer to be stored */ + byte* b, /* in: pointer to memory where to store */ + dulint n); /* in: dulint integer to be stored */ /************************************************************* Returns the size of a dulint when written in the compressed form. */ UNIV_INLINE @@ -204,7 +204,7 @@ ulint mach_dulint_get_compressed_size( /*============================*/ /* out: compressed size in bytes */ - dulint n); /* in: dulint integer to be stored */ + dulint n); /* in: dulint integer to be stored */ /************************************************************* Reads a dulint in a compressed form. */ UNIV_INLINE @@ -212,7 +212,7 @@ dulint mach_dulint_read_compressed( /*========================*/ /* out: read dulint */ - byte* b); /* in: pointer to memory from where to read */ + byte* b); /* in: pointer to memory from where to read */ /************************************************************* Writes a dulint in a compressed form (1..11 bytes). */ UNIV_INLINE @@ -220,8 +220,8 @@ ulint mach_dulint_write_much_compressed( /*==============================*/ /* out: size in bytes */ - byte* b, /* in: pointer to memory where to store */ - dulint n); /* in: dulint integer to be stored */ + byte* b, /* in: pointer to memory where to store */ + dulint n); /* in: dulint integer to be stored */ /************************************************************* Returns the size of a dulint when written in the compressed form. */ UNIV_INLINE @@ -229,7 +229,7 @@ ulint mach_dulint_get_much_compressed_size( /*=================================*/ /* out: compressed size in bytes */ - dulint n); /* in: dulint integer to be stored */ + dulint n); /* in: dulint integer to be stored */ /************************************************************* Reads a dulint in a compressed form. */ UNIV_INLINE @@ -237,7 +237,7 @@ dulint mach_dulint_read_much_compressed( /*=============================*/ /* out: read dulint */ - byte* b); /* in: pointer to memory from where to read */ + byte* b); /* in: pointer to memory from where to read */ /************************************************************* Reads a ulint in a compressed form if the log record fully contains it. */ @@ -246,9 +246,9 @@ mach_parse_compressed( /*==================*/ /* out: pointer to end of the stored field, NULL if not complete */ - byte* ptr, /* in: pointer to buffer from where to read */ + byte* ptr, /* in: pointer to buffer from where to read */ byte* end_ptr,/* in: pointer to end of the buffer */ - ulint* val); /* out: read value */ + ulint* val); /* out: read value */ /************************************************************* Reads a dulint in a compressed form if the log record fully contains it. */ @@ -257,9 +257,9 @@ mach_dulint_parse_compressed( /*=========================*/ /* out: pointer to end of the stored field, NULL if not complete */ - byte* ptr, /* in: pointer to buffer from where to read */ + byte* ptr, /* in: pointer to buffer from where to read */ byte* end_ptr,/* in: pointer to end of the buffer */ - dulint* val); /* out: read value */ + dulint* val); /* out: read value */ /************************************************************* Reads a double. It is stored in a little-endian format. */ UNIV_INLINE @@ -267,31 +267,31 @@ double mach_double_read( /*=============*/ /* out: double read */ - byte* b); /* in: pointer to memory from where to read */ + byte* b); /* in: pointer to memory from where to read */ /************************************************************* Writes a double. It is stored in a little-endian format. */ UNIV_INLINE void mach_double_write( /*==============*/ - byte* b, /* in: pointer to memory where to write */ - double d); /* in: double */ + byte* b, /* in: pointer to memory where to write */ + double d); /* in: double */ /************************************************************* Reads a float. It is stored in a little-endian format. */ UNIV_INLINE float mach_float_read( -/*=============*/ +/*============*/ /* out: float read */ - byte* b); /* in: pointer to memory from where to read */ + byte* b); /* in: pointer to memory from where to read */ /************************************************************* Writes a float. It is stored in a little-endian format. */ UNIV_INLINE void mach_float_write( -/*==============*/ - byte* b, /* in: pointer to memory where to write */ - float d); /* in: float */ +/*=============*/ + byte* b, /* in: pointer to memory where to write */ + float d); /* in: float */ /************************************************************* Reads a ulint stored in the little-endian format. */ UNIV_INLINE @@ -326,7 +326,7 @@ mach_write_to_2_little_endian( /*==========================*/ byte* dest, /* in: where to write */ ulint n); /* in: unsigned long int to write */ - + #ifndef UNIV_NONINL #include "mach0data.ic" #endif diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic index 888f3f743e4..2199565aff4 100644 --- a/storage/innobase/include/mach0data.ic +++ b/storage/innobase/include/mach0data.ic @@ -1,6 +1,6 @@ /********************************************************************** Utilities for converting data from the database file -to the machine format. +to the machine format. (c) 1995 Innobase Oy @@ -10,11 +10,11 @@ Created 11/28/1995 Heikki Tuuri /*********************************************************** The following function is used to store data in one byte. */ UNIV_INLINE -void +void mach_write_to_1( /*============*/ - byte* b, /* in: pointer to byte where to store */ - ulint n) /* in: ulint integer to be stored, >= 0, < 256 */ + byte* b, /* in: pointer to byte where to store */ + ulint n) /* in: ulint integer to be stored, >= 0, < 256 */ { ut_ad(b); ut_ad(n <= 0xFFUL); @@ -25,11 +25,11 @@ mach_write_to_1( /************************************************************ The following function is used to fetch data from one byte. */ UNIV_INLINE -ulint +ulint mach_read_from_1( /*=============*/ /* out: ulint integer, >= 0, < 256 */ - byte* b) /* in: pointer to byte */ + byte* b) /* in: pointer to byte */ { ut_ad(b); return((ulint)(b[0])); @@ -39,11 +39,11 @@ mach_read_from_1( The following function is used to store data in two consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_2( /*============*/ - byte* b, /* in: pointer to two bytes where to store */ - ulint n) /* in: ulint integer to be stored */ + byte* b, /* in: pointer to two bytes where to store */ + ulint n) /* in: ulint integer to be stored */ { ut_ad(b); ut_ad(n <= 0xFFFFUL); @@ -56,16 +56,16 @@ mach_write_to_2( The following function is used to fetch data from 2 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_2( /*=============*/ /* out: ulint integer */ - byte* b) /* in: pointer to 2 bytes */ + byte* b) /* in: pointer to 2 bytes */ { ut_ad(b); return( ((ulint)(b[0]) << 8) + (ulint)(b[1]) - ); + ); } /************************************************************ @@ -103,11 +103,11 @@ mach_decode_2( The following function is used to store data in 3 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_3( /*============*/ - byte* b, /* in: pointer to 3 bytes where to store */ - ulint n) /* in: ulint integer to be stored */ + byte* b, /* in: pointer to 3 bytes where to store */ + ulint n) /* in: ulint integer to be stored */ { ut_ad(b); ut_ad(n <= 0xFFFFFFUL); @@ -121,28 +121,28 @@ mach_write_to_3( The following function is used to fetch data from 3 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_3( /*=============*/ /* out: ulint integer */ - byte* b) /* in: pointer to 3 bytes */ + byte* b) /* in: pointer to 3 bytes */ { ut_ad(b); return( ((ulint)(b[0]) << 16) + ((ulint)(b[1]) << 8) + (ulint)(b[2]) - ); + ); } /*********************************************************** The following function is used to store data in four consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_4( /*============*/ - byte* b, /* in: pointer to four bytes where to store */ - ulint n) /* in: ulint integer to be stored */ + byte* b, /* in: pointer to four bytes where to store */ + ulint n) /* in: ulint integer to be stored */ { ut_ad(b); @@ -154,7 +154,7 @@ mach_write_to_4( __asm MOV EAX, n __asm BSWAP EAX /* Intel is little-endian, must swap bytes */ __asm MOV n, EAX - + *((ulint*)b) = n; #else b[0] = (byte)(n >> 24); @@ -168,11 +168,11 @@ mach_write_to_4( The following function is used to fetch data from 4 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -ulint +ulint mach_read_from_4( /*=============*/ /* out: ulint integer */ - byte* b) /* in: pointer to four bytes */ + byte* b) /* in: pointer to four bytes */ { #if (0 == 1) && !defined(__STDC__) && defined(UNIV_INTEL) && (UNIV_WORD_SIZE == 4) && defined(UNIV_VISUALC) /* We do not use this even on Intel, because unaligned accesses may @@ -194,7 +194,7 @@ mach_read_from_4( + ((ulint)(b[1]) << 16) + ((ulint)(b[2]) << 8) + (ulint)(b[3]) - ); + ); #endif } @@ -203,15 +203,15 @@ Writes a ulint in a compressed form where the first byte codes the length of the stored ulint. We look at the most significant bits of the byte. If the most significant bit is zero, it means 1-byte storage, else if the 2nd bit is 0, it means 2-byte storage, else if 3rd is 0, -it means 3-byte storage, else if 4th is 0, it means 4-byte storage, +it means 3-byte storage, else if 4th is 0, it means 4-byte storage, else the storage is 5-byte. */ UNIV_INLINE ulint mach_write_compressed( /*==================*/ /* out: compressed size in bytes */ - byte* b, /* in: pointer to memory where to store */ - ulint n) /* in: ulint integer (< 2^32) to be stored */ + byte* b, /* in: pointer to memory where to store */ + ulint n) /* in: ulint integer (< 2^32) to be stored */ { ut_ad(b); @@ -241,7 +241,7 @@ ulint mach_get_compressed_size( /*=====================*/ /* out: compressed size in bytes */ - ulint n) /* in: ulint integer (< 2^32) to be stored */ + ulint n) /* in: ulint integer (< 2^32) to be stored */ { if (n < 0x80UL) { return(1); @@ -263,7 +263,7 @@ ulint mach_read_compressed( /*=================*/ /* out: read integer (< 2^32) */ - byte* b) /* in: pointer to memory from where to read */ + byte* b) /* in: pointer to memory from where to read */ { ulint flag; @@ -289,11 +289,11 @@ mach_read_compressed( The following function is used to store data in 8 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_8( /*============*/ - byte* b, /* in: pointer to 8 bytes where to store */ - dulint n) /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 8 bytes where to store */ + dulint n) /* in: dulint integer to be stored */ { ut_ad(b); @@ -305,11 +305,11 @@ mach_write_to_8( The following function is used to fetch data from 8 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_8( /*=============*/ /* out: dulint integer */ - byte* b) /* in: pointer to 8 bytes */ + byte* b) /* in: pointer to 8 bytes */ { ulint high; ulint low; @@ -319,18 +319,18 @@ mach_read_from_8( high = mach_read_from_4(b); low = mach_read_from_4(b + 4); - return(ut_dulint_create(high, low)); + return(ut_dulint_create(high, low)); } /*********************************************************** The following function is used to store data in 7 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_7( /*============*/ - byte* b, /* in: pointer to 7 bytes where to store */ - dulint n) /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 7 bytes where to store */ + dulint n) /* in: dulint integer to be stored */ { ut_ad(b); @@ -342,11 +342,11 @@ mach_write_to_7( The following function is used to fetch data from 7 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_7( /*=============*/ /* out: dulint integer */ - byte* b) /* in: pointer to 7 bytes */ + byte* b) /* in: pointer to 7 bytes */ { ulint high; ulint low; @@ -356,18 +356,18 @@ mach_read_from_7( high = mach_read_from_3(b); low = mach_read_from_4(b + 3); - return(ut_dulint_create(high, low)); + return(ut_dulint_create(high, low)); } /*********************************************************** The following function is used to store data in 6 consecutive bytes. We store the most significant byte to the lowest address. */ UNIV_INLINE -void +void mach_write_to_6( /*============*/ - byte* b, /* in: pointer to 6 bytes where to store */ - dulint n) /* in: dulint integer to be stored */ + byte* b, /* in: pointer to 6 bytes where to store */ + dulint n) /* in: dulint integer to be stored */ { ut_ad(b); @@ -379,11 +379,11 @@ mach_write_to_6( The following function is used to fetch data from 6 consecutive bytes. The most significant byte is at the lowest address. */ UNIV_INLINE -dulint +dulint mach_read_from_6( /*=============*/ /* out: dulint integer */ - byte* b) /* in: pointer to 7 bytes */ + byte* b) /* in: pointer to 7 bytes */ { ulint high; ulint low; @@ -393,7 +393,7 @@ mach_read_from_6( high = mach_read_from_2(b); low = mach_read_from_4(b + 2); - return(ut_dulint_create(high, low)); + return(ut_dulint_create(high, low)); } /************************************************************* @@ -403,8 +403,8 @@ ulint mach_dulint_write_compressed( /*=========================*/ /* out: size in bytes */ - byte* b, /* in: pointer to memory where to store */ - dulint n) /* in: dulint integer to be stored */ + byte* b, /* in: pointer to memory where to store */ + dulint n) /* in: dulint integer to be stored */ { ulint size; @@ -423,7 +423,7 @@ ulint mach_dulint_get_compressed_size( /*============================*/ /* out: compressed size in bytes */ - dulint n) /* in: dulint integer to be stored */ + dulint n) /* in: dulint integer to be stored */ { return(4 + mach_get_compressed_size(ut_dulint_get_high(n))); } @@ -435,7 +435,7 @@ dulint mach_dulint_read_compressed( /*========================*/ /* out: read dulint */ - byte* b) /* in: pointer to memory from where to read */ + byte* b) /* in: pointer to memory from where to read */ { ulint high; ulint low; @@ -449,7 +449,7 @@ mach_dulint_read_compressed( low = mach_read_from_4(b + size); - return(ut_dulint_create(high, low)); + return(ut_dulint_create(high, low)); } /************************************************************* @@ -459,17 +459,17 @@ ulint mach_dulint_write_much_compressed( /*==============================*/ /* out: size in bytes */ - byte* b, /* in: pointer to memory where to store */ - dulint n) /* in: dulint integer to be stored */ + byte* b, /* in: pointer to memory where to store */ + dulint n) /* in: dulint integer to be stored */ { ulint size; ut_ad(b); - + if (ut_dulint_get_high(n) == 0) { return(mach_write_compressed(b, ut_dulint_get_low(n))); } - + *b = (byte)0xFF; size = 1 + mach_write_compressed(b + 1, ut_dulint_get_high(n)); @@ -485,14 +485,14 @@ ulint mach_dulint_get_much_compressed_size( /*=================================*/ /* out: compressed size in bytes */ - dulint n) /* in: dulint integer to be stored */ + dulint n) /* in: dulint integer to be stored */ { if (0 == ut_dulint_get_high(n)) { return(mach_get_compressed_size(ut_dulint_get_low(n))); } return(1 + mach_get_compressed_size(ut_dulint_get_high(n)) - + mach_get_compressed_size(ut_dulint_get_low(n))); + + mach_get_compressed_size(ut_dulint_get_low(n))); } /************************************************************* @@ -502,7 +502,7 @@ dulint mach_dulint_read_much_compressed( /*=============================*/ /* out: read dulint */ - byte* b) /* in: pointer to memory from where to read */ + byte* b) /* in: pointer to memory from where to read */ { ulint high; ulint low; @@ -521,7 +521,7 @@ mach_dulint_read_much_compressed( low = mach_read_compressed(b + size); - return(ut_dulint_create(high, low)); + return(ut_dulint_create(high, low)); } /************************************************************* @@ -531,9 +531,9 @@ double mach_double_read( /*=============*/ /* out: double read */ - byte* b) /* in: pointer to memory from where to read */ + byte* b) /* in: pointer to memory from where to read */ { - double d; + double d; ulint i; byte* ptr; @@ -547,7 +547,7 @@ mach_double_read( #endif } - return(d); + return(d); } /************************************************************* @@ -556,8 +556,8 @@ UNIV_INLINE void mach_double_write( /*==============*/ - byte* b, /* in: pointer to memory where to write */ - double d) /* in: double */ + byte* b, /* in: pointer to memory where to write */ + double d) /* in: double */ { ulint i; byte* ptr; @@ -578,11 +578,11 @@ Reads a float. It is stored in a little-endian format. */ UNIV_INLINE float mach_float_read( -/*=============*/ +/*============*/ /* out: float read */ - byte* b) /* in: pointer to memory from where to read */ + byte* b) /* in: pointer to memory from where to read */ { - float d; + float d; ulint i; byte* ptr; @@ -596,7 +596,7 @@ mach_float_read( #endif } - return(d); + return(d); } /************************************************************* @@ -604,9 +604,9 @@ Writes a float. It is stored in a little-endian format. */ UNIV_INLINE void mach_float_write( -/*==============*/ - byte* b, /* in: pointer to memory where to write */ - float d) /* in: float */ +/*=============*/ + byte* b, /* in: pointer to memory where to write */ + float d) /* in: float */ { ulint i; byte* ptr; @@ -639,7 +639,7 @@ mach_read_from_n_little_endian( ut_ad(buf_size > 0); ptr = buf + buf_size; - + for (;;) { ptr--; @@ -671,7 +671,7 @@ mach_write_to_n_little_endian( ut_ad(dest_size > 0); end = dest + dest_size; - + for (;;) { *dest = (byte)(n & 0xFF); @@ -681,7 +681,7 @@ mach_write_to_n_little_endian( if (dest == end) { break; - } + } } ut_ad(n == 0); diff --git a/storage/innobase/include/mem0dbg.h b/storage/innobase/include/mem0dbg.h index 96f30842df6..0f4441f4f9d 100644 --- a/storage/innobase/include/mem0dbg.h +++ b/storage/innobase/include/mem0dbg.h @@ -11,11 +11,11 @@ Created 6/9/1994 Heikki Tuuri check fields whose sizes are given below */ #ifdef UNIV_MEM_DEBUG -#define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\ +#define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\ UNIV_MEM_ALIGNMENT) -#define MEM_FIELD_TRAILER_SIZE sizeof(ulint) +#define MEM_FIELD_TRAILER_SIZE sizeof(ulint) #else -#define MEM_FIELD_HEADER_SIZE 0 +#define MEM_FIELD_HEADER_SIZE 0 #endif @@ -25,8 +25,7 @@ UNIV_MEM_ALIGNMENT. In the debug version there are also check fields at the both ends of the field. */ #ifdef UNIV_MEM_DEBUG #define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\ - + MEM_FIELD_TRAILER_SIZE,\ - UNIV_MEM_ALIGNMENT) + + MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT) #else #define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT) #endif @@ -41,23 +40,23 @@ of blocks. */ void mem_heap_validate_or_print( /*=======================*/ - mem_heap_t* heap, /* in: memory heap */ + mem_heap_t* heap, /* in: memory heap */ byte* top, /* in: calculate and validate only until this top pointer in the heap is reached, if this pointer is NULL, ignored */ - ibool print, /* in: if TRUE, prints the contents + ibool print, /* in: if TRUE, prints the contents of the heap; works only in the debug version */ - ibool* error, /* out: TRUE if error */ - ulint* us_size,/* out: allocated memory + ibool* error, /* out: TRUE if error */ + ulint* us_size,/* out: allocated memory (for the user) in the heap, if a NULL pointer is passed as this argument, it is ignored; in the non-debug version this is always -1 */ - ulint* ph_size,/* out: physical size of the heap, + ulint* ph_size,/* out: physical size of the heap, if a NULL pointer is passed as this argument, it is ignored */ - ulint* n_blocks); /* out: number of blocks in the heap, + ulint* n_blocks); /* out: number of blocks in the heap, if a NULL pointer is passed as this argument, it is ignored */ #ifdef UNIV_MEM_DEBUG @@ -115,7 +114,7 @@ the neighborhood of a given pointer. */ void mem_analyze_corruption( /*===================*/ - byte* ptr); /* in: pointer to place of possible corruption */ + void* ptr); /* in: pointer to place of possible corruption */ /********************************************************************* Prints information of dynamic memory usage and currently allocated memory heaps or buffers. Can only be used in the debug version. */ diff --git a/storage/innobase/include/mem0dbg.ic b/storage/innobase/include/mem0dbg.ic index 7ce5f6f1ba5..e8a34adb3fa 100644 --- a/storage/innobase/include/mem0dbg.ic +++ b/storage/innobase/include/mem0dbg.ic @@ -34,8 +34,8 @@ Used to initialize allocated memory. */ void mem_init_buf( /*=========*/ - byte* buf, /* in: pointer to buffer */ - ulint n); /* in: length of buffer */ + byte* buf, /* in: pointer to buffer */ + ulint n); /* in: length of buffer */ /******************************************************************* Initializes a buffer to a random combination of hex DE and AD. Used to erase freed memory.*/ @@ -43,8 +43,8 @@ Used to erase freed memory.*/ void mem_erase_buf( /*==========*/ - byte* buf, /* in: pointer to buffer */ - ulint n); /* in: length of buffer */ + byte* buf, /* in: pointer to buffer */ + ulint n); /* in: length of buffer */ /******************************************************************* Inserts a created memory heap to the hash table of current allocated memory heaps. diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index 399ab8a338e..e2f8be98b01 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -49,8 +49,8 @@ the size is not specified, i.e., 0 is given as the parameter in the call of create. The standard size is the maximum (payload) size of the blocks used for allocations of small buffers. */ -#define MEM_BLOCK_START_SIZE 64 -#define MEM_BLOCK_STANDARD_SIZE 8000 +#define MEM_BLOCK_START_SIZE 64 +#define MEM_BLOCK_STANDARD_SIZE 8000 /* If a memory heap is allowed to grow into the buffer pool, the following is the maximum size for a single allocated buffer: */ @@ -67,24 +67,21 @@ mem_init( Use this macro instead of the corresponding function! Macro for memory heap creation. */ -#define mem_heap_create(N) mem_heap_create_func(\ - (N), NULL, MEM_HEAP_DYNAMIC,\ - __FILE__, __LINE__) +#define mem_heap_create(N) mem_heap_create_func(\ + (N), NULL, MEM_HEAP_DYNAMIC, __FILE__, __LINE__) /****************************************************************** Use this macro instead of the corresponding function! Macro for memory heap creation. */ #define mem_heap_create_in_buffer(N) mem_heap_create_func(\ - (N), NULL, MEM_HEAP_BUFFER,\ - __FILE__, __LINE__) + (N), NULL, MEM_HEAP_BUFFER, __FILE__, __LINE__) /****************************************************************** Use this macro instead of the corresponding function! Macro for memory heap creation. */ -#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\ - (N), NULL, MEM_HEAP_BTR_SEARCH |\ - MEM_HEAP_BUFFER,\ - __FILE__, __LINE__) +#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\ + (N), NULL, MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER,\ + __FILE__, __LINE__) /****************************************************************** Use this macro instead of the corresponding function! Macro for fast memory heap creation. An initial block of memory B is given by the @@ -92,8 +89,7 @@ caller, N is its size, and this memory block is not freed by mem_heap_free. See the parameter comment in mem_heap_create_func below. */ #define mem_heap_fast_create(N, B) mem_heap_create_func(\ - (N), (B), MEM_HEAP_DYNAMIC,\ - __FILE__, __LINE__) + (N), (B), MEM_HEAP_DYNAMIC, __FILE__, __LINE__) /****************************************************************** Use this macro instead of the corresponding function! Macro for memory @@ -114,7 +110,7 @@ mem_heap_create_func( MEM_HEAP_BTR_SEARCH type heaps)*/ ulint n, /* in: desired start block size, this means that a single user buffer - of size n will fit in the block, + of size n will fit in the block, 0 creates a default size block; if init_block is not NULL, n tells its size in bytes */ @@ -128,7 +124,7 @@ mem_heap_create_func( block is not unintentionally erased (if allocated in the stack), before the memory heap is explicitly freed. */ - ulint type, /* in: heap type */ + ulint type, /* in: heap type */ const char* file_name, /* in: file name where created */ ulint line); /* in: line where created */ /********************************************************************* @@ -139,9 +135,9 @@ UNIV_INLINE void mem_heap_free_func( /*===============*/ - mem_heap_t* heap, /* in, own: heap to be freed */ - const char* file_name, /* in: file name where freed */ - ulint line); /* in: line where freed */ + mem_heap_t* heap, /* in, own: heap to be freed */ + const char* file_name, /* in: file name where freed */ + ulint line); /* in: line where freed */ /******************************************************************* Allocates n bytes of memory from a memory heap. */ UNIV_INLINE @@ -151,8 +147,8 @@ mem_heap_alloc( /* out: allocated storage, NULL if did not succeed (only possible for MEM_HEAP_BTR_SEARCH type heaps) */ - mem_heap_t* heap, /* in: memory heap */ - ulint n); /* in: number of bytes; if the heap is allowed + mem_heap_t* heap, /* in: memory heap */ + ulint n); /* in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be <= MEM_MAX_ALLOC_IN_BUF */ /********************************************************************* @@ -160,9 +156,9 @@ Returns a pointer to the heap top. */ UNIV_INLINE byte* mem_heap_get_heap_top( -/*==================*/ +/*==================*/ /* out: pointer to the heap top */ - mem_heap_t* heap); /* in: memory heap */ + mem_heap_t* heap); /* in: memory heap */ /********************************************************************* Frees the space in a memory heap exceeding the pointer given. The pointer must have been acquired from mem_heap_get_heap_top. The first @@ -171,7 +167,7 @@ UNIV_INLINE void mem_heap_free_heap_top( /*===================*/ - mem_heap_t* heap, /* in: heap from which to free */ + mem_heap_t* heap, /* in: heap from which to free */ byte* old_top);/* in: pointer to old top of heap */ /********************************************************************* Empties a memory heap. The first memory block of the heap is not freed. */ @@ -179,48 +175,48 @@ UNIV_INLINE void mem_heap_empty( /*===========*/ - mem_heap_t* heap); /* in: heap to empty */ + mem_heap_t* heap); /* in: heap to empty */ /********************************************************************* Returns a pointer to the topmost element in a memory heap. The size of the element must be given. */ UNIV_INLINE void* mem_heap_get_top( -/*=============*/ +/*=============*/ /* out: pointer to the topmost element */ - mem_heap_t* heap, /* in: memory heap */ - ulint n); /* in: size of the topmost element */ + mem_heap_t* heap, /* in: memory heap */ + ulint n); /* in: size of the topmost element */ /********************************************************************* Frees the topmost element in a memory heap. The size of the element must be given. */ UNIV_INLINE void mem_heap_free_top( -/*==============*/ - mem_heap_t* heap, /* in: memory heap */ - ulint n); /* in: size of the topmost element */ +/*==============*/ + mem_heap_t* heap, /* in: memory heap */ + ulint n); /* in: size of the topmost element */ /********************************************************************* Returns the space in bytes occupied by a memory heap. */ UNIV_INLINE ulint mem_heap_get_size( /*==============*/ - mem_heap_t* heap); /* in: heap */ + mem_heap_t* heap); /* in: heap */ /****************************************************************** Use this macro instead of the corresponding function! Macro for memory buffer allocation */ -#define mem_alloc(N) mem_alloc_func((N), __FILE__, __LINE__) +#define mem_alloc(N) mem_alloc_func((N), __FILE__, __LINE__) /****************************************************************** Use this macro instead of the corresponding function! Macro for memory buffer allocation */ -#define mem_alloc_noninline(N) mem_alloc_func_noninline(\ +#define mem_alloc_noninline(N) mem_alloc_func_noninline(\ (N), __FILE__, __LINE__) /******************************************************************* NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of -the C compiler. Is like malloc of C. The buffer must be freed +the C compiler. Is like malloc of C. The buffer must be freed with mem_free. */ UNIV_INLINE void* @@ -234,7 +230,7 @@ mem_alloc_func( /******************************************************************* NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of -the C compiler. Is like malloc of C. The buffer must be freed +the C compiler. Is like malloc of C. The buffer must be freed with mem_free. */ void* @@ -249,7 +245,7 @@ mem_alloc_func_noninline( Use this macro instead of the corresponding function! Macro for memory buffer freeing */ -#define mem_free(PTR) mem_free_func((PTR), __FILE__, __LINE__) +#define mem_free(PTR) mem_free_func((PTR), __FILE__, __LINE__) /******************************************************************* NOTE: Use the corresponding macro instead of this function. Frees a single buffer of storage from @@ -326,11 +322,11 @@ mem_validate_all_blocks(void); #endif /*#######################################################################*/ - + /* The info header of a block in a memory heap */ struct mem_block_info_struct { - ulint magic_n;/* magic number for debugging */ + ulint magic_n;/* magic number for debugging */ char file_name[8];/* file name where the mem heap was created */ ulint line; /* line number where the mem heap was created */ UT_LIST_BASE_NODE_T(mem_block_t) base; /* In the first block in the @@ -340,23 +336,23 @@ struct mem_block_info_struct { and prev in the list. The first block allocated to the heap is also the first block in this list, though it also contains the base node of the list. */ - ulint len; /* physical length of this block in bytes */ - ulint type; /* type of heap: MEM_HEAP_DYNAMIC, or + ulint len; /* physical length of this block in bytes */ + ulint type; /* type of heap: MEM_HEAP_DYNAMIC, or MEM_HEAP_BUF possibly ORed to MEM_HEAP_BTR_SEARCH */ ibool init_block; /* TRUE if this is the first block used in fast creation of a heap: the memory will be freed by the creator, not by mem_heap_free */ - ulint free; /* offset in bytes of the first free position for + ulint free; /* offset in bytes of the first free position for user data in the block */ - ulint start; /* the value of the struct field 'free' at the + ulint start; /* the value of the struct field 'free' at the creation of the block */ - byte* free_block; + byte* free_block; /* if the MEM_HEAP_BTR_SEARCH bit is set in type, and this is the heap root, this can contain an allocated buffer frame, which can be appended as a free block to the heap, if we need more space; otherwise, this is NULL */ -#ifdef MEM_PERIODIC_CHECK +#ifdef MEM_PERIODIC_CHECK UT_LIST_NODE_T(mem_block_t) mem_block_list; /* List of all mem blocks allocated; protected by the mem_comm_pool mutex */ @@ -367,7 +363,7 @@ struct mem_block_info_struct { #define MEM_FREED_BLOCK_MAGIC_N 547711122 /* Header size for a memory heap block */ -#define MEM_BLOCK_HEADER_SIZE ut_calc_align(sizeof(mem_block_info_t),\ +#define MEM_BLOCK_HEADER_SIZE ut_calc_align(sizeof(mem_block_info_t),\ UNIV_MEM_ALIGNMENT) #include "mem0dbg.h" @@ -375,4 +371,4 @@ struct mem_block_info_struct { #include "mem0mem.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 291b68723b4..db0ab7aba8c 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -53,7 +53,7 @@ mem_heap_add_block( /* out: created block, NULL if did not succeed (only possible for MEM_HEAP_BTR_SEARCH type heaps)*/ - mem_heap_t* heap, /* in: memory heap */ + mem_heap_t* heap, /* in: memory heap */ ulint n); /* in: number of bytes user needs */ UNIV_INLINE @@ -131,25 +131,25 @@ mem_heap_alloc( /* out: allocated storage, NULL if did not succeed (only possible for MEM_HEAP_BTR_SEARCH type heaps) */ - mem_heap_t* heap, /* in: memory heap */ - ulint n) /* in: number of bytes; if the heap is allowed + mem_heap_t* heap, /* in: memory heap */ + ulint n) /* in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be <= MEM_MAX_ALLOC_IN_BUF */ { mem_block_t* block; void* buf; ulint free; - + ut_ad(mem_heap_check(heap)); block = UT_LIST_GET_LAST(heap->base); ut_ad(!(block->type & MEM_HEAP_BUFFER) || (n <= MEM_MAX_ALLOC_IN_BUF)); - + /* Check if there is enough space in block. If not, create a new block to the heap */ - if (mem_block_get_len(block) + if (mem_block_get_len(block) < mem_block_get_free(block) + MEM_SPACE_NEEDED(n)) { block = mem_heap_add_block(heap, n); @@ -187,13 +187,13 @@ Returns a pointer to the heap top. */ UNIV_INLINE byte* mem_heap_get_heap_top( -/*==================*/ +/*==================*/ /* out: pointer to the heap top */ - mem_heap_t* heap) /* in: memory heap */ + mem_heap_t* heap) /* in: memory heap */ { mem_block_t* block; byte* buf; - + ut_ad(mem_heap_check(heap)); block = UT_LIST_GET_LAST(heap->base); @@ -201,7 +201,7 @@ mem_heap_get_heap_top( buf = (byte*)block + mem_block_get_free(block); return(buf); -} +} /********************************************************************* Frees the space in a memory heap exceeding the pointer given. The @@ -211,19 +211,19 @@ UNIV_INLINE void mem_heap_free_heap_top( /*===================*/ - mem_heap_t* heap, /* in: heap from which to free */ + mem_heap_t* heap, /* in: heap from which to free */ byte* old_top)/* in: pointer to old top of heap */ { mem_block_t* block; mem_block_t* prev_block; #ifdef UNIV_MEM_DEBUG ibool error; - ulint total_size; + ulint total_size; ulint size; -#endif +#endif ut_ad(mem_heap_check(heap)); - + #ifdef UNIV_MEM_DEBUG /* Validate the heap and get its total allocated size */ @@ -247,7 +247,7 @@ mem_heap_free_heap_top( break; } - + /* Store prev_block value before freeing the current block (the current block will be erased in freeing) */ @@ -257,17 +257,17 @@ mem_heap_free_heap_top( block = prev_block; } - + ut_ad(block); /* Set the free field of block */ - mem_block_set_free(block, old_top - (byte*)block); + mem_block_set_free(block, old_top - (byte*)block); #ifdef UNIV_MEM_DEBUG ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); /* In the debug version erase block from top up */ - + mem_erase_buf(old_top, (byte*)block + block->len - old_top); /* Update allocated memory count */ @@ -279,9 +279,9 @@ mem_heap_free_heap_top( /* If free == start, we may free the block if it is not the first one */ - - if ((heap != block) && (mem_block_get_free(block) == - mem_block_get_start(block))) { + + if ((heap != block) && (mem_block_get_free(block) == + mem_block_get_start(block))) { mem_heap_block_free(heap, block); } } @@ -292,14 +292,14 @@ UNIV_INLINE void mem_heap_empty( /*===========*/ - mem_heap_t* heap) /* in: heap to empty */ + mem_heap_t* heap) /* in: heap to empty */ { mem_heap_free_heap_top(heap, (byte*)heap + mem_block_get_start(heap)); if (heap->free_block) { mem_heap_free_block_free(heap); } -} +} /********************************************************************* Returns a pointer to the topmost element in a memory heap. The size of the @@ -307,14 +307,14 @@ element must be given. */ UNIV_INLINE void* mem_heap_get_top( -/*=============*/ +/*=============*/ /* out: pointer to the topmost element */ - mem_heap_t* heap, /* in: memory heap */ - ulint n) /* in: size of the topmost element */ + mem_heap_t* heap, /* in: memory heap */ + ulint n) /* in: size of the topmost element */ { mem_block_t* block; void* buf; - + ut_ad(mem_heap_check(heap)); block = UT_LIST_GET_LAST(heap->base); @@ -326,7 +326,7 @@ mem_heap_get_top( /* In the debug version, advance buf to point at the storage which was given to the caller in the allocation*/ - + buf = (byte*)buf + MEM_FIELD_HEADER_SIZE; /* Check that the field lengths agree */ @@ -334,7 +334,7 @@ mem_heap_get_top( #endif return(buf); -} +} /********************************************************************* Frees the topmost element in a memory heap. The size of the element must be @@ -342,12 +342,12 @@ given. */ UNIV_INLINE void mem_heap_free_top( -/*==============*/ - mem_heap_t* heap, /* in: memory heap */ - ulint n) /* in: size of the topmost element */ +/*==============*/ + mem_heap_t* heap, /* in: memory heap */ + ulint n) /* in: size of the topmost element */ { mem_block_t* block; - + ut_ad(mem_heap_check(heap)); block = UT_LIST_GET_LAST(heap->base); @@ -365,9 +365,9 @@ mem_heap_free_top( /* If free == start, we may free the block if it is not the first one */ - - if ((heap != block) && (mem_block_get_free(block) == - mem_block_get_start(block))) { + + if ((heap != block) && (mem_block_get_free(block) == + mem_block_get_start(block))) { mem_heap_block_free(heap, block); } } @@ -385,7 +385,7 @@ mem_heap_create_func( MEM_HEAP_BTR_SEARCH type heaps)*/ ulint n, /* in: desired start block size, this means that a single user buffer - of size n will fit in the block, + of size n will fit in the block, 0 creates a default size block; if init_block is not NULL, n tells its size in bytes */ @@ -399,25 +399,25 @@ mem_heap_create_func( block is not unintentionally erased (if allocated in the stack), before the memory heap is explicitly freed. */ - ulint type, /* in: heap type */ + ulint type, /* in: heap type */ const char* file_name, /* in: file name where created */ ulint line) /* in: line where created */ { - mem_block_t* block; + mem_block_t* block; if (n > 0) { block = mem_heap_create_block(NULL, n, init_block, type, file_name, line); } else { - block = mem_heap_create_block(NULL, MEM_BLOCK_START_SIZE, + block = mem_heap_create_block(NULL, MEM_BLOCK_START_SIZE, init_block, type, file_name, line); } if (block == NULL) { - + return(NULL); } - + UT_LIST_INIT(block->base); /* Add the created block itself as the first block in the list */ @@ -428,7 +428,7 @@ mem_heap_create_func( mem_hash_insert(block, file_name, line); #endif - + return(block); } @@ -440,16 +440,16 @@ UNIV_INLINE void mem_heap_free_func( /*===============*/ - mem_heap_t* heap, /* in, own: heap to be freed */ + mem_heap_t* heap, /* in, own: heap to be freed */ const char* file_name __attribute__((unused)), /* in: file name where freed */ - ulint line __attribute__((unused))) + ulint line __attribute__((unused))) { mem_block_t* block; mem_block_t* prev_block; ut_ad(mem_heap_check(heap)); - + block = UT_LIST_GET_LAST(heap->base); #ifdef UNIV_MEM_DEBUG @@ -457,15 +457,15 @@ mem_heap_free_func( /* In the debug version remove the heap from the hash table of heaps and check its consistency */ - mem_hash_remove(heap, file_name, line); + mem_hash_remove(heap, file_name, line); #endif - + if (heap->free_block) { mem_heap_free_block_free(heap); } - while (block != NULL) { + while (block != NULL) { /* Store the contents of info before freeing current block (it is erased in freeing) */ @@ -480,7 +480,7 @@ mem_heap_free_func( /******************************************************************* NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of -the C compiler. Is like malloc of C. The buffer must be freed +the C compiler. Is like malloc of C. The buffer must be freed with mem_free. */ UNIV_INLINE void* @@ -492,8 +492,8 @@ mem_alloc_func( ulint line /* in: line where created */ ) { - mem_heap_t* heap; - void* buf; + mem_heap_t* heap; + void* buf; heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name, line); @@ -523,10 +523,10 @@ mem_free_func( ulint line /* in: line where created */ ) { - mem_heap_t* heap; + mem_heap_t* heap; heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE - - MEM_FIELD_HEADER_SIZE); + - MEM_FIELD_HEADER_SIZE); mem_heap_free_func(heap, file_name, line); } @@ -536,16 +536,16 @@ UNIV_INLINE ulint mem_heap_get_size( /*==============*/ - mem_heap_t* heap) /* in: heap */ + mem_heap_t* heap) /* in: heap */ { - mem_block_t* block; - ulint size = 0; + mem_block_t* block; + ulint size = 0; ut_ad(mem_heap_check(heap)); - + block = heap; - while (block != NULL) { + while (block != NULL) { size += mem_block_get_len(block); block = UT_LIST_GET_NEXT(list, block); diff --git a/storage/innobase/include/mem0pool.h b/storage/innobase/include/mem0pool.h index 43707bd5f61..bf659ca9a72 100644 --- a/storage/innobase/include/mem0pool.h +++ b/storage/innobase/include/mem0pool.h @@ -25,14 +25,14 @@ struct mem_area_struct{ ulint size_and_free; /* memory area size is obtained by anding with ~MEM_AREA_FREE; area in a free list if ANDing with - MEM_AREA_FREE results in nonzero */ + MEM_AREA_FREE results in nonzero */ UT_LIST_NODE_T(mem_area_t) free_list; /* free list node */ }; /* Each memory area takes this many extra bytes for control information */ #define MEM_AREA_EXTRA_SIZE (ut_calc_align(sizeof(struct mem_area_struct),\ - UNIV_MEM_ALIGNMENT)) + UNIV_MEM_ALIGNMENT)) /************************************************************************ Creates a memory pool. */ @@ -97,7 +97,7 @@ Prints info of a memory pool. */ void mem_pool_print_info( /*================*/ - FILE* outfile,/* in: output file to write to */ + FILE* outfile,/* in: output file to write to */ mem_pool_t* pool); /* in: memory pool */ @@ -105,4 +105,4 @@ mem_pool_print_info( #include "mem0pool.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic index 08d9a6448eb..1a5ef033f87 100644 --- a/storage/innobase/include/mtr0log.ic +++ b/storage/innobase/include/mtr0log.ic @@ -73,10 +73,18 @@ mlog_catenate_ulint( mlog = &(mtr->log); - ut_ad(MLOG_1BYTE == 1); - ut_ad(MLOG_2BYTES == 2); - ut_ad(MLOG_4BYTES == 4); - +#if MLOG_1BYTE != 1 +# error "MLOG_1BYTE != 1" +#endif +#if MLOG_2BYTES != 2 +# error "MLOG_2BYTES != 2" +#endif +#if MLOG_4BYTES != 4 +# error "MLOG_4BYTES != 4" +#endif +#if MLOG_8BYTES != 8 +# error "MLOG_8BYTES != 8" +#endif ptr = dyn_array_push(mlog, type); if (type == MLOG_4BYTES) { @@ -86,7 +94,7 @@ mlog_catenate_ulint( } else { ut_ad(type == MLOG_1BYTE); mach_write_to_1(ptr, val); - } + } } /************************************************************ @@ -156,7 +164,7 @@ mlog_write_initial_log_record_fast( ulint space; ulint offset; - ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), + ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), MTR_MEMO_PAGE_X_FIX)); ut_ad(type <= MLOG_BIGGEST_TYPE); ut_ad(ptr && log_ptr); @@ -167,7 +175,7 @@ mlog_write_initial_log_record_fast( offset = buf_block_get_page_no(block); mach_write_to_1(log_ptr, type); - log_ptr++; + log_ptr++; log_ptr += mach_write_compressed(log_ptr, space); log_ptr += mach_write_compressed(log_ptr, offset); @@ -188,7 +196,7 @@ mlog_write_initial_log_record_fast( } #endif return(log_ptr); -} +} /************************************************************ Writes a log record about an .ibd file create/delete/rename. */ @@ -216,4 +224,4 @@ mlog_write_initial_log_record_for_file_op( mtr->n_log_recs++; return(log_ptr); -} +} diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index f44e813cf6b..3167ea3bc03 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -27,7 +27,7 @@ Created 11/26/1995 Heikki Tuuri (operations in fsp0fsp.* ) */ #define MTR_LOG_SHORT_INSERTS 24 /* inserts are logged in a shorter form */ - + /* Types for the mlock objects to store in the mtr memo; NOTE that the first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */ #define MTR_MEMO_PAGE_S_FIX RW_S_LATCH @@ -47,31 +47,31 @@ flag value must give the length also! */ has been called only once, this flag is ORed to the type of that first log record */ -#define MLOG_1BYTE ((byte)1) /* one byte is written */ -#define MLOG_2BYTES ((byte)2) /* 2 bytes ... */ -#define MLOG_4BYTES ((byte)4) /* 4 bytes ... */ -#define MLOG_8BYTES ((byte)8) /* 8 bytes ... */ +#define MLOG_1BYTE (1) /* one byte is written */ +#define MLOG_2BYTES (2) /* 2 bytes ... */ +#define MLOG_4BYTES (4) /* 4 bytes ... */ +#define MLOG_8BYTES (8) /* 8 bytes ... */ #define MLOG_REC_INSERT ((byte)9) /* record insert */ -#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /* mark clustered index record +#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /* mark clustered index record deleted */ -#define MLOG_REC_SEC_DELETE_MARK ((byte)11) /* mark secondary index record +#define MLOG_REC_SEC_DELETE_MARK ((byte)11) /* mark secondary index record deleted */ #define MLOG_REC_UPDATE_IN_PLACE ((byte)13) /* update of a record, preserves record field sizes */ #define MLOG_REC_DELETE ((byte)14) /* delete a record from a page */ -#define MLOG_LIST_END_DELETE ((byte)15) /* delete record list end on +#define MLOG_LIST_END_DELETE ((byte)15) /* delete record list end on index page */ -#define MLOG_LIST_START_DELETE ((byte)16) /* delete record list start on +#define MLOG_LIST_START_DELETE ((byte)16) /* delete record list start on index page */ -#define MLOG_LIST_END_COPY_CREATED ((byte)17) /* copy record list end to a +#define MLOG_LIST_END_COPY_CREATED ((byte)17) /* copy record list end to a new created index page */ -#define MLOG_PAGE_REORGANIZE ((byte)18) /* reorganize an index page */ -#define MLOG_PAGE_CREATE ((byte)19) /* create an index page */ -#define MLOG_UNDO_INSERT ((byte)20) /* insert entry in an undo +#define MLOG_PAGE_REORGANIZE ((byte)18) /* reorganize an index page */ +#define MLOG_PAGE_CREATE ((byte)19) /* create an index page */ +#define MLOG_UNDO_INSERT ((byte)20) /* insert entry in an undo log */ #define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log page end */ -#define MLOG_UNDO_INIT ((byte)22) /* initialize a page in an +#define MLOG_UNDO_INIT ((byte)22) /* initialize a page in an undo log */ #define MLOG_UNDO_HDR_DISCARD ((byte)23) /* discard an update undo log header */ @@ -132,9 +132,9 @@ flag value must give the length also! */ #define MLOG_BIGGEST_TYPE ((byte)46) /* biggest value (used in asserts) */ - + /******************************************************************* -Starts a mini-transaction and creates a mini-transaction handle +Starts a mini-transaction and creates a mini-transaction handle and buffer in the memory buffer given by the caller. */ UNIV_INLINE mtr_t* @@ -144,7 +144,7 @@ mtr_start( the mtr handle */ mtr_t* mtr); /* in: memory buffer for the mtr buffer */ /******************************************************************* -Starts a mini-transaction and creates a mini-transaction handle +Starts a mini-transaction and creates a mini-transaction handle and buffer in the memory buffer given by the caller. */ mtr_t* @@ -187,7 +187,7 @@ mtr_release_s_latch_at_savepoint( /*=============================*/ mtr_t* mtr, /* in: mtr */ ulint savepoint, /* in: savepoint */ - rw_lock_t* lock); /* in: latch to release */ + rw_lock_t* lock); /* in: latch to release */ /******************************************************************* Gets the logging mode of a mini-transaction. */ UNIV_INLINE @@ -220,7 +220,7 @@ Reads 8 bytes from a file page buffered in the buffer pool. */ dulint mtr_read_dulint( -/*===========*/ +/*============*/ /* out: value read */ byte* ptr, /* in: pointer from where to read */ mtr_t* mtr); /* in: mini-transaction handle */ @@ -336,7 +336,7 @@ struct mtr_struct{ #define MTR_ACTIVE 12231 #define MTR_COMMITTING 56456 #define MTR_COMMITTED 34676 - + #ifndef UNIV_NONINL #include "mtr0mtr.ic" #endif diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index 4fc6dd2f6a9..d81f6cb9c0d 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -11,7 +11,7 @@ Created 11/26/1995 Heikki Tuuri #include "mach0data.h" /******************************************************************* -Starts a mini-transaction and creates a mini-transaction handle +Starts a mini-transaction and creates a mini-transaction handle and a buffer in the memory buffer given by the caller. */ UNIV_INLINE mtr_t* @@ -33,7 +33,7 @@ mtr_start( mtr->magic_n = MTR_MAGIC_N; #endif return(mtr); -} +} /******************************************************* Pushes an object to an mtr memo stack. */ @@ -49,12 +49,12 @@ mtr_memo_push( mtr_memo_slot_t* slot; ut_ad(object); - ut_ad(type >= MTR_MEMO_PAGE_S_FIX); + ut_ad(type >= MTR_MEMO_PAGE_S_FIX); ut_ad(type <= MTR_MEMO_X_LOCK); ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); - memo = &(mtr->memo); + memo = &(mtr->memo); slot = dyn_array_push(memo, sizeof(mtr_memo_slot_t)); @@ -72,11 +72,11 @@ mtr_set_savepoint( mtr_t* mtr) /* in: mtr */ { dyn_array_t* memo; - + ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); - memo = &(mtr->memo); + memo = &(mtr->memo); return(dyn_array_get_data_size(memo)); } @@ -90,11 +90,11 @@ mtr_release_s_latch_at_savepoint( /*=============================*/ mtr_t* mtr, /* in: mtr */ ulint savepoint, /* in: savepoint */ - rw_lock_t* lock) /* in: latch to release */ + rw_lock_t* lock) /* in: latch to release */ { mtr_memo_slot_t* slot; dyn_array_t* memo; - + ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); ut_ad(mtr->state == MTR_ACTIVE); @@ -102,7 +102,7 @@ mtr_release_s_latch_at_savepoint( memo = &(mtr->memo); ut_ad(dyn_array_get_data_size(memo) > savepoint); - + slot = dyn_array_get_element(memo, savepoint); ut_ad(slot->object == lock); diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 224fd59a76b..4ab7fda7358 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -28,8 +28,8 @@ extern ibool os_aio_print_debug; extern ulint os_file_n_pending_preads; extern ulint os_file_n_pending_pwrites; -extern ulint os_n_pending_reads; -extern ulint os_n_pending_writes; +extern ulint os_n_pending_reads; +extern ulint os_n_pending_writes; #ifdef __WIN__ @@ -75,7 +75,7 @@ log. */ #define OS_FILE_OPEN_RETRY 56 /* for os_file_create() on the first ibdata file */ -#define OS_FILE_READ_ONLY 333 +#define OS_FILE_READ_ONLY 333 #define OS_FILE_READ_WRITE 444 #define OS_FILE_READ_ALLOW_DELETE 555 /* for ibbackup */ @@ -91,9 +91,10 @@ log. */ #define OS_FILE_NOT_FOUND 71 #define OS_FILE_DISK_FULL 72 #define OS_FILE_ALREADY_EXISTS 73 -#define OS_FILE_AIO_RESOURCES_RESERVED 74 /* wait for OS aio resources +#define OS_FILE_PATH_ERROR 74 +#define OS_FILE_AIO_RESOURCES_RESERVED 75 /* wait for OS aio resources to become available again */ -#define OS_FILE_ERROR_NOT_SPECIFIED 75 +#define OS_FILE_ERROR_NOT_SPECIFIED 76 /* Types for aio operations */ #define OS_FILE_READ 10 @@ -109,7 +110,7 @@ log. */ pages or ibuf bitmap pages */ #define OS_AIO_IBUF 22 /* Asynchronous i/o for ibuf pages or ibuf bitmap pages */ -#define OS_AIO_LOG 23 /* Asynchronous i/o for the log */ +#define OS_AIO_LOG 23 /* Asynchronous i/o for the log */ #define OS_AIO_SYNC 24 /* Asynchronous i/o where the calling thread will itself wait for the i/o to complete, doing also the job of the i/o-handler thread; @@ -124,12 +125,12 @@ log. */ in the call of os_aio(...), if the caller wants to post several i/o requests in a batch, and only after that - wake the i/o-handler thread; this has - effect only in simulated aio */ -#define OS_WIN31 1 -#define OS_WIN95 2 -#define OS_WINNT 3 -#define OS_WIN2000 4 + wake the i/o-handler thread; this has + effect only in simulated aio */ +#define OS_WIN31 1 +#define OS_WIN95 2 +#define OS_WINNT 3 +#define OS_WIN2000 4 extern ulint os_n_file_reads; extern ulint os_n_file_writes; @@ -138,10 +139,10 @@ extern ulint os_n_fsyncs; /* File types for directory entry data type */ enum os_file_type_enum{ - OS_FILE_TYPE_UNKNOWN = 0, - OS_FILE_TYPE_FILE, /* regular file */ - OS_FILE_TYPE_DIR, /* directory */ - OS_FILE_TYPE_LINK /* symbolic link */ + OS_FILE_TYPE_UNKNOWN = 0, + OS_FILE_TYPE_FILE, /* regular file */ + OS_FILE_TYPE_DIR, /* directory */ + OS_FILE_TYPE_LINK /* symbolic link */ }; typedef enum os_file_type_enum os_file_type_t; @@ -156,14 +157,14 @@ struct os_file_stat_struct{ char name[OS_FILE_MAX_PATH]; /* path to a file */ os_file_type_t type; /* file type */ ib_longlong size; /* file size */ - time_t ctime; /* creation time */ + time_t ctime; /* creation time */ time_t mtime; /* modification time */ time_t atime; /* access time */ }; typedef struct os_file_stat_struct os_file_stat_t; #ifdef __WIN__ -typedef HANDLE os_file_dir_t; /* directory stream */ +typedef HANDLE os_file_dir_t; /* directory stream */ #else typedef DIR* os_file_dir_t; /* directory stream */ #endif @@ -174,7 +175,7 @@ Gets the operating system version. Currently works only on Windows. */ ulint os_get_os_version(void); /*===================*/ - /* out: OS_WIN95, OS_WIN31, OS_WINNT, or OS_WIN2000 */ + /* out: OS_WIN95, OS_WIN31, OS_WINNT, or OS_WIN2000 */ /******************************************************************** Creates the seek mutexes used in positioned reads and writes. */ @@ -182,12 +183,15 @@ void os_io_init_simple(void); /*===================*/ /*************************************************************************** -Creates a temporary file. */ +Creates a temporary file. This function is like tmpfile(3), but +the temporary file is created in the MySQL temporary directory. +On Netware, this function is like tmpfile(3), because the C run-time +library of Netware does not expose the delete-on-close flag. */ FILE* os_file_create_tmpfile(void); /*========================*/ - /* out: temporary file handle (never NULL) */ + /* out: temporary file handle, or NULL on error */ /*************************************************************************** The os_file_opendir() function opens a directory stream corresponding to the directory named by the dirname argument. The directory stream is positioned @@ -256,7 +260,7 @@ os_file_create_simple( opened (if does not exist, error), or OS_FILE_CREATE if a new file is created (if exists, error), or - OS_FILE_CREATE_PATH if new file + OS_FILE_CREATE_PATH if new file (if exists, error) and subdirectories along its path are created (if needed)*/ ulint access_type,/* in: OS_FILE_READ_ONLY or @@ -430,7 +434,7 @@ os_file_read( offset where to read */ ulint offset_high,/* in: most significant 32 bits of offset */ - ulint n); /* in: number of bytes to read */ + ulint n); /* in: number of bytes to read */ /*********************************************************************** Rewind file to its start, read at most size - 1 bytes from it to str, and NUL-terminate str. All errors are silently ignored. This function is @@ -457,7 +461,7 @@ os_file_read_no_error_handling( offset where to read */ ulint offset_high,/* in: most significant 32 bits of offset */ - ulint n); /* in: number of bytes to read */ + ulint n); /* in: number of bytes to read */ /*********************************************************************** Requests a synchronous write operation. */ @@ -475,7 +479,7 @@ os_file_write( offset where to write */ ulint offset_high,/* in: most significant 32 bits of offset */ - ulint n); /* in: number of bytes to write */ + ulint n); /* in: number of bytes to write */ /*********************************************************************** Check the existence and type of the given file. */ @@ -483,7 +487,7 @@ ibool os_file_status( /*===========*/ /* out: TRUE if call succeeded */ - const char* path, /* in: pathname of the file */ + const char* path, /* in: pathname of the file */ ibool* exists, /* out: TRUE if file exists */ os_file_type_t* type); /* out: type of the file (if it exists) */ /******************************************************************** @@ -500,18 +504,18 @@ yields a complete pathname. The return value is a copy of the directory component of the pathname. The copy is allocated from heap. It is the caller responsibility -to free it after it is no longer needed. +to free it after it is no longer needed. The following list of examples (taken from SUSv2) shows the strings returned by dirname and basename for different paths: - path dirname basename - "/usr/lib" "/usr" "lib" - "/usr/" "/" "usr" - "usr" "." "usr" - "/" "/" "/" - "." "." "." - ".." "." ".." + path dirname basename + "/usr/lib" "/usr" "lib" + "/usr/" "/" "usr" + "usr" "." "usr" + "/" "/" "/" + "." "." "." + ".." "." ".." */ char* @@ -522,7 +526,7 @@ os_file_dirname( const char* path); /* in: pathname */ /******************************************************************** Creates all missing subdirectories along the given path. */ - + ibool os_file_create_subdirs_if_needed( /*=============================*/ @@ -577,7 +581,7 @@ os_aio( offset where to read or write */ ulint offset_high, /* in: most significant 32 bits of offset */ - ulint n, /* in: number of bytes to read or write */ + ulint n, /* in: number of bytes to read or write */ fil_node_t* message1,/* in: messages for the aio handler (these can be used to identify a completed aio operation); if mode is OS_AIO_SYNC, these @@ -635,7 +639,7 @@ os_aio_windows_handle( sync aio is used, and this parameter is ignored */ ulint pos, /* this parameter is used only in sync aio: - wait for the aio slot at this position */ + wait for the aio slot at this position */ fil_node_t**message1, /* out: the messages passed with the aio request; note that also in the case where the aio operation failed, these output @@ -720,7 +724,7 @@ ibool os_file_get_status( /*===============*/ /* out: TRUE if stat information found */ - const char* path, /* in: pathname of the file */ + const char* path, /* in: pathname of the file */ os_file_stat_t* stat_info); /* information of a file in a directory */ -#endif +#endif diff --git a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h index b0b72e18675..f54e08de7ee 100644 --- a/storage/innobase/include/os0proc.h +++ b/storage/innobase/include/os0proc.h @@ -116,20 +116,21 @@ Allocates large pages memory. */ void* os_mem_alloc_large( -/*=================*/ - /* out: allocated memory */ - ulint n, /* in: number of bytes */ - ibool set_to_zero, /* in: TRUE if allocated memory should be set - to zero if UNIV_SET_MEM_TO_ZERO is defined */ - ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory - cannot be allocated */ +/*===============*/ + /* out: allocated memory */ + ulint n, /* in: number of bytes */ + ibool set_to_zero, /* in: TRUE if allocated memory + should be set to zero if + UNIV_SET_MEM_TO_ZERO is defined */ + ibool assert_on_error);/* in: if TRUE, we crash mysqld if + the memory cannot be allocated */ /******************************************************************** Frees large pages memory. */ void os_mem_free_large( -/*=================*/ -void *ptr); /* in: number of bytes */ +/*==============*/ +void *ptr); /* in: number of bytes */ /******************************************************************** Sets the priority boost for threads released from waiting within the current process. */ @@ -144,4 +145,4 @@ os_process_set_priority_boost( #include "os0proc.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h index d27b1676f1b..0239cc853ed 100644 --- a/storage/innobase/include/os0sync.h +++ b/storage/innobase/include/os0sync.h @@ -16,10 +16,10 @@ Created 9/6/1995 Heikki Tuuri #define os_fast_mutex_t CRITICAL_SECTION -typedef HANDLE os_native_event_t; +typedef HANDLE os_native_event_t; -typedef struct os_event_struct os_event_struct_t; -typedef os_event_struct_t* os_event_t; +typedef struct os_event_struct os_event_struct_t; +typedef os_event_struct_t* os_event_t; struct os_event_struct { os_native_event_t handle; @@ -30,8 +30,8 @@ struct os_event_struct { #else typedef pthread_mutex_t os_fast_mutex_t; -typedef struct os_event_struct os_event_struct_t; -typedef os_event_struct_t* os_event_t; +typedef struct os_event_struct os_event_struct_t; +typedef os_event_struct_t* os_event_t; struct os_event_struct { os_fast_mutex_t os_mutex; /* this mutex protects the next @@ -79,7 +79,7 @@ Frees created events and OS 'slow' mutexes. */ void os_sync_free(void); /*==============*/ -/************************************************************* +/************************************************************* Creates an event semaphore, i.e., a semaphore which may just have two states: signaled and nonsignaled. The created event is manual reset: it must be reset explicitly by calling sync_os_reset_event. */ @@ -158,9 +158,9 @@ os_event_wait_multiple( /*===================*/ /* out: index of the event which was signaled */ - ulint n, /* in: number of events in the + ulint n, /* in: number of events in the array */ - os_native_event_t* native_event_array); + os_native_event_t* native_event_array); /* in: pointer to an array of event handles */ #endif @@ -234,9 +234,9 @@ void os_fast_mutex_free( /*===============*/ os_fast_mutex_t* fast_mutex); /* in: mutex to free */ - + #ifndef UNIV_NONINL #include "os0sync.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/os0sync.ic b/storage/innobase/include/os0sync.ic index 1337e97152a..75dea9369c2 100644 --- a/storage/innobase/include/os0sync.ic +++ b/storage/innobase/include/os0sync.ic @@ -22,7 +22,7 @@ os_fast_mutex_trylock( thread */ os_fast_mutex_t* fast_mutex) /* in: mutex to acquire */ { -#ifdef __WIN__ +#ifdef __WIN__ EnterCriticalSection(fast_mutex); return(0); diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index c00d28baf60..4685ffad351 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -30,8 +30,8 @@ typedef void* os_thread_t; typedef ulint os_thread_id_t; /* In Windows the thread id is an unsigned long int */ #else -typedef pthread_t os_thread_t; -typedef os_thread_t os_thread_id_t; /* In Unix we use the thread +typedef pthread_t os_thread_t; +typedef os_thread_t os_thread_id_t; /* In Unix we use the thread handle itself as the id of the thread */ #endif @@ -69,7 +69,7 @@ os_thread_create( /*=============*/ /* out: handle to the thread */ #ifndef __WIN__ - os_posix_f_t start_f, + os_posix_f_t start_f, #else ulint (*start_f)(void*), /* in: pointer to function from which to start */ @@ -80,7 +80,7 @@ os_thread_create( thread */ int os_thread_join( -/*=============*/ +/*===========*/ os_thread_id_t thread_id); /* in: id of the thread to join */ /********************************************************************* Exits the current thread. */ @@ -142,4 +142,4 @@ os_thread_get_last_error(void); #include "os0thread.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index b03302b0e77..36370201d9b 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -57,7 +57,7 @@ page_cur_get_rec( /* out: record */ page_cur_t* cur); /* in: page cursor */ /************************************************************* -Sets the cursor object to point before the first user record +Sets the cursor object to point before the first user record on the page. */ UNIV_INLINE void @@ -66,7 +66,7 @@ page_cur_set_before_first( page_t* page, /* in: index page */ page_cur_t* cur); /* in: cursor */ /************************************************************* -Sets the cursor object to point after the last user record on +Sets the cursor object to point after the last user record on the page. */ UNIV_INLINE void @@ -178,13 +178,13 @@ page_copy_rec_list_end_to_created_page( dict_index_t* index, /* in: record descriptor */ mtr_t* mtr); /* in: mtr */ /*************************************************************** -Deletes a record at the page cursor. The cursor is moved to the +Deletes a record at the page cursor. The cursor is moved to the next record after the deleted one. */ void page_cur_delete_rec( /*================*/ - page_cur_t* cursor, /* in: a page cursor */ + page_cur_t* cursor, /* in: a page cursor */ dict_index_t* index, /* in: record descriptor */ const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */ mtr_t* mtr); /* in: mini-transaction handle */ @@ -224,7 +224,7 @@ page_cur_search_with_match( ulint* ilow_matched_bytes, /* in/out: already matched bytes in a field not yet completely matched */ - page_cur_t* cursor); /* out: page cursor */ + page_cur_t* cursor); /* out: page cursor */ /*************************************************************** Positions a page cursor on a randomly chosen user record on a page. If there are no user records, sets the cursor on the infimum record. */ @@ -282,4 +282,4 @@ struct page_cur_struct{ #include "page0cur.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic index f8346819e84..243550c055f 100644 --- a/storage/innobase/include/page0cur.ic +++ b/storage/innobase/include/page0cur.ic @@ -38,7 +38,7 @@ page_cur_get_rec( } /************************************************************* -Sets the cursor object to point before the first user record +Sets the cursor object to point before the first user record on the page. */ UNIV_INLINE void @@ -51,7 +51,7 @@ page_cur_set_before_first( } /************************************************************* -Sets the cursor object to point after the last user record on +Sets the cursor object to point after the last user record on the page. */ UNIV_INLINE void @@ -181,7 +181,7 @@ page_cur_tuple_insert( /* out: pointer to record if succeed, NULL otherwise */ page_cur_t* cursor, /* in: a page cursor */ - dtuple_t* tuple, /* in: pointer to a data tuple */ + dtuple_t* tuple, /* in: pointer to a data tuple */ dict_index_t* index, /* in: record descriptor */ mtr_t* mtr) /* in: mini-transaction handle */ { diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index c4ffa39d3ac..7f99f670190 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -115,7 +115,7 @@ typedef byte page_dir_slot_t; typedef page_dir_slot_t page_dir_t; /* Offset of the directory start down from the page end. We call the -slot with the highest file address directory start, as it points to +slot with the highest file address directory start, as it points to the first record in the list of records. */ #define PAGE_DIR FIL_PAGE_DATA_END @@ -127,7 +127,7 @@ page end, when the page is empty */ #define PAGE_EMPTY_DIR_START (PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE) /* The maximum and minimum number of records owned by a directory slot. The -number may drop below the minimum in the first and the last slot in the +number may drop below the minimum in the first and the last slot in the directory. */ #define PAGE_DIR_SLOT_MAX_N_OWNED 8 #define PAGE_DIR_SLOT_MIN_N_OWNED 4 @@ -234,20 +234,20 @@ the positive infinity in the alphabetical order. */ UNIV_INLINE int page_cmp_dtuple_rec_with_match( -/*===========================*/ - /* out: 1, 0, -1, if dtuple is greater, equal, - less than rec, respectively, when only the +/*===========================*/ + /* out: 1, 0, -1, if dtuple is greater, equal, + less than rec, respectively, when only the common first fields are compared */ dtuple_t* dtuple, /* in: data tuple */ - rec_t* rec, /* in: physical record on a page; may also - be page infimum or supremum, in which case - matched-parameter values below are not + rec_t* rec, /* in: physical record on a page; may also + be page infimum or supremum, in which case + matched-parameter values below are not affected */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint* matched_fields, /* in/out: number of already completely + ulint* matched_fields, /* in/out: number of already completely matched fields; when function returns contains the value for current comparison */ - ulint* matched_bytes); /* in/out: number of already matched + ulint* matched_bytes); /* in/out: number of already matched bytes within the first field not completely matched; when function returns contains the value for current comparison */ @@ -342,7 +342,7 @@ ulint page_dir_slot_get_n_owned( /*======================*/ /* out: number of records */ - page_dir_slot_t* slot); /* in: page directory slot */ + page_dir_slot_t* slot); /* in: page directory slot */ /******************************************************************* This is used to set the owned records field of a directory slot. */ UNIV_INLINE @@ -350,7 +350,7 @@ void page_dir_slot_set_n_owned( /*======================*/ page_dir_slot_t* slot, /* in: directory slot */ - ulint n); /* in: number of records owned + ulint n); /* in: number of records owned by the slot */ /**************************************************************** Calculates the space reserved for directory slots of a given @@ -397,7 +397,7 @@ page_rec_get_next( rec_t* rec); /* in: pointer to record, must not be page supremum */ /**************************************************************** -Sets the pointer to the next record on the page. */ +Sets the pointer to the next record on the page. */ UNIV_INLINE void page_rec_set_next( @@ -436,7 +436,7 @@ TRUE if the record is the infimum record on a page. */ UNIV_INLINE ibool page_rec_is_infimum_low( -/*=====================*/ +/*====================*/ /* out: TRUE if the infimum record */ ulint offset);/* in: record offset on page */ @@ -548,7 +548,7 @@ page_mem_free( /************************************************************** The index page creation function. */ -page_t* +page_t* page_create( /*========*/ /* out: pointer to the page */ @@ -651,19 +651,19 @@ Splits a directory slot which owns too many records. */ void page_dir_split_slot( /*================*/ - page_t* page, /* in: the index page in question */ - ulint slot_no); /* in: the directory slot */ + page_t* page, /* in: the index page in question */ + ulint slot_no); /* in: the directory slot */ /***************************************************************** Tries to balance the given directory slot with too few records -with the upper neighbor, so that there are at least the minimum number -of records owned by the slot; this may result in the merging of +with the upper neighbor, so that there are at least the minimum number +of records owned by the slot; this may result in the merging of two slots. */ void page_dir_balance_slot( /*==================*/ page_t* page, /* in: index page */ - ulint slot_no); /* in: the directory slot */ + ulint slot_no); /* in: the directory slot */ /************************************************************** Parses a log record of a record list end or start deletion. */ @@ -695,7 +695,7 @@ page_parse_create( /**************************************************************** Prints record contents including the data relevant only in the index page context. */ - + void page_rec_print( /*===========*/ @@ -733,7 +733,7 @@ debugging purposes. */ void page_print( -/*======*/ +/*=======*/ page_t* page, /* in: index page */ dict_index_t* index, /* in: dictionary index of the page */ ulint dn, /* in: print dn first and last entries @@ -799,4 +799,4 @@ page_find_rec_with_heap_no( #include "page0page.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 655ff245aa8..2f651b40319 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -41,7 +41,7 @@ page_update_max_trx_id( ut_ad(page); if (ut_dulint_cmp(page_get_max_trx_id(page), trx_id) < 0) { - + page_set_max_trx_id(page, trx_id); } } @@ -93,8 +93,8 @@ page_header_get_ptr( ut_ad(page); ut_ad((field == PAGE_FREE) - || (field == PAGE_LAST_INSERT) - || (field == PAGE_HEAP_TOP)); + || (field == PAGE_LAST_INSERT) + || (field == PAGE_HEAP_TOP)); offs = page_header_get_field(page, field); @@ -122,8 +122,8 @@ page_header_set_ptr( ut_ad(page); ut_ad((field == PAGE_FREE) - || (field == PAGE_LAST_INSERT) - || (field == PAGE_HEAP_TOP)); + || (field == PAGE_LAST_INSERT) + || (field == PAGE_HEAP_TOP)); if (ptr == NULL) { offs = 0; @@ -177,13 +177,13 @@ page_rec_is_comp( { #ifdef UNIV_RELEASE_NOT_YET_STABLE if (UNIV_UNLIKELY((ulint)rec < (ulint)(buf_pool->frame_zero)) - || UNIV_UNLIKELY((ulint)rec >= (ulint)(buf_pool->high_end))) { + || UNIV_UNLIKELY((ulint)rec >= (ulint)(buf_pool->high_end))) { - ut_print_timestamp(stderr); + ut_print_timestamp(stderr); fprintf(stderr, "InnoDB: Error: trying to read a stray page rec %p\n" "InnoDB: buf pool start is at %p, end at %p\n", - rec, buf_pool->frame_zero, + rec, buf_pool->frame_zero, buf_pool->high_end); ut_error; } @@ -284,7 +284,7 @@ TRUE if the record is the infimum record on a page. */ UNIV_INLINE ibool page_rec_is_infimum_low( -/*=====================*/ +/*====================*/ /* out: TRUE if the infimum record */ ulint offset) /* in: record offset on page */ { @@ -343,20 +343,20 @@ the positive infinity in the alphabetical order. */ UNIV_INLINE int page_cmp_dtuple_rec_with_match( -/*===========================*/ - /* out: 1, 0, -1, if dtuple is greater, equal, - less than rec, respectively, when only the +/*===========================*/ + /* out: 1, 0, -1, if dtuple is greater, equal, + less than rec, respectively, when only the common first fields are compared */ dtuple_t* dtuple, /* in: data tuple */ - rec_t* rec, /* in: physical record on a page; may also - be page infimum or supremum, in which case - matched-parameter values below are not + rec_t* rec, /* in: physical record on a page; may also + be page infimum or supremum, in which case + matched-parameter values below are not affected */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint* matched_fields, /* in/out: number of already completely + ulint* matched_fields, /* in/out: number of already completely matched fields; when function returns contains the value for current comparison */ - ulint* matched_bytes) /* in/out: number of already matched + ulint* matched_bytes) /* in/out: number of already matched bytes within the first field not completely matched; when function returns contains the value for current comparison */ @@ -461,7 +461,7 @@ page_dir_get_nth_slot( return(page + UNIV_PAGE_SIZE - PAGE_DIR - (n + 1) * PAGE_DIR_SLOT_SIZE); -} +} /****************************************************************** Used to check the consistency of a record on a page. */ @@ -474,7 +474,7 @@ page_rec_check( { page_t* page; - ut_a(rec); + ut_a(rec); page = buf_frame_align(rec); @@ -517,7 +517,7 @@ ulint page_dir_slot_get_n_owned( /*======================*/ /* out: number of records */ - page_dir_slot_t* slot) /* in: page directory slot */ + page_dir_slot_t* slot) /* in: page directory slot */ { rec_t* rec = page_dir_slot_get_rec(slot); return(rec_get_n_owned(rec, page_rec_is_comp(rec))); @@ -530,7 +530,7 @@ void page_dir_slot_set_n_owned( /*======================*/ page_dir_slot_t* slot, /* in: directory slot */ - ulint n) /* in: number of records owned + ulint n) /* in: number of records owned by the slot */ { rec_t* rec = page_dir_slot_get_rec(slot); @@ -549,7 +549,7 @@ page_dir_calc_reserved_space( { return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1) / PAGE_DIR_SLOT_MIN_N_OWNED); -} +} /**************************************************************** Gets the pointer to the next record on the page. */ @@ -563,7 +563,7 @@ page_rec_get_next( ulint offs; page_t* page; - ut_ad(page_rec_check(rec)); + ut_ad(page_rec_check(rec)); page = ut_align_down(rec, UNIV_PAGE_SIZE); @@ -584,7 +584,7 @@ page_rec_get_next( } if (UNIV_UNLIKELY(offs == 0)) { - + return(NULL); } @@ -592,7 +592,7 @@ page_rec_get_next( } /**************************************************************** -Sets the pointer to the next record on the page. */ +Sets the pointer to the next record on the page. */ UNIV_INLINE void page_rec_set_next( @@ -604,7 +604,7 @@ page_rec_set_next( page_t* page; ulint offs; - ut_ad(page_rec_check(rec)); + ut_ad(page_rec_check(rec)); ut_ad(!page_rec_is_supremum(rec)); page = ut_align_down(rec, UNIV_PAGE_SIZE); @@ -635,7 +635,7 @@ page_rec_get_prev( rec_t* prev_rec = NULL; page_t* page; - ut_ad(page_rec_check(rec)); + ut_ad(page_rec_check(rec)); page = ut_align_down(rec, UNIV_PAGE_SIZE); @@ -644,16 +644,16 @@ page_rec_get_prev( slot_no = page_dir_find_owner_slot(rec); ut_a(slot_no != 0); - + slot = page_dir_get_nth_slot(page, slot_no - 1); - + rec2 = page_dir_slot_get_rec(slot); - + while (rec != rec2) { prev_rec = rec2; rec2 = page_rec_get_next(rec2); } - + ut_a(prev_rec); return(prev_rec); @@ -696,10 +696,10 @@ page_get_data_size( ulint ret; ret = (ulint)(page_header_get_field(page, PAGE_HEAP_TOP) - - (page_is_comp(page) - ? PAGE_NEW_SUPREMUM_END - : PAGE_OLD_SUPREMUM_END) - - page_header_get_field(page, PAGE_GARBAGE)); + - (page_is_comp(page) + ? PAGE_NEW_SUPREMUM_END + : PAGE_OLD_SUPREMUM_END) + - page_header_get_field(page, PAGE_GARBAGE)); ut_ad(ret < UNIV_PAGE_SIZE); diff --git a/storage/innobase/include/page0types.h b/storage/innobase/include/page0types.h index 525a0366a6f..1fbeeb0f60f 100644 --- a/storage/innobase/include/page0types.h +++ b/storage/innobase/include/page0types.h @@ -13,10 +13,10 @@ Created 2/2/1994 Heikki Tuuri /* Type of the index page */ /* The following define eliminates a name collision on HP-UX */ -#define page_t ib_page_t +#define page_t ib_page_t typedef byte page_t; typedef struct page_search_struct page_search_t; typedef struct page_cur_struct page_cur_t; -#endif +#endif diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h index b2790949057..e35fcf47692 100644 --- a/storage/innobase/include/pars0grm.h +++ b/storage/innobase/include/pars0grm.h @@ -1,90 +1,220 @@ -#ifndef YYSTYPE -#define YYSTYPE int +/* A Bison parser, made by GNU Bison 1.875d. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + 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, 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. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + PARS_INT_LIT = 258, + PARS_FLOAT_LIT = 259, + PARS_STR_LIT = 260, + PARS_NULL_LIT = 261, + PARS_ID_TOKEN = 262, + PARS_AND_TOKEN = 263, + PARS_OR_TOKEN = 264, + PARS_NOT_TOKEN = 265, + PARS_GE_TOKEN = 266, + PARS_LE_TOKEN = 267, + PARS_NE_TOKEN = 268, + PARS_PROCEDURE_TOKEN = 269, + PARS_IN_TOKEN = 270, + PARS_OUT_TOKEN = 271, + PARS_BINARY_TOKEN = 272, + PARS_BLOB_TOKEN = 273, + PARS_INT_TOKEN = 274, + PARS_INTEGER_TOKEN = 275, + PARS_FLOAT_TOKEN = 276, + PARS_CHAR_TOKEN = 277, + PARS_IS_TOKEN = 278, + PARS_BEGIN_TOKEN = 279, + PARS_END_TOKEN = 280, + PARS_IF_TOKEN = 281, + PARS_THEN_TOKEN = 282, + PARS_ELSE_TOKEN = 283, + PARS_ELSIF_TOKEN = 284, + PARS_LOOP_TOKEN = 285, + PARS_WHILE_TOKEN = 286, + PARS_RETURN_TOKEN = 287, + PARS_SELECT_TOKEN = 288, + PARS_SUM_TOKEN = 289, + PARS_COUNT_TOKEN = 290, + PARS_DISTINCT_TOKEN = 291, + PARS_FROM_TOKEN = 292, + PARS_WHERE_TOKEN = 293, + PARS_FOR_TOKEN = 294, + PARS_DDOT_TOKEN = 295, + PARS_CONSISTENT_TOKEN = 296, + PARS_READ_TOKEN = 297, + PARS_ORDER_TOKEN = 298, + PARS_BY_TOKEN = 299, + PARS_ASC_TOKEN = 300, + PARS_DESC_TOKEN = 301, + PARS_INSERT_TOKEN = 302, + PARS_INTO_TOKEN = 303, + PARS_VALUES_TOKEN = 304, + PARS_UPDATE_TOKEN = 305, + PARS_SET_TOKEN = 306, + PARS_DELETE_TOKEN = 307, + PARS_CURRENT_TOKEN = 308, + PARS_OF_TOKEN = 309, + PARS_CREATE_TOKEN = 310, + PARS_TABLE_TOKEN = 311, + PARS_INDEX_TOKEN = 312, + PARS_UNIQUE_TOKEN = 313, + PARS_CLUSTERED_TOKEN = 314, + PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 315, + PARS_ON_TOKEN = 316, + PARS_ASSIGN_TOKEN = 317, + PARS_DECLARE_TOKEN = 318, + PARS_CURSOR_TOKEN = 319, + PARS_SQL_TOKEN = 320, + PARS_OPEN_TOKEN = 321, + PARS_FETCH_TOKEN = 322, + PARS_CLOSE_TOKEN = 323, + PARS_NOTFOUND_TOKEN = 324, + PARS_TO_CHAR_TOKEN = 325, + PARS_TO_NUMBER_TOKEN = 326, + PARS_TO_BINARY_TOKEN = 327, + PARS_BINARY_TO_NUMBER_TOKEN = 328, + PARS_SUBSTR_TOKEN = 329, + PARS_REPLSTR_TOKEN = 330, + PARS_CONCAT_TOKEN = 331, + PARS_INSTR_TOKEN = 332, + PARS_LENGTH_TOKEN = 333, + PARS_SYSDATE_TOKEN = 334, + PARS_PRINTF_TOKEN = 335, + PARS_ASSERT_TOKEN = 336, + PARS_RND_TOKEN = 337, + PARS_RND_STR_TOKEN = 338, + PARS_ROW_PRINTF_TOKEN = 339, + PARS_COMMIT_TOKEN = 340, + PARS_ROLLBACK_TOKEN = 341, + PARS_WORK_TOKEN = 342, + NEG = 343 + }; #endif -#define PARS_INT_LIT 257 -#define PARS_FLOAT_LIT 258 -#define PARS_STR_LIT 259 -#define PARS_NULL_LIT 260 -#define PARS_ID_TOKEN 261 -#define PARS_AND_TOKEN 262 -#define PARS_OR_TOKEN 263 -#define PARS_NOT_TOKEN 264 -#define PARS_GE_TOKEN 265 -#define PARS_LE_TOKEN 266 -#define PARS_NE_TOKEN 267 -#define PARS_PROCEDURE_TOKEN 268 -#define PARS_IN_TOKEN 269 -#define PARS_OUT_TOKEN 270 -#define PARS_INT_TOKEN 271 -#define PARS_INTEGER_TOKEN 272 -#define PARS_FLOAT_TOKEN 273 -#define PARS_CHAR_TOKEN 274 -#define PARS_IS_TOKEN 275 -#define PARS_BEGIN_TOKEN 276 -#define PARS_END_TOKEN 277 -#define PARS_IF_TOKEN 278 -#define PARS_THEN_TOKEN 279 -#define PARS_ELSE_TOKEN 280 -#define PARS_ELSIF_TOKEN 281 -#define PARS_LOOP_TOKEN 282 -#define PARS_WHILE_TOKEN 283 -#define PARS_RETURN_TOKEN 284 -#define PARS_SELECT_TOKEN 285 -#define PARS_SUM_TOKEN 286 -#define PARS_COUNT_TOKEN 287 -#define PARS_DISTINCT_TOKEN 288 -#define PARS_FROM_TOKEN 289 -#define PARS_WHERE_TOKEN 290 -#define PARS_FOR_TOKEN 291 -#define PARS_DDOT_TOKEN 292 -#define PARS_CONSISTENT_TOKEN 293 -#define PARS_READ_TOKEN 294 -#define PARS_ORDER_TOKEN 295 -#define PARS_BY_TOKEN 296 -#define PARS_ASC_TOKEN 297 -#define PARS_DESC_TOKEN 298 -#define PARS_INSERT_TOKEN 299 -#define PARS_INTO_TOKEN 300 -#define PARS_VALUES_TOKEN 301 -#define PARS_UPDATE_TOKEN 302 -#define PARS_SET_TOKEN 303 -#define PARS_DELETE_TOKEN 304 -#define PARS_CURRENT_TOKEN 305 -#define PARS_OF_TOKEN 306 -#define PARS_CREATE_TOKEN 307 -#define PARS_TABLE_TOKEN 308 -#define PARS_INDEX_TOKEN 309 -#define PARS_UNIQUE_TOKEN 310 -#define PARS_CLUSTERED_TOKEN 311 -#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 312 -#define PARS_ON_TOKEN 313 -#define PARS_ASSIGN_TOKEN 314 -#define PARS_DECLARE_TOKEN 315 -#define PARS_CURSOR_TOKEN 316 -#define PARS_SQL_TOKEN 317 -#define PARS_OPEN_TOKEN 318 -#define PARS_FETCH_TOKEN 319 -#define PARS_CLOSE_TOKEN 320 -#define PARS_NOTFOUND_TOKEN 321 -#define PARS_TO_CHAR_TOKEN 322 -#define PARS_TO_NUMBER_TOKEN 323 -#define PARS_TO_BINARY_TOKEN 324 -#define PARS_BINARY_TO_NUMBER_TOKEN 325 -#define PARS_SUBSTR_TOKEN 326 -#define PARS_REPLSTR_TOKEN 327 -#define PARS_CONCAT_TOKEN 328 -#define PARS_INSTR_TOKEN 329 -#define PARS_LENGTH_TOKEN 330 -#define PARS_SYSDATE_TOKEN 331 -#define PARS_PRINTF_TOKEN 332 -#define PARS_ASSERT_TOKEN 333 -#define PARS_RND_TOKEN 334 -#define PARS_RND_STR_TOKEN 335 -#define PARS_ROW_PRINTF_TOKEN 336 -#define PARS_COMMIT_TOKEN 337 -#define PARS_ROLLBACK_TOKEN 338 -#define PARS_WORK_TOKEN 339 -#define NEG 340 +#define PARS_INT_LIT 258 +#define PARS_FLOAT_LIT 259 +#define PARS_STR_LIT 260 +#define PARS_NULL_LIT 261 +#define PARS_ID_TOKEN 262 +#define PARS_AND_TOKEN 263 +#define PARS_OR_TOKEN 264 +#define PARS_NOT_TOKEN 265 +#define PARS_GE_TOKEN 266 +#define PARS_LE_TOKEN 267 +#define PARS_NE_TOKEN 268 +#define PARS_PROCEDURE_TOKEN 269 +#define PARS_IN_TOKEN 270 +#define PARS_OUT_TOKEN 271 +#define PARS_BINARY_TOKEN 272 +#define PARS_BLOB_TOKEN 273 +#define PARS_INT_TOKEN 274 +#define PARS_INTEGER_TOKEN 275 +#define PARS_FLOAT_TOKEN 276 +#define PARS_CHAR_TOKEN 277 +#define PARS_IS_TOKEN 278 +#define PARS_BEGIN_TOKEN 279 +#define PARS_END_TOKEN 280 +#define PARS_IF_TOKEN 281 +#define PARS_THEN_TOKEN 282 +#define PARS_ELSE_TOKEN 283 +#define PARS_ELSIF_TOKEN 284 +#define PARS_LOOP_TOKEN 285 +#define PARS_WHILE_TOKEN 286 +#define PARS_RETURN_TOKEN 287 +#define PARS_SELECT_TOKEN 288 +#define PARS_SUM_TOKEN 289 +#define PARS_COUNT_TOKEN 290 +#define PARS_DISTINCT_TOKEN 291 +#define PARS_FROM_TOKEN 292 +#define PARS_WHERE_TOKEN 293 +#define PARS_FOR_TOKEN 294 +#define PARS_DDOT_TOKEN 295 +#define PARS_CONSISTENT_TOKEN 296 +#define PARS_READ_TOKEN 297 +#define PARS_ORDER_TOKEN 298 +#define PARS_BY_TOKEN 299 +#define PARS_ASC_TOKEN 300 +#define PARS_DESC_TOKEN 301 +#define PARS_INSERT_TOKEN 302 +#define PARS_INTO_TOKEN 303 +#define PARS_VALUES_TOKEN 304 +#define PARS_UPDATE_TOKEN 305 +#define PARS_SET_TOKEN 306 +#define PARS_DELETE_TOKEN 307 +#define PARS_CURRENT_TOKEN 308 +#define PARS_OF_TOKEN 309 +#define PARS_CREATE_TOKEN 310 +#define PARS_TABLE_TOKEN 311 +#define PARS_INDEX_TOKEN 312 +#define PARS_UNIQUE_TOKEN 313 +#define PARS_CLUSTERED_TOKEN 314 +#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 315 +#define PARS_ON_TOKEN 316 +#define PARS_ASSIGN_TOKEN 317 +#define PARS_DECLARE_TOKEN 318 +#define PARS_CURSOR_TOKEN 319 +#define PARS_SQL_TOKEN 320 +#define PARS_OPEN_TOKEN 321 +#define PARS_FETCH_TOKEN 322 +#define PARS_CLOSE_TOKEN 323 +#define PARS_NOTFOUND_TOKEN 324 +#define PARS_TO_CHAR_TOKEN 325 +#define PARS_TO_NUMBER_TOKEN 326 +#define PARS_TO_BINARY_TOKEN 327 +#define PARS_BINARY_TO_NUMBER_TOKEN 328 +#define PARS_SUBSTR_TOKEN 329 +#define PARS_REPLSTR_TOKEN 330 +#define PARS_CONCAT_TOKEN 331 +#define PARS_INSTR_TOKEN 332 +#define PARS_LENGTH_TOKEN 333 +#define PARS_SYSDATE_TOKEN 334 +#define PARS_PRINTF_TOKEN 335 +#define PARS_ASSERT_TOKEN 336 +#define PARS_RND_TOKEN 337 +#define PARS_RND_STR_TOKEN 338 +#define PARS_ROW_PRINTF_TOKEN 339 +#define PARS_COMMIT_TOKEN 340 +#define PARS_ROLLBACK_TOKEN 341 +#define PARS_WORK_TOKEN 342 +#define NEG 343 + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + extern YYSTYPE yylval; + + + diff --git a/storage/innobase/include/pars0opt.h b/storage/innobase/include/pars0opt.h index d091c3ee2d0..ff92cc062d9 100644 --- a/storage/innobase/include/pars0opt.h +++ b/storage/innobase/include/pars0opt.h @@ -55,4 +55,4 @@ opt_print_query_plan( #include "pars0opt.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index 62a41a881e8..2ae2d6cff74 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -46,6 +46,8 @@ extern pars_res_word_t pars_rnd_str_token; extern pars_res_word_t pars_count_token; extern pars_res_word_t pars_sum_token; extern pars_res_word_t pars_distinct_token; +extern pars_res_word_t pars_binary_token; +extern pars_res_word_t pars_blob_token; extern pars_res_word_t pars_int_token; extern pars_res_word_t pars_char_token; extern pars_res_word_t pars_float_token; @@ -59,7 +61,7 @@ extern pars_res_word_t pars_unique_token; extern pars_res_word_t pars_clustered_token; extern ulint pars_star_denoter; - + /* Procedure parameter types */ #define PARS_INPUT 0 #define PARS_OUTPUT 1 @@ -111,7 +113,7 @@ func_node_t* pars_func( /*======*/ /* out, own: function node in a query tree */ - que_node_t* res_word,/* in: function name reserved word */ + que_node_t* res_word,/* in: function name reserved word */ que_node_t* arg); /* in: first argument in the argument list */ /************************************************************************* Parses an operator expression. */ @@ -190,7 +192,7 @@ pars_update_statement_start( ibool is_delete, /* in: TRUE if delete */ sym_node_t* table_sym, /* in: table name node */ col_assign_node_t* col_assign_list);/* in: column assignment list, NULL - if delete */ + if delete */ /************************************************************************* Parses an update or delete statement. */ @@ -212,7 +214,7 @@ pars_insert_statement( /* out, own: update node in a query tree */ sym_node_t* table_sym, /* in: table name node */ - que_node_t* values_list, /* in: value expression list or NULL */ + que_node_t* values_list, /* in: value expression list or NULL */ sel_node_t* select); /* in: select condition or NULL */ /************************************************************************* Parses a procedure parameter declaration. */ @@ -336,10 +338,15 @@ Parses a column definition at a table creation. */ sym_node_t* pars_column_def( /*============*/ - /* out: column sym table node */ - sym_node_t* sym_node, /* in: column node in the symbol - table */ - pars_res_word_t* type); /* in: data type */ + /* out: column sym table + node */ + sym_node_t* sym_node, /* in: column node in the + symbol table */ + pars_res_word_t* type, /* in: data type */ + sym_node_t* len, /* in: length of column, or + NULL */ + void* is_not_null); /* in: if not NULL, column + is of type NOT NULL. */ /************************************************************************* Parses a table creation operation. */ @@ -464,7 +471,7 @@ struct if_node_struct{ que_node_t* cond; /* if condition */ que_node_t* stat_list; /* statement list */ que_node_t* else_part; /* else-part statement list */ - elsif_node_t* elsif_list; /* elsif element list */ + elsif_node_t* elsif_list; /* elsif element list */ }; /* while-statement node */ @@ -523,4 +530,4 @@ struct col_assign_node_struct{ #include "pars0pars.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/pars0sym.h b/storage/innobase/include/pars0sym.h index 633a49e3cb5..a10d70d48b6 100644 --- a/storage/innobase/include/pars0sym.h +++ b/storage/innobase/include/pars0sym.h @@ -74,7 +74,7 @@ sym_tab_add_id( #define SYM_CLUST_FIELD_NO 0 #define SYM_SEC_FIELD_NO 1 - + struct sym_node_struct{ que_common_t common; /* node type: QUE_NODE_SYMBOL */ @@ -185,4 +185,4 @@ struct sym_tab_struct{ #include "pars0sym.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/pars0types.h b/storage/innobase/include/pars0types.h index 9fbfd6efaa1..cf62617e066 100644 --- a/storage/innobase/include/pars0types.h +++ b/storage/innobase/include/pars0types.h @@ -25,4 +25,4 @@ typedef struct col_assign_node_struct col_assign_node_t; typedef UT_LIST_BASE_NODE_T(sym_node_t) sym_node_list_t; -#endif +#endif diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 4113e52d425..4e31e2db4b7 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -50,7 +50,7 @@ UNIV_INLINE que_thr_t* que_fork_get_first_thr( /*===================*/ - que_fork_t* fork); /* in: query fork */ + que_fork_t* fork); /* in: query fork */ /*************************************************************************** Gets the child node of the first thr in a fork. */ UNIV_INLINE @@ -174,7 +174,7 @@ que_thr_handle_error( byte* err_str,/* in, own: error string or NULL; NOTE: the function will take care of freeing of the string! */ - ulint err_len);/* in: error string length */ + ulint err_len);/* in: error string length */ /************************************************************************** Moves a suspended query thread to the QUE_THR_RUNNING state and releases a single worker thread to execute it. This function should be used to end @@ -216,7 +216,7 @@ que_fork_start_command( QUE_THR_RUNNING state, or NULL; the query thread should be executed by que_run_threads by the caller */ - que_fork_t* fork); /* in: a query fork */ + que_fork_t* fork); /* in: a query fork */ /*************************************************************************** Gets the trx of a query thread. */ UNIV_INLINE @@ -359,7 +359,7 @@ struct que_thr_struct{ the control came */ ulint resource; /* resource usage of the query thread thus far */ - ulint lock_state; /* lock state of thread (table or + ulint lock_state; /* lock state of thread (table or row) */ }; @@ -411,7 +411,7 @@ struct que_fork_struct{ /*------------------------------*/ mem_heap_t* heap; /* memory heap where the fork was created */ - + }; /* Query fork (or graph) types */ @@ -485,9 +485,9 @@ struct que_fork_struct{ #define QUE_THR_ERROR 8 /* Query thread lock states */ -#define QUE_THR_LOCK_NOLOCK 0 -#define QUE_THR_LOCK_ROW 1 -#define QUE_THR_LOCK_TABLE 2 +#define QUE_THR_LOCK_NOLOCK 0 +#define QUE_THR_LOCK_ROW 1 +#define QUE_THR_LOCK_TABLE 2 /* From where the cursor position is counted */ #define QUE_CUR_NOT_DEFINED 1 diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.ic index ae4ed10560f..70be4068147 100644 --- a/storage/innobase/include/que0que.ic +++ b/storage/innobase/include/que0que.ic @@ -27,7 +27,7 @@ UNIV_INLINE que_thr_t* que_fork_get_first_thr( /*===================*/ - que_fork_t* fork) /* in: query fork */ + que_fork_t* fork) /* in: query fork */ { return(UT_LIST_GET_FIRST(fork->thrs)); } @@ -38,7 +38,7 @@ UNIV_INLINE que_node_t* que_fork_get_child( /*===============*/ - que_fork_t* fork) /* in: query fork */ + que_fork_t* fork) /* in: query fork */ { que_thr_t* thr; @@ -143,7 +143,7 @@ que_node_list_add_last( que_common_t* cnode2; cnode = node; - + cnode->brother = NULL; if (node_list == NULL) { @@ -152,7 +152,7 @@ que_node_list_add_last( } cnode2 = node_list; - + while (cnode2->brother != NULL) { cnode2 = cnode2->brother; } @@ -188,7 +188,7 @@ que_node_list_get_len( cnode = node_list; len = 0; - + while (cnode != NULL) { len++; cnode = cnode->brother; @@ -228,11 +228,12 @@ que_thr_peek_stop( graph = thr->graph; trx = graph->trx; - + if (graph->state != QUE_FORK_ACTIVE - || trx->que_state == TRX_QUE_LOCK_WAIT - || (UT_LIST_GET_LEN(trx->signals) > 0 - && trx->que_state == TRX_QUE_RUNNING)) { + || trx->que_state == TRX_QUE_LOCK_WAIT + || (UT_LIST_GET_LEN(trx->signals) > 0 + && trx->que_state == TRX_QUE_RUNNING)) { + return(TRUE); } @@ -251,7 +252,7 @@ que_graph_is_select( if (graph->fork_type == QUE_FORK_SELECT_SCROLL || graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) { - return(TRUE); + return(TRUE); } return(FALSE); diff --git a/storage/innobase/include/que0types.h b/storage/innobase/include/que0types.h index e59c2313a5a..30e3f0a172b 100644 --- a/storage/innobase/include/que0types.h +++ b/storage/innobase/include/que0types.h @@ -14,7 +14,7 @@ Created 5/27/1996 Heikki Tuuri /* Pseudotype for all graph nodes */ typedef void que_node_t; - + typedef struct que_fork_struct que_fork_t; /* Query graph root is a fork node */ diff --git a/storage/innobase/include/read0read.h b/storage/innobase/include/read0read.h index 7a91248cf7f..8089a620536 100644 --- a/storage/innobase/include/read0read.h +++ b/storage/innobase/include/read0read.h @@ -24,9 +24,12 @@ point in time are seen in the view. */ read_view_t* read_view_open_now( /*===============*/ - /* out, own: read view struct */ - trx_t* cr_trx, /* in: creating transaction, or NULL */ - mem_heap_t* heap); /* in: memory heap from which allocated */ + /* out, own: read view struct */ + dulint cr_trx_id, /* in: trx_id of creating + transaction, or (0, 0) used in + purge */ + mem_heap_t* heap); /* in: memory heap from which + allocated */ /************************************************************************* Makes a copy of the oldest existing read view, or opens a new. The view must be closed with ..._close. */ @@ -34,9 +37,12 @@ must be closed with ..._close. */ read_view_t* read_view_oldest_copy_or_open_new( /*==============================*/ - /* out, own: read view struct */ - trx_t* cr_trx, /* in: creating transaction, or NULL */ - mem_heap_t* heap); /* in: memory heap from which allocated */ + /* out, own: read view struct */ + dulint cr_trx_id, /* in: trx_id of creating + transaction, or (0, 0) used in + purge */ + mem_heap_t* heap); /* in: memory heap from which + allocated */ /************************************************************************* Closes a read view. */ @@ -60,7 +66,7 @@ read_view_sees_trx_id( /*==================*/ /* out: TRUE if sees */ read_view_t* view, /* in: read view */ - dulint trx_id); /* in: trx id */ + dulint trx_id);/* in: trx id */ /************************************************************************* Prints a read view to stderr. */ @@ -69,7 +75,7 @@ read_view_print( /*============*/ read_view_t* view); /* in: read view */ /************************************************************************* -Create a consistent cursor view for mysql to be used in cursors. In this +Create a consistent cursor view for mysql to be used in cursors. In this consistent read view modifications done by the creating transaction or future transactions are not visible. */ @@ -91,7 +97,7 @@ This function sets a given consistent cursor view to a transaction read view if given consistent cursor view is not NULL. Otherwise, function restores a global read view to a transaction read view. */ -void +void read_cursor_set_for_mysql( /*======================*/ trx_t* trx, /* in: transaction where cursor is set */ @@ -101,6 +107,10 @@ read_cursor_set_for_mysql( read should not see the modifications to the database. */ struct read_view_struct{ + ulint type; /* VIEW_NORMAL, VIEW_HIGH_GRANULARITY */ + dulint undo_no; /* (0, 0) or if type is VIEW_HIGH_GRANULARITY + transaction undo_no when this high-granularity + consistent read view was created */ ibool can_be_too_old; /* TRUE if the system has had to purge old versions which this read view should be able to access: the read view can bump into the @@ -121,12 +131,23 @@ struct read_view_struct{ serialized, except the reading transaction itself; the trx ids in this array are in a descending order */ - trx_t* creator; /* Pointer to the creating transaction, or - NULL if used in purge */ + dulint creator_trx_id; /* trx id of creating transaction, or + (0, 0) used in purge */ UT_LIST_NODE_T(read_view_t) view_list; /* List of read views in trx_sys */ }; +/* Read view types */ +#define VIEW_NORMAL 1 /* Normal consistent read view + where transaction does not see changes + made by active transactions except + creating transaction. */ +#define VIEW_HIGH_GRANULARITY 2 /* High-granularity read view where + transaction does not see changes + made by active transactions and own + changes after a point in time when this + read view was created. */ + /* Implement InnoDB framework to support consistent read views in cursors. This struct holds both heap where consistent read view is allocated and pointer to a read view. */ @@ -134,15 +155,15 @@ is allocated and pointer to a read view. */ struct cursor_view_struct{ mem_heap_t* heap; /* Memory heap for the cursor view */ - read_view_t* read_view; + read_view_t* read_view; /* Consistent read view of the cursor*/ ulint n_mysql_tables_in_use; - /* number of Innobase tables used in the - processing of this cursor */ + /* number of Innobase tables used in the + processing of this cursor */ }; #ifndef UNIV_NONINL #include "read0read.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/read0read.ic b/storage/innobase/include/read0read.ic index ec9ef5814bb..276e01b9f4a 100644 --- a/storage/innobase/include/read0read.ic +++ b/storage/innobase/include/read0read.ic @@ -49,7 +49,7 @@ read_view_sees_trx_id( ulint n_ids; int cmp; ulint i; - + if (ut_dulint_cmp(trx_id, view->up_limit_id) < 0) { return(TRUE); @@ -75,6 +75,6 @@ read_view_sees_trx_id( return(cmp < 0); } } - + return(TRUE); } diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index 1b1ee26b809..36d91db0e87 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -24,15 +24,16 @@ cmp_types_are_equal( /* out: TRUE if the types are considered equal in comparisons */ dtype_t* type1, /* in: type 1 */ - dtype_t* type2); /* in: type 2 */ + dtype_t* type2, /* in: type 2 */ + ibool check_charsets); /* in: whether to check charsets */ /***************************************************************** This function is used to compare two data fields for which we know the data type. */ UNIV_INLINE int cmp_data_data( -/*==========*/ - /* out: 1, 0, -1, if data1 is greater, equal, +/*==========*/ + /* out: 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ dtype_t* cur_type,/* in: data type of the fields */ byte* data1, /* in: data field (== a pointer to a memory @@ -47,8 +48,8 @@ data type. */ int cmp_data_data_slow( -/*===============*/ - /* out: 1, 0, -1, if data1 is greater, equal, +/*===============*/ + /* out: 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ dtype_t* cur_type,/* in: data type of the fields */ byte* data1, /* in: data field (== a pointer to a memory @@ -63,8 +64,8 @@ has its data type field set. */ UNIV_INLINE int cmp_dfield_dfield( -/*==============*/ - /* out: 1, 0, -1, if dfield1 is greater, equal, +/*==============*/ + /* out: 1, 0, -1, if dfield1 is greater, equal, less than dfield2, respectively */ dfield_t* dfield1,/* in: data field; must have type field set */ dfield_t* dfield2);/* in: data field */ @@ -79,9 +80,9 @@ made. */ int cmp_dtuple_rec_with_match( -/*======================*/ - /* out: 1, 0, -1, if dtuple is greater, equal, - less than rec, respectively, when only the +/*======================*/ + /* out: 1, 0, -1, if dtuple is greater, equal, + less than rec, respectively, when only the common first fields are compared, or until the first externally stored field in rec */ @@ -91,10 +92,10 @@ cmp_dtuple_rec_with_match( has an equal number or more fields than dtuple */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint* matched_fields, /* in/out: number of already completely + ulint* matched_fields, /* in/out: number of already completely matched fields; when function returns, contains the value for current comparison */ - ulint* matched_bytes); /* in/out: number of already matched + ulint* matched_bytes); /* in/out: number of already matched bytes within the first field not completely matched; when function returns, contains the value for current comparison */ @@ -104,10 +105,10 @@ Compares a data tuple to a physical record. */ int cmp_dtuple_rec( /*===========*/ - /* out: 1, 0, -1, if dtuple is greater, equal, + /* out: 1, 0, -1, if dtuple is greater, equal, less than rec, respectively; see the comments for cmp_dtuple_rec_with_match */ - dtuple_t* dtuple, /* in: data tuple */ + dtuple_t* dtuple, /* in: data tuple */ rec_t* rec, /* in: physical record */ const ulint* offsets);/* in: array returned by rec_get_offsets() */ /****************************************************************** @@ -128,7 +129,7 @@ encountered, then 0 is returned. */ int cmp_rec_rec_with_match( -/*===================*/ +/*===================*/ /* out: 1, 0 , -1 if rec1 is greater, equal, less, respectively, than rec2; only the common first fields are compared */ @@ -137,11 +138,11 @@ cmp_rec_rec_with_match( const ulint* offsets1,/* in: rec_get_offsets(rec1, index) */ const ulint* offsets2,/* in: rec_get_offsets(rec2, index) */ dict_index_t* index, /* in: data dictionary index */ - ulint* matched_fields, /* in/out: number of already completely + ulint* matched_fields, /* in/out: number of already completely matched fields; when the function returns, contains the value the for current comparison */ - ulint* matched_bytes);/* in/out: number of already matched + ulint* matched_bytes);/* in/out: number of already matched bytes within the first field not completely matched; when the function returns, contains the value for the current comparison */ @@ -151,7 +152,7 @@ first fields are compared. */ UNIV_INLINE int cmp_rec_rec( -/*========*/ +/*========*/ /* out: 1, 0 , -1 if rec1 is greater, equal, less, respectively, than rec2; only the common first fields are compared */ diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic index b86534e0a6a..954634737bc 100644 --- a/storage/innobase/include/rem0cmp.ic +++ b/storage/innobase/include/rem0cmp.ic @@ -12,8 +12,8 @@ data type. */ UNIV_INLINE int cmp_data_data( -/*==========*/ - /* out: 1, 0, -1, if data1 is greater, equal, +/*==========*/ + /* out: 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ dtype_t* cur_type,/* in: data type of the fields */ byte* data1, /* in: data field (== a pointer to a memory @@ -32,8 +32,8 @@ has its data type field set. */ UNIV_INLINE int cmp_dfield_dfield( -/*==============*/ - /* out: 1, 0, -1, if dfield1 is greater, equal, +/*==============*/ + /* out: 1, 0, -1, if dfield1 is greater, equal, less than dfield2, respectively */ dfield_t* dfield1,/* in: data field; must have type field set */ dfield_t* dfield2)/* in: data field */ @@ -51,7 +51,7 @@ first fields are compared. */ UNIV_INLINE int cmp_rec_rec( -/*========*/ +/*========*/ /* out: 1, 0 , -1 if rec1 is greater, equal, less, respectively, than rec2; only the common first fields are compared */ @@ -63,7 +63,7 @@ cmp_rec_rec( { ulint match_f = 0; ulint match_b = 0; - + return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index, &match_f, &match_b)); } diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 69b397c9682..b2f3b9d141b 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -45,10 +45,10 @@ offsets[] array, first passed to rec_get_offsets() */ The following function is used to get the offset of the next chained record on the same page. */ UNIV_INLINE -ulint +ulint rec_get_next_offs( /*==============*/ - /* out: the page offset of the next + /* out: the page offset of the next chained record */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format */ @@ -182,7 +182,7 @@ The following function tells if a new-style record is a node pointer. */ UNIV_INLINE ibool rec_get_node_ptr_flag( -/*=================*/ +/*==================*/ /* out: TRUE if node pointer */ rec_t* rec); /* in: physical record */ /********************************************************** @@ -191,7 +191,7 @@ of the record in the heap of the index page. */ UNIV_INLINE ulint rec_get_heap_no( -/*=============*/ +/*============*/ /* out: heap order number */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format */ @@ -201,7 +201,7 @@ field in the record. */ UNIV_INLINE void rec_set_heap_no( -/*=============*/ +/*============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint heap_no);/* in: the heap number */ @@ -216,7 +216,7 @@ rec_get_1byte_offs_flag( rec_t* rec); /* in: physical record */ /********************************************************** The following function determines the offsets to each field -in the record. It can reuse a previously allocated array. */ +in the record. It can reuse a previously allocated array. */ ulint* rec_get_offsets_func( @@ -264,10 +264,10 @@ data field in an old-style record. */ byte* rec_get_nth_field_old( /*==================*/ - /* out: pointer to the field */ - rec_t* rec, /* in: record */ - ulint n, /* in: index of the field */ - ulint* len); /* out: length of the field; UNIV_SQL_NULL + /* out: pointer to the field */ + rec_t* rec, /* in: record */ + ulint n, /* in: index of the field */ + ulint* len); /* out: length of the field; UNIV_SQL_NULL if SQL null */ /**************************************************************** Gets the physical size of an old-style field. @@ -278,8 +278,8 @@ ulint rec_get_nth_field_size( /*===================*/ /* out: field size in bytes */ - rec_t* rec, /* in: record */ - ulint n); /* in: index of the field */ + rec_t* rec, /* in: record */ + ulint n); /* in: index of the field */ /**************************************************************** The following function is used to get a pointer to the nth data field in a record. */ @@ -287,8 +287,8 @@ UNIV_INLINE byte* rec_get_nth_field( /*==============*/ - /* out: pointer to the field */ - rec_t* rec, /* in: record */ + /* out: pointer to the field */ + rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n, /* in: index of the field */ ulint* len); /* out: length of the field; UNIV_SQL_NULL @@ -365,7 +365,7 @@ rec_set_field_extern_bits( mtr_t* mtr); /* in: mtr holding an X-latch to the page where rec is, or NULL; in the NULL case we do not write to log about the change */ -/*************************************************************** +/*************************************************************** This is used to modify the value of an already existing field in a record. The previous value must have exactly the same size as the new value. If len is UNIV_SQL_NULL then the field is treated as an SQL null for old-style @@ -374,7 +374,7 @@ UNIV_INLINE void rec_set_nth_field( /*==============*/ - rec_t* rec, /* in: record */ + rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n, /* in: index number of the field */ const void* data, /* in: pointer to the data if not SQL null */ @@ -383,7 +383,7 @@ rec_set_nth_field( length as the previous value. If SQL null, previous value must be SQL null. */ -/************************************************************** +/************************************************************** The following function returns the data size of an old-style physical record, that is the sum of field lengths. SQL null fields are counted as length 0 fields. The value returned by the function @@ -394,12 +394,12 @@ rec_get_data_size_old( /*==================*/ /* out: size */ rec_t* rec); /* in: physical record */ -/************************************************************** +/************************************************************** The following function returns the number of fields in a record. */ UNIV_INLINE ulint rec_offs_n_fields( -/*===============*/ +/*==============*/ /* out: number of fields */ const ulint* offsets);/* in: array returned by rec_get_offsets() */ /************************************************************** @@ -415,7 +415,7 @@ rec_offs_data_size( const ulint* offsets);/* in: array returned by rec_get_offsets() */ /************************************************************** Returns the total size of record minus data size of record. -The value returned by the function is the distance from record +The value returned by the function is the distance from record start to record origin in bytes. */ UNIV_INLINE ulint @@ -492,9 +492,9 @@ rec_fold( Builds a physical record out of a data tuple and stores it beginning from address destination. */ -rec_t* +rec_t* rec_convert_dtuple_to_rec( -/*======================*/ +/*======================*/ /* out: pointer to the origin of physical record */ byte* buf, /* in: start address of the diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index 9c24f385f4f..e716241f26c 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -26,7 +26,7 @@ most significant bytes and bits are written below less significant. downward from origin -> 1 8 bits pointer to next record 2 8 bits pointer to next record - 3 1 bit short flag + 3 1 bit short flag 7 bits number of fields 4 3 bits number of fields 5 bits heap number @@ -99,7 +99,7 @@ and the shift needed to obtain each bit-field of the record. */ #define REC_INFO_BITS_SHIFT 0 /* The deleted flag in info bits */ -#define REC_INFO_DELETED_FLAG 0x20UL /* when bit is set to 1, it means the +#define REC_INFO_DELETED_FLAG 0x20UL /* when bit is set to 1, it means the record has been delete marked */ /* The following masks are used to filter the SQL null bit from one-byte and two-byte offsets */ @@ -137,14 +137,14 @@ rec_set_nth_field_null_bit( rec_t* rec, /* in: record */ ulint i, /* in: ith field */ ibool val); /* in: value to set */ -/*************************************************************** +/*************************************************************** Sets an old-style record field to SQL null. The physical size of the field is not changed. */ void rec_set_nth_field_sql_null( /*=======================*/ - rec_t* rec, /* in: record */ + rec_t* rec, /* in: record */ ulint n); /* in: index of the field */ /*************************************************************** @@ -207,9 +207,9 @@ rec_set_bit_field_1( ut_ad(mask <= 0xFFUL); ut_ad(((mask >> shift) << shift) == mask); ut_ad(((val << shift) & mask) == (val << shift)); - - mach_write_to_1(rec - offs, - (mach_read_from_1(rec - offs) & ~mask) + + mach_write_to_1(rec - offs, + (mach_read_from_1(rec - offs) & ~mask) | (val << shift)); } @@ -250,8 +250,8 @@ rec_set_bit_field_2( ut_ad(((mask >> shift) << shift) == mask); ut_ad(((val << shift) & mask) == (val << shift)); - mach_write_to_2(rec - offs, - (mach_read_from_2(rec - offs) & ~mask) + mach_write_to_2(rec - offs, + (mach_read_from_2(rec - offs) & ~mask) | (val << shift)); } @@ -259,18 +259,21 @@ rec_set_bit_field_2( The following function is used to get the offset of the next chained record on the same page. */ UNIV_INLINE -ulint +ulint rec_get_next_offs( /*==============*/ /* out: the page offset of the next chained record, or 0 if none */ rec_t* rec, /* in: physical record */ ulint comp) /* in: nonzero=compact page format */ -{ +{ ulint field_value; - - ut_ad(REC_NEXT_MASK == 0xFFFFUL); - ut_ad(REC_NEXT_SHIFT == 0); +#if REC_NEXT_MASK != 0xFFFFUL +# error "REC_NEXT_MASK != 0xFFFFUL" +#endif +#if REC_NEXT_SHIFT +# error "REC_NEXT_SHIFT != 0" +#endif field_value = mach_read_from_2(rec - REC_NEXT); @@ -286,16 +289,16 @@ rec_get_next_offs( (int16_t) field_value + ut_align_offset(...) < UNIV_PAGE_SIZE */ ut_ad((field_value >= 32768 - ? field_value - 65536 - : field_value) - + ut_align_offset(rec, UNIV_PAGE_SIZE) - < UNIV_PAGE_SIZE); + ? field_value - 65536 + : field_value) + + ut_align_offset(rec, UNIV_PAGE_SIZE) + < UNIV_PAGE_SIZE); #endif if (field_value == 0) { return(0); } - + return(ut_align_offset(rec + field_value, UNIV_PAGE_SIZE)); } else { ut_ad(field_value < UNIV_PAGE_SIZE); @@ -317,8 +320,12 @@ rec_set_next_offs( { ut_ad(rec); ut_ad(UNIV_PAGE_SIZE > next); - ut_ad(REC_NEXT_MASK == 0xFFFFUL); - ut_ad(REC_NEXT_SHIFT == 0); +#if REC_NEXT_MASK != 0xFFFFUL +# error "REC_NEXT_MASK != 0xFFFFUL" +#endif +#if REC_NEXT_SHIFT +# error "REC_NEXT_SHIFT != 0" +#endif if (comp) { ulint field_value; @@ -327,8 +334,8 @@ rec_set_next_offs( /* The following two statements calculate next - offset_of_rec mod 64Ki, where mod is the modulo as a non-negative number */ - - field_value = (ulint)((lint)next + + field_value = (ulint)((lint)next - (lint)ut_align_offset(rec, UNIV_PAGE_SIZE)); field_value &= REC_NEXT_MASK; } else { @@ -361,7 +368,7 @@ rec_get_n_fields_old( ut_ad(ret > 0); return(ret); -} +} /********************************************************** The following function is used to set the number of fields @@ -414,9 +421,11 @@ rec_get_n_fields( { ut_ad(rec); ut_ad(index); - if (UNIV_UNLIKELY(!index->table->comp)) { + + if (!dict_table_is_comp(index->table)) { return(rec_get_n_fields_old(rec)); } + switch (rec_get_status(rec)) { case REC_STATUS_ORDINARY: return(dict_index_get_n_fields(index)); @@ -449,10 +458,10 @@ rec_get_n_owned( ret = rec_get_bit_field_1(rec, comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED, REC_N_OWNED_MASK, REC_N_OWNED_SHIFT); - ut_ad(ret <= REC_MAX_N_OWNED); + ut_ad(ret <= REC_MAX_N_OWNED); return(ret); -} +} /********************************************************** The following function is used to set the number of owned records. */ @@ -492,7 +501,7 @@ rec_get_info_bits( ut_ad((ret & ~REC_INFO_BITS_MASK) == 0); return(ret); -} +} /********************************************************** The following function is used to set the info bits of a record. */ @@ -609,7 +618,7 @@ rec_set_deleted_flag( ulint val; val = rec_get_info_bits(rec, comp); - + if (flag) { val |= REC_INFO_DELETED_FLAG; } else { @@ -624,7 +633,7 @@ The following function tells if a new-style record is a node pointer. */ UNIV_INLINE ibool rec_get_node_ptr_flag( -/*=================*/ +/*==================*/ /* out: TRUE if node pointer */ rec_t* rec) /* in: physical record */ { @@ -637,7 +646,7 @@ heap of the index page. */ UNIV_INLINE ulint rec_get_heap_no( -/*=============*/ +/*============*/ /* out: heap order number */ rec_t* rec, /* in: physical record */ ulint comp) /* in: nonzero=compact page format */ @@ -652,14 +661,14 @@ rec_get_heap_no( ut_ad(ret <= REC_MAX_HEAP_NO); return(ret); -} +} /********************************************************** The following function is used to set the heap number field in the record. */ UNIV_INLINE void rec_set_heap_no( -/*=============*/ +/*============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint heap_no)/* in: the heap number */ @@ -715,17 +724,17 @@ UNIV_INLINE ulint rec_1_get_field_end_info( /*=====================*/ - /* out: offset of the start of the field, SQL null - flag ORed */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + /* out: offset of the start of the field, SQL null + flag ORed */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1))); } - + /********************************************************** Returns the offset of nth field end if the record is stored in the 2-byte offsets form. If the field is SQL null, the flag is ORed in the returned @@ -734,10 +743,10 @@ UNIV_INLINE ulint rec_2_get_field_end_info( /*=====================*/ - /* out: offset of the start of the field, SQL null - flag and extern storage flag ORed */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + /* out: offset of the start of the field, SQL null + flag and extern storage flag ORed */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -758,7 +767,7 @@ this position, and following positions hold the end offsets of the fields. */ #define rec_offs_base(offsets) (offsets + REC_OFFS_HEADER_SIZE) -/************************************************************** +/************************************************************** The following function returns the number of allocated elements for an array of offsets. */ UNIV_INLINE @@ -775,7 +784,7 @@ rec_offs_get_n_alloc( return(n_alloc); } -/************************************************************** +/************************************************************** The following function sets the number of allocated elements for an array of offsets. */ UNIV_INLINE @@ -790,12 +799,12 @@ rec_offs_set_n_alloc( offsets[0] = n_alloc; } -/************************************************************** +/************************************************************** The following function returns the number of fields in a record. */ UNIV_INLINE ulint rec_offs_n_fields( -/*===============*/ +/*==============*/ /* out: number of fields */ const ulint* offsets)/* in: array returned by rec_get_offsets() */ { @@ -891,8 +900,8 @@ UNIV_INLINE byte* rec_get_nth_field( /*==============*/ - /* out: pointer to the field */ - rec_t* rec, /* in: record */ + /* out: pointer to the field */ + rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n, /* in: index of the field */ ulint* len) /* out: length of the field; UNIV_SQL_NULL @@ -1019,7 +1028,7 @@ rec_set_nth_field_extern_bit( where rec is, or NULL; in the NULL case we do not write to log about the change */ { - if (UNIV_LIKELY(index->table->comp)) { + if (dict_table_is_comp(index->table)) { rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr); } else { rec_set_nth_field_extern_bit_old(rec, i, val, mtr); @@ -1036,17 +1045,17 @@ UNIV_INLINE ulint rec_1_get_prev_field_end_info( /*==========================*/ - /* out: offset of the start of the PREVIOUS field, SQL + /* out: offset of the start of the PREVIOUS field, SQL null flag ORed */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n))); } - + /********************************************************** Returns the offset of n - 1th field end if the record is stored in the 2-byte offsets form. If the field is SQL null, the flag is ORed in the returned @@ -1055,10 +1064,10 @@ UNIV_INLINE ulint rec_2_get_prev_field_end_info( /*==========================*/ - /* out: offset of the start of the PREVIOUS field, SQL + /* out: offset of the start of the PREVIOUS field, SQL null flag ORed */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1073,9 +1082,9 @@ UNIV_INLINE void rec_1_set_field_end_info( /*=====================*/ - rec_t* rec, /* in: record */ - ulint n, /* in: field index */ - ulint info) /* in: value to set */ + rec_t* rec, /* in: record */ + ulint n, /* in: field index */ + ulint info) /* in: value to set */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -1090,9 +1099,9 @@ UNIV_INLINE void rec_2_set_field_end_info( /*=====================*/ - rec_t* rec, /* in: record */ - ulint n, /* in: field index */ - ulint info) /* in: value to set */ + rec_t* rec, /* in: record */ + ulint n, /* in: field index */ + ulint info) /* in: value to set */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -1107,9 +1116,9 @@ UNIV_INLINE ulint rec_1_get_field_start_offs( /*=======================*/ - /* out: offset of the start of the field */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + /* out: offset of the start of the field */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1122,7 +1131,7 @@ rec_1_get_field_start_offs( return(rec_1_get_prev_field_end_info(rec, n) & ~REC_1BYTE_SQL_NULL_MASK); } - + /********************************************************** Returns the offset of nth field start if the record is stored in the 2-byte offsets form. */ @@ -1130,9 +1139,9 @@ UNIV_INLINE ulint rec_2_get_field_start_offs( /*=======================*/ - /* out: offset of the start of the field */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + /* out: offset of the start of the field */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1145,7 +1154,7 @@ rec_2_get_field_start_offs( return(rec_2_get_prev_field_end_info(rec, n) & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK)); } - + /********************************************************** The following function is used to read the offset of the start of a data field in the record. The start of an SQL null field is the end offset of the @@ -1155,9 +1164,9 @@ UNIV_INLINE ulint rec_get_field_start_offs( /*=====================*/ - /* out: offset of the start of the field */ - rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + /* out: offset of the start of the field */ + rec_t* rec, /* in: record */ + ulint n) /* in: field index */ { ut_ad(rec); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1184,8 +1193,8 @@ ulint rec_get_nth_field_size( /*===================*/ /* out: field size in bytes */ - rec_t* rec, /* in: record */ - ulint n) /* in: index of the field */ + rec_t* rec, /* in: record */ + ulint n) /* in: index of the field */ { ulint os; ulint next_os; @@ -1198,7 +1207,7 @@ rec_get_nth_field_size( return(next_os - os); } -/*************************************************************** +/*************************************************************** This is used to modify the value of an already existing field in a record. The previous value must have exactly the same size as the new value. If len is UNIV_SQL_NULL then the field is treated as an SQL null for old-style @@ -1243,7 +1252,7 @@ rec_set_nth_field( ut_memcpy(data2, data, len); } -/************************************************************** +/************************************************************** The following function returns the data size of an old-style physical record, that is the sum of field lengths. SQL null fields are counted as length 0 fields. The value returned by the function @@ -1260,7 +1269,7 @@ rec_get_data_size_old( return(rec_get_field_start_offs(rec, rec_get_n_fields_old(rec))); } -/************************************************************** +/************************************************************** The following function sets the number of fields in offsets. */ UNIV_INLINE void @@ -1327,7 +1336,7 @@ rec_offs_size( { return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); } - + /************************************************************** Returns a pointer to the end of the record. */ UNIV_INLINE @@ -1367,7 +1376,7 @@ rec_copy( { ulint extra_len; ulint data_len; - + ut_ad(rec && buf); ut_ad(rec_offs_validate((rec_t*) rec, NULL, offsets)); ut_ad(rec_validate((rec_t*) rec, offsets)); @@ -1434,7 +1443,7 @@ rec_get_converted_size( ? dict_index_get_n_unique_in_tree(index) + 1 : dict_index_get_n_fields(index))); - if (UNIV_LIKELY(index->table->comp)) { + if (dict_table_is_comp(index->table)) { return(rec_get_converted_size_new(index, dtuple)); } @@ -1478,15 +1487,15 @@ rec_fold( ut_ad(n_fields < n_fields_rec || n_bytes == 0); if (n_fields > n_fields_rec) { - n_fields = n_fields_rec; + n_fields = n_fields_rec; } if (n_fields == n_fields_rec) { - n_bytes = 0; + n_bytes = 0; } fold = ut_fold_dulint(tree_id); - + for (i = 0; i < n_fields; i++) { data = rec_get_nth_field(rec, offsets, i, &len); @@ -1503,7 +1512,7 @@ rec_fold( if (len > n_bytes) { len = n_bytes; } - + fold = ut_fold_ulint_pair(fold, ut_fold_binary(data, len)); } diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index a5b4b74e7fc..b4bcc8ac5ca 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -15,7 +15,7 @@ Created 4/20/1996 Heikki Tuuri #include "dict0types.h" #include "trx0types.h" #include "row0types.h" - + /******************************************************************* Checks if foreign key constraint fails for an index entry. Sets shared locks which lock either the success or the failure of the constraint. NOTE that @@ -45,7 +45,7 @@ ins_node_create( /*============*/ /* out, own: insert node struct */ ulint ins_type, /* in: INS_VALUES, ... */ - dict_table_t* table, /* in: table where to insert */ + dict_table_t* table, /* in: table where to insert */ mem_heap_t* heap); /* in: mem heap where created */ /************************************************************************* Sets a new row to insert for an INS_DIRECT node. This function is only used @@ -166,4 +166,4 @@ struct ins_node_struct{ #include "row0ins.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 4062179483d..8ff8a0476a1 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -154,7 +154,7 @@ row_update_prebuilt_trx( /************************************************************************* Unlocks an AUTO_INC type lock possibly reserved by trx. */ -void +void row_unlock_table_autoinc_for_mysql( /*===============================*/ trx_t* trx); /* in: transaction */ @@ -186,7 +186,7 @@ row_lock_table_for_mysql( prebuilt->select_lock_type */ ulint mode); /* in: lock mode of table (ignored if table==NULL) */ - + /************************************************************************* Does an insert for MySQL. */ @@ -489,7 +489,7 @@ struct mysql_row_templ_struct { length at the start of row in the MySQL format (NOTE that the MySQL key value format always uses 2 bytes for the data - len) */ + len) */ ulint charset; /* MySQL charset-collation code of the column, or zero */ ulint mbminlen; /* minimum length of a char, in bytes, @@ -523,10 +523,10 @@ struct row_prebuilt_struct { an SQL statement: we may have to set an intention lock on the table, create a consistent read view etc. */ - ibool mysql_has_locked; /* this is set TRUE when MySQL - calls external_lock on this handle - with a lock flag, and set FALSE when - with the F_UNLOCK flag */ + ibool mysql_has_locked; /* this is set TRUE when MySQL + calls external_lock on this handle + with a lock flag, and set FALSE when + with the F_UNLOCK flag */ ibool clust_index_was_generated; /* if the user did not define a primary key in MySQL, then Innobase @@ -549,7 +549,7 @@ struct row_prebuilt_struct { unique search from a clustered index, because HANDLER allows NEXT and PREV in such a situation */ - ulint template_type; /* ROW_MYSQL_WHOLE_ROW, + ulint template_type; /* ROW_MYSQL_WHOLE_ROW, ROW_MYSQL_REC_FIELDS, ROW_MYSQL_DUMMY_TEMPLATE, or ROW_MYSQL_NO_TEMPLATE */ @@ -625,12 +625,12 @@ struct row_prebuilt_struct { ('semi-consistent read'). Then, this field will be set to ROW_READ_DID_SEMI_CONSISTENT to - indicate that. If the row does not + indicate that. If the row does not match the WHERE condition, MySQL will invoke handler::unlock_row() to clear the flag back to ROW_READ_TRY_SEMI_CONSISTENT and - to simply skip the row. If + to simply skip the row. If the row matches, the next call to row_search_for_mysql() will lock the row. @@ -654,9 +654,9 @@ struct row_prebuilt_struct { allocated mem buf start, because there is a 4 byte magic number at the start and at the end */ - ibool keep_other_fields_on_keyread; /* when using fetch - cache with HA_EXTRA_KEYREAD, don't - overwrite other fields in mysql row + ibool keep_other_fields_on_keyread; /* when using fetch + cache with HA_EXTRA_KEYREAD, don't + overwrite other fields in mysql row row buffer.*/ ulint fetch_cache_first;/* position of the first not yet fetched row in fetch_cache */ @@ -687,9 +687,8 @@ struct row_prebuilt_struct { #define ROW_READ_TRY_SEMI_CONSISTENT 1 #define ROW_READ_DID_SEMI_CONSISTENT 2 - #ifndef UNIV_NONINL #include "row0mysql.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index 4c863441442..52dd2fce551 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -17,7 +17,7 @@ Created 3/14/1997 Heikki Tuuri #include "trx0types.h" #include "que0types.h" #include "row0types.h" - + /************************************************************************ Creates a purge node to a query graph. */ @@ -77,4 +77,4 @@ struct purge_node_struct{ #include "row0purge.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index 782973d8f5d..22ad4cb4d6d 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -14,7 +14,7 @@ Created 4/20/1996 Heikki Tuuri #include "dict0types.h" #include "trx0types.h" #include "que0types.h" -#include "mtr0mtr.h" +#include "mtr0mtr.h" #include "rem0types.h" #include "read0types.h" #include "btr0types.h" @@ -67,9 +67,9 @@ dtuple_t* row_build_index_entry( /*==================*/ /* out: index entry which should be inserted */ - dtuple_t* row, /* in: row which should be inserted to the + dtuple_t* row, /* in: row which should be inserted to the table */ - dict_index_t* index, /* in: index on the table */ + dict_index_t* index, /* in: index on the table */ mem_heap_t* heap); /* in: memory heap from which the memory for the index entry is allocated */ /*********************************************************************** @@ -81,7 +81,7 @@ row_build( /*======*/ /* out, own: row built; see the NOTE below! */ ulint type, /* in: ROW_COPY_POINTERS, ROW_COPY_DATA, or - ROW_COPY_ALSO_EXTERNALS, + ROW_COPY_ALSO_EXTERNALS, the two last copy also the data fields to heap as the first only places pointers to data fields on the index page, and thus is @@ -232,7 +232,7 @@ row_search_index_entry( be closed by the caller */ mtr_t* mtr); /* in: mtr */ - + #define ROW_COPY_DATA 1 #define ROW_COPY_POINTERS 2 #define ROW_COPY_ALSO_EXTERNALS 3 @@ -249,4 +249,4 @@ However, the kernel mutex can be reserved while latches are owned. */ #include "row0row.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic index 85410beacf0..7cf09d25eed 100644 --- a/storage/innobase/include/row0row.ic +++ b/storage/innobase/include/row0row.ic @@ -53,7 +53,7 @@ row_get_rec_trx_id( ut_ad(rec_offs_validate(rec, index, offsets)); offset = index->trx_id_offset; - + if (offset) { return(trx_read_trx_id(rec + offset)); } else { @@ -79,7 +79,7 @@ row_get_rec_roll_ptr( ut_ad(rec_offs_validate(rec, index, offsets)); offset = index->trx_id_offset; - + if (offset) { return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN)); } else { @@ -105,7 +105,7 @@ row_set_rec_trx_id( ut_ad(rec_offs_validate(rec, index, offsets)); offset = index->trx_id_offset; - + if (offset) { trx_write_trx_id(rec + offset, trx_id); } else { @@ -131,11 +131,11 @@ row_set_rec_roll_ptr( ut_ad(rec_offs_validate(rec, index, offsets)); offset = index->trx_id_offset; - + if (offset) { trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr); } else { - row_set_rec_sys_field(DATA_ROLL_PTR, + row_set_rec_sys_field(DATA_ROLL_PTR, rec, index, offsets, roll_ptr); } } @@ -163,10 +163,10 @@ row_build_row_ref_fast( ulint ref_len; ulint field_no; ulint i; - + ut_ad(rec_offs_validate(rec, NULL, offsets)); ref_len = dtuple_get_n_fields(ref); - + for (i = 0; i < ref_len; i++) { dfield = dtuple_get_nth_field(ref, i); diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index 8d5187bfc1c..c9f2389d3dd 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -118,7 +118,7 @@ ulint row_search_for_mysql( /*=================*/ /* out: DB_SUCCESS, - DB_RECORD_NOT_FOUND, + DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK, DB_LOCK_TABLE_FULL, or DB_TOO_BIG_RECORD */ @@ -133,7 +133,7 @@ row_search_for_mysql( the end of the index, depending on 'mode' */ ulint match_mode, /* in: 0 or ROW_SEL_EXACT or - ROW_SEL_EXACT_PREFIX */ + ROW_SEL_EXACT_PREFIX */ ulint direction); /* in: 0 or ROW_SEL_NEXT or ROW_SEL_PREV; NOTE: if this is != 0, then prebuilt must have a pcur @@ -238,8 +238,8 @@ struct plan_struct{ this pcur to search the clustered index */ mem_heap_t* old_vers_heap; /* memory heap used in building an old - version of a row, or NULL */ -}; + version of a row, or NULL */ +}; struct sel_node_struct{ que_common_t common; /* node type: QUE_NODE_SELECT */ @@ -296,7 +296,7 @@ struct sel_node_struct{ so that they do not change between fetches */ }; - + /* Select node states */ #define SEL_NODE_CLOSED 0 /* it is a declared cursor which is not currently open */ @@ -335,7 +335,7 @@ struct row_printf_node_struct{ #define ROW_SEL_PREV 2 #define ROW_SEL_EXACT 1 /* search using a complete key value */ -#define ROW_SEL_EXACT_PREFIX 2 /* search using a key prefix which +#define ROW_SEL_EXACT_PREFIX 2 /* search using a key prefix which must match to rows: the prefix may contain an incomplete field (the last field in prefix may be just @@ -345,4 +345,4 @@ struct row_printf_node_struct{ #include "row0sel.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0sel.ic b/storage/innobase/include/row0sel.ic index 600c6204571..d58daf79969 100644 --- a/storage/innobase/include/row0sel.ic +++ b/storage/innobase/include/row0sel.ic @@ -50,7 +50,7 @@ open_step( ulint err; ut_ad(thr); - + node = thr->run_node; ut_ad(que_node_get_type(node) == QUE_NODE_OPEN); @@ -74,15 +74,15 @@ open_step( err = DB_ERROR; } } - + if (UNIV_EXPECT(err, DB_SUCCESS) != DB_SUCCESS) { /* SQL error detected */ fprintf(stderr, "SQL error %lu\n", (ulong) err); ut_error; } - + thr->run_node = que_node_get_parent(node); - + return(thr); } diff --git a/storage/innobase/include/row0types.h b/storage/innobase/include/row0types.h index 79b864f4835..56ca8711848 100644 --- a/storage/innobase/include/row0types.h +++ b/storage/innobase/include/row0types.h @@ -27,7 +27,7 @@ typedef struct open_node_struct open_node_t; typedef struct fetch_node_struct fetch_node_t; -typedef struct row_printf_node_struct row_printf_node_t; +typedef struct row_printf_node_struct row_printf_node_t; typedef struct sel_buf_struct sel_buf_t; typedef struct undo_node_struct undo_node_t; diff --git a/storage/innobase/include/row0uins.h b/storage/innobase/include/row0uins.h index fc57881f691..e28d5363048 100644 --- a/storage/innobase/include/row0uins.h +++ b/storage/innobase/include/row0uins.h @@ -16,7 +16,7 @@ Created 2/25/1997 Heikki Tuuri #include "que0types.h" #include "row0types.h" #include "mtr0mtr.h" - + /*************************************************************** Undoes a fresh insert of a row to a table. A fresh insert means that the same clustered index unique key did not have any record, even delete @@ -33,4 +33,4 @@ row_undo_ins( #include "row0uins.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0umod.h b/storage/innobase/include/row0umod.h index 2c8e19a80ae..f22945e6f12 100644 --- a/storage/innobase/include/row0umod.h +++ b/storage/innobase/include/row0umod.h @@ -16,7 +16,7 @@ Created 2/27/1997 Heikki Tuuri #include "que0types.h" #include "row0types.h" #include "mtr0mtr.h" - + /*************************************************************** Undoes a modify operation on a row of a table. */ @@ -32,4 +32,4 @@ row_undo_mod( #include "row0umod.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h index d64a00dcb8f..5e3f514ad8d 100644 --- a/storage/innobase/include/row0undo.h +++ b/storage/innobase/include/row0undo.h @@ -113,4 +113,4 @@ struct undo_node_struct{ #include "row0undo.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 673e0511153..41cce851d87 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -18,7 +18,7 @@ Created 12/27/1996 Heikki Tuuri #include "que0types.h" #include "row0types.h" #include "pars0types.h" - + /************************************************************************* Creates an update vector object. */ UNIV_INLINE @@ -209,7 +209,7 @@ Checks if an update vector changes an ordering field of an index record. This function is fast if the update vector is short or the number of ordering fields in the index is small. Otherwise, this can be quadratic. NOTE: we compare the fields as binary strings! */ - + ibool row_upd_changes_ord_field_binary( /*=============================*/ @@ -410,7 +410,7 @@ struct upd_node_struct{ index record was changed, or this is a delete operation: should update all the secondary index records */ -#define UPD_NODE_UPDATE_SOME_SEC 5 /* secondary index entries should be +#define UPD_NODE_UPDATE_SOME_SEC 5 /* secondary index entries should be looked at and updated if an ordering field changed */ @@ -425,4 +425,4 @@ struct upd_node_struct{ #include "row0upd.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic index acbb11aa1c7..d5a797df651 100644 --- a/storage/innobase/include/row0upd.ic +++ b/storage/innobase/include/row0upd.ic @@ -34,7 +34,7 @@ upd_create( for (i = 0; i < n; i++) { update->fields[i].extern_storage = 0; } - + return(update); } @@ -80,7 +80,7 @@ upd_field_set_field_no( index */ dict_index_t* index, /* in: index */ trx_t* trx) /* in: transaction */ -{ +{ upd_field->field_no = field_no; if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) { diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h index fafbe9a2402..e1377112d2a 100644 --- a/storage/innobase/include/row0vers.h +++ b/storage/innobase/include/row0vers.h @@ -123,4 +123,4 @@ row_vers_build_for_semi_consistent_read( #include "row0vers.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 11347f430d4..906f0e3875c 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -34,6 +34,18 @@ extern ibool srv_lower_case_table_names; 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 */ @@ -43,12 +55,12 @@ extern char* srv_arch_dir; #endif /* UNIV_LOG_ARCHIVE */ extern ibool srv_file_per_table; -extern ibool srv_locks_unsafe_for_binlog; +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 ulint* srv_data_file_is_raw_partition; extern ibool srv_auto_extend_last_data_file; extern ulint srv_last_file_size_max; @@ -56,8 +68,8 @@ extern ulong srv_auto_extend_increment; extern ibool srv_created_new_raw; -#define SRV_NEW_RAW 1 -#define SRV_OLD_RAW 2 +#define SRV_NEW_RAW 1 +#define SRV_OLD_RAW 2 extern char** srv_log_group_home_dirs; @@ -84,9 +96,9 @@ extern dulint srv_archive_recovery_limit_lsn; 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 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; @@ -100,7 +112,7 @@ 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 +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 @@ -112,8 +124,8 @@ 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 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; @@ -127,20 +139,20 @@ 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_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 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; @@ -152,7 +164,7 @@ 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; @@ -183,8 +195,7 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, #define kernel_mutex (*kernel_mutex_temp) #define SRV_MAX_N_IO_THREADS 100 -#define SRV_CONCURRENCY_THRESHOLD 20 - + /* Array of English strings describing the current state of an i/o handler thread */ extern const char* srv_io_thread_op_info[]; @@ -252,15 +263,17 @@ 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 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 @@ -274,7 +287,7 @@ 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 +#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 @@ -288,7 +301,7 @@ of lower numbers are included. */ as committed */ #define SRV_FORCE_NO_LOG_REDO 6 /* do not do the log roll-forward in connection with recovery */ - + /************************************************************************* Boots Innobase server. */ @@ -433,7 +446,7 @@ void srv_release_mysql_thread_if_suspended( /*==================================*/ que_thr_t* thr); /* in: query thread associated with the - MySQL OS thread */ + 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. */ @@ -496,7 +509,7 @@ cleaning versions from the buffer pool. */ 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 +#define SRV_MASTER 7 /* the master thread, (whose type number must be biggest) */ /* Thread slot in the thread table */ @@ -507,49 +520,49 @@ 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; + 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 */ diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index d24f119c0b0..a04930d6516 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -89,18 +89,18 @@ void set_panic_flag_for_netware(void); extern ibool srv_have_fullfsync; #endif -extern ulint srv_sizeof_trx_t_in_ha_innodb_cc; +extern ulint srv_sizeof_trx_t_in_ha_innodb_cc; -extern ibool srv_is_being_started; +extern ibool srv_is_being_started; extern ibool srv_startup_is_before_trx_rollback_phase; extern ibool srv_is_being_shut_down; -extern ibool srv_start_raw_disk_in_use; +extern ibool srv_start_raw_disk_in_use; /* At a shutdown the value first climbs from 0 to SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on */ -extern ulint srv_shutdown_state; +extern ulint srv_shutdown_state; #define SRV_SHUTDOWN_CLEANUP 1 #define SRV_SHUTDOWN_LAST_PHASE 2 diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h index fecd910683e..d4407e14dc4 100644 --- a/storage/innobase/include/sync0arr.h +++ b/storage/innobase/include/sync0arr.h @@ -14,7 +14,7 @@ Created 9/5/1995 Heikki Tuuri #include "ut0mem.h" #include "os0thread.h" -typedef struct sync_cell_struct sync_cell_t; +typedef struct sync_cell_struct sync_cell_t; typedef struct sync_array_struct sync_array_t; #define SYNC_ARRAY_OS_MUTEX 1 @@ -48,12 +48,12 @@ The event of the cell is reset to nonsignalled state. */ void sync_array_reserve_cell( /*====================*/ - sync_array_t* arr, /* in: wait array */ - void* object, /* in: pointer to the object to wait for */ - ulint type, /* in: lock request type */ + sync_array_t* arr, /* in: wait array */ + void* object, /* in: pointer to the object to wait for */ + ulint type, /* in: lock request type */ const char* file, /* in: file where requested */ - ulint line, /* in: line where requested */ - ulint* index); /* out: index of the reserved cell */ + ulint line, /* in: line where requested */ + ulint* index); /* out: index of the reserved cell */ /********************************************************************** This function should be called when a thread starts to wait on a wait array cell. In the debug version this function checks @@ -63,17 +63,17 @@ case prints info and asserts. */ void sync_array_wait_event( /*==================*/ - sync_array_t* arr, /* in: wait array */ - ulint index); /* in: index of the reserved cell */ + sync_array_t* arr, /* in: wait array */ + ulint index); /* in: index of the reserved cell */ /********************************************************************** -Frees the cell. NOTE! sync_array_wait_event frees the cell -automatically! */ +Frees the cell safely by reserving the sync array mutex and decrementing +n_reserved if necessary. Should only be called from mutex_spin_wait. */ void -sync_array_free_cell( -/*=================*/ +sync_array_free_cell_protected( +/*===========================*/ sync_array_t* arr, /* in: wait array */ - ulint index); /* in: index of the cell in array */ + ulint index); /* in: index of the cell in array */ /************************************************************************** Looks for the cells in the wait array which refer to the wait object specified, diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 911c8ac3f4a..e6ca3258099 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -31,7 +31,7 @@ typedef struct rw_lock_debug_struct rw_lock_debug_t; typedef UT_LIST_BASE_NODE_T(rw_lock_t) rw_lock_list_t; -extern rw_lock_list_t rw_lock_list; +extern rw_lock_list_t rw_lock_list; extern mutex_t rw_lock_list_mutex; #ifdef UNIV_SYNC_DEBUG @@ -62,7 +62,7 @@ location (which must be appropriately aligned). The rw-lock is initialized to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free is necessary only if the memory block containing it is freed. */ #define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__, #L) - + /*=====================*/ /********************************************************************** Creates, or rather, initializes an rw-lock object in a specified memory @@ -75,7 +75,7 @@ rw_lock_create_func( /*================*/ rw_lock_t* lock, /* in: pointer to memory */ const char* cfile_name, /* in: file name where created */ - ulint cline, /* in: file line where created */ + ulint cline, /* in: file line where created */ const char* cmutex_name); /* in: mutex name */ /********************************************************************** Calling this function is obligatory only if the memory buffer containing @@ -98,20 +98,20 @@ rw_lock_validate( NOTE! The following macros should be used in rw s-locking, not the corresponding function. */ -#define rw_lock_s_lock(M) rw_lock_s_lock_func(\ - (M), 0, __FILE__, __LINE__) +#define rw_lock_s_lock(M) rw_lock_s_lock_func(\ + (M), 0, __FILE__, __LINE__) /****************************************************************** NOTE! The following macros should be used in rw s-locking, not the corresponding function. */ -#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\ - (M), (P), __FILE__, __LINE__) +#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\ + (M), (P), __FILE__, __LINE__) /****************************************************************** NOTE! The following macros should be used in rw s-locking, not the corresponding function. */ -#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\ - (M), __FILE__, __LINE__) +#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\ + (M), __FILE__, __LINE__) /********************************************************************** NOTE! Use the corresponding macro, not directly this function, except if you supply the file name and line number. Lock an rw-lock in shared mode @@ -123,7 +123,7 @@ UNIV_INLINE void rw_lock_s_lock_func( /*================*/ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ ulint pass, /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/* in: file name where lock requested */ @@ -137,7 +137,7 @@ ibool rw_lock_s_lock_func_nowait( /*=======================*/ /* out: TRUE if success */ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ const char* file_name,/* in: file name where lock requested */ ulint line); /* in: line where requested */ /********************************************************************** @@ -149,7 +149,7 @@ ibool rw_lock_x_lock_func_nowait( /*=======================*/ /* out: TRUE if success */ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ const char* file_name,/* in: file name where lock requested */ ulint line); /* in: line where requested */ /********************************************************************** @@ -168,36 +168,36 @@ rw_lock_s_unlock_func( Releases a shared mode lock. */ #ifdef UNIV_SYNC_DEBUG -#define rw_lock_s_unlock(L) rw_lock_s_unlock_func(L, 0) +#define rw_lock_s_unlock(L) rw_lock_s_unlock_func(L, 0) #else -#define rw_lock_s_unlock(L) rw_lock_s_unlock_func(L) +#define rw_lock_s_unlock(L) rw_lock_s_unlock_func(L) #endif /*********************************************************************** Releases a shared mode lock. */ #ifdef UNIV_SYNC_DEBUG -#define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L, P) +#define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L, P) #else -#define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L) +#define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L) #endif /****************************************************************** NOTE! The following macro should be used in rw x-locking, not the corresponding function. */ -#define rw_lock_x_lock(M) rw_lock_x_lock_func(\ - (M), 0, __FILE__, __LINE__) +#define rw_lock_x_lock(M) rw_lock_x_lock_func(\ + (M), 0, __FILE__, __LINE__) /****************************************************************** NOTE! The following macro should be used in rw x-locking, not the corresponding function. */ -#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\ - (M), (P), __FILE__, __LINE__) +#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\ + (M), (P), __FILE__, __LINE__) /****************************************************************** NOTE! The following macros should be used in rw x-locking, not the corresponding function. */ -#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\ - (M), __FILE__, __LINE__) +#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\ + (M), __FILE__, __LINE__) /********************************************************************** NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for the current thread. If the rw-lock is locked @@ -211,7 +211,7 @@ an s-lock, locking does not succeed! */ void rw_lock_x_lock_func( /*================*/ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ ulint pass, /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/* in: file name where lock requested */ @@ -232,17 +232,17 @@ rw_lock_x_unlock_func( Releases an exclusive mode lock. */ #ifdef UNIV_SYNC_DEBUG -#define rw_lock_x_unlock(L) rw_lock_x_unlock_func(L, 0) +#define rw_lock_x_unlock(L) rw_lock_x_unlock_func(L, 0) #else -#define rw_lock_x_unlock(L) rw_lock_x_unlock_func(L) +#define rw_lock_x_unlock(L) rw_lock_x_unlock_func(L) #endif /*********************************************************************** Releases an exclusive mode lock. */ #ifdef UNIV_SYNC_DEBUG -#define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L, P) +#define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L, P) #else -#define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L) +#define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L) #endif /********************************************************************** Low-level function which locks an rw-lock in s-mode when we know that it @@ -413,7 +413,7 @@ field. Then no new readers are allowed in. */ struct rw_lock_struct { ulint reader_count; /* Number of readers who have locked this lock in the shared mode */ - ulint writer; /* This field is set to RW_LOCK_EX if there + ulint writer; /* This field is set to RW_LOCK_EX if there is a writer owning the lock (in exclusive mode), RW_LOCK_WAIT_EX if a writer is queueing for the lock, and @@ -424,7 +424,7 @@ struct rw_lock_struct { recursively locked the lock in the exclusive mode */ mutex_t mutex; /* The mutex protecting rw_lock_struct */ - ulint pass; /* Default value 0. This is set to some + ulint pass; /* Default value 0. This is set to some value != 0 given by the caller of an x-lock operation, if the x-lock is to be passed to another thread to unlock (which happens in diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index b1ae636010a..37dc22f1fe5 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -15,7 +15,7 @@ waiting for the lock before suspending the thread. */ void rw_lock_s_lock_spin( /*================*/ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ ulint pass, /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/* in: file name where lock requested */ @@ -126,9 +126,9 @@ ibool rw_lock_s_lock_low( /*===============*/ /* out: TRUE if success */ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ ulint pass __attribute__((unused)), - /* in: pass value; != 0, if the lock will be + /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /* in: file name where lock requested */ ulint line) /* in: line where requested */ @@ -169,7 +169,7 @@ rw_lock_s_lock_direct( { ut_ad(lock->writer == RW_LOCK_NOT_LOCKED); ut_ad(rw_lock_get_reader_count(lock) == 0); - + /* Set the shared lock by incrementing the reader count */ lock->reader_count++; @@ -193,7 +193,7 @@ rw_lock_x_lock_direct( const char* file_name, /* in: file name where requested */ ulint line) /* in: line where lock requested */ { - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); ut_ad(rw_lock_get_reader_count(lock) == 0); ut_ad(rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED); @@ -201,7 +201,7 @@ rw_lock_x_lock_direct( lock->writer_thread = os_thread_get_curr_id(); lock->writer_count++; lock->pass = 0; - + lock->last_x_file_name = file_name; lock->last_x_line = line; @@ -220,7 +220,7 @@ UNIV_INLINE void rw_lock_s_lock_func( /*================*/ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ ulint pass, /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/* in: file name where lock requested */ @@ -236,7 +236,7 @@ rw_lock_s_lock_func( safe recursive s-locking, we should keep in a list the thread ids of the threads which have s-locked a latch. This would use some CPU time. */ - + #ifdef UNIV_SYNC_DEBUG ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */ #endif /* UNIV_SYNC_DEBUG */ @@ -266,7 +266,7 @@ ibool rw_lock_s_lock_func_nowait( /*=======================*/ /* out: TRUE if success */ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ const char* file_name,/* in: file name where lock requested */ ulint line) /* in: line where requested */ { @@ -285,7 +285,7 @@ rw_lock_s_lock_func_nowait( lock->last_s_file_name = file_name; lock->last_s_line = line; - + success = TRUE; } @@ -303,7 +303,7 @@ ibool rw_lock_x_lock_func_nowait( /*=======================*/ /* out: TRUE if success */ - rw_lock_t* lock, /* in: pointer to rw-lock */ + rw_lock_t* lock, /* in: pointer to rw-lock */ const char* file_name,/* in: file name where lock requested */ ulint line) /* in: line where requested */ { @@ -313,13 +313,13 @@ rw_lock_x_lock_func_nowait( if (UNIV_UNLIKELY(rw_lock_get_reader_count(lock) != 0)) { } else if (UNIV_LIKELY(rw_lock_get_writer(lock) - == RW_LOCK_NOT_LOCKED)) { + == RW_LOCK_NOT_LOCKED)) { rw_lock_set_writer(lock, RW_LOCK_EX); lock->writer_thread = curr_thread; lock->pass = 0; relock: lock->writer_count++; - + #ifdef UNIV_SYNC_DEBUG rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line); #endif @@ -336,7 +336,7 @@ rw_lock_x_lock_func_nowait( mutex_exit(rw_lock_get_mutex(lock)); - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); return(success); } @@ -355,9 +355,9 @@ rw_lock_s_unlock_func( ) { mutex_t* mutex = &(lock->mutex); - ibool sg = FALSE; + ibool sg = FALSE; - /* Acquire the mutex protecting the rw-lock fields */ + /* Acquire the mutex protecting the rw-lock fields */ mutex_enter(mutex); /* Reset the shared lock by decrementing the reader count */ @@ -368,24 +368,24 @@ rw_lock_s_unlock_func( #ifdef UNIV_SYNC_DEBUG rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED); #endif - + /* If there may be waiters and this was the last s-lock, signal the object */ if (UNIV_UNLIKELY(lock->waiters) && lock->reader_count == 0) { - sg = TRUE; + sg = TRUE; rw_lock_set_waiters(lock, 0); } - + mutex_exit(mutex); if (UNIV_UNLIKELY(sg)) { sync_array_signal_object(sync_primary_wait_array, lock); } - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); #ifdef UNIV_SYNC_PERF_STAT rw_s_exit_count++; @@ -412,7 +412,7 @@ rw_lock_s_unlock_direct( #endif ut_ad(!lock->waiters); - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); #ifdef UNIV_SYNC_PERF_STAT rw_s_exit_count++; #endif @@ -431,9 +431,9 @@ rw_lock_x_unlock_func( #endif ) { - ibool sg = FALSE; + ibool sg = FALSE; - /* Acquire the mutex protecting the rw-lock fields */ + /* Acquire the mutex protecting the rw-lock fields */ mutex_enter(&(lock->mutex)); /* Reset the exclusive lock if this thread no longer has an x-mode @@ -450,22 +450,22 @@ rw_lock_x_unlock_func( #ifdef UNIV_SYNC_DEBUG rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX); #endif - + /* If there may be waiters, signal the lock */ if (UNIV_UNLIKELY(lock->waiters) && lock->writer_count == 0) { - sg = TRUE; + sg = TRUE; rw_lock_set_waiters(lock, 0); } - + mutex_exit(&(lock->mutex)); if (UNIV_UNLIKELY(sg)) { sync_array_signal_object(sync_primary_wait_array, lock); } - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); #ifdef UNIV_SYNC_PERF_STAT rw_x_exit_count++; @@ -497,7 +497,7 @@ rw_lock_x_unlock_direct( #endif ut_ad(!lock->waiters); - ut_ad(rw_lock_validate(lock)); + ut_ad(rw_lock_validate(lock)); #ifdef UNIV_SYNC_PERF_STAT rw_x_exit_count++; diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 5955ab9a06a..0a233843b50 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -18,7 +18,7 @@ Created 9/5/1995 Heikki Tuuri #include "sync0arr.h" #ifndef UNIV_HOTBACKUP -extern my_bool timed_mutexes; +extern my_bool timed_mutexes; #endif /* UNIV_HOTBACKUP */ /********************************************************************** @@ -52,7 +52,7 @@ mutex_create_func( /*==============*/ mutex_t* mutex, /* in: pointer to memory */ const char* cfile_name, /* in: file name where created */ - ulint cline, /* in: file line where created */ + ulint cline, /* in: file line where created */ const char* cmutex_name); /* in: mutex name */ /********************************************************************** Calling this function is obligatory only if the memory buffer containing @@ -68,7 +68,7 @@ mutex_free( NOTE! The following macro should be used in mutex locking, not the corresponding function. */ -#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__) +#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__) /********************************************************************** A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled inlining of InnoDB functions, and no inlined functions should be called from @@ -84,8 +84,8 @@ corresponding function. */ /* NOTE! currently same as mutex_enter! */ -#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__) -#define mutex_enter_fast_func mutex_enter_func; +#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__) +#define mutex_enter_fast_func mutex_enter_func; /********************************************************************** NOTE! Use the corresponding macro in the header file, not this function directly. Locks a mutex for the current thread. If the mutex is reserved @@ -96,7 +96,7 @@ void mutex_enter_func( /*=============*/ mutex_t* mutex, /* in: pointer to mutex */ - const char* file_name, /* in: file name where locked */ + const char* file_name, /* in: file name where locked */ ulint line); /* in: line where locked */ /************************************************************************ Tries to lock the mutex for the current thread. If the lock is not acquired @@ -172,7 +172,7 @@ sync_thread_add_level( /*==================*/ void* latch, /* in: pointer to a mutex or an rw-lock */ ulint level); /* in: level in the latching order; if SYNC_LEVEL_NONE, - nothing is done */ + nothing is done */ /********************************************************************** Removes a latch from the thread level array if it is found there. */ @@ -253,7 +253,7 @@ UNIV_INLINE ulint mutex_get_waiters( /*==============*/ - /* out: value to set */ + /* out: value to set */ mutex_t* mutex); /* in: mutex */ #endif /* UNIV_SYNC_DEBUG */ @@ -269,7 +269,7 @@ central memory object latch or mutex. Synchronization object Notes ---------------------- ----- - + Dictionary mutex If we have a pointer to a dictionary | object, e.g., a table, it can be | accessed without reserving the @@ -281,7 +281,7 @@ Dictionary mutex If we have a pointer to a dictionary V Dictionary header | -V +V Secondary index tree latch The tree latch protects also all | the B-tree non-leaf pages. These V can be read with the page only @@ -293,7 +293,7 @@ Secondary index non-leaf bufferfixed to save CPU time, | it is allowed to latch non-leaf pages | even after it has acquired the fsp | latch. -V +V Secondary index leaf The latch on the secondary index leaf | can be kept while accessing the | clustered index, to save CPU time. @@ -301,7 +301,7 @@ V Clustered index tree latch To increase concurrency, the tree | latch is usually released when the | leaf page latch has been acquired. -V +V Clustered index non-leaf | V @@ -319,7 +319,7 @@ Transaction undo mutex The undo log entry must be written | trx undo mutex reserved, it is allowed | to latch the undo log pages in any | order, and also after it has acquired -| the fsp latch. +| the fsp latch. V Rollback segment mutex The rollback segment mutex must be | reserved, if, e.g., a new page must @@ -412,7 +412,7 @@ or row lock! */ #define SYNC_EXTERN_STORAGE 500 #define SYNC_FSP 400 #define SYNC_FSP_PAGE 395 -/*------------------------------------- Insert buffer headers */ +/*------------------------------------- Insert buffer headers */ /*------------------------------------- ibuf_mutex */ /*------------------------------------- Insert buffer tree */ #define SYNC_IBUF_BITMAP_MUTEX 351 @@ -441,7 +441,7 @@ or row lock! */ #define SYNC_MEM_POOL 130 /* Codes used to designate lock operations */ -#define RW_LOCK_NOT_LOCKED 350 +#define RW_LOCK_NOT_LOCKED 350 #define RW_LOCK_EX 351 #define RW_LOCK_EXCLUSIVE 351 #define RW_LOCK_SHARED 352 @@ -485,8 +485,8 @@ struct mutex_struct { ulong count_os_yield; /* count of os_wait */ ulonglong lspent_time; /* mutex os_wait timer msec */ ulonglong lmax_spent_time; /* mutex os_wait timer msec */ - const char* cmutex_name;/* mutex name */ - ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ + const char* cmutex_name;/* mutex name */ + ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ #endif /* !UNIV_HOTBACKUP */ }; @@ -512,7 +512,7 @@ to 20 microseconds. */ /* The number of system calls made in this module. Intended for performance monitoring. */ -extern ulint mutex_system_call_count; +extern ulint mutex_system_call_count; extern ulint mutex_exit_count; /* Latching order checks start when this is set TRUE */ diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index b3fde61db5e..f384e43779f 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -13,7 +13,7 @@ void mutex_set_waiters( /*==============*/ mutex_t* mutex, /* in: mutex */ - ulint n); /* in: value to set */ + ulint n); /* in: value to set */ /********************************************************************** Reserves a mutex for the current thread. If the mutex is reserved, the function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting @@ -22,9 +22,10 @@ for the mutex before suspending the thread. */ void mutex_spin_wait( /*============*/ - mutex_t* mutex, /* in: pointer to mutex */ - const char* file_name,/* in: file name where mutex requested */ - ulint line); /* in: line where requested */ + mutex_t* mutex, /* in: pointer to mutex */ + const char* file_name, /* in: file name where mutex + requested */ + ulint line); /* in: line where requested */ #ifdef UNIV_SYNC_DEBUG /********************************************************************** Sets the debug information for a reserved mutex. */ @@ -64,10 +65,10 @@ mutex_test_and_set( lw = &(mutex->lock_word); - __asm MOV ECX, lw - __asm MOV EDX, 1 - __asm XCHG EDX, DWORD PTR [ECX] - __asm MOV res, EDX + __asm MOV ECX, lw + __asm MOV EDX, 1 + __asm XCHG EDX, DWORD PTR [ECX] + __asm MOV res, EDX /* The fence below would prevent this thread from reading the data structure protected by the mutex before the test-and-set operation is @@ -97,8 +98,8 @@ mutex_test_and_set( code, and the second line tells the input to the asm code. */ asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" : - "=eax" (res), "=m" (*lw) : - "ecx" (lw)); + "=eax" (res), "=m" (*lw) : + "ecx" (lw)); return(res); #else ibool ret; @@ -133,9 +134,9 @@ mutex_reset_lock_word( lw = &(mutex->lock_word); - __asm MOV EDX, 0 - __asm MOV ECX, lw - __asm XCHG EDX, DWORD PTR [ECX] + __asm MOV EDX, 0 + __asm MOV ECX, lw + __asm XCHG EDX, DWORD PTR [ECX] #elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86) ulint* lw; @@ -146,11 +147,11 @@ mutex_reset_lock_word( syntax. The 'l' after the mnemonics denotes a 32-bit operation. */ asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" : - "=m" (*lw) : - "ecx" (lw) : - "eax"); /* gcc does not seem to understand - that our asm code resets eax: tell it - explicitly that after the third ':' */ + "=m" (*lw) : + "ecx" (lw) : + "eax"); /* gcc does not seem to understand that our asm code + resets eax: tell it explicitly that after the third + ':' */ #else mutex->lock_word = 0; @@ -181,7 +182,7 @@ UNIV_INLINE ulint mutex_get_waiters( /*==============*/ - /* out: value to set */ + /* out: value to set */ mutex_t* mutex) /* in: mutex */ { volatile ulint* ptr; /* declared volatile to ensure that @@ -208,7 +209,7 @@ mutex_exit( mutex->thread_id = ULINT_UNDEFINED; sync_thread_reset_level(mutex); -#endif +#endif mutex_reset_lock_word(mutex); /* A problem: we assume that mutex_reset_lock word @@ -224,10 +225,10 @@ mutex_exit( they are missed in mutex_signal_object. */ if (mutex_get_waiters(mutex) != 0) { - + mutex_signal_object(mutex); } - + #ifdef UNIV_SYNC_PERF_STAT mutex_exit_count++; #endif @@ -242,7 +243,7 @@ void mutex_enter_func( /*=============*/ mutex_t* mutex, /* in: pointer to mutex */ - const char* file_name, /* in: file name where locked */ + const char* file_name, /* in: file name where locked */ ulint line) /* in: line where locked */ { ut_ad(mutex_validate(mutex)); @@ -253,9 +254,8 @@ mutex_enter_func( #ifndef UNIV_HOTBACKUP mutex->count_using++; #endif /* UNIV_HOTBACKUP */ - - if (!mutex_test_and_set(mutex)) - { + + if (!mutex_test_and_set(mutex)) { #ifdef UNIV_SYNC_DEBUG mutex_set_debug_info(mutex, file_name, line); #endif @@ -263,5 +263,4 @@ mutex_enter_func( } mutex_spin_wait(mutex, file_name, line); - } diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 049c79aec9b..c4aab91a93a 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -166,4 +166,4 @@ struct trx_purge_struct{ #include "trx0purge.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0purge.ic b/storage/innobase/include/trx0purge.ic index 451e8ca31d0..9f1c0ed96f8 100644 --- a/storage/innobase/include/trx0purge.ic +++ b/storage/innobase/include/trx0purge.ic @@ -22,5 +22,5 @@ trx_purge_get_log_from_hist( node_addr.boffset -= TRX_UNDO_HISTORY_NODE; return(node_addr); -} +} diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 4387ce1a61e..6447b6a2e35 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -300,4 +300,4 @@ record */ #include "trx0rec.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index 944142a299d..7b450f9da39 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -89,7 +89,7 @@ trx_undo_rec_release( trx_t* trx, /* in: transaction */ dulint undo_no);/* in: undo number */ /************************************************************************* -Starts a rollback operation. */ +Starts a rollback operation. */ void trx_rollback( @@ -104,7 +104,7 @@ trx_rollback( /*********************************************************************** Rollback or clean up transactions which have no user session. If the transaction already was committed, then we clean up a possible insert -undo log. If the transaction was not yet committed, then we roll it back. +undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread. */ #ifndef __WIN__ @@ -114,10 +114,10 @@ ulint #endif trx_rollback_or_clean_all_without_sess( /*===================================*/ - /* out: a dummy parameter */ - void* arg __attribute__((unused))); - /* in: a dummy parameter required by - os_thread_create */ + /* out: a dummy parameter */ + void* arg __attribute__((unused))); + /* in: a dummy parameter required by + os_thread_create */ /******************************************************************** Finishes a transaction rollback. */ @@ -129,7 +129,7 @@ trx_finish_rollback_off_kernel( que_thr_t** next_thr);/* in/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the - calling function can start running + calling function can start running a new query thread; if this parameter is NULL, it is ignored */ /******************************************************************** @@ -190,7 +190,7 @@ trx_general_rollback_for_mysql( Rolls back a transaction back to a named savepoint. Modifications after the savepoint are undone but InnoDB does NOT release the corresponding locks which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in +row holds a lock where the lock information is carried by the trx id stored in the row, these locks are naturally released in the rollback. Savepoints which were set after this savepoint are deleted. */ @@ -225,14 +225,14 @@ trx_savepoint_for_mysql( position corresponding to this connection at the time of the savepoint */ - + /*********************************************************************** Releases a named savepoint. Savepoints which were set after this savepoint are deleted. */ ulint trx_release_savepoint_for_mysql( -/*================================*/ +/*============================*/ /* out: if no savepoint of the name found then DB_NO_SAVEPOINT, @@ -303,4 +303,4 @@ struct trx_named_savept_struct{ #include "trx0roll.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index fd64612ab3f..46ba010bd1d 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -118,13 +118,13 @@ trx_rseg_create( /* The rollback segment memory object */ struct trx_rseg_struct{ /*--------------------------------------------------------*/ - ulint id; /* rollback segment id == the index of + ulint id; /* rollback segment id == the index of its slot in the trx system file copy */ mutex_t mutex; /* mutex protecting the fields in this struct except id; NOTE that the latching order must always be kernel mutex -> rseg mutex */ - ulint space; /* space where the rollback segment is + ulint space; /* space where the rollback segment is header is placed */ ulint page_no;/* page number of the rollback segment header */ @@ -190,4 +190,4 @@ struct trx_rseg_struct{ #include "trx0rseg.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic index c9ac50ebf16..4de7a4ab144 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.ic @@ -109,7 +109,7 @@ trx_rsegf_undo_find_free( { ulint i; ulint page_no; - + for (i = 0; i < TRX_RSEG_N_SLOTS; i++) { page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr); diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 31e8607f8a0..a8da5cd51a3 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -29,7 +29,7 @@ file name and position here. We have successfully got the updates to InnoDB up to this position. If .._pos is -1, it means no crash recovery was needed, or there was no master log position info inside InnoDB. */ -extern char trx_sys_mysql_master_log_name[]; +extern char trx_sys_mysql_master_log_name[]; extern ib_longlong trx_sys_mysql_master_log_pos; /* If this MySQL server uses binary logging, after InnoDB has been inited @@ -37,7 +37,7 @@ and if it has done a crash recovery, we store the binlog file name and position here. If .._pos is -1, it means there was no binlog position info inside InnoDB. */ -extern char trx_sys_mysql_bin_log_name[]; +extern char trx_sys_mysql_bin_log_name[]; extern ib_longlong trx_sys_mysql_bin_log_pos; /* The transaction system */ @@ -320,7 +320,7 @@ trx_sys_print_mysql_master_log_pos(void); #define TRX_SYS_FSEG_HEADER 8 /* segment header for the tablespace segment the trx system is created into */ -#define TRX_SYS_RSEGS (8 + FSEG_HEADER_SIZE) +#define TRX_SYS_RSEGS (8 + FSEG_HEADER_SIZE) /* the start of the array of rollback segment specification slots */ /*-------------------------------------------------------------*/ @@ -352,10 +352,10 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ /* The offset of the doublewrite buffer header on the trx system header page */ #define TRX_SYS_DOUBLEWRITE (UNIV_PAGE_SIZE - 200) /*-------------------------------------------------------------*/ -#define TRX_SYS_DOUBLEWRITE_FSEG 0 /* fseg header of the fseg +#define TRX_SYS_DOUBLEWRITE_FSEG 0 /* fseg header of the fseg containing the doublewrite buffer */ -#define TRX_SYS_DOUBLEWRITE_MAGIC FSEG_HEADER_SIZE +#define TRX_SYS_DOUBLEWRITE_MAGIC FSEG_HEADER_SIZE /* 4-byte magic number which shows if we already have created the doublewrite @@ -390,7 +390,7 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ #define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N 1783657386 -#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE +#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE /* Doublewrite control struct */ struct trx_doublewrite_struct{ @@ -401,7 +401,7 @@ struct trx_doublewrite_struct{ ulint block2; /* page number of the second block */ ulint first_free; /* first free position in write_buf measured in units of UNIV_PAGE_SIZE */ - byte* write_buf; /* write buffer used in writing to the + byte* write_buf; /* write buffer used in writing to the doublewrite buffer, aligned to an address divisible by UNIV_PAGE_SIZE (which is required by Windows aio) */ @@ -450,4 +450,4 @@ page is updated */ #include "trx0sys.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index 24610bef827..e0653609b36 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -11,12 +11,14 @@ Created 3/26/1996 Heikki Tuuri #include "data0type.h" /* The typedef for rseg slot in the file copy */ -typedef byte trx_sysf_rseg_t; +typedef byte trx_sysf_rseg_t; /* Rollback segment specification slot offsets */ /*-------------------------------------------------------------*/ #define TRX_SYS_RSEG_SPACE 0 /* space where the the segment - header is placed */ + header is placed; starting with + MySQL/InnoDB 5.1.7, this is + UNIV_UNDEFINED if the slot is unused */ #define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the the segment header is placed; this is FIL_NULL if the slot is unused */ @@ -96,7 +98,7 @@ trx_sysf_get( trx_sysf_t* header; ut_ad(mtr); - + header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, mtr); @@ -217,7 +219,7 @@ trx_write_trx_id( dulint id) /* in: id */ { ut_ad(DATA_TRX_ID_LEN == 6); - + mach_write_to_6(ptr, id); } @@ -233,7 +235,7 @@ trx_read_trx_id( byte* ptr) /* in: pointer to memory from where to read */ { ut_ad(DATA_TRX_ID_LEN == 6); - + return(mach_read_from_6(ptr)); } @@ -325,8 +327,8 @@ trx_is_active( } trx = trx_get_on_id(trx_id); - if (trx && (trx->conc_state == TRX_ACTIVE || - trx->conc_state == TRX_PREPARED)) { + if (trx && (trx->conc_state == TRX_ACTIVE || + trx->conc_state == TRX_PREPARED)) { return(TRUE); } @@ -354,13 +356,13 @@ trx_sys_get_new_trx_id(void) and the value for trx id will be written to disk-based header! Thus trx id values will not overlap when the database is repeatedly started! */ - + if (ut_dulint_get_low(trx_sys->max_trx_id) % TRX_SYS_TRX_ID_WRITE_MARGIN == 0) { trx_sys_flush_max_trx_id(); } - + id = trx_sys->max_trx_id; UT_DULINT_INC(trx_sys->max_trx_id); diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 0dc82893ad1..4278d602675 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -55,7 +55,7 @@ Releases the search latch if trx has reserved it. */ void trx_search_latch_release_if_reserved( /*=================================*/ - trx_t* trx); /* in: transaction */ + trx_t* trx); /* in: transaction */ /********************************************************************** Set detailed error message for the transaction. */ void @@ -78,8 +78,8 @@ Retrieves the error_info field from a trx. */ void* trx_get_error_info( /*===============*/ - /* out: the error info */ - trx_t* trx); /* in: trx object */ + /* out: the error info */ + trx_t* trx); /* in: trx object */ /******************************************************************** Creates and initializes a transaction object. */ @@ -141,7 +141,7 @@ trx_start( /*======*/ /* out: TRUE if success, FALSE if the rollback segment could not support this many transactions */ - trx_t* trx, /* in: transaction */ + trx_t* trx, /* in: transaction */ ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion */ @@ -152,7 +152,7 @@ ibool trx_start_low( /*==========*/ /* out: TRUE */ - trx_t* trx, /* in: transaction */ + trx_t* trx, /* in: transaction */ ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion */ @@ -207,7 +207,7 @@ Does the transaction prepare for MySQL. */ ulint trx_prepare_for_mysql( -/*=================*/ +/*==================*/ /* out: 0 or error number */ trx_t* trx); /* in: trx handle */ /************************************************************************** @@ -218,7 +218,7 @@ int trx_recover_for_mysql( /*==================*/ /* out: number of prepared transactions */ - XID* xid_list, /* in/out: prepared transactions */ + XID* xid_list, /* in/out: prepared transactions */ ulint len); /* in: number of slots in xid_list */ /*********************************************************************** This function is used to find one X/Open XA distributed transaction @@ -278,7 +278,7 @@ trx_sig_send( que_thr_t* receiver_thr, /* in: query thread which wants the reply, or NULL; if type is TRX_SIG_END_WAIT, this must be NULL */ - trx_savept_t* savept, /* in: possible rollback savepoint, or + trx_savept_t* savept, /* in: possible rollback savepoint, or NULL */ que_thr_t** next_thr); /* in/out: next query thread to run; if the value which is passed in is @@ -357,7 +357,7 @@ trx_print( /*======*/ FILE* f, /* in: output stream */ trx_t* trx, /* in: transaction */ - uint max_query_len); /* in: max query length to print, or 0 to + ulint max_query_len); /* in: max query length to print, or 0 to use the default max length */ #ifndef UNIV_HOTBACKUP @@ -411,9 +411,9 @@ struct trx_struct{ of view of concurrency control: TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY, ... */ - time_t start_time; /* time the trx object was created - or the state last time became - TRX_ACTIVE */ + time_t start_time; /* time the trx object was created + or the state last time became + TRX_ACTIVE */ ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */ ibool check_foreigns; /* normally TRUE, but if the user wants to suppress foreign key checks, @@ -427,8 +427,8 @@ struct trx_struct{ if we can use the insert buffer for them, we set this FALSE */ dulint id; /* transaction id */ - XID xid; /* X/Open XA transaction - identification to identify a + XID xid; /* X/Open XA transaction + identification to identify a transaction branch */ ibool support_xa; /* normally we do the XA two-phase commit steps, but by setting this to @@ -436,7 +436,7 @@ struct trx_struct{ 150 bytes in the undo log size as then we skip XA steps */ dulint no; /* transaction serialization number == - max trx id when the transaction is + max trx id when the transaction is moved to COMMITTED_IN_MEMORY state */ ibool flush_log_later;/* when we commit the transaction in MySQL's binlog write, we will @@ -451,7 +451,7 @@ struct trx_struct{ dulint commit_lsn; /* lsn at the time of the commit */ ibool dict_operation; /* TRUE if the trx is used to create a table, create an index, or drop a - table. This is a hint that the table + table. This is a hint that the table may need to be dropped in crash recovery. */ dulint table_id; /* table id if the preceding field is @@ -459,8 +459,8 @@ struct trx_struct{ /*------------------------------*/ int active_trans; /* 1 - if a transaction in MySQL is active. 2 - if prepare_commit_mutex - was taken */ - void* mysql_thd; /* MySQL thread handle corresponding + was taken */ + void* mysql_thd; /* MySQL thread handle corresponding to this trx, or NULL */ char** mysql_query_str;/* pointer to the field in mysqld_thd which contains the pointer to the @@ -507,17 +507,17 @@ struct trx_struct{ ulint n_mysql_tables_in_use; /* number of Innobase tables used in the processing of the current SQL statement in MySQL */ - ulint mysql_n_tables_locked; - /* how many tables the current SQL + ulint mysql_n_tables_locked; + /* how many tables the current SQL statement uses, except those in consistent read */ ibool dict_operation_lock_mode; /* 0, RW_S_LATCH, or RW_X_LATCH: the latch mode trx currently holds on dict_operation_lock */ - ibool has_search_latch; - /* TRUE if this trx has latched the - search system latch in S-mode */ + ibool has_search_latch; + /* TRUE if this trx has latched the + search system latch in S-mode */ ulint search_latch_timeout; /* If we notice that someone is waiting for our S-lock on the search @@ -538,7 +538,7 @@ struct trx_struct{ /* this can be > 0 only when declared_to_... is TRUE; when we come to srv_conc_innodb_enter, if the value - here is > 0, we decrement this by 1 */ + here is > 0, we decrement this by 1 */ /*------------------------------*/ lock_t* auto_inc_lock; /* possible auto-inc lock reserved by the transaction; note that it is also @@ -570,7 +570,7 @@ struct trx_struct{ duplicate key error, a pointer to the problematic index is stored here */ sess_t* sess; /* session of the trx, NULL if none */ - ulint que_state; /* TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, + ulint que_state; /* TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, ... */ que_t* graph; /* query currently run in the session, or NULL if none; NOTE that the query @@ -608,7 +608,7 @@ struct trx_struct{ if another transaction chooses this transaction as a victim in deadlock resolution, it sets this to TRUE */ - time_t wait_started; /* lock wait started at this time */ + time_t wait_started; /* lock wait started at this time */ UT_LIST_BASE_NODE_T(que_thr_t) wait_thrs; /* query threads belonging to this trx that are in the QUE_THR_LOCK_WAIT @@ -618,23 +618,23 @@ struct trx_struct{ /*------------------------------*/ mem_heap_t* lock_heap; /* memory heap for the locks of the transaction */ - UT_LIST_BASE_NODE_T(lock_t) + UT_LIST_BASE_NODE_T(lock_t) trx_locks; /* locks reserved by the transaction */ /*------------------------------*/ - mem_heap_t* global_read_view_heap; - /* memory heap for the global read + mem_heap_t* global_read_view_heap; + /* memory heap for the global read view */ read_view_t* global_read_view; /* consistent read view associated to a transaction or NULL */ read_view_t* read_view; /* consistent read view used in the transaction or NULL, this read view - if defined can be normal read view - associated to a transaction (i.e. + if defined can be normal read view + associated to a transaction (i.e. same as global_read_view) or read view associated to a cursor */ /*------------------------------*/ - UT_LIST_BASE_NODE_T(trx_named_savept_t) + UT_LIST_BASE_NODE_T(trx_named_savept_t) trx_savepoints; /* savepoints set with SAVEPOINT ..., oldest first */ /*------------------------------*/ @@ -654,9 +654,9 @@ struct trx_struct{ trx_rseg_t* rseg; /* rollback segment assigned to the transaction, or NULL if not assigned yet */ - trx_undo_t* insert_undo; /* pointer to the insert undo log, or + trx_undo_t* insert_undo; /* pointer to the insert undo log, or NULL if no inserts performed yet */ - trx_undo_t* update_undo; /* pointer to the update undo log, or + trx_undo_t* update_undo; /* pointer to the update undo log, or NULL if no update performed yet */ dulint roll_limit; /* least undo number to undo during a rollback */ @@ -743,7 +743,7 @@ struct trx_struct{ /* Signal states */ #define TRX_SIG_WAITING 1 #define TRX_SIG_BEING_HANDLED 2 - + /* Commit command node in a query graph */ struct commit_node_struct{ que_common_t common; /* node type: QUE_NODE_COMMIT */ @@ -759,4 +759,4 @@ struct commit_node_struct{ #include "trx0trx.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.ic index 54cf2ff331f..3992225ed8b 100644 --- a/storage/innobase/include/trx0trx.ic +++ b/storage/innobase/include/trx0trx.ic @@ -13,7 +13,7 @@ void trx_start_if_not_started( /*=====================*/ trx_t* trx) /* in: transaction */ -{ +{ ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY); if (trx->conc_state == TRX_NOT_STARTED) { @@ -30,7 +30,7 @@ void trx_start_if_not_started_low( /*=========================*/ trx_t* trx) /* in: transaction */ -{ +{ ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY); if (trx->conc_state == TRX_NOT_STARTED) { @@ -94,5 +94,5 @@ trx_new_rec_locks_contain( dict_index_t* index) /* in: index */ { return(trx->new_rec_locks[0] == index - || trx->new_rec_locks[1] == index); + || trx->new_rec_locks[1] == index); } diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 2965eb4451f..0e6ee79498c 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -42,4 +42,4 @@ typedef byte trx_upagef_t; /* Undo log record */ typedef byte trx_undo_rec_t; -#endif +#endif diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index bd7337e4f90..83f022cc2c5 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -71,7 +71,7 @@ Gets an undo log page and x-latches it. */ UNIV_INLINE page_t* trx_undo_page_get( -/*===============*/ +/*==============*/ /* out: pointer to page x-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ @@ -81,7 +81,7 @@ Gets an undo log page and s-latches it. */ UNIV_INLINE page_t* trx_undo_page_get_s_latched( -/*=========================*/ +/*========================*/ /* out: pointer to page s-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ @@ -162,7 +162,7 @@ trx_undo_get_first_rec( /*===================*/ /* out: undo log record, the page latched, NULL if none */ - ulint space, /* in: undo log header space */ + ulint space, /* in: undo log header space */ ulint page_no,/* in: undo log header page number */ ulint offset, /* in: undo log header offset on page */ ulint mode, /* in: latching mode: RW_S_LATCH or RW_X_LATCH */ @@ -217,7 +217,7 @@ trx_undo_lists_init( /*================*/ /* out: the combined size of undo log segments in pages */ - trx_rseg_t* rseg); /* in: rollback segment memory object */ + trx_rseg_t* rseg); /* in: rollback segment memory object */ /************************************************************************** Assigns an undo log for a transaction. A new undo log is created or a cached undo log reused. */ @@ -278,7 +278,7 @@ Parses the redo log entry of an undo log page initialization. */ byte* trx_undo_parse_page_init( -/*======================*/ +/*=====================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ byte* end_ptr,/* in: buffer end */ @@ -322,7 +322,7 @@ trx_undo_parse_discard_latest( #define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be reused: it can be freed in purge when all undo data in it is removed */ -#define TRX_UNDO_PREPARED 5 /* contains an undo log of an +#define TRX_UNDO_PREPARED 5 /* contains an undo log of an prepared transaction */ /* Transaction undo log memory object; this is protected by the undo_mutex @@ -346,7 +346,7 @@ struct trx_undo_struct{ field */ dulint trx_id; /* id of the trx assigned to the undo log */ - XID xid; /* X/Open XA transaction + XID xid; /* X/Open XA transaction identification */ ibool dict_operation; /* TRUE if a dict operation trx */ dulint table_id; /* if a dict operation, then the table @@ -482,7 +482,7 @@ is not needed by the user. The XID wastes about 150 bytes of space in every undo log. In the history list we may have millions of undo logs, which means quite a large overhead. */ -/* X/Open XA Transaction Identification (XID) */ +/* X/Open XA Transaction Identification (XID) */ #define TRX_UNDO_XA_FORMAT (TRX_UNDO_LOG_OLD_HDR_SIZE) #define TRX_UNDO_XA_TRID_LEN (TRX_UNDO_XA_FORMAT + 4) @@ -496,4 +496,4 @@ quite a large overhead. */ #include "trx0undo.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic index a04b234b495..1678b292590 100644 --- a/storage/innobase/include/trx0undo.ic +++ b/storage/innobase/include/trx0undo.ic @@ -20,7 +20,9 @@ trx_undo_build_roll_ptr( ulint page_no, /* in: page number */ ulint offset) /* in: offset of the undo entry within page */ { - ut_ad(DATA_ROLL_PTR_LEN == 7); +#if DATA_ROLL_PTR_LEN != 7 +# error "DATA_ROLL_PTR_LEN != 7" +#endif ut_ad(rseg_id < 128); return(ut_dulint_create(is_insert * 128 * 256 * 256 @@ -44,13 +46,15 @@ trx_undo_decode_roll_ptr( { ulint low; ulint high; - - ut_ad(DATA_ROLL_PTR_LEN == 7); - ut_ad(TRUE == 1); - +#if DATA_ROLL_PTR_LEN != 7 +# error "DATA_ROLL_PTR_LEN != 7" +#endif +#if TRUE != 1 +# error "TRUE != 1" +#endif high = ut_dulint_get_high(roll_ptr); low = ut_dulint_get_low(roll_ptr); - + *offset = low % (256 * 256); *is_insert = high / (256 * 256 * 128); /* TRUE == 1 */ @@ -70,12 +74,14 @@ trx_undo_roll_ptr_is_insert( dulint roll_ptr) /* in: roll pointer */ { ulint high; - - ut_ad(DATA_ROLL_PTR_LEN == 7); - ut_ad(TRUE == 1); - +#if DATA_ROLL_PTR_LEN != 7 +# error "DATA_ROLL_PTR_LEN != 7" +#endif +#if TRUE != 1 +# error "TRUE != 1" +#endif high = ut_dulint_get_high(roll_ptr); - + return(high / (256 * 256 * 128)); } @@ -91,7 +97,7 @@ trx_write_roll_ptr( dulint roll_ptr) /* in: roll ptr */ { ut_ad(DATA_ROLL_PTR_LEN == 7); - + mach_write_to_7(ptr, roll_ptr); } @@ -106,8 +112,9 @@ trx_read_roll_ptr( /* out: roll ptr */ byte* ptr) /* in: pointer to memory from where to read */ { - ut_ad(DATA_ROLL_PTR_LEN == 7); - +#if DATA_ROLL_PTR_LEN != 7 +# error "DATA_ROLL_PTR_LEN != 7" +#endif return(mach_read_from_7(ptr)); } @@ -116,14 +123,14 @@ Gets an undo log page and x-latches it. */ UNIV_INLINE page_t* trx_undo_page_get( -/*===============*/ +/*==============*/ /* out: pointer to page x-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ mtr_t* mtr) /* in: mtr */ { page_t* page; - + page = buf_page_get(space, page_no, RW_X_LATCH, mtr); #ifdef UNIV_SYNC_DEBUG @@ -138,14 +145,14 @@ Gets an undo log page and s-latches it. */ UNIV_INLINE page_t* trx_undo_page_get_s_latched( -/*=========================*/ +/*========================*/ /* out: pointer to page s-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ mtr_t* mtr) /* in: mtr */ { page_t* page; - + page = buf_page_get(space, page_no, RW_S_LATCH, mtr); #ifdef UNIV_SYNC_DEBUG @@ -168,7 +175,7 @@ trx_undo_page_get_start( ulint offset) /* in: undo log header offset on page */ { ulint start; - + if (page_no == buf_frame_get_page_no(undo_page)) { start = mach_read_from_2(offset + undo_page @@ -194,7 +201,7 @@ trx_undo_page_get_end( { trx_ulogf_t* log_hdr; ulint end; - + if (page_no == buf_frame_get_page_no(undo_page)) { log_hdr = undo_page + offset; @@ -259,14 +266,14 @@ trx_undo_page_get_next_rec( undo_page = buf_frame_align(rec); end = trx_undo_page_get_end(undo_page, page_no, offset); - + next = mach_read_from_2(rec); if (next == end) { return(NULL); } - + return(undo_page + next); } @@ -285,9 +292,9 @@ trx_undo_page_get_last_rec( ulint start; ulint end; - start = trx_undo_page_get_start(undo_page, page_no, offset); - end = trx_undo_page_get_end(undo_page, page_no, offset); - + start = trx_undo_page_get_start(undo_page, page_no, offset); + end = trx_undo_page_get_end(undo_page, page_no, offset); + if (start == end) { return(NULL); @@ -311,9 +318,9 @@ trx_undo_page_get_first_rec( ulint start; ulint end; - start = trx_undo_page_get_start(undo_page, page_no, offset); - end = trx_undo_page_get_end(undo_page, page_no, offset); - + start = trx_undo_page_get_start(undo_page, page_no, offset); + end = trx_undo_page_get_end(undo_page, page_no, offset); + if (start == end) { return(NULL); diff --git a/storage/innobase/include/trx0xa.h b/storage/innobase/include/trx0xa.h index 34b7a2f95a8..e90ce47ffcf 100644 --- a/storage/innobase/include/trx0xa.h +++ b/storage/innobase/include/trx0xa.h @@ -52,27 +52,27 @@ struct xa_switch_t { long flags; /* resource manager specific options */ long version; /* must be 0 */ int (*xa_open_entry) /* xa_open function pointer */ - __P((char *, int, long)); + __P((char *, int, long)); int (*xa_close_entry) /* xa_close function pointer */ - __P((char *, int, long)); + __P((char *, int, long)); int (*xa_start_entry) /* xa_start function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_end_entry) /* xa_end function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_rollback_entry) /* xa_rollback function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_prepare_entry) /* xa_prepare function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_commit_entry) /* xa_commit function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_recover_entry) /* xa_recover function pointer */ - __P((XID *, long, int, long)); + __P((XID *, long, int, long)); int (*xa_forget_entry) /* xa_forget function pointer */ - __P((XID *, int, long)); + __P((XID *, int, long)); int (*xa_complete_entry) /* xa_complete function pointer */ - __P((int *, int *, int, long)); + __P((int *, int *, int, long)); }; -#endif /* NOTDEFINED */ +#endif /* NOTDEFINED */ /* diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index dd4862b3808..7b021087163 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -163,7 +163,7 @@ management to ensure correct alignment for doubles etc. */ #define UNIV_PAGE_SIZE (2 * 8192) /* NOTE! Currently, this has to be a power of 2 */ /* The 2-logarithm of UNIV_PAGE_SIZE: */ -#define UNIV_PAGE_SIZE_SHIFT 14 +#define UNIV_PAGE_SIZE_SHIFT 14 /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 @@ -232,7 +232,7 @@ of a field is a 32-bit integer when we store it, for example, to an undo log on disk, we must have also this number fit in 32 bits, also in 64-bit computers! */ -#define UNIV_SQL_NULL ULINT32_UNDEFINED +#define UNIV_SQL_NULL ULINT32_UNDEFINED /* Lengths which are not UNIV_SQL_NULL, but bigger than the following number indicate that a field contains a reference to an externally @@ -265,6 +265,9 @@ it is read or written. */ /* Tell the compiler that cond is unlikely to hold */ #define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE) +/* Compile-time constant of the given array's size. */ +#define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0])) + #include <stdio.h> #include "ut0dbg.h" #include "ut0ut.h" diff --git a/storage/innobase/include/usr0sess.h b/storage/innobase/include/usr0sess.h index c7bcfb20fed..3ed1ea21a4d 100644 --- a/storage/innobase/include/usr0sess.h +++ b/storage/innobase/include/usr0sess.h @@ -58,4 +58,4 @@ struct sess_struct{ #include "usr0sess.ic" #endif -#endif +#endif diff --git a/storage/innobase/include/usr0types.h b/storage/innobase/include/usr0types.h index 29359425169..311471c1a0e 100644 --- a/storage/innobase/include/usr0types.h +++ b/storage/innobase/include/usr0types.h @@ -11,4 +11,4 @@ Created 6/25/1996 Heikki Tuuri typedef struct sess_struct sess_t; -#endif +#endif diff --git a/storage/innobase/include/ut0byte.h b/storage/innobase/include/ut0byte.h index 22d488abeaf..6533f1166ca 100644 --- a/storage/innobase/include/ut0byte.h +++ b/storage/innobase/include/ut0byte.h @@ -78,7 +78,7 @@ int ut_dulint_cmp( /*==========*/ /* out: -1 if a < b, 0 if a == b, - 1 if a > b */ + 1 if a > b */ dulint a, /* in: dulint */ dulint b); /* in: dulint */ /*********************************************************** @@ -135,8 +135,8 @@ dulint ut_dulint_align_down( /*=================*/ /* out: rounded value */ - dulint n, /* in: number to be rounded */ - ulint align_no); /* in: align by this number which must be a + dulint n, /* in: number to be rounded */ + ulint align_no); /* in: align by this number which must be a power of 2 */ /************************************************************ Rounds a dulint upward to a multiple of a power of 2. */ @@ -145,8 +145,8 @@ dulint ut_dulint_align_up( /*===============*/ /* out: rounded value */ - dulint n, /* in: number to be rounded */ - ulint align_no); /* in: align by this number which must be a + dulint n, /* in: number to be rounded */ + ulint align_no); /* in: align by this number which must be a power of 2 */ /*********************************************************** Increments a dulint variable by 1. */ @@ -177,8 +177,8 @@ ulint ut_calc_align( /*==========*/ /* out: rounded value */ - ulint n, /* in: number to be rounded */ - ulint align_no); /* in: align by this number */ + ulint n, /* in: number to be rounded */ + ulint align_no); /* in: align by this number */ /************************************************************ The following function calculates the value of an integer n rounded to the biggest product of align_no which is <= n. align_no has to be a @@ -188,8 +188,8 @@ ulint ut_calc_align_down( /*===============*/ /* out: rounded value */ - ulint n, /* in: number to be rounded */ - ulint align_no); /* in: align by this number */ + ulint n, /* in: number to be rounded */ + ulint align_no); /* in: align by this number */ /************************************************************* The following function rounds up a pointer to the nearest aligned address. */ UNIV_INLINE @@ -197,8 +197,8 @@ void* ut_align( /*=====*/ /* out: aligned pointer */ - void* ptr, /* in: pointer */ - ulint align_no); /* in: align by this number */ + void* ptr, /* in: pointer */ + ulint align_no); /* in: align by this number */ /************************************************************* The following function rounds down a pointer to the nearest aligned address. */ @@ -207,8 +207,8 @@ void* ut_align_down( /*==========*/ /* out: aligned pointer */ - void* ptr, /* in: pointer */ - ulint align_no) /* in: align by this number */ + void* ptr, /* in: pointer */ + ulint align_no) /* in: align by this number */ __attribute__((const)); /************************************************************* The following function computes the offset of a pointer from the nearest @@ -216,7 +216,7 @@ aligned address. */ UNIV_INLINE ulint ut_align_offset( -/*==========*/ +/*============*/ /* out: distance from aligned pointer */ const void* ptr, /* in: pointer */ diff --git a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.ic index e141de3aa3f..9829b3a2c46 100644 --- a/storage/innobase/include/ut0byte.ic +++ b/storage/innobase/include/ut0byte.ic @@ -22,7 +22,7 @@ ut_dulint_create( ut_ad(low <= 0xFFFFFFFF); res.high = high; - res.low = low; + res.low = low; return(res); } @@ -89,7 +89,7 @@ int ut_dulint_cmp( /*==========*/ /* out: -1 if a < b, 0 if a == b, - 1 if a > b */ + 1 if a > b */ dulint a, /* in: dulint */ dulint b) /* in: dulint */ { @@ -186,7 +186,7 @@ ut_dulint_subtract( a.low = 0xFFFFFFFFUL - b; ut_ad(a.high > 0); - + a.high--; return(a); @@ -218,9 +218,9 @@ ut_dulint_minus( diff += 1 + a.low; ut_ad(diff > a.low); - + return(diff); -} +} /************************************************************ Rounds a dulint downward to a multiple of a power of 2. */ @@ -229,8 +229,8 @@ dulint ut_dulint_align_down( /*=================*/ /* out: rounded value */ - dulint n, /* in: number to be rounded */ - ulint align_no) /* in: align by this number which must be a + dulint n, /* in: number to be rounded */ + ulint align_no) /* in: align by this number which must be a power of 2 */ { ulint low, high; @@ -240,7 +240,7 @@ ut_dulint_align_down( low = ut_dulint_get_low(n); high = ut_dulint_get_high(n); - + low = low & ~(align_no - 1); return(ut_dulint_create(high, low)); @@ -253,8 +253,8 @@ dulint ut_dulint_align_up( /*===============*/ /* out: rounded value */ - dulint n, /* in: number to be rounded */ - ulint align_no) /* in: align by this number which must be a + dulint n, /* in: number to be rounded */ + ulint align_no) /* in: align by this number which must be a power of 2 */ { return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no)); @@ -269,8 +269,8 @@ ulint ut_calc_align( /*==========*/ /* out: rounded value */ - ulint n, /* in: number to be rounded */ - ulint align_no) /* in: align by this number */ + ulint n, /* in: number to be rounded */ + ulint align_no) /* in: align by this number */ { ut_ad(align_no > 0); ut_ad(((align_no - 1) & align_no) == 0); @@ -285,8 +285,8 @@ void* ut_align( /*=====*/ /* out: aligned pointer */ - void* ptr, /* in: pointer */ - ulint align_no) /* in: align by this number */ + void* ptr, /* in: pointer */ + ulint align_no) /* in: align by this number */ { ut_ad(align_no > 0); ut_ad(((align_no - 1) & align_no) == 0); @@ -306,8 +306,8 @@ ulint ut_calc_align_down( /*===============*/ /* out: rounded value */ - ulint n, /* in: number to be rounded */ - ulint align_no) /* in: align by this number */ + ulint n, /* in: number to be rounded */ + ulint align_no) /* in: align by this number */ { ut_ad(align_no > 0); ut_ad(((align_no - 1) & align_no) == 0); @@ -323,8 +323,8 @@ void* ut_align_down( /*==========*/ /* out: aligned pointer */ - void* ptr, /* in: pointer */ - ulint align_no) /* in: align by this number */ + void* ptr, /* in: pointer */ + ulint align_no) /* in: align by this number */ { ut_ad(align_no > 0); ut_ad(((align_no - 1) & align_no) == 0); @@ -344,8 +344,8 @@ ut_align_offset( /*============*/ /* out: distance from aligned pointer */ - const void* ptr, /* in: pointer */ - ulint align_no) /* in: align by this number */ + const void* ptr, /* in: pointer */ + ulint align_no) /* in: align by this number */ { ut_ad(align_no > 0); ut_ad(((align_no - 1) & align_no) == 0); @@ -368,8 +368,9 @@ ut_bit_get_nth( ulint n) /* in: nth bit requested */ { ut_ad(n < 8 * sizeof(ulint)); - ut_ad(TRUE == 1); - +#if TRUE != 1 +# error "TRUE != 1" +#endif return(1 & (a >> n)); } @@ -385,8 +386,9 @@ ut_bit_set_nth( ibool val) /* in: value for the bit to set */ { ut_ad(n < 8 * sizeof(ulint)); - ut_ad(TRUE == 1); - +#if TRUE != 1 +# error "TRUE != 1" +#endif if (val) { return((1 << n) | a); } else { diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index bc3f852626a..55e8c8ef88c 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -74,7 +74,7 @@ ut_dbg_stop_thread( __FILE__, (ulint) __LINE__); \ UT_DBG_PANIC; \ } \ - UT_DBG_STOP; \ + UT_DBG_STOP; \ } while (0) /* Abort execution. */ @@ -84,7 +84,7 @@ ut_dbg_stop_thread( } while (0) #ifdef UNIV_DEBUG -#define ut_ad(EXPR) ut_a(EXPR) +#define ut_ad(EXPR) ut_a(EXPR) #define ut_d(EXPR) do {EXPR;} while (0) #else #define ut_ad(EXPR) diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h index d290c476963..819f2e770ba 100644 --- a/storage/innobase/include/ut0lst.h +++ b/storage/innobase/include/ut0lst.h @@ -192,9 +192,9 @@ TYPE is the node type, and BASE is the base node (not a pointer to it). */ ut_list_node_313 = (BASE).start;\ \ for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\ - ut_list_i_313++) {\ - ut_a(ut_list_node_313);\ - ut_list_node_313 = (ut_list_node_313->NAME).next;\ + ut_list_i_313++) {\ + ut_a(ut_list_node_313);\ + ut_list_node_313 = (ut_list_node_313->NAME).next;\ }\ \ ut_a(ut_list_node_313 == NULL);\ @@ -202,14 +202,14 @@ TYPE is the node type, and BASE is the base node (not a pointer to it). */ ut_list_node_313 = (BASE).end;\ \ for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\ - ut_list_i_313++) {\ - ut_a(ut_list_node_313);\ - ut_list_node_313 = (ut_list_node_313->NAME).prev;\ + ut_list_i_313++) {\ + ut_a(ut_list_node_313);\ + ut_list_node_313 = (ut_list_node_313->NAME).prev;\ }\ \ ut_a(ut_list_node_313 == NULL);\ }\ - + #endif diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h index b9bbe0b5c92..6e4a265349f 100644 --- a/storage/innobase/include/ut0mem.h +++ b/storage/innobase/include/ut0mem.h @@ -36,12 +36,13 @@ defined and set_to_zero is TRUE. */ void* ut_malloc_low( /*==========*/ - /* out, own: allocated memory */ - ulint n, /* in: number of bytes to allocate */ - ibool set_to_zero, /* in: TRUE if allocated memory should be set - to zero if UNIV_SET_MEM_TO_ZERO is defined */ - ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory - cannot be allocated */ + /* out, own: allocated memory */ + ulint n, /* in: number of bytes to allocate */ + ibool set_to_zero, /* in: TRUE if allocated memory + should be set to zero if + UNIV_SET_MEM_TO_ZERO is defined */ + ibool assert_on_error); /* in: if TRUE, we crash mysqld if + the memory cannot be allocated */ /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined. */ @@ -49,8 +50,8 @@ defined. */ void* ut_malloc( /*======*/ - /* out, own: allocated memory */ - ulint n); /* in: number of bytes to allocate */ + /* out, own: allocated memory */ + ulint n); /* in: number of bytes to allocate */ /************************************************************************** Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs out. It cannot be used if we want to return an error message. Prints to @@ -78,10 +79,10 @@ man realloc in Linux, 2004: realloc() changes the size of the memory block pointed to by ptr to size bytes. The contents will be unchanged to the minimum of the old and new sizes; newly allocated mem - ory will be uninitialized. If ptr is NULL, the call is + ory will be uninitialized. If ptr is NULL, the call is equivalent to malloc(size); if size is equal to zero, the - call is equivalent to free(ptr). Unless ptr is NULL, it - must have been returned by an earlier call to malloc(), + call is equivalent to free(ptr). Unless ptr is NULL, it + must have been returned by an earlier call to malloc(), calloc() or realloc(). RETURN VALUE @@ -89,8 +90,8 @@ RETURN VALUE which is suitably aligned for any kind of variable and may be different from ptr, or NULL if the request fails. If size was equal to 0, either NULL or a pointer suitable to - be passed to free() is returned. If realloc() fails the - original block is left untouched - it is not freed or + be passed to free() is returned. If realloc() fails the + original block is left untouched - it is not freed or moved. */ void* @@ -154,7 +155,7 @@ ut_strlenq( char q); /* in: the quote character */ /************************************************************************** -Make a quoted copy of a NUL-terminated string. Leading and trailing +Make a quoted copy of a NUL-terminated string. Leading and trailing quotes will not be included; only embedded quotes will be escaped. See also ut_strlenq() and ut_memcpyq(). */ diff --git a/storage/innobase/include/ut0mem.ic b/storage/innobase/include/ut0mem.ic index 76c721112a0..e0253ebf618 100644 --- a/storage/innobase/include/ut0mem.ic +++ b/storage/innobase/include/ut0mem.ic @@ -10,7 +10,7 @@ UNIV_INLINE void* ut_memcpy(void* dest, const void* sour, ulint n) { - return(memcpy(dest, sour, n)); + return(memcpy(dest, sour, n)); } UNIV_INLINE diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h index aeec5d2f6eb..3f3fce1075c 100644 --- a/storage/innobase/include/ut0rnd.h +++ b/storage/innobase/include/ut0rnd.h @@ -15,7 +15,7 @@ Created 1/20/1994 Heikki Tuuri /* The 'character code' for end of field or string (used in folding records */ -#define UT_END_OF_FIELD 257 +#define UT_END_OF_FIELD 257 /************************************************************ This is used to set the random number seed. */ @@ -23,7 +23,7 @@ UNIV_INLINE void ut_rnd_set_seed( /*============*/ - ulint seed); /* in: seed */ + ulint seed); /* in: seed */ /************************************************************ The following function generates a series of 'random' ulint integers. */ UNIV_INLINE @@ -65,10 +65,10 @@ random number to work reliably. */ UNIV_INLINE ulint ut_hash_ulint( -/*=========*/ +/*==========*/ /* out: hash value */ - ulint key, /* in: value to be hashed */ - ulint table_size); /* in: hash table size */ + ulint key, /* in: value to be hashed */ + ulint table_size); /* in: hash table size */ /***************************************************************** Folds a pair of ulints. */ UNIV_INLINE @@ -93,7 +93,7 @@ ulint ut_fold_string( /*===========*/ /* out: folded value */ - const char* str); /* in: null-terminated string */ + const char* str); /* in: null-terminated string */ /***************************************************************** Folds a binary string. */ UNIV_INLINE @@ -111,7 +111,7 @@ ulint ut_find_prime( /*==========*/ /* out: prime */ - ulint n); /* in: positive number > 100 */ + ulint n); /* in: positive number > 100 */ #ifndef UNIV_NONINL diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic index d2ab087d491..455007c7d9b 100644 --- a/storage/innobase/include/ut0rnd.ic +++ b/storage/innobase/include/ut0rnd.ic @@ -6,19 +6,19 @@ Random numbers and hashing Created 5/30/1994 Heikki Tuuri *******************************************************************/ -#define UT_HASH_RANDOM_MASK 1463735687 -#define UT_HASH_RANDOM_MASK2 1653893711 -#define UT_RND1 151117737 -#define UT_RND2 119785373 -#define UT_RND3 85689495 -#define UT_RND4 76595339 -#define UT_SUM_RND2 98781234 -#define UT_SUM_RND3 126792457 -#define UT_SUM_RND4 63498502 -#define UT_XOR_RND1 187678878 -#define UT_XOR_RND2 143537923 - -extern ulint ut_rnd_ulint_counter; +#define UT_HASH_RANDOM_MASK 1463735687 +#define UT_HASH_RANDOM_MASK2 1653893711 +#define UT_RND1 151117737 +#define UT_RND2 119785373 +#define UT_RND3 85689495 +#define UT_RND4 76595339 +#define UT_SUM_RND2 98781234 +#define UT_SUM_RND3 126792457 +#define UT_SUM_RND4 63498502 +#define UT_XOR_RND1 187678878 +#define UT_XOR_RND2 143537923 + +extern ulint ut_rnd_ulint_counter; /************************************************************ This is used to set the random number seed. */ @@ -26,7 +26,7 @@ UNIV_INLINE void ut_rnd_set_seed( /*============*/ - ulint seed) /* in: seed */ + ulint seed) /* in: seed */ { ut_rnd_ulint_counter = seed; } @@ -66,7 +66,7 @@ ut_rnd_gen_ulint(void) /*==================*/ /* out: the 'random' number */ { - ulint rnd; + ulint rnd; ulint n_bits; n_bits = 8 * sizeof(ulint); @@ -111,7 +111,7 @@ ut_rnd_gen_ibool(void) /*=================*/ /* out: the random value */ { - ulint x; + ulint x; x = ut_rnd_gen_ulint(); @@ -121,7 +121,7 @@ ut_rnd_gen_ibool(void) } return(FALSE); -} +} /*********************************************************** The following function generates a hash value for a ulint integer @@ -130,10 +130,10 @@ or some random number for the hash table to work reliably. */ UNIV_INLINE ulint ut_hash_ulint( -/*=========*/ +/*==========*/ /* out: hash value */ - ulint key, /* in: value to be hashed */ - ulint table_size) /* in: hash table size */ + ulint key, /* in: value to be hashed */ + ulint table_size) /* in: hash table size */ { key = key ^ UT_HASH_RANDOM_MASK2; @@ -152,7 +152,7 @@ ut_fold_ulint_pair( { return(((((n1 ^ n2 ^ UT_HASH_RANDOM_MASK2) << 8) + n1) ^ UT_HASH_RANDOM_MASK) + n2); -} +} /***************************************************************** Folds a dulint. */ @@ -165,7 +165,7 @@ ut_fold_dulint( { return(ut_fold_ulint_pair(ut_dulint_get_low(d), ut_dulint_get_high(d))); -} +} /***************************************************************** Folds a character string ending in the null character. */ @@ -174,7 +174,7 @@ ulint ut_fold_string( /*===========*/ /* out: folded value */ - const char* str) /* in: null-terminated string */ + const char* str) /* in: null-terminated string */ { #ifdef UNIV_DEBUG ulint i = 0; @@ -196,7 +196,7 @@ ut_fold_string( return(fold); } - + /***************************************************************** Folds a binary string. */ UNIV_INLINE diff --git a/storage/innobase/include/ut0sort.h b/storage/innobase/include/ut0sort.h index d0a3d34e79e..87d30dee6f2 100644 --- a/storage/innobase/include/ut0sort.h +++ b/storage/innobase/include/ut0sort.h @@ -40,20 +40,20 @@ see test program in tsut.c. */ ulint ut_sort_low77;\ ulint ut_sort_high77;\ \ - ut_ad((LOW) < (HIGH));\ - ut_ad(ARR);\ - ut_ad(AUX_ARR);\ + ut_ad((LOW) < (HIGH));\ + ut_ad(ARR);\ + ut_ad(AUX_ARR);\ \ - if ((LOW) == (HIGH) - 1) {\ - return;\ - } else if ((LOW) == (HIGH) - 2) {\ - if (CMP_FUN((ARR)[LOW], (ARR)[(HIGH) - 1]) > 0) {\ - (AUX_ARR)[LOW] = (ARR)[LOW];\ - (ARR)[LOW] = (ARR)[(HIGH) - 1];\ - (ARR)[(HIGH) - 1] = (AUX_ARR)[LOW];\ - }\ - return;\ - }\ + if ((LOW) == (HIGH) - 1) {\ + return;\ + } else if ((LOW) == (HIGH) - 2) {\ + if (CMP_FUN((ARR)[LOW], (ARR)[(HIGH) - 1]) > 0) {\ + (AUX_ARR)[LOW] = (ARR)[LOW];\ + (ARR)[LOW] = (ARR)[(HIGH) - 1];\ + (ARR)[(HIGH) - 1] = (AUX_ARR)[LOW];\ + }\ + return;\ + }\ \ ut_sort_mid77 = ((LOW) + (HIGH)) / 2;\ \ @@ -63,29 +63,29 @@ see test program in tsut.c. */ ut_sort_low77 = (LOW);\ ut_sort_high77 = ut_sort_mid77;\ \ - for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\ + for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\ \ - if (ut_sort_low77 >= ut_sort_mid77) {\ - (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ - ut_sort_high77++;\ - } else if (ut_sort_high77 >= (HIGH)) {\ - (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ - ut_sort_low77++;\ - } else if (CMP_FUN((ARR)[ut_sort_low77],\ + if (ut_sort_low77 >= ut_sort_mid77) {\ + (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ + ut_sort_high77++;\ + } else if (ut_sort_high77 >= (HIGH)) {\ + (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ + ut_sort_low77++;\ + } else if (CMP_FUN((ARR)[ut_sort_low77],\ (ARR)[ut_sort_high77]) > 0) {\ - (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ - ut_sort_high77++;\ + (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ + ut_sort_high77++;\ } else {\ - (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ - ut_sort_low77++;\ + (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ + ut_sort_low77++;\ }\ }\ \ - for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\ - (ARR)[ut_sort_i77] = (AUX_ARR)[ut_sort_i77];\ - }\ + for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\ + (ARR)[ut_sort_i77] = (AUX_ARR)[ut_sort_i77];\ + }\ }\ - + #endif diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 8938957cd12..8f1be212fbf 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -34,8 +34,8 @@ ulint ut_min( /*===*/ /* out: minimum */ - ulint n1, /* in: first number */ - ulint n2); /* in: second number */ + ulint n1, /* in: first number */ + ulint n2); /* in: second number */ /********************************************************** Calculates the maximum of two ulints. */ UNIV_INLINE @@ -43,8 +43,8 @@ ulint ut_max( /*===*/ /* out: maximum */ - ulint n1, /* in: first number */ - ulint n2); /* in: second number */ + ulint n1, /* in: first number */ + ulint n2); /* in: second number */ /******************************************************************** Calculates minimum of two ulint-pairs. */ UNIV_INLINE @@ -73,7 +73,7 @@ int ut_pair_cmp( /*========*/ /* out: -1 if a < b, 0 if a == b, - 1 if a > b */ + 1 if a > b */ ulint a1, /* in: more significant part of first pair */ ulint a2, /* in: less significant part of first pair */ ulint b1, /* in: more significant part of second pair */ @@ -202,7 +202,7 @@ void ut_print_buf( /*=========*/ FILE* file, /* in: file where to print */ - const byte* buf, /* in: memory buffer */ + const void* buf, /* in: memory buffer */ ulint len); /* in: length of the buffer */ /************************************************************************** @@ -231,7 +231,7 @@ Outputs a fixed-length string, quoted as an SQL identifier. */ void ut_print_namel( -/*==========*/ +/*===========*/ FILE* f, /* in: output stream */ struct trx_struct*trx, /* in: transaction (NULL=no quotes) */ const char* name, /* in: name to print */ diff --git a/storage/innobase/include/ut0ut.ic b/storage/innobase/include/ut0ut.ic index 9a0ef1c0d5b..7b080216117 100644 --- a/storage/innobase/include/ut0ut.ic +++ b/storage/innobase/include/ut0ut.ic @@ -13,8 +13,8 @@ ulint ut_min( /*===*/ /* out: minimum */ - ulint n1, /* in: first number */ - ulint n2) /* in: second number */ + ulint n1, /* in: first number */ + ulint n2) /* in: second number */ { return((n1 <= n2) ? n1 : n2); } @@ -26,8 +26,8 @@ ulint ut_max( /*===*/ /* out: maximum */ - ulint n1, /* in: first number */ - ulint n2) /* in: second number */ + ulint n1, /* in: first number */ + ulint n2) /* in: second number */ { return((n1 <= n2) ? n2 : n1); } @@ -44,7 +44,7 @@ ut_pair_min( ulint b1, /* in: less significant part of first pair */ ulint a2, /* in: more significant part of second pair */ ulint b2) /* in: less significant part of second pair */ -{ +{ if (a1 == a2) { *a = a1; *b = ut_min(b1, b2); @@ -82,7 +82,7 @@ UNIV_INLINE int ut_pair_cmp( /*========*/ - /* out: -1 if a < b, 0 if a == b, 1 if a > b */ + /* out: -1 if a < b, 0 if a == b, 1 if a > b */ ulint a1, /* in: more significant part of first pair */ ulint a2, /* in: less significant part of first pair */ ulint b1, /* in: more significant part of second pair */ |