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/mem | |
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/mem')
-rw-r--r-- | storage/innobase/mem/mem0dbg.c | 214 | ||||
-rw-r--r-- | storage/innobase/mem/mem0mem.c | 44 | ||||
-rw-r--r-- | storage/innobase/mem/mem0pool.c | 96 |
3 files changed, 178 insertions, 176 deletions
diff --git a/storage/innobase/mem/mem0dbg.c b/storage/innobase/mem/mem0dbg.c index 7c0be818948..86d5beb9c80 100644 --- a/storage/innobase/mem/mem0dbg.c +++ b/storage/innobase/mem/mem0dbg.c @@ -17,8 +17,8 @@ mutex_t mem_hash_mutex; /* The mutex which protects in the extent of memory allocations. Only used in the debug version. Protected by mem_hash_mutex above. */ -static ulint mem_n_created_heaps = 0; -static ulint mem_n_allocations = 0; +static ulint mem_n_created_heaps = 0; +static ulint mem_n_allocations = 0; static ulint mem_total_allocated_memory = 0; ulint mem_current_allocated_memory = 0; static ulint mem_max_allocated_memory = 0; @@ -130,7 +130,7 @@ mem_init( } UT_LIST_INIT(mem_all_list_base); - + mem_hash_initialized = TRUE; #endif @@ -150,17 +150,17 @@ mem_field_init( byte* usr_buf; usr_buf = buf + MEM_FIELD_HEADER_SIZE; - - /* In the debug version write the length field and the + + /* In the debug version write the length field and the check fields to the start and the end of the allocated storage. The field header consists of a length field and a random number field, in this order. The field trailer contains the same random number as a check field. */ mem_field_header_set_len(usr_buf, n); - + rnd = ut_rnd_gen_ulint(); - + mem_field_header_set_check(usr_buf, rnd); mem_field_trailer_set_check(usr_buf, rnd); @@ -202,7 +202,7 @@ mem_field_erase( #ifdef UNIV_MEM_DEBUG mutex_enter(&mem_hash_mutex); - mem_current_allocated_memory -= n; + mem_current_allocated_memory -= n; mutex_exit(&mem_hash_mutex); /* Check that the field lengths agree */ @@ -223,10 +223,10 @@ 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 */ { - byte* ptr; + byte* ptr; for (ptr = buf; ptr < buf + n; ptr++) { @@ -245,10 +245,10 @@ 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 */ { - byte* ptr; + byte* ptr; for (ptr = buf; ptr < buf + n; ptr++) { if (ut_rnd_gen_ibool()) { @@ -276,7 +276,7 @@ mem_hash_insert( ut_ad(mem_heap_check(heap)); mutex_enter(&mem_hash_mutex); - + cell_no = ut_hash_ulint((ulint)heap, MEM_HASH_SIZE); /* Allocate a new node to the list */ @@ -292,7 +292,7 @@ mem_hash_insert( UT_LIST_ADD_LAST(all_list, mem_all_list_base, new_node); - mem_n_created_heaps++; + mem_n_created_heaps++; mutex_exit(&mem_hash_mutex); } @@ -317,14 +317,14 @@ mem_hash_remove( ulint cell_no; ibool error; ulint size; - + ut_ad(mem_heap_check(heap)); mutex_enter(&mem_hash_mutex); cell_no = ut_hash_ulint((ulint)heap, MEM_HASH_SIZE); - /* Look for the heap in the hash table list */ + /* Look for the heap in the hash table list */ node = UT_LIST_GET_FIRST(*mem_hash_get_nth_cell(cell_no)); while (node != NULL) { @@ -335,10 +335,10 @@ mem_hash_remove( node = UT_LIST_GET_NEXT(list, node); } - + if (node == NULL) { fprintf(stderr, - "Memory heap or buffer freed in %s line %lu did not exist.\n", + "Memory heap or buffer freed in %s line %lu did not exist.\n", file_name, (ulong) line); ut_error; } @@ -384,16 +384,16 @@ of blocks. */ void mem_heap_validate_or_print( /*=======================*/ - mem_heap_t* heap, /* in: memory heap */ - byte* top __attribute__((unused)), - /* in: calculate and validate only until + mem_heap_t* heap, /* in: memory heap */ + byte* top __attribute__((unused)), + /* 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 of the heap; works only in the debug version */ ibool* error, /* out: TRUE if error */ - ulint* us_size,/* out: allocated memory + 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 @@ -406,7 +406,7 @@ mem_heap_validate_or_print( argument, it is ignored */ { mem_block_t* block; - ulint total_len = 0; + ulint total_len = 0; ulint block_count = 0; ulint phys_len = 0; #ifdef UNIV_MEM_DEBUG @@ -417,19 +417,19 @@ mem_heap_validate_or_print( #endif /* Pessimistically, we set the parameters to error values */ - if (us_size != NULL) { + if (us_size != NULL) { *us_size = 0; } - if (ph_size != NULL) { + if (ph_size != NULL) { *ph_size = 0; } if (n_blocks != NULL) { *n_blocks = 0; - } + } *error = TRUE; block = heap; - + if (block->magic_n != MEM_BLOCK_MAGIC_N) { return; } @@ -438,18 +438,18 @@ mem_heap_validate_or_print( fputs("Memory heap:", stderr); } - while (block != NULL) { + while (block != NULL) { phys_len += mem_block_get_len(block); if ((block->type == MEM_HEAP_BUFFER) - && (mem_block_get_len(block) > UNIV_PAGE_SIZE)) { + && (mem_block_get_len(block) > UNIV_PAGE_SIZE)) { fprintf(stderr, "InnoDB: Error: mem block %p length %lu > UNIV_PAGE_SIZE\n", block, (ulong) mem_block_get_len(block)); - /* error */ + /* error */ - return; + return; } #ifdef UNIV_MEM_DEBUG @@ -470,20 +470,20 @@ mem_heap_validate_or_print( /* Calculate the pointer to the storage which was given to the user */ - + user_field = field + MEM_FIELD_HEADER_SIZE; - - len = mem_field_header_get_len(user_field); - + + len = mem_field_header_get_len(user_field); + if (print) { ut_print_buf(stderr, user_field, len); } - + total_len += len; check_field = mem_field_header_get_check(user_field); - - if (check_field != - mem_field_trailer_get_check(user_field)) { + + if (check_field != + mem_field_trailer_get_check(user_field)) { /* error */ fprintf(stderr, @@ -492,7 +492,7 @@ mem_heap_validate_or_print( (ulint)field, len, check_field, mem_field_trailer_get_check(user_field)); - return; + return; } /* Move to next field */ @@ -526,16 +526,16 @@ mem_heap_validate_or_print( } #ifdef UNIV_MEM_DEBUG completed: -#endif - if (us_size != NULL) { +#endif + if (us_size != NULL) { *us_size = total_len; } - if (ph_size != NULL) { + if (ph_size != NULL) { *ph_size = phys_len; } if (n_blocks != NULL) { *n_blocks = block_count; - } + } *error = FALSE; } @@ -547,14 +547,14 @@ mem_heap_print( /*===========*/ mem_heap_t* heap) /* in: memory heap */ { - ibool error; + ibool error; ulint us_size; ulint phys_size; ulint n_blocks; ut_ad(mem_heap_check(heap)); - mem_heap_validate_or_print(heap, NULL, TRUE, &error, + mem_heap_validate_or_print(heap, NULL, TRUE, &error, &us_size, &phys_size, &n_blocks); fprintf(stderr, "\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n", @@ -586,7 +586,7 @@ mem_heap_validate( /* out: TRUE if ok */ mem_heap_t* heap) /* in: memory heap */ { - ibool error; + ibool error; ulint us_size; ulint phys_size; ulint n_blocks; @@ -651,10 +651,10 @@ mem_validate_no_assert(void) /* out: TRUE if error */ { mem_hash_node_t* node; - ulint n_heaps = 0; + ulint n_heaps = 0; ulint allocated_mem; ulint ph_size; - ulint total_allocated_mem = 0; + ulint total_allocated_mem = 0; ibool error = FALSE; ulint n_blocks; ulint i; @@ -671,7 +671,7 @@ mem_validate_no_assert(void) n_heaps++; mem_heap_validate_or_print(node->heap, NULL, - FALSE, &error, &allocated_mem, + FALSE, &error, &allocated_mem, &ph_size, &n_blocks); if (error) { @@ -690,11 +690,11 @@ mem_validate_no_assert(void) node = UT_LIST_GET_NEXT(list, node); } } - + if ((n_heaps == 0) && (mem_current_allocated_memory != 0)) { error = TRUE; } - + if (mem_total_allocated_memory < mem_current_allocated_memory) { error = TRUE; } @@ -702,13 +702,13 @@ mem_validate_no_assert(void) if (mem_max_allocated_memory > mem_total_allocated_memory) { error = TRUE; } - + if (mem_n_created_heaps < n_heaps) { error = TRUE; } - + mutex_exit(&mem_hash_mutex); - + return(error); } @@ -733,41 +733,41 @@ 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 */ { byte* p; ulint i; ulint dist; fputs("InnoDB: Apparent memory corruption: mem dump ", stderr); - ut_print_buf(stderr, ptr - 250, 500); + ut_print_buf(stderr, (byte*)ptr - 250, 500); fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr); - p = ptr; + p = (byte*)ptr; dist = 0; - + for (i = 0; i < 10; i++) { for (;;) { if (((ulint)p) % 4 == 0) { - if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) { - fprintf(stderr, - "Mem block at - %lu, file %s, line %lu\n", + if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) { + fprintf(stderr, + "Mem block at - %lu, file %s, line %lu\n", (ulong) dist, (p + sizeof(ulint)), (ulong) (*(ulint*)(p + 8 + sizeof(ulint)))); - break; - } + break; + } - if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) { - fprintf(stderr, - "Freed mem block at - %lu, file %s, line %lu\n", + if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) { + fprintf(stderr, + "Freed mem block at - %lu, file %s, line %lu\n", (ulong) dist, (p + sizeof(ulint)), (ulong) (*(ulint*)(p + 8 + sizeof(ulint)))); - break; - } + break; + } } p--; @@ -781,30 +781,30 @@ mem_analyze_corruption( fprintf(stderr, "InnoDB: Scanning forward trying to find next allocated mem blocks\n"); - p = ptr; + p = (byte*)ptr; dist = 0; - + for (i = 0; i < 10; i++) { for (;;) { if (((ulint)p) % 4 == 0) { - if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) { - fprintf(stderr, - "Mem block at + %lu, file %s, line %lu\n", + if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) { + fprintf(stderr, + "Mem block at + %lu, file %s, line %lu\n", (ulong) dist, (p + sizeof(ulint)), (ulong) (*(ulint*)(p + 8 + sizeof(ulint)))); - break; - } + break; + } - if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) { - fprintf(stderr, - "Freed mem block at + %lu, file %s, line %lu\n", + if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) { + fprintf(stderr, + "Freed mem block at + %lu, file %s, line %lu\n", (ulong) dist, (p + sizeof(ulint)), (ulong) (*(ulint*)(p + 8 + sizeof(ulint)))); - break; - } + break; + } } p++; @@ -823,26 +823,26 @@ static void mem_print_info_low( /*===============*/ - ibool print_all) /* in: if TRUE, all heaps are printed, + ibool print_all) /* in: if TRUE, all heaps are printed, else only the heaps allocated after the - previous call of this function */ + previous call of this function */ { #ifdef UNIV_MEM_DEBUG mem_hash_node_t* node; - ulint n_heaps = 0; + ulint n_heaps = 0; ulint allocated_mem; ulint ph_size; - ulint total_allocated_mem = 0; + ulint total_allocated_mem = 0; ibool error; ulint n_blocks; #endif FILE* outfile; - + /* outfile = fopen("ibdebug", "a"); */ outfile = stdout; - - fprintf(outfile, "\n"); + + fprintf(outfile, "\n"); fprintf(outfile, "________________________________________________________\n"); fprintf(outfile, "MEMORY ALLOCATION INFORMATION\n\n"); @@ -852,16 +852,16 @@ mem_print_info_low( UT_NOT_USED(print_all); mem_pool_print_info(outfile, mem_comm_pool); - + fprintf(outfile, "Sorry, non-debug version cannot give more memory info\n"); /* fclose(outfile); */ - + return; #else mutex_enter(&mem_hash_mutex); - + fprintf(outfile, "LIST OF CREATED HEAPS AND ALLOCATED BUFFERS: \n\n"); if (!print_all) { @@ -872,39 +872,39 @@ mem_print_info_low( while (node != NULL) { n_heaps++; - + if (!print_all && node->nth_heap < mem_last_print_info) { goto next_heap; - } + } - mem_heap_validate_or_print(node->heap, NULL, - FALSE, &error, &allocated_mem, + mem_heap_validate_or_print(node->heap, NULL, + FALSE, &error, &allocated_mem, &ph_size, &n_blocks); total_allocated_mem += allocated_mem; fprintf(outfile, "%lu: file %s line %lu of size %lu phys.size %lu with %lu blocks, type %lu\n", - node->nth_heap, node->file_name, node->line, + node->nth_heap, node->file_name, node->line, allocated_mem, ph_size, n_blocks, (node->heap)->type); next_heap: node = UT_LIST_GET_NEXT(all_list, node); } - + fprintf(outfile, "\n"); - fprintf(outfile, "Current allocated memory : %lu\n", + fprintf(outfile, "Current allocated memory : %lu\n", mem_current_allocated_memory); - fprintf(outfile, "Current allocated heaps and buffers : %lu\n", + fprintf(outfile, "Current allocated heaps and buffers : %lu\n", n_heaps); - fprintf(outfile, "Cumulative allocated memory : %lu\n", + fprintf(outfile, "Cumulative allocated memory : %lu\n", mem_total_allocated_memory); - fprintf(outfile, "Maximum allocated memory : %lu\n", + fprintf(outfile, "Maximum allocated memory : %lu\n", mem_max_allocated_memory); - fprintf(outfile, "Cumulative created heaps and buffers : %lu\n", + fprintf(outfile, "Cumulative created heaps and buffers : %lu\n", mem_n_created_heaps); - fprintf(outfile, "Cumulative number of allocations : %lu\n", + fprintf(outfile, "Cumulative number of allocations : %lu\n", mem_n_allocations); mem_last_print_info = mem_n_created_heaps; @@ -912,10 +912,10 @@ mem_print_info_low( mutex_exit(&mem_hash_mutex); mem_pool_print_info(outfile, mem_comm_pool); - + /* mem_validate(); */ -/* fclose(outfile); */ +/* fclose(outfile); */ #endif } diff --git a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c index e1911097ca5..90d3f4fa6b1 100644 --- a/storage/innobase/mem/mem0mem.c +++ b/storage/innobase/mem/mem0mem.c @@ -35,7 +35,7 @@ When we use a memory heap, we can allocate larger blocks of memory at a time and thus reduce overhead. Slightly more efficient the method is when we allocate the memory from the index page buffer pool, as we can -claim a new page fast. This is called buffer allocation. +claim a new page fast. This is called buffer allocation. When we allocate the memory from the dynamic memory of the C environment, that is called dynamic allocation. @@ -44,13 +44,13 @@ First, when the heap is created, an initial block of memory is allocated. In dynamic allocation this may be about 50 bytes. If more space is needed, additional blocks are allocated and they are put into a linked list. -After the initial block, each allocated block is twice the size of the +After the initial block, each allocated block is twice the size of the previous, until a threshold is attained, after which the sizes of the blocks stay the same. An exception is, of course, the case where the caller requests a memory buffer whose size is bigger than the threshold. In that case a block big enough must be allocated. - + The heap is physically arranged so that if the current block becomes full, a new block is allocated and always inserted in the chain of blocks as the last block. @@ -75,18 +75,18 @@ After freeing, all the blocks in the heap are set to random bytes to help us discover errors which result from the use of buffers in an already freed heap. */ -#ifdef MEM_PERIODIC_CHECK +#ifdef MEM_PERIODIC_CHECK ibool mem_block_list_inited; /* List of all mem blocks allocated; protected by the mem_comm_pool mutex */ UT_LIST_BASE_NODE_T(mem_block_t) mem_block_list; #endif - + /******************************************************************* 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* @@ -97,7 +97,7 @@ mem_alloc_func_noninline( const char* file_name, /* in: file name where created */ ulint line) /* in: line where created */ { - return(mem_alloc_func(n, file_name, line)); + return(mem_alloc_func(n, file_name, line)); } /************************************************************************** @@ -136,12 +136,12 @@ mem_heap_create_block( { mem_block_t* block; ulint len; - + ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER) || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH)); if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) { - mem_analyze_corruption((byte*)heap); + mem_analyze_corruption(heap); } /* In dynamic allocation, calculate the size: block header + data. */ @@ -191,14 +191,14 @@ mem_heap_create_block( ut_strlcpy_rev(block->file_name, file_name, sizeof(block->file_name)); block->line = line; -#ifdef MEM_PERIODIC_CHECK +#ifdef MEM_PERIODIC_CHECK mem_pool_mutex_enter(); if (!mem_block_list_inited) { mem_block_list_inited = TRUE; UT_LIST_INIT(mem_block_list); } - + UT_LIST_ADD_LAST(mem_block_list, mem_block_list, block); mem_pool_mutex_exit(); @@ -225,11 +225,11 @@ 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 */ { - mem_block_t* block; - mem_block_t* new_block; + mem_block_t* block; + mem_block_t* new_block; ulint new_size; ut_ad(mem_heap_check(heap)); @@ -239,7 +239,7 @@ mem_heap_add_block( /* We have to allocate a new block. The size is always at least doubled until the standard size is reached. After that the size stays the same, except in cases where the caller needs more space. */ - + new_size = 2 * mem_block_get_len(block); if (heap->type != MEM_HEAP_DYNAMIC) { @@ -257,7 +257,7 @@ mem_heap_add_block( if (new_size < n) { new_size = n; } - + new_block = mem_heap_create_block(heap, new_size, NULL, heap->type, heap->file_name, heap->line); if (new_block == NULL) { @@ -283,15 +283,15 @@ mem_heap_block_free( { ulint type; ulint len; - ibool init_block; + ibool init_block; if (block->magic_n != MEM_BLOCK_MAGIC_N) { - mem_analyze_corruption((byte*)block); + mem_analyze_corruption(block); } UT_LIST_REMOVE(list, heap->base, block); - -#ifdef MEM_PERIODIC_CHECK + +#ifdef MEM_PERIODIC_CHECK mem_pool_mutex_enter(); UT_LIST_REMOVE(mem_block_list, mem_block_list, block); @@ -302,7 +302,7 @@ mem_heap_block_free( len = block->len; init_block = block->init_block; block->magic_n = MEM_FREED_BLOCK_MAGIC_N; - + #ifdef UNIV_MEM_DEBUG /* In the debug version we set the memory to a random combination of hex 0xDE and 0xAD. */ @@ -361,7 +361,7 @@ mem_validate_all_blocks(void) while (block) { if (block->magic_n != MEM_BLOCK_MAGIC_N) { - mem_analyze_corruption((byte*)block); + mem_analyze_corruption(block); } block = UT_LIST_GET_NEXT(mem_block_list, block); diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c index cb891a03092..a61ab1ce170 100644 --- a/storage/innobase/mem/mem0pool.c +++ b/storage/innobase/mem/mem0pool.c @@ -157,8 +157,9 @@ mem_area_get_free( /* out: TRUE if free */ mem_area_t* area) /* in: area */ { - ut_ad(TRUE == MEM_AREA_FREE); - +#if TRUE != MEM_AREA_FREE +# error "TRUE != MEM_AREA_FREE" +#endif return(area->size_and_free & MEM_AREA_FREE); } @@ -171,8 +172,9 @@ mem_area_set_free( mem_area_t* area, /* in: area */ ibool free) /* in: free bit value */ { - ut_ad(TRUE == MEM_AREA_FREE); - +#if TRUE != MEM_AREA_FREE +# error "TRUE != MEM_AREA_FREE" +#endif area->size_and_free = (area->size_and_free & ~MEM_AREA_FREE) | free; } @@ -192,7 +194,7 @@ mem_pool_create( ulint used; ut_a(size > 10000); - + pool = ut_malloc(sizeof(mem_pool_t)); /* We do not set the memory to zero (FALSE) in the pool, @@ -221,7 +223,7 @@ mem_pool_create( if (ut_2_exp(i) > size - used) { /* ut_2_log rounds upward */ - + i--; } @@ -238,7 +240,7 @@ mem_pool_create( ut_ad(size >= used); pool->reserved = 0; - + return(pool); } @@ -264,17 +266,17 @@ mem_pool_fill_free_list( if (i >= 63) { /* We come here when we have run out of space in the memory pool: */ - + return(FALSE); } area = UT_LIST_GET_FIRST(pool->free_list[i + 1]); if (area == NULL) { - if (UT_LIST_GET_LEN(pool->free_list[i + 1]) > 0) { - ut_print_timestamp(stderr); + if (UT_LIST_GET_LEN(pool->free_list[i + 1]) > 0) { + ut_print_timestamp(stderr); - fprintf(stderr, + fprintf(stderr, " InnoDB: Error: mem pool free list %lu length is %lu\n" "InnoDB: though the list is empty!\n", (ulong) i + 1, @@ -292,7 +294,7 @@ mem_pool_fill_free_list( } if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) { - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); ut_error; } @@ -305,14 +307,14 @@ mem_pool_fill_free_list( mem_area_set_free(area2, TRUE); UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area2); - + mem_area_set_size(area, ut_2_exp(i)); UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area); return(TRUE); } - + /************************************************************************ Allocates memory from a pool. NOTE: This low-level function should only be used in mem0mem.*! */ @@ -356,19 +358,19 @@ mem_area_alloc( } if (!mem_area_get_free(area)) { - fprintf(stderr, + fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu though the\n" "InnoDB: element is not marked free!\n", (ulong) n); - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); /* Try to analyze a strange assertion failure reported at mysql@lists.mysql.com where the free bit IS 1 in the hex dump above */ if (mem_area_get_free(area)) { - fprintf(stderr, + fprintf(stderr, "InnoDB: Probably a race condition because now the area is marked free!\n"); } @@ -376,29 +378,29 @@ mem_area_alloc( } if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) { - fprintf(stderr, + fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu\n" "InnoDB: though the list length is 0!\n", (ulong) n); - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); ut_error; } - ut_ad(mem_area_get_size(area) == ut_2_exp(n)); + ut_ad(mem_area_get_size(area) == ut_2_exp(n)); mem_area_set_free(area, FALSE); - + UT_LIST_REMOVE(free_list, pool->free_list[n], area); pool->reserved += mem_area_get_size(area); - + mem_n_threads_inside--; mutex_exit(&(pool->mutex)); ut_ad(mem_pool_validate(pool)); - - return((void*)(MEM_AREA_EXTRA_SIZE + ((byte*)area))); + + return((void*)(MEM_AREA_EXTRA_SIZE + ((byte*)area))); } /************************************************************************ @@ -417,7 +419,7 @@ mem_area_get_buddy( ut_ad(size != 0); if (((((byte*)area) - pool->buf) % (2 * size)) == 0) { - + /* The buddy is in a higher address */ buddy = (mem_area_t*)(((byte*)area) + size); @@ -456,7 +458,7 @@ mem_area_free( void* new_ptr; ulint size; ulint n; - + /* It may be that the area was really allocated from the OS with regular malloc: check if ptr points within our memory pool */ @@ -468,27 +470,27 @@ mem_area_free( area = (mem_area_t*) (((byte*)ptr) - MEM_AREA_EXTRA_SIZE); - if (mem_area_get_free(area)) { - fprintf(stderr, + if (mem_area_get_free(area)) { + fprintf(stderr, "InnoDB: Error: Freeing element to mem pool free list though the\n" "InnoDB: element is marked free!\n"); - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); ut_error; } size = mem_area_get_size(area); - - if (size == 0) { - fprintf(stderr, + + if (size == 0) { + fprintf(stderr, "InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n" "InnoDB: previous allocated area!\n"); - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); ut_error; } -#ifdef UNIV_LIGHT_MEM_DEBUG +#ifdef UNIV_LIGHT_MEM_DEBUG if (((byte*)area) + size < pool->buf + pool->size) { ulint next_size; @@ -496,20 +498,20 @@ mem_area_free( next_size = mem_area_get_size( (mem_area_t*)(((byte*)area) + size)); if (ut_2_power_up(next_size) != next_size) { - fprintf(stderr, + fprintf(stderr, "InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n" "InnoDB: Possibly a memory overrun of the buffer being freed here.\n", (ulong) size, (ulong) next_size); - mem_analyze_corruption((byte*)area); + mem_analyze_corruption(area); ut_error; } } #endif buddy = mem_area_get_buddy(area, size, pool); - + n = ut_2_log(size); - + mutex_enter(&(pool->mutex)); mem_n_threads_inside++; @@ -532,7 +534,7 @@ mem_area_free( } /* Remove the buddy from its free list and merge it to area */ - + UT_LIST_REMOVE(free_list, pool->free_list[n], buddy); pool->reserved += ut_2_exp(n); @@ -552,7 +554,7 @@ mem_area_free( pool->reserved -= size; } - + mem_n_threads_inside--; mutex_exit(&(pool->mutex)); @@ -576,9 +578,9 @@ mem_pool_validate( mutex_enter(&(pool->mutex)); free = 0; - + for (i = 0; i < 64; i++) { - + UT_LIST_VALIDATE(free_list, mem_area_t, pool->free_list[i]); area = UT_LIST_GET_FIRST(pool->free_list[i]); @@ -590,7 +592,7 @@ mem_pool_validate( buddy = mem_area_get_buddy(area, ut_2_exp(i), pool); ut_a(!buddy || !mem_area_get_free(buddy) - || (ut_2_exp(i) != mem_area_get_size(buddy))); + || (ut_2_exp(i) != mem_area_get_size(buddy))); area = UT_LIST_GET_NEXT(free_list, area); @@ -611,7 +613,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 */ { ulint i; @@ -629,11 +631,11 @@ mem_pool_print_info( "Free list length %lu for blocks of size %lu\n", (ulong) UT_LIST_GET_LEN(pool->free_list[i]), (ulong) ut_2_exp(i)); - } + } } fprintf(outfile, "Pool size %lu, reserved %lu.\n", (ulong) pool->size, - (ulong) pool->reserved); + (ulong) pool->reserved); mutex_exit(&(pool->mutex)); } @@ -651,7 +653,7 @@ mem_pool_get_reserved( mutex_enter(&(pool->mutex)); reserved = pool->reserved; - + mutex_exit(&(pool->mutex)); return(reserved); |