Below is the list of changes that have just been committed into a local
5.1 repository of alexi. When alexi does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2159 06/03/10 19:22:21 aivanov@stripped +217 -0
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.
storage/innobase/pars/make_bison.sh
1.1 06/03/10 19:22:14 aivanov@stripped +11 -0
New BitKeeper file ``storage/innobase/pars/make_bison.sh''
mysql-test/t/innodb_unsafe_binlog.test
1.1 06/03/10 19:22:14 aivanov@stripped +55 -0
New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog.test''
storage/innobase/pars/make_bison.sh
1.0 06/03/10 19:22:14 aivanov@stripped +0 -0
BitKeeper file /home/alexi/innodb/mysql-5.1-xx269/storage/innobase/pars/make_bison.sh
mysql-test/t/innodb_unsafe_binlog.test
1.0 06/03/10 19:22:14 aivanov@stripped +0 -0
BitKeeper file /home/alexi/innodb/mysql-5.1-xx269/mysql-test/t/innodb_unsafe_binlog.test
mysql-test/t/innodb_unsafe_binlog-master.opt
1.1 06/03/10 19:22:13 aivanov@stripped +1 -0
New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog-master.opt''
mysql-test/r/innodb_unsafe_binlog.result
1.1 06/03/10 19:22:13 aivanov@stripped +35 -0
New BitKeeper file ``mysql-test/r/innodb_unsafe_binlog.result''
storage/innobase/ut/ut0ut.c
1.34 06/03/10 19:22:13 aivanov@stripped +50 -50
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0rnd.c
1.4 06/03/10 19:22:13 aivanov@stripped +11 -11
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0mem.c
1.30 06/03/10 19:22:13 aivanov@stripped +47 -46
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0dbg.c
1.10 06/03/10 19:22:13 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0byte.c
1.7 06/03/10 19:22:13 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/usr/usr0sess.c
1.8 06/03/10 19:22:13 aivanov@stripped +2 -3
Applied innodb-5.1-ss269 snapshot.
mysql-test/t/innodb_unsafe_binlog-master.opt
1.0 06/03/10 19:22:13 aivanov@stripped +0 -0
BitKeeper file /home/alexi/innodb/mysql-5.1-xx269/mysql-test/t/innodb_unsafe_binlog-master.opt
mysql-test/r/innodb_unsafe_binlog.result
1.0 06/03/10 19:22:13 aivanov@stripped +0 -0
BitKeeper file /home/alexi/innodb/mysql-5.1-xx269/mysql-test/r/innodb_unsafe_binlog.result
storage/innobase/trx/trx0undo.c
1.26 06/03/10 19:22:12 aivanov@stripped +113 -114
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0trx.c
1.63 06/03/10 19:22:12 aivanov@stripped +261 -258
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0sys.c
1.37 06/03/10 19:22:12 aivanov@stripped +84 -78
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0rseg.c
1.7 06/03/10 19:22:12 aivanov@stripped +10 -11
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0roll.c
1.29 06/03/10 19:22:12 aivanov@stripped +91 -90
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0rec.c
1.24 06/03/10 19:22:12 aivanov@stripped +169 -164
Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0purge.c
1.21 06/03/10 19:22:12 aivanov@stripped +108 -107
Applied innodb-5.1-ss269 snapshot.
storage/innobase/thr/thr0loc.c
1.9 06/03/10 19:22:12 aivanov@stripped +21 -21
Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0sync.c
1.38 06/03/10 19:22:12 aivanov@stripped +290 -267
Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0rw.c
1.21 06/03/10 19:22:12 aivanov@stripped +95 -95
Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0arr.c
1.22 06/03/10 19:22:12 aivanov@stripped +388 -296
Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0start.c
1.91 06/03/10 19:22:12 aivanov@stripped +269 -227
Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0srv.c
1.97 06/03/10 19:22:12 aivanov@stripped +285 -269
Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0que.c
1.4 06/03/10 19:22:11 aivanov@stripped +5 -5
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0vers.c
1.19 06/03/10 19:22:11 aivanov@stripped +53 -21
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0upd.c
1.40 06/03/10 19:22:11 aivanov@stripped +139 -132
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0undo.c
1.16 06/03/10 19:22:11 aivanov@stripped +21 -21
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0umod.c
1.22 06/03/10 19:22:11 aivanov@stripped +53 -53
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0uins.c
1.11 06/03/10 19:22:11 aivanov@stripped +22 -22
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0sel.c
1.101 06/03/10 19:22:11 aivanov@stripped +389 -380
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0row.c
1.21 06/03/10 19:22:11 aivanov@stripped +36 -35
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0purge.c
1.24 06/03/10 19:22:11 aivanov@stripped +41 -41
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0mysql.c
1.122 06/03/10 19:22:11 aivanov@stripped +352 -362
Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0ins.c
1.77 06/03/10 19:22:11 aivanov@stripped +206 -188
Applied innodb-5.1-ss269 snapshot.
storage/innobase/rem/rem0rec.c
1.20 06/03/10 19:22:11 aivanov@stripped +92 -89
Applied innodb-5.1-ss269 snapshot.
storage/innobase/rem/rem0cmp.c
1.32 06/03/10 19:22:11 aivanov@stripped +166 -139
Applied innodb-5.1-ss269 snapshot.
storage/innobase/read/read0read.c
1.10 06/03/10 19:22:11 aivanov@stripped +174 -48
Applied innodb-5.1-ss269 snapshot.
storage/innobase/que/que0que.c
1.23 06/03/10 19:22:11 aivanov@stripped +70 -70
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0sym.c
1.6 06/03/10 19:22:11 aivanov@stripped +16 -16
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0pars.c
1.16 06/03/10 19:22:11 aivanov@stripped +147 -86
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0opt.c
1.13 06/03/10 19:22:11 aivanov@stripped +85 -85
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0lex.l
1.11 06/03/10 19:22:10 aivanov@stripped +11 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.y
1.9 06/03/10 19:22:10 aivanov@stripped +20 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.h
1.4 06/03/10 19:22:10 aivanov@stripped +216 -86
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.c
1.11 06/03/10 19:22:10 aivanov@stripped +2142 -1516
Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/lexyy.c
1.19 06/03/10 19:22:10 aivanov@stripped +1101 -1059
Applied innodb-5.1-ss269 snapshot.
storage/innobase/page/page0page.c
1.32 06/03/10 19:22:10 aivanov@stripped +151 -147
Applied innodb-5.1-ss269 snapshot.
storage/innobase/page/page0cur.c
1.27 06/03/10 19:22:10 aivanov@stripped +142 -140
Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0thread.c
1.33 06/03/10 19:22:10 aivanov@stripped +30 -39
Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0sync.c
1.29 06/03/10 19:22:10 aivanov@stripped +49 -50
Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0proc.c
1.17 06/03/10 19:22:10 aivanov@stripped +111 -111
Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0file.c
1.114 06/03/10 19:22:10 aivanov@stripped +516 -504
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mtr/mtr0mtr.c
1.12 06/03/10 19:22:10 aivanov@stripped +21 -21
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mtr/mtr0log.c
1.13 06/03/10 19:22:10 aivanov@stripped +14 -13
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0pool.c
1.22 06/03/10 19:22:10 aivanov@stripped +49 -47
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0mem.c
1.13 06/03/10 19:22:10 aivanov@stripped +22 -22
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0dbg.c
1.19 06/03/10 19:22:10 aivanov@stripped +107 -107
Applied innodb-5.1-ss269 snapshot.
storage/innobase/mach/mach0data.c
1.4 06/03/10 19:22:10 aivanov@stripped +11 -11
Applied innodb-5.1-ss269 snapshot.
storage/innobase/log/log0recv.c
1.51 06/03/10 19:22:10 aivanov@stripped +287 -276
Applied innodb-5.1-ss269 snapshot.
storage/innobase/log/log0log.c
1.46 06/03/10 19:22:10 aivanov@stripped +251 -246
Applied innodb-5.1-ss269 snapshot.
storage/innobase/lock/lock0lock.c
1.66 06/03/10 19:22:09 aivanov@stripped +359 -356
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0ut.ic
1.5 06/03/10 19:22:09 aivanov@stripped +6 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0ut.h
1.19 06/03/10 19:22:09 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0sort.h
1.3 06/03/10 19:22:09 aivanov@stripped +30 -30
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0rnd.ic
1.6 06/03/10 19:22:09 aivanov@stripped +23 -23
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0rnd.h
1.5 06/03/10 19:22:09 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0mem.ic
1.8 06/03/10 19:22:09 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0mem.h
1.20 06/03/10 19:22:09 aivanov@stripped +15 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0lst.h
1.3 06/03/10 19:22:09 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0dbg.h
1.18 06/03/10 19:22:09 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0byte.ic
1.6 06/03/10 19:22:09 aivanov@stripped +26 -24
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0byte.h
1.9 06/03/10 19:22:09 aivanov@stripped +14 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/usr0types.h
1.4 06/03/10 19:22:09 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/usr0sess.h
1.7 06/03/10 19:22:09 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/univ.i
1.47 06/03/10 19:22:09 aivanov@stripped +5 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0xa.h
1.5 06/03/10 19:22:09 aivanov@stripped +11 -11
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0undo.ic
1.4 06/03/10 19:22:09 aivanov@stripped +35 -28
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0undo.h
1.8 06/03/10 19:22:09 aivanov@stripped +9 -9
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0types.h
1.5 06/03/10 19:22:09 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0trx.ic
1.5 06/03/10 19:22:08 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0trx.h
1.52 06/03/10 19:22:08 aivanov@stripped +36 -36
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0sys.ic
1.7 06/03/10 19:22:08 aivanov@stripped +11 -9
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0sys.h
1.17 06/03/10 19:22:08 aivanov@stripped +8 -8
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rseg.ic
1.7 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rseg.h
1.3 06/03/10 19:22:08 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0roll.h
1.11 06/03/10 19:22:08 aivanov@stripped +11 -11
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rec.h
1.7 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0purge.ic
1.3 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0purge.h
1.5 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0sync.ic
1.20 06/03/10 19:22:08 aivanov@stripped +26 -27
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0sync.h
1.25 06/03/10 19:22:08 aivanov@stripped +18 -18
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0rw.ic
1.12 06/03/10 19:22:08 aivanov@stripped +28 -28
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0rw.h
1.13 06/03/10 19:22:08 aivanov@stripped +29 -29
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0arr.h
1.9 06/03/10 19:22:08 aivanov@stripped +13 -13
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/srv0start.h
1.15 06/03/10 19:22:08 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/srv0srv.h
1.60 06/03/10 19:22:08 aivanov@stripped +88 -75
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0vers.h
1.6 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0upd.ic
1.11 06/03/10 19:22:08 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0upd.h
1.15 06/03/10 19:22:08 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0undo.h
1.4 06/03/10 19:22:08 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0umod.h
1.3 06/03/10 19:22:08 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0uins.h
1.4 06/03/10 19:22:08 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0types.h
1.3 06/03/10 19:22:07 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0sel.ic
1.6 06/03/10 19:22:07 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0sel.h
1.9 06/03/10 19:22:07 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0row.ic
1.4 06/03/10 19:22:07 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0row.h
1.8 06/03/10 19:22:07 aivanov@stripped +6 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0purge.h
1.3 06/03/10 19:22:07 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0mysql.h
1.47 06/03/10 19:22:07 aivanov@stripped +14 -15
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0ins.h
1.8 06/03/10 19:22:07 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0rec.ic
1.25 06/03/10 19:22:07 aivanov@stripped +94 -85
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0rec.h
1.17 06/03/10 19:22:07 aivanov@stripped +22 -22
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0cmp.ic
1.6 06/03/10 19:22:07 aivanov@stripped +6 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0cmp.h
1.12 06/03/10 19:22:07 aivanov@stripped +19 -18
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/read0read.ic
1.4 06/03/10 19:22:07 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/read0read.h
1.7 06/03/10 19:22:07 aivanov@stripped +36 -15
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0types.h
1.4 06/03/10 19:22:07 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0que.ic
1.6 06/03/10 19:22:07 aivanov@stripped +11 -10
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0que.h
1.14 06/03/10 19:22:07 aivanov@stripped +8 -8
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0types.h
1.4 06/03/10 19:22:06 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0sym.h
1.6 06/03/10 19:22:06 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0pars.h
1.9 06/03/10 19:22:06 aivanov@stripped +17 -10
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0opt.h
1.5 06/03/10 19:22:06 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0grm.h
1.4 06/03/10 19:22:06 aivanov@stripped +216 -86
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0types.h
1.4 06/03/10 19:22:06 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0page.ic
1.15 06/03/10 19:22:06 aivanov@stripped +35 -35
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0page.h
1.10 06/03/10 19:22:06 aivanov@stripped +23 -23
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0cur.ic
1.7 06/03/10 19:22:06 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0cur.h
1.10 06/03/10 19:22:06 aivanov@stripped +6 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0thread.h
1.18 06/03/10 19:22:06 aivanov@stripped +5 -5
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0sync.ic
1.9 06/03/10 19:22:06 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0sync.h
1.16 06/03/10 19:22:06 aivanov@stripped +10 -10
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0proc.h
1.9 06/03/10 19:22:06 aivanov@stripped +11 -10
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0file.h
1.45 06/03/10 19:22:06 aivanov@stripped +43 -39
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0mtr.ic
1.5 06/03/10 19:22:06 aivanov@stripped +9 -9
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0mtr.h
1.14 06/03/10 19:22:06 aivanov@stripped +20 -20
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0log.ic
1.10 06/03/10 19:22:06 aivanov@stripped +17 -9
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0pool.h
1.10 06/03/10 19:22:06 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0mem.ic
1.16 06/03/10 19:22:06 aivanov@stripped +59 -59
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0mem.h
1.15 06/03/10 19:22:06 aivanov@stripped +42 -46
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0dbg.ic
1.7 06/03/10 19:22:06 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0dbg.h
1.8 06/03/10 19:22:06 aivanov@stripped +11 -12
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mach0data.ic
1.9 06/03/10 19:22:06 aivanov@stripped +76 -76
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mach0data.h
1.6 06/03/10 19:22:05 aivanov@stripped +61 -61
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0recv.h
1.14 06/03/10 19:22:05 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0log.ic
1.11 06/03/10 19:22:05 aivanov@stripped +16 -16
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0log.h
1.18 06/03/10 19:22:05 aivanov@stripped +15 -15
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/lock0types.h
1.5 06/03/10 19:22:05 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/lock0lock.h
1.27 06/03/10 19:22:05 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ibuf0ibuf.ic
1.5 06/03/10 19:22:05 aivanov@stripped +9 -8
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ibuf0ibuf.h
1.9 06/03/10 19:22:05 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/hash0hash.ic
1.6 06/03/10 19:22:05 aivanov@stripped +13 -13
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/hash0hash.h
1.8 06/03/10 19:22:05 aivanov@stripped +19 -19
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ha0ha.h
1.10 06/03/10 19:22:05 aivanov@stripped +6 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fut0lst.ic
1.4 06/03/10 19:22:05 aivanov@stripped +8 -8
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fsp0fsp.h
1.12 06/03/10 19:22:05 aivanov@stripped +8 -8
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fil0fil.h
1.21 06/03/10 19:22:05 aivanov@stripped +35 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0proc.ic
1.3 06/03/10 19:22:05 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0proc.h
1.3 06/03/10 19:22:05 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0eval.ic
1.5 06/03/10 19:22:05 aivanov@stripped +14 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0eval.h
1.3 06/03/10 19:22:05 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dyn0dyn.ic
1.8 06/03/10 19:22:05 aivanov@stripped +21 -19
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dyn0dyn.h
1.10 06/03/10 19:22:05 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0mem.h
1.27 06/03/10 19:22:05 aivanov@stripped +14 -22
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0load.h
1.12 06/03/10 19:22:05 aivanov@stripped +3 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0dict.ic
1.13 06/03/10 19:22:04 aivanov@stripped +38 -32
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0dict.h
1.41 06/03/10 19:22:04 aivanov@stripped +20 -16
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0crea.h
1.9 06/03/10 19:22:04 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0boot.ic
1.4 06/03/10 19:22:04 aivanov@stripped +10 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0boot.h
1.6 06/03/10 19:22:04 aivanov@stripped +4 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/db0err.h
1.13 06/03/10 19:22:04 aivanov@stripped +7 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0type.ic
1.29 06/03/10 19:22:04 aivanov@stripped +57 -30
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0type.h
1.24 06/03/10 19:22:04 aivanov@stripped +5 -4
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0data.ic
1.11 06/03/10 19:22:04 aivanov@stripped +42 -39
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0data.h
1.15 06/03/10 19:22:04 aivanov@stripped +37 -29
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0lru.h
1.10 06/03/10 19:22:04 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0flu.ic
1.5 06/03/10 19:22:04 aivanov@stripped +6 -6
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0flu.h
1.7 06/03/10 19:22:04 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0buf.ic
1.20 06/03/10 19:22:04 aivanov@stripped +41 -40
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0buf.h
1.34 06/03/10 19:22:04 aivanov@stripped +38 -32
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0types.h
1.3 06/03/10 19:22:04 aivanov@stripped +2 -2
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0sea.ic
1.5 06/03/10 19:22:04 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0sea.h
1.10 06/03/10 19:22:04 aivanov@stripped +5 -5
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0pcur.ic
1.9 06/03/10 19:22:04 aivanov@stripped +27 -27
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0pcur.h
1.10 06/03/10 19:22:04 aivanov@stripped +5 -5
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0cur.ic
1.5 06/03/10 19:22:04 aivanov@stripped +19 -18
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0cur.h
1.17 06/03/10 19:22:04 aivanov@stripped +3 -3
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0btr.ic
1.9 06/03/10 19:22:04 aivanov@stripped +12 -12
Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0btr.h
1.17 06/03/10 19:22:03 aivanov@stripped +9 -7
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ibuf/ibuf0ibuf.c
1.40 06/03/10 19:22:03 aivanov@stripped +209 -196
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ha/hash0hash.c
1.6 06/03/10 19:22:03 aivanov@stripped +9 -9
Applied innodb-5.1-ss269 snapshot.
storage/innobase/ha/ha0ha.c
1.18 06/03/10 19:22:03 aivanov@stripped +22 -16
Applied innodb-5.1-ss269 snapshot.
storage/innobase/fut/fut0lst.c
1.7 06/03/10 19:22:03 aivanov@stripped +37 -37
Applied innodb-5.1-ss269 snapshot.
storage/innobase/fsp/fsp0fsp.c
1.28 06/03/10 19:22:03 aivanov@stripped +397 -375
Applied innodb-5.1-ss269 snapshot.
storage/innobase/fil/fil0fil.c
1.62 06/03/10 19:22:03 aivanov@stripped +304 -205
Applied innodb-5.1-ss269 snapshot.
storage/innobase/eval/eval0proc.c
1.4 06/03/10 19:22:03 aivanov@stripped +14 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/eval/eval0eval.c
1.10 06/03/10 19:22:03 aivanov@stripped +28 -28
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dyn/dyn0dyn.c
1.3 06/03/10 19:22:03 aivanov@stripped +1 -1
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0mem.c
1.19 06/03/10 19:22:03 aivanov@stripped +19 -23
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0load.c
1.45 06/03/10 19:22:03 aivanov@stripped +154 -137
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0dict.c
1.76 06/03/10 19:22:03 aivanov@stripped +273 -284
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0crea.c
1.35 06/03/10 19:22:03 aivanov@stripped +84 -80
Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0boot.c
1.16 06/03/10 19:22:03 aivanov@stripped +41 -42
Applied innodb-5.1-ss269 snapshot.
storage/innobase/data/data0type.c
1.22 06/03/10 19:22:03 aivanov@stripped +14 -14
Applied innodb-5.1-ss269 snapshot.
storage/innobase/data/data0data.c
1.20 06/03/10 19:22:03 aivanov@stripped +71 -60
Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0rea.c
1.20 06/03/10 19:22:02 aivanov@stripped +58 -57
Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0lru.c
1.27 06/03/10 19:22:02 aivanov@stripped +88 -88
Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0flu.c
1.32 06/03/10 19:22:02 aivanov@stripped +124 -123
Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0buf.c
1.51 06/03/10 19:22:02 aivanov@stripped +302 -257
Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0sea.c
1.39 06/03/10 19:22:02 aivanov@stripped +206 -153
Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0pcur.c
1.19 06/03/10 19:22:02 aivanov@stripped +48 -48
Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0cur.c
1.49 06/03/10 19:22:02 aivanov@stripped +226 -222
Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0btr.c
1.42 06/03/10 19:22:02 aivanov@stripped +220 -219
Applied innodb-5.1-ss269 snapshot.
sql/ha_innodb.h
1.118 06/03/10 19:22:02 aivanov@stripped +114 -124
Applied innodb-5.1-ss269 snapshot.
sql/ha_innodb.cc
1.259 06/03/10 19:22:02 aivanov@stripped +1739 -1681
Applied innodb-5.1-ss269 snapshot.
mysql-test/t/innodb.test
1.131 06/03/10 19:22:02 aivanov@stripped +371 -2
Applied innodb-5.1-ss269 snapshot.
mysql-test/r/innodb.result
1.166 06/03/10 19:22:02 aivanov@stripped +440 -2
Applied innodb-5.1-ss269 snapshot.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: aivanov
# Host: mysqld.creware.com
# Root: /home/alexi/innodb/mysql-5.1-xx269
--- New file ---
+++ mysql-test/r/innodb_unsafe_binlog.result 06/03/10 19:22:13
drop table if exists t1,t2;
create table t1 (id int not null, f_id int not null, f int not null,
primary key(f_id, id)) engine=innodb;
create table t2 (id int not null,s_id int not null,s varchar(200),
primary key(id)) engine=innodb;
INSERT INTO t1 VALUES (8, 1, 3);
INSERT INTO t1 VALUES (1, 2, 1);
INSERT INTO t2 VALUES (1, 0, '');
INSERT INTO t2 VALUES (8, 1, '');
commit;
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
WHERE mm.id IS NULL;
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
where mm.id is null lock in share mode;
id f_id f
drop table t1,t2;
create table t1(a int not null, b int, primary key(a)) engine=innodb;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
commit;
set autocommit = 0;
select * from t1 lock in share mode;
a b
1 1
2 2
3 1
4 2
5 1
6 2
update t1 set b = 5 where b = 1;
set autocommit = 0;
select * from t1 where a = 2 and b = 2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
commit;
drop table t1;
--- New file ---
+++ mysql-test/t/innodb_unsafe_binlog-master.opt 06/03/10 19:22:13
--innodb_locks_unsafe_for_binlog=true
--- New file ---
+++ mysql-test/t/innodb_unsafe_binlog.test 06/03/10 19:22:14
-- source include/have_innodb.inc
#
# Note that these tests uses a innodb_locks_unsafe_for_binlog option.
#
#
# Test cases for a bug #15650
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (id int not null, f_id int not null, f int not null,
primary key(f_id, id)) engine=innodb;
create table t2 (id int not null,s_id int not null,s varchar(200),
primary key(id)) engine=innodb;
INSERT INTO t1 VALUES (8, 1, 3);
INSERT INTO t1 VALUES (1, 2, 1);
INSERT INTO t2 VALUES (1, 0, '');
INSERT INTO t2 VALUES (8, 1, '');
commit;
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
WHERE mm.id IS NULL;
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
where mm.id is null lock in share mode;
drop table t1,t2;
#
# Test case for unlock row bug where unlock releases all locks granted for
# a row. Only the latest lock should be released.
#
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
commit;
set autocommit = 0;
select * from t1 lock in share mode;
update t1 set b = 5 where b = 1;
connection b;
set autocommit = 0;
#
# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
#
--error 1205
select * from t1 where a = 2 and b = 2 for update;
connection a;
commit;
connection b;
commit;
drop table t1;
disconnect a;
disconnect b;
--- New file ---
+++ storage/innobase/pars/make_bison.sh 06/03/10 19:22:14
#!/bin/bash
#
# regenerate parser from bison input files as documented at the top of
# pars0lex.l.
set -eu
bison -d pars0grm.y
mv pars0grm.tab.c pars0grm.c
mv pars0grm.tab.h pars0grm.h
cp pars0grm.h ../include
--- 1.3/storage/innobase/srv/srv0que.c 2005-04-08 03:37:35 +04:00
+++ 1.4/storage/innobase/srv/srv0que.c 2006-03-10 19:22:11 +03:00
@@ -38,7 +38,7 @@
}
UT_LIST_REMOVE(queue, srv_sys->tasks, thr);
-
+
mutex_exit(&kernel_mutex);
que_run_threads(thr);
@@ -62,11 +62,11 @@
ut_ad(thr->state == QUE_THR_RUNNING);
mutex_enter(&kernel_mutex);
-
+
UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
new_thr = UT_LIST_GET_FIRST(srv_sys->tasks);
-
+
mutex_exit(&kernel_mutex);
return(new_thr);
@@ -106,8 +106,8 @@
ut_a(0); /* Under MySQL this is never called */
mutex_enter(&kernel_mutex);
-
+
srv_que_task_enqueue_low(thr);
-
+
mutex_exit(&kernel_mutex);
}
--- 1.4/storage/innobase/include/trx0xa.h 2005-04-08 03:37:33 +04:00
+++ 1.5/storage/innobase/include/trx0xa.h 2006-03-10 19:22:09 +03:00
@@ -52,27 +52,27 @@
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 */
/*
--- 1.41/storage/innobase/btr/btr0btr.c 2005-07-12 21:23:29 +04:00
+++ 1.42/storage/innobase/btr/btr0btr.c 2006-03-10 19:22:02 +03:00
@@ -5,7 +5,7 @@
Created 6/2/1994 Heikki Tuuri
*******************************************************/
-
+
#include "btr0btr.h"
#ifdef UNIV_NONINL
@@ -56,7 +56,7 @@
which are >= P in the alphabetical order, but < P1 if there is
a next node pointer on the level, and P1 is its prefix.
-If a node pointer with a prefix P points to a non-leaf child,
+If a node pointer with a prefix P points to a non-leaf child,
then the leftmost record in the child must have the same
prefix P. If it points to a leaf node, the child is not required
to contain any record with a prefix equal to P. The leaf case
@@ -138,14 +138,14 @@
ulint space;
ulint root_page_no;
page_t* root;
-
+
space = dict_tree_get_space(tree);
root_page_no = dict_tree_get_page(tree);
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(root) ==
- UT_LIST_GET_FIRST(tree->tree_indexes)->table->comp);
-
+ dict_table_is_comp(UT_LIST_GET_FIRST(tree->tree_indexes)->table));
+
return(root);
}
@@ -175,20 +175,20 @@
return(prev_rec);
}
}
-
+
page = buf_frame_align(rec);
prev_page_no = btr_page_get_prev(page, mtr);
space = buf_frame_get_space_id(page);
-
+
if (prev_page_no != FIL_NULL) {
prev_page = buf_page_get_with_no_latch(space, prev_page_no,
mtr);
/* The caller must already have a latch to the brother */
ut_ad((mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_S_FIX))
- || (mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_X_FIX)));
+ MTR_MEMO_PAGE_S_FIX))
+ || (mtr_memo_contains(mtr, buf_block_align(prev_page),
+ MTR_MEMO_PAGE_X_FIX)));
ut_a(page_is_comp(prev_page) == page_is_comp(page));
return(page_rec_get_prev(page_get_supremum_rec(prev_page)));
@@ -223,20 +223,20 @@
return(next_rec);
}
}
-
+
page = buf_frame_align(rec);
next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page);
-
+
if (next_page_no != FIL_NULL) {
next_page = buf_page_get_with_no_latch(space, next_page_no,
mtr);
/* The caller must already have a latch to the brother */
ut_ad((mtr_memo_contains(mtr, buf_block_align(next_page),
- MTR_MEMO_PAGE_S_FIX))
- || (mtr_memo_contains(mtr, buf_block_align(next_page),
- MTR_MEMO_PAGE_X_FIX)));
+ MTR_MEMO_PAGE_S_FIX))
+ || (mtr_memo_contains(mtr, buf_block_align(next_page),
+ MTR_MEMO_PAGE_X_FIX)));
ut_a(page_is_comp(next_page) == page_is_comp(page));
return(page_rec_get_next(page_get_infimum_rec(next_page)));
@@ -257,11 +257,11 @@
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
page_create(page, mtr,
- UT_LIST_GET_FIRST(tree->tree_indexes)->table->comp);
+ dict_table_is_comp(UT_LIST_GET_FIRST(tree->tree_indexes)->table));
buf_block_align(page)->check_index_page_at_flush = TRUE;
-
+
btr_page_set_index_id(page, tree->id, mtr);
}
@@ -281,7 +281,7 @@
page_t* new_page;
root = btr_root_get(tree, mtr);
-
+
node_addr = flst_get_first(root + PAGE_HEADER
+ PAGE_BTR_IBUF_FREE_LIST, mtr);
ut_a(node_addr.page != FIL_NULL);
@@ -293,7 +293,7 @@
#endif /* UNIV_SYNC_DEBUG */
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
+ new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr));
@@ -328,7 +328,7 @@
}
root = btr_root_get(tree, mtr);
-
+
if (level == 0) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
} else {
@@ -338,7 +338,7 @@
/* Parameter TRUE below states that the caller has made the
reservation for free extents, and thus we know that a page can
be allocated: */
-
+
new_page_no = fseg_alloc_free_page_general(seg_header, hint_page_no,
file_direction, TRUE, mtr);
if (new_page_no == FIL_NULL) {
@@ -351,9 +351,9 @@
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
-
+
return(new_page);
-}
+}
/******************************************************************
Gets the number of pages in a B-tree. */
@@ -376,20 +376,20 @@
mtr_s_lock(dict_tree_get_lock(index->tree), &mtr);
root = btr_root_get(index->tree, &mtr);
-
+
if (flag == BTR_N_LEAF_PAGES) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
-
+
fseg_n_reserved_pages(seg_header, &n, &mtr);
-
+
} else if (flag == BTR_TOTAL_SIZE) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
n = fseg_n_reserved_pages(seg_header, &dummy, &mtr);
-
+
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
-
- n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
+
+ n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
} else {
ut_error;
}
@@ -397,7 +397,7 @@
mtr_commit(&mtr);
return(n);
-}
+}
/******************************************************************
Frees a page used in an ibuf tree. Puts the page to the free list of the
@@ -407,17 +407,17 @@
btr_page_free_for_ibuf(
/*===================*/
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 */
{
page_t* root;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
root = btr_root_get(tree, mtr);
-
+
flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
mtr));
@@ -432,7 +432,7 @@
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 */
{
@@ -442,12 +442,12 @@
ulint page_no;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* The page gets invalid for optimistic searches: increment the frame
modify clock */
buf_frame_modify_clock_inc(page);
-
+
if (tree->type & DICT_IBUF) {
btr_page_free_for_ibuf(tree, page, mtr);
@@ -456,7 +456,7 @@
}
root = btr_root_get(tree, mtr);
-
+
if (level == 0) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
} else {
@@ -465,9 +465,9 @@
space = buf_frame_get_space_id(page);
page_no = buf_frame_get_page_no(page);
-
+
fseg_free_page(seg_header, space, page_no, mtr);
-}
+}
/******************************************************************
Frees a file page used in an index tree. NOTE: cannot free field external
@@ -477,17 +477,17 @@
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 */
{
ulint level;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
-
+
btr_page_free_low(tree, page, level, mtr);
-}
+}
/******************************************************************
Sets the child node file address in a node pointer. */
@@ -507,12 +507,12 @@
ut_ad(0 < btr_page_get_level(buf_frame_align(rec), mtr));
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);
-
+
mlog_write_ulint(field, page_no, MLOG_4BYTES, mtr);
}
@@ -536,7 +536,7 @@
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
-
+
return(page);
}
@@ -567,7 +567,7 @@
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK));
ut_a(page_rec_is_user_rec(user_rec));
-
+
ut_ad(dict_tree_get_page(tree) != buf_frame_get_page_no(page));
heap = mem_heap_create(100);
@@ -589,7 +589,7 @@
ULINT_UNDEFINED, &heap);
if (btr_node_ptr_get_child_page_no(node_ptr, offsets) !=
- buf_frame_get_page_no(page)) {
+ buf_frame_get_page_no(page)) {
rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr);
buf_page_print(buf_frame_align(page));
@@ -677,13 +677,13 @@
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_frame_get_page_no(ibuf_hdr_frame)
- == IBUF_HEADER_PAGE_NO);
+ == IBUF_HEADER_PAGE_NO);
/* Allocate then the next page to the segment: it will be the
- tree root page */
+ tree root page */
- page_no = fseg_alloc_free_page(
+ page_no = fseg_alloc_free_page(
ibuf_hdr_frame + IBUF_HEADER
- + IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO,
+ + IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO,
FSP_UP, mtr);
ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
@@ -692,14 +692,14 @@
frame = fseg_create(space, 0, PAGE_HEADER + PAGE_BTR_SEG_TOP,
mtr);
}
-
+
if (frame == NULL) {
return(FIL_NULL);
}
page_no = buf_frame_get_page_no(frame);
-
+
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
@@ -708,9 +708,9 @@
/* It is an insert buffer tree: initialize the free list */
ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
-
+
flst_init(frame + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr);
- } else {
+ } else {
/* It is a non-ibuf tree: create a file segment for leaf
pages */
fseg_create(space, page_no, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
@@ -721,7 +721,7 @@
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
}
-
+
/* Create a new index page on the the allocated segment page */
page = page_create(frame, mtr, comp);
buf_block_align(page)->check_index_page_at_flush = TRUE;
@@ -731,7 +731,7 @@
/* Set the level of the new index page */
btr_page_set_level(page, 0, mtr);
-
+
/* Set the next node and previous node fields */
btr_page_set_next(page, FIL_NULL, mtr);
btr_page_set_prev(page, FIL_NULL, mtr);
@@ -739,7 +739,7 @@
/* We reset the free bits for the page to allow creation of several
trees in the same mtr, otherwise the latch on a bitmap page would
prevent it because of the latching order */
-
+
ibuf_reset_free_bits_with_type(type, page);
/* In the following assertion we test that two records of maximum
@@ -765,10 +765,10 @@
page_t* root;
mtr_t mtr;
-leaf_loop:
+leaf_loop:
mtr_start(&mtr);
-
- root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
+
+ root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
/* NOTE: page hash indexes are dropped when a page is freed inside
fsp0fsp. */
@@ -783,8 +783,8 @@
}
top_loop:
mtr_start(&mtr);
-
- root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
+
+ root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
finished = fseg_free_step_not_header(
root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr);
@@ -793,7 +793,7 @@
if (!finished) {
goto top_loop;
- }
+ }
}
/****************************************************************
@@ -812,14 +812,14 @@
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
- btr_search_drop_page_hash_index(root);
-top_loop:
+ btr_search_drop_page_hash_index(root);
+top_loop:
finished = fseg_free_step(
root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
if (!finished) {
goto top_loop;
- }
+ }
}
/*****************************************************************
@@ -845,8 +845,8 @@
ulint max_ins_size2;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
- ut_ad(!!page_is_comp(page) == index->table->comp);
+ MTR_MEMO_PAGE_X_FIX));
+ ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
@@ -872,7 +872,7 @@
page_create(page, mtr, page_is_comp(page));
buf_block_align(page)->check_index_page_at_flush = TRUE;
-
+
/* Copy the records from the temporary space to the recreated page;
do not copy the lock bits yet */
@@ -880,7 +880,7 @@
page_get_infimum_rec(new_page), index, mtr);
/* Copy max trx id to recreated page */
page_set_max_trx_id(page, page_get_max_trx_id(new_page));
-
+
if (!recovery) {
/* Update the record lock bitmaps */
lock_move_reorganize_page(page, new_page);
@@ -892,7 +892,7 @@
if (data_size1 != data_size2 || max_ins_size1 != max_ins_size2) {
buf_page_print(page);
buf_page_print(new_page);
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: Error: page old data size %lu new data size %lu\n"
"InnoDB: Error: page old max ins size %lu new max ins size %lu\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
@@ -955,7 +955,7 @@
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(page);
/* Recreate the page: note that global data on page (possible
@@ -990,10 +990,10 @@
rec_t* rec;
mem_heap_t* heap;
dtuple_t* node_ptr;
- ulint level;
+ ulint level;
rec_t* node_ptr_rec;
page_cur_t* page_cursor;
-
+
root = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
@@ -1001,24 +1001,24 @@
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(root),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(root);
/* Allocate a new page to the tree. Root splitting is done by first
moving the root records to the new page, emptying the root, putting
a node pointer to the new page, and then splitting the new page. */
-
+
new_page = btr_page_alloc(tree, 0, FSP_NO_DIR,
btr_page_get_level(root, mtr), mtr);
btr_page_create(new_page, tree, mtr);
level = btr_page_get_level(root, mtr);
-
+
/* Set the levels of the new index page and root page */
btr_page_set_level(new_page, level, mtr);
btr_page_set_level(root, level + 1, mtr);
-
+
/* Set the next node and previous node fields of new page */
btr_page_set_next(new_page, FIL_NULL, mtr);
btr_page_set_prev(new_page, FIL_NULL, mtr);
@@ -1031,7 +1031,7 @@
perform a pessimistic update then we have stored the lock
information of the record to be inserted on the infimum of the
root page: we cannot discard the lock structs on the root page */
-
+
lock_update_root_raise(new_page, root);
/* Create a memory heap where the node pointer is stored */
@@ -1039,17 +1039,17 @@
rec = page_rec_get_next(page_get_infimum_rec(new_page));
new_page_no = buf_frame_get_page_no(new_page);
-
+
/* Build the node pointer (= node key and page address) for the
child */
node_ptr = dict_tree_build_node_ptr(tree, rec, new_page_no, heap,
- level);
+ level);
/* Reorganize the root to get free space */
btr_page_reorganize(root, cursor->index, mtr);
page_cursor = btr_cur_get_page_cur(cursor);
-
+
/* Insert node pointer to the root */
page_cur_set_before_first(root, page_cursor);
@@ -1064,7 +1064,7 @@
node of a level: */
btr_set_min_rec_mark(node_ptr_rec, page_is_comp(root), mtr);
-
+
/* Free the memory heap */
mem_heap_free(heap);
@@ -1078,10 +1078,10 @@
/* Reposition the cursor to the child node */
page_cur_search(new_page, cursor->index, tuple,
PAGE_CUR_LE, page_cursor);
-
+
/* Split the child and insert tuple */
return(btr_page_split_and_insert(cursor, tuple, mtr));
-}
+}
/*****************************************************************
Decides if the page should be split at the convergence point of inserts
@@ -1105,22 +1105,22 @@
insert_point = btr_cur_get_rec(cursor);
if (page_header_get_ptr(page, PAGE_LAST_INSERT)
- == page_rec_get_next(insert_point)) {
+ == page_rec_get_next(insert_point)) {
+
+ infimum = page_get_infimum_rec(page);
- infimum = page_get_infimum_rec(page);
-
/* If the convergence is in the middle of a page, include also
the record immediately before the new insert to the upper
page. Otherwise, we could repeatedly move from page to page
lots of records smaller than the convergence point. */
if (infimum != insert_point
- && page_rec_get_next(infimum) != insert_point) {
+ && page_rec_get_next(infimum) != insert_point) {
*split_rec = insert_point;
} else {
- *split_rec = page_rec_get_next(insert_point);
- }
+ *split_rec = page_rec_get_next(insert_point);
+ }
return(TRUE);
}
@@ -1162,7 +1162,7 @@
if (page_rec_is_supremum(next_rec)) {
split_at_new:
/* Split at the new record to insert */
- *split_rec = NULL;
+ *split_rec = NULL;
} else {
rec_t* next_next_rec = page_rec_get_next(next_rec);
if (page_rec_is_supremum(next_next_rec)) {
@@ -1176,7 +1176,7 @@
index, as they can do the necessary checks of the right
search position just by looking at the records on this
page. */
-
+
*split_rec = next_next_rec;
}
@@ -1199,7 +1199,7 @@
upper half-page */
btr_cur_t* cursor, /* in: cursor at which insert
should be made */
- dtuple_t* tuple) /* in: tuple to insert */
+ dtuple_t* tuple) /* in: tuple to insert */
{
page_t* page;
ulint insert_size;
@@ -1216,7 +1216,7 @@
ulint* offsets;
page = btr_cur_get_page(cursor);
-
+
insert_size = rec_get_converted_size(cursor->index, tuple);
free_space = page_get_free_space_of_empty(page_is_comp(page));
@@ -1263,15 +1263,15 @@
}
n++;
-
+
if (incl_data + page_dir_calc_reserved_space(n)
- >= total_space / 2) {
+ >= total_space / 2) {
- if (incl_data + page_dir_calc_reserved_space(n)
- <= free_space) {
- /* The next record will be the first on
- the right half page if it is not the
- supremum record of page */
+ if (incl_data + page_dir_calc_reserved_space(n)
+ <= free_space) {
+ /* The next record will be the first on
+ the right half page if it is not the
+ supremum record of page */
if (rec == ins_rec) {
rec = NULL;
@@ -1286,7 +1286,7 @@
if (!page_rec_is_supremum(next_rec)) {
rec = next_rec;
}
- }
+ }
func_exit:
if (UNIV_LIKELY_NULL(heap)) {
@@ -1295,7 +1295,7 @@
return(rec);
}
}
-}
+}
/*****************************************************************
Returns TRUE if the insert fits on the appropriate half-page with the
@@ -1323,7 +1323,7 @@
rec_t* rec;
rec_t* end_rec;
ulint* offs;
-
+
page = btr_cur_get_page(cursor);
ut_ad(!split_rec == !offsets);
@@ -1339,11 +1339,11 @@
total_data = page_get_data_size(page) + insert_size;
total_n_recs = page_get_n_recs(page) + 1;
-
+
/* We determine which records (from rec to end_rec, not including
end_rec) will end up on the other half page from tuple when it is
inserted. */
-
+
if (split_rec == NULL) {
rec = page_rec_get_next(page_get_infimum_rec(page));
end_rec = page_rec_get_next(btr_cur_get_rec(cursor));
@@ -1351,14 +1351,14 @@
} else if (cmp_dtuple_rec(tuple, split_rec, offsets) >= 0) {
rec = page_rec_get_next(page_get_infimum_rec(page));
- end_rec = split_rec;
+ end_rec = split_rec;
} else {
rec = split_rec;
end_rec = page_get_supremum_rec(page);
}
if (total_data + page_dir_calc_reserved_space(total_n_recs)
- <= free_space) {
+ <= free_space) {
/* Ok, there will be enough available space on the
half page where the tuple is inserted */
@@ -1379,7 +1379,7 @@
total_n_recs--;
if (total_data + page_dir_calc_reserved_space(total_n_recs)
- <= free_space) {
+ <= free_space) {
/* Ok, there will be enough available space on the
half page where the tuple is inserted */
@@ -1391,7 +1391,7 @@
}
return(FALSE);
-}
+}
/***********************************************************
Inserts a data tuple to a tree on a non-leaf level. It is assumed
@@ -1406,25 +1406,22 @@
mtr_t* mtr) /* in: mtr */
{
big_rec_t* dummy_big_rec;
- btr_cur_t cursor;
+ btr_cur_t cursor;
ulint err;
rec_t* rec;
ut_ad(level > 0);
-
+
/* In the following, choose just any index from the tree as the
first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(UT_LIST_GET_FIRST(tree->tree_indexes),
- level, tuple, PAGE_CUR_LE,
- BTR_CONT_MODIFY_TREE,
- &cursor, 0, mtr);
+ level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE,
+ &cursor, 0, mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
- | BTR_KEEP_SYS_FLAG
- | BTR_NO_UNDO_LOG_FLAG,
- &cursor, tuple,
- &rec, &dummy_big_rec, NULL, mtr);
+ | BTR_KEEP_SYS_FLAG | BTR_NO_UNDO_LOG_FLAG,
+ &cursor, tuple, &rec, &dummy_big_rec, NULL, mtr);
ut_a(err == DB_SUCCESS);
}
@@ -1455,12 +1452,12 @@
ulint lower_page_no;
ulint upper_page_no;
dtuple_t* node_ptr_upper;
- mem_heap_t* heap;
+ mem_heap_t* heap;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(new_page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_a(page_is_comp(page) == page_is_comp(new_page));
/* Create a memory heap where the data tuple is stored */
@@ -1477,7 +1474,7 @@
/* Look from the tree for the node pointer to page */
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
- /* Replace the address of the old child node (= page) with the
+ /* Replace the address of the old child node (= page) with the
address of the new lower half */
btr_node_ptr_set_child_page_no(node_ptr,
@@ -1492,7 +1489,7 @@
lower_page = page;
upper_page = new_page;
}
-
+
/* Get the level of the split pages */
level = btr_page_get_level(page, mtr);
@@ -1500,13 +1497,13 @@
half */
node_ptr_upper = dict_tree_build_node_ptr(tree, split_rec,
- upper_page_no, heap, level);
+ upper_page_no, heap, level);
/* Insert it next to the pointer to the lower half. Note that this
may generate recursion leading to a split on the higher level. */
btr_insert_on_non_leaf_level(tree, level + 1, node_ptr_upper, mtr);
-
+
/* Free the memory heap */
mem_heap_free(heap);
@@ -1515,9 +1512,9 @@
prev_page_no = btr_page_get_prev(page, mtr);
next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page);
-
+
/* Update page links of the level */
-
+
if (prev_page_no != FIL_NULL) {
prev_page = btr_page_get(space, prev_page_no, RW_X_LATCH, mtr);
@@ -1533,7 +1530,7 @@
btr_page_set_prev(next_page, upper_page_no, mtr);
}
-
+
btr_page_set_prev(lower_page, prev_page_no, mtr);
btr_page_set_next(lower_page, upper_page_no, mtr);
btr_page_set_level(lower_page, level, mtr);
@@ -1590,7 +1587,7 @@
mem_heap_empty(heap);
offsets = NULL;
tree = btr_cur_get_tree(cursor);
-
+
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK));
#ifdef UNIV_SYNC_DEBUG
@@ -1600,9 +1597,9 @@
page = btr_cur_get_page(cursor);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(page_get_n_recs(page) >= 2);
-
+
page_no = buf_frame_get_page_no(page);
/* 1. Decide the split record; split_rec == NULL means that the
@@ -1613,7 +1610,7 @@
direction = FSP_UP;
hint_page_no = page_no + 1;
split_rec = btr_page_get_sure_split_rec(cursor, tuple);
-
+
} else if (btr_page_get_split_rec_to_right(cursor, &split_rec)) {
direction = FSP_UP;
hint_page_no = page_no + 1;
@@ -1631,7 +1628,7 @@
new_page = btr_page_alloc(tree, hint_page_no, direction,
btr_page_get_level(page, mtr), mtr);
btr_page_create(new_page, tree, mtr);
-
+
/* 3. Calculate the first record on the upper half-page, and the
first record (move_limit) on original page which ends up on the
upper half */
@@ -1646,7 +1643,7 @@
cursor->index, tuple);
move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
}
-
+
/* 4. Do first the modifications in the tree structure */
btr_attach_half_pages(tree, page, first_rec, new_page, direction, mtr);
@@ -1670,7 +1667,7 @@
insert_will_fit = btr_page_insert_fits(cursor,
NULL, NULL, tuple, heap);
}
-
+
if (insert_will_fit && (btr_page_get_level(page, mtr) == 0)) {
mtr_memo_release(mtr, dict_tree_get_lock(tree),
@@ -1737,7 +1734,7 @@
mem_heap_free(heap);
return(rec);
}
-
+
/* 8. If insert did not fit, try page reorganization */
btr_page_reorganize(insert_page, cursor->index, mtr);
@@ -1749,7 +1746,7 @@
if (rec == NULL) {
/* The insert did not fit on the page: loop back to the
start of the function for a new split */
-
+
/* We play safe and reset the free bits for new_page */
ibuf_reset_free_bits(cursor->index, new_page);
@@ -1787,24 +1784,24 @@
dict_tree_t* tree __attribute__((unused)), /* in: index tree */
page_t* page, /* in: page to remove */
mtr_t* mtr) /* in: mtr */
-{
+{
ulint space;
ulint prev_page_no;
page_t* prev_page;
ulint next_page_no;
page_t* next_page;
-
+
ut_ad(tree && page && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Get the previous and next page numbers of page */
prev_page_no = btr_page_get_prev(page, mtr);
next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page);
-
+
/* Update page links of the level */
-
+
if (prev_page_no != FIL_NULL) {
prev_page = btr_page_get(space, prev_page_no, RW_X_LATCH, mtr);
@@ -1821,7 +1818,7 @@
btr_page_set_prev(next_page, prev_page_no, mtr);
}
}
-
+
/********************************************************************
Writes the redo log record for setting an index record as the predefined
minimum record. */
@@ -1906,7 +1903,7 @@
btr_cur_t cursor;
ibool compressed;
ulint err;
-
+
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
/* Delete node pointer on father page */
@@ -1945,33 +1942,33 @@
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
father_page = buf_frame_align(
btr_page_get_father_node_ptr(tree, page, mtr));
-
+
page_level = btr_page_get_level(page, mtr);
index = UT_LIST_GET_FIRST(tree->tree_indexes);
btr_search_drop_page_hash_index(page);
-
+
/* Make the father empty */
btr_page_empty(father_page, mtr);
/* Move records to the father */
- page_copy_rec_list_end(father_page, page, page_get_infimum_rec(page),
+ page_copy_rec_list_end(father_page, page, page_get_infimum_rec(page),
index, mtr);
lock_update_copy_and_discard(father_page, page);
btr_page_set_level(father_page, page_level, mtr);
/* Free the file page */
- btr_page_free(tree, page, mtr);
+ btr_page_free(tree, page, mtr);
/* We play safe and reset the free bits for the father */
ibuf_reset_free_bits(index, father_page);
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(tree, father_page, mtr));
-}
+}
/*****************************************************************
Tries to merge the page first to the left immediate brother if such a
@@ -2014,7 +2011,7 @@
page = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
comp = page_is_comp(page);
- ut_a((ibool)!!comp == cursor->index->table->comp);
+ ut_a((ibool)!!comp == dict_table_is_comp(cursor->index->table));
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK));
@@ -2054,7 +2051,7 @@
return;
}
-
+
n_recs = page_get_n_recs(page);
data_size = page_get_data_size(page);
ut_a(page_is_comp(merge_page) == comp);
@@ -2071,7 +2068,7 @@
ut_ad(page_validate(merge_page, cursor->index));
max_ins_size = page_get_max_insert_size(merge_page, n_recs);
-
+
if (data_size > max_ins_size) {
/* We have to reorganize merge_page */
@@ -2103,7 +2100,7 @@
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- /* Replace the address of the old child node (= page) with the
+ /* Replace the address of the old child node (= page) with the
address of the merge page to the right */
btr_node_ptr_set_child_page_no(node_ptr,
@@ -2115,7 +2112,7 @@
}
btr_node_ptr_delete(tree, merge_page, mtr);
}
-
+
/* Move records to the merge page */
if (is_left) {
orig_pred = page_rec_get_prev(
@@ -2136,14 +2133,14 @@
/* We have added new records to merge_page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, merge_page,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
-
+
ut_ad(page_validate(merge_page, cursor->index));
/* Free the file page */
- btr_page_free(tree, page, mtr);
+ btr_page_free(tree, page, mtr);
ut_ad(btr_check_node_ptr(tree, merge_page, mtr));
-}
+}
/*****************************************************************
Discards a page that is the only page on its level. */
@@ -2158,7 +2155,7 @@
rec_t* node_ptr;
page_t* father_page;
ulint page_level;
-
+
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
@@ -2175,7 +2172,7 @@
btr_page_set_level(father_page, page_level, mtr);
/* Free the file page */
- btr_page_free(tree, page, mtr);
+ btr_page_free(tree, page, mtr);
if (buf_frame_get_page_no(father_page) == dict_tree_get_page(tree)) {
/* The father is the root page */
@@ -2190,7 +2187,7 @@
btr_discard_only_page_on_level(tree, father_page, mtr);
}
-}
+}
/*****************************************************************
Discards a page from a B-tree. This is used to remove the last record from
@@ -2212,7 +2209,7 @@
ibool is_left;
page_t* page;
rec_t* node_ptr;
-
+
page = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
@@ -2222,7 +2219,7 @@
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
space = dict_tree_get_space(tree);
-
+
/* Decide the page which will inherit the locks */
left_page_no = btr_page_get_prev(page, mtr);
@@ -2244,7 +2241,7 @@
ut_a(page_is_comp(merge_page) == page_is_comp(page));
btr_search_drop_page_hash_index(page);
-
+
if (left_page_no == FIL_NULL && btr_page_get_level(page, mtr) > 0) {
/* We have to mark the leftmost node pointer on the right
@@ -2255,8 +2252,8 @@
ut_ad(page_rec_is_user_rec(node_ptr));
btr_set_min_rec_mark(node_ptr, page_is_comp(merge_page), mtr);
- }
-
+ }
+
btr_node_ptr_delete(tree, page, mtr);
/* Remove the page from the level list */
@@ -2266,14 +2263,14 @@
lock_update_discard(page_get_supremum_rec(merge_page), page);
} else {
lock_update_discard(page_rec_get_next(
- page_get_infimum_rec(merge_page)), page);
+ page_get_infimum_rec(merge_page)), page);
}
/* Free the file page */
- btr_page_free(tree, page, mtr);
+ btr_page_free(tree, page, mtr);
ut_ad(btr_check_node_ptr(tree, merge_page, mtr));
-}
+}
#ifdef UNIV_BTR_PRINT
/*****************************************************************
@@ -2297,7 +2294,7 @@
}
mtr_start(&mtr);
-
+
root = btr_root_get(tree, &mtr);
seg = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
@@ -2313,7 +2310,7 @@
fseg_print(seg, &mtr);
}
- mtr_commit(&mtr);
+ mtr_commit(&mtr);
}
/****************************************************************
@@ -2341,14 +2338,14 @@
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
fprintf(stderr, "NODE ON LEVEL %lu page number %lu\n",
- (ulong) btr_page_get_level(page, mtr),
- (ulong) buf_frame_get_page_no(page));
-
+ (ulong) btr_page_get_level(page, mtr),
+ (ulong) buf_frame_get_page_no(page));
+
index = UT_LIST_GET_FIRST(tree->tree_indexes);
page_print(page, index, width, width);
-
+
n_recs = page_get_n_recs(page);
-
+
page_cur_set_before_first(page, &cursor);
page_cur_move_to_next(&cursor);
@@ -2413,6 +2410,7 @@
}
#endif /* UNIV_BTR_PRINT */
+#ifdef UNIV_DEBUG
/****************************************************************
Checks that the node pointer to a page is appropriate. */
@@ -2436,19 +2434,19 @@
}
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
-
+
if (btr_page_get_level(page, mtr) == 0) {
return(TRUE);
}
-
+
heap = mem_heap_create(256);
-
+
node_ptr_tuple = dict_tree_build_node_ptr(
tree,
page_rec_get_next(page_get_infimum_rec(page)),
0, heap, btr_page_get_level(page, mtr));
-
+
ut_a(cmp_dtuple_rec(node_ptr_tuple, node_ptr,
rec_get_offsets(node_ptr,
dict_tree_find_index(tree, node_ptr),
@@ -2458,6 +2456,7 @@
return(TRUE);
}
+#endif /* UNIV_DEBUG */
/****************************************************************
Display identification information for a record. */
@@ -2481,7 +2480,7 @@
ibool
btr_index_rec_validate(
-/*====================*/
+/*===================*/
/* out: TRUE if ok */
rec_t* rec, /* in: index record */
dict_index_t* index, /* in: index */
@@ -2501,18 +2500,20 @@
page = buf_frame_align(rec);
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
- /* The insert buffer index tree can contain records from any
- other index: we cannot check the number of fields or
- their length */
+ /* The insert buffer index tree can contain records from any
+ other index: we cannot check the number of fields or
+ their length */
- return(TRUE);
+ return(TRUE);
}
- if (UNIV_UNLIKELY((ibool)!!page_is_comp(page) != index->table->comp)) {
+ if (UNIV_UNLIKELY((ibool)!!page_is_comp(page)
+ != dict_table_is_comp(index->table))) {
btr_index_rec_validate_report(page, rec, index);
fprintf(stderr, "InnoDB: compact flag=%lu, should be %lu\n",
(ulong) !!page_is_comp(page),
- (ulong) index->table->comp);
+ (ulong) dict_table_is_comp(index->table));
+
return(FALSE);
}
@@ -2546,12 +2547,12 @@
their type is CHAR. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0
- && len != UNIV_SQL_NULL && fixed_size
- && len != fixed_size)
+ && len != UNIV_SQL_NULL && fixed_size
+ && len != fixed_size)
||
(dict_index_get_nth_field(index, i)->prefix_len > 0
- && len != UNIV_SQL_NULL
- && len >
+ && len != UNIV_SQL_NULL
+ && len >
dict_index_get_nth_field(index, i)->prefix_len)) {
btr_index_rec_validate_report(page, rec, index);
@@ -2576,7 +2577,7 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- return(TRUE);
+ return(TRUE);
}
/****************************************************************
@@ -2590,9 +2591,9 @@
page_t* page, /* in: index page */
dict_index_t* index) /* in: index */
{
- page_cur_t cur;
+ page_cur_t cur;
ibool ret = TRUE;
-
+
page_cur_set_before_first(page, &cur);
page_cur_move_to_next(&cur);
@@ -2610,7 +2611,7 @@
page_cur_move_to_next(&cur);
}
- return(ret);
+ return(ret);
}
/****************************************************************
@@ -2686,7 +2687,7 @@
mtr_start(&mtr);
mtr_x_lock(dict_tree_get_lock(tree), &mtr);
-
+
page = btr_root_get(tree, &mtr);
space = buf_frame_get_space_id(page);
@@ -2733,14 +2734,14 @@
ret = FALSE;
}
}
-
+
ut_a(btr_page_get_level(page, &mtr) == level);
right_page_no = btr_page_get_next(page, &mtr);
left_page_no = btr_page_get_prev(page, &mtr);
ut_a((page_get_n_recs(page) > 0)
- || ((level == 0) &&
+ || ((level == 0) &&
(buf_frame_get_page_no(page) == dict_tree_get_page(tree))));
if (right_page_no != FIL_NULL) {
@@ -2776,10 +2777,10 @@
rec_print(stderr, rec, index);
putc('\n', stderr);
- ret = FALSE;
- }
+ ret = FALSE;
+ }
}
-
+
if (level > 0 && left_page_no == FIL_NULL) {
ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits(
page_rec_get_next(page_get_infimum_rec(page)),
@@ -2789,7 +2790,7 @@
if (buf_frame_get_page_no(page) != dict_tree_get_page(tree)) {
/* Check father node pointers */
-
+
node_ptr = btr_page_get_father_node_ptr(tree, page, &mtr);
father_page = buf_frame_align(node_ptr);
offsets = rec_get_offsets(node_ptr, index,
@@ -2822,25 +2823,25 @@
&mtr);
rec_print(stderr, rec, index);
putc('\n', stderr);
- ret = FALSE;
+ ret = FALSE;
- goto node_ptr_fails;
+ goto node_ptr_fails;
}
if (btr_page_get_level(page, &mtr) > 0) {
offsets = rec_get_offsets(node_ptr, index,
offsets, ULINT_UNDEFINED, &heap);
-
+
node_ptr_tuple = dict_tree_build_node_ptr(
tree,
page_rec_get_next(
page_get_infimum_rec(page)),
0, heap,
- btr_page_get_level(page, &mtr));
+ btr_page_get_level(page, &mtr));
if (cmp_dtuple_rec(node_ptr_tuple, node_ptr,
offsets)) {
- rec_t* first_rec = page_rec_get_next(
+ rec_t* first_rec = page_rec_get_next(
page_get_infimum_rec(page));
btr_validate_report1(index, level, page);
@@ -2855,9 +2856,9 @@
fputs("InnoDB: first rec ", stderr);
rec_print(stderr, first_rec, index);
putc('\n', stderr);
- ret = FALSE;
+ ret = FALSE;
- goto node_ptr_fails;
+ goto node_ptr_fails;
}
}
@@ -2897,9 +2898,9 @@
} else {
right_father_page = buf_frame_align(
right_node_ptr);
-
+
if (right_node_ptr != page_rec_get_next(
- page_get_infimum_rec(
+ page_get_infimum_rec(
right_father_page))) {
ret = FALSE;
fputs(
@@ -2931,7 +2932,7 @@
buf_page_print(page);
buf_page_print(right_page);
}
- }
+ }
}
}
@@ -2941,7 +2942,7 @@
if (right_page_no != FIL_NULL) {
ulint comp = page_is_comp(page);
mtr_start(&mtr);
-
+
page = btr_page_get(space, right_page_no, RW_X_LATCH, &mtr);
ut_a(page_is_comp(page) == comp);
--- 1.48/storage/innobase/btr/btr0cur.c 2005-07-12 21:23:29 +04:00
+++ 1.49/storage/innobase/btr/btr0cur.c 2006-03-10 19:22:02 +03:00
@@ -116,7 +116,7 @@
const ulint* offsets);/* in: array returned by rec_get_offsets() */
/*==================== B-TREE SEARCH =========================*/
-
+
/************************************************************************
Latches the leaf page or pages requested. */
static
@@ -128,17 +128,17 @@
ulint space, /* in: space id */
ulint page_no, /* in: page number of the leaf */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */
- btr_cur_t* cursor, /* in: cursor */
+ btr_cur_t* cursor, /* in: cursor */
mtr_t* mtr) /* in: mtr */
{
ulint left_page_no;
ulint right_page_no;
page_t* get_page;
-
+
ut_ad(page && mtr);
if (latch_mode == BTR_SEARCH_LEAF) {
-
+
get_page = btr_page_get(space, page_no, RW_S_LATCH, mtr);
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush = TRUE;
@@ -161,7 +161,7 @@
buf_block_align(get_page)->check_index_page_at_flush =
TRUE;
}
-
+
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush = TRUE;
@@ -261,7 +261,7 @@
ulint up_match;
ulint up_bytes;
ulint low_match;
- ulint low_bytes;
+ ulint low_bytes;
ulint height;
ulint savepoint;
ulint rw_latch;
@@ -289,7 +289,7 @@
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
-#endif
+#endif
insert_planned = latch_mode & BTR_INSERT;
estimate = latch_mode & BTR_ESTIMATE;
ignore_sec_unique = latch_mode & BTR_IGNORE_SEC_UNIQUE;
@@ -297,7 +297,7 @@
| BTR_IGNORE_SEC_UNIQUE);
ut_ad(!insert_planned || (mode == PAGE_CUR_LE));
-
+
cursor->flag = BTR_CUR_BINARY;
cursor->index = index;
@@ -312,7 +312,7 @@
#ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
-#endif
+#endif
if (btr_search_latch.writer == RW_LOCK_NOT_LOCKED
&& latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
&& !estimate
@@ -320,7 +320,7 @@
&& mode != PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
&& srv_use_adaptive_hash_indexes
- && btr_search_guess_on_hash(index, info, tuple, mode,
+ && btr_search_guess_on_hash(index, info, tuple, mode,
latch_mode, cursor,
has_search_latch, mtr)) {
@@ -334,7 +334,7 @@
|| mode != PAGE_CUR_LE);
btr_cur_n_sea++;
- return;
+ return;
}
#endif
#endif
@@ -354,7 +354,7 @@
savepoint = mtr_set_savepoint(mtr);
tree = index->tree;
-
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
@@ -365,7 +365,7 @@
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
space = dict_tree_get_space(tree);
@@ -411,14 +411,14 @@
if (insert_planned && ibuf_should_try(index,
ignore_sec_unique)) {
-
+
/* Try insert to the insert buffer if the
page is not in the buffer pool */
buf_mode = BUF_GET_IF_IN_POOL;
}
}
-retry_page_get:
+retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
__FILE__, __LINE__,
@@ -451,8 +451,8 @@
}
buf_block_align(page)->check_index_page_at_flush = TRUE;
-
-#ifdef UNIV_SYNC_DEBUG
+
+#ifdef UNIV_SYNC_DEBUG
if (rw_latch != RW_NO_LATCH) {
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
}
@@ -469,10 +469,10 @@
#ifdef BTR_CUR_ADAPT
if (page != guess) {
info->root_guess = page;
- }
+ }
#endif
}
-
+
if (height == 0) {
if (rw_latch == RW_NO_LATCH) {
@@ -482,7 +482,7 @@
}
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
@@ -499,7 +499,7 @@
&low_match, &low_bytes, page_cursor);
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
- }
+ }
/* If this is the desired level, leave the loop */
@@ -513,7 +513,7 @@
page = btr_page_get(space,
page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(page)
- == index->table->comp);
+ == dict_table_is_comp(index->table));
}
break;
@@ -541,7 +541,7 @@
cursor->up_match = up_match;
cursor->up_bytes = up_bytes;
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_ADAPT
if (srv_use_adaptive_hash_indexes) {
btr_search_info_update(index, cursor);
@@ -556,7 +556,7 @@
}
if (has_search_latch) {
-
+
rw_lock_s_lock(&btr_search_latch);
}
}
@@ -583,7 +583,7 @@
ulint root_height = 0; /* remove warning */
rec_t* node_ptr;
ulint estimate;
- ulint savepoint;
+ ulint savepoint;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
@@ -591,9 +591,9 @@
estimate = latch_mode & BTR_ESTIMATE;
latch_mode = latch_mode & ~BTR_ESTIMATE;
-
+
tree = index->tree;
-
+
/* Store the position of the tree latch we push to mtr so that we
know how to release it when we have latched the leaf node */
@@ -604,7 +604,7 @@
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -639,9 +639,9 @@
we had to scan far to find a record visible to the
current transaction, that could starve others
waiting for the tree latch. */
-
+
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
@@ -650,7 +650,7 @@
dict_tree_get_lock(tree));
}
}
-
+
if (from_left) {
page_cur_set_before_first(page, page_cursor);
} else {
@@ -658,10 +658,10 @@
}
if (height == 0) {
- if (estimate) {
- btr_cur_add_path_info(cursor, height,
- root_height);
- }
+ if (estimate) {
+ btr_cur_add_path_info(cursor, height,
+ root_height);
+ }
break;
}
@@ -691,7 +691,7 @@
mem_heap_free(heap);
}
}
-
+
/**************************************************************************
Positions a cursor at a randomly chosen position within a B-tree. */
@@ -716,13 +716,13 @@
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
tree = index->tree;
-
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -730,7 +730,7 @@
page_no = dict_tree_get_page(tree);
height = ULINT_UNDEFINED;
-
+
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
@@ -750,7 +750,7 @@
latch_mode, cursor, mtr);
}
- page_cur_open_on_rnd_user_rec(page, page_cursor);
+ page_cur_open_on_rnd_user_rec(page, page_cursor);
if (height == 0) {
@@ -771,7 +771,7 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
-}
+}
/*==================== B-TREE INSERT =========================*/
@@ -798,7 +798,7 @@
rec_t* rec;
ut_ad(dtuple_check_typed(tuple));
-
+
*reorg = FALSE;
page = btr_cur_get_page(cursor);
@@ -806,7 +806,7 @@
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
page_cursor = btr_cur_get_page_cur(cursor);
-
+
/* Now, try the insert */
rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, mtr);
@@ -855,9 +855,9 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
-
+
err = lock_rec_insert_check_and_lock(flags, rec, index, thr, inherit);
-
+
if (err != DB_SUCCESS) {
return(err);
@@ -942,7 +942,7 @@
ibool inherit;
ulint rec_size;
ulint type;
- ulint err;
+ ulint err;
*big_rec = NULL;
@@ -975,11 +975,11 @@
/* The record is so big that we have to store some fields
externally on separate database pages */
-
- big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
+
+ big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
if (big_rec_vec == NULL) {
-
+
return(DB_TOO_BIG_RECORD);
}
@@ -991,38 +991,38 @@
for future updates of records. */
type = index->type;
-
+
if ((type & DICT_CLUSTERED)
- && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
- && (page_get_n_recs(page) >= 2)
- && (0 == level)
- && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
- || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
+ && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
+ && (page_get_n_recs(page) >= 2)
+ && (0 == level)
+ && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
+ || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(DB_FAIL);
}
-
+
if (!(((max_size >= rec_size)
- && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
- || (page_get_max_insert_size(page, 1) >= rec_size)
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
+ || (page_get_max_insert_size(page, 1) >= rec_size)
+ || (page_get_n_recs(page) <= 1))) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(DB_FAIL);
}
- /* Check locks and write to the undo log, if specified */
- err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit);
+ /* Check locks and write to the undo log, if specified */
+ err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit);
if (err != DB_SUCCESS) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(err);
@@ -1041,7 +1041,7 @@
btr_page_reorganize(page, index, mtr);
ut_ad(page_get_max_insert_size(page, 1) == max_size);
-
+
reorg = TRUE;
page_cur_search(page, index, entry, PAGE_CUR_LE, page_cursor);
@@ -1076,7 +1076,7 @@
" rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type);
-*/
+*/
if (!(type & DICT_CLUSTERED)) {
/* We have added a record to page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, page, max_size,
@@ -1123,7 +1123,7 @@
ibool success;
ulint n_extents = 0;
ulint n_reserved;
-
+
ut_ad(dtuple_check_typed(entry));
*big_rec = NULL;
@@ -1158,7 +1158,7 @@
return(err);
}
- if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
+ if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
/* First reserve enough free space for the file segments
of the index tree, so that the insert will not fail because
of lack of space */
@@ -1180,13 +1180,13 @@
/* The record is so big that we have to store some fields
externally on separate database pages */
-
- big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
+
+ big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
if (big_rec_vec == NULL) {
-
+
if (n_extents > 0) {
- fil_space_release_free_extents(index->space,
+ fil_space_release_free_extents(index->space,
n_reserved);
}
return(DB_TOO_BIG_RECORD);
@@ -1202,7 +1202,7 @@
*rec = btr_page_split_and_insert(cursor, entry, mtr);
}
- btr_cur_position(index, page_rec_get_prev(*rec), cursor);
+ btr_cur_position(index, page_rec_get_prev(*rec), cursor);
#ifdef BTR_CUR_ADAPT
btr_search_update_hash_on_insert(cursor);
@@ -1244,12 +1244,12 @@
dict_index_t* index;
rec_t* rec;
ulint err;
-
+
ut_ad(cursor && update && thr && roll_ptr);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
-
+
if (!(index->type & DICT_CLUSTERED)) {
/* We do undo logging only when we update a clustered index
record */
@@ -1304,7 +1304,7 @@
byte* log_ptr;
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
ut_ad(flags < 256);
- ut_ad(!!page_is_comp(page) == index->table->comp);
+ ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index, page_is_comp(page)
? MLOG_COMP_REC_UPDATE_IN_PLACE
@@ -1332,7 +1332,7 @@
log_ptr += 2;
row_upd_index_write_log(update, log_ptr, mtr);
-}
+}
/***************************************************************
Parses a redo log record of updating a record in-place. */
@@ -1360,7 +1360,7 @@
return(NULL);
}
-
+
flags = mach_read_from_1(ptr);
ptr++;
@@ -1382,7 +1382,7 @@
ut_a(rec_offset <= UNIV_PAGE_SIZE);
heap = mem_heap_create(256);
-
+
ptr = row_upd_index_parse(ptr, end_ptr, heap, &update);
if (!ptr || !page) {
@@ -1390,9 +1390,9 @@
goto func_exit;
}
- ut_a((ibool)!!page_is_comp(page) == index->table->comp);
+ ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
rec = page + rec_offset;
-
+
/* We do not need to reserve btr_search_latch, as the page is only
being recovered, and there cannot be a hash index to it. */
@@ -1443,7 +1443,7 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
trx = thr_get_trx(thr);
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
#ifdef UNIV_DEBUG
@@ -1466,19 +1466,19 @@
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == index->table->comp);
+ == dict_table_is_comp(index->table));
if (block->is_hashed) {
/* The function row_upd_changes_ord_field_binary works only
if the update vector was built for a clustered index, we must
NOT call it if index is secondary */
- if (!(index->type & DICT_CLUSTERED)
- || row_upd_changes_ord_field_binary(NULL, index, update)) {
+ if (!(index->type & DICT_CLUSTERED)
+ || row_upd_changes_ord_field_binary(NULL, index, update)) {
- /* Remove possible hash index pointer to this record */
- btr_search_update_hash_on_delete(cursor);
- }
+ /* Remove possible hash index pointer to this record */
+ btr_search_update_hash_on_delete(cursor);
+ }
rw_lock_x_lock(&btr_search_latch);
}
@@ -1558,8 +1558,8 @@
page = btr_cur_get_page(cursor);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
-
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
+
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
@@ -1600,20 +1600,20 @@
mem_heap_free(heap);
return(DB_OVERFLOW);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
-
+
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
NULL);
old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry);
-
+
if (UNIV_UNLIKELY(new_rec_size >= page_get_free_space_of_empty(
page_is_comp(page)) / 2)) {
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_OVERFLOW);
}
@@ -1633,14 +1633,14 @@
}
if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
- && (max_size >= new_rec_size))
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= new_rec_size))
+ || (page_get_n_recs(page) <= 1))) {
/* There was not enough space, or it did not pay to
reorganize: for simplicity, we decide what to do assuming a
reorganization is needed, though it might not be necessary */
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_OVERFLOW);
}
@@ -1654,8 +1654,8 @@
return(err);
}
-
- /* Ok, we may do the replacement. Store on the page infimum the
+
+ /* Ok, we may do the replacement. Store on the page infimum the
explicit locks on rec, before deleting rec (see the comment in
.._pessimistic_update). */
@@ -1666,7 +1666,7 @@
page_cur_delete_rec(page_cursor, index, offsets, mtr);
page_cur_move_to_prev(page_cursor);
-
+
trx = thr_get_trx(thr);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
@@ -1693,9 +1693,9 @@
lock_rec_restore_from_page_infimum(rec, page);
- page_cur_move_to_next(page_cursor);
+ page_cur_move_to_next(page_cursor);
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_SUCCESS);
}
@@ -1717,24 +1717,24 @@
page_t* prev_page;
ulint space;
ulint prev_page_no;
-
+
page = buf_frame_align(rec);
if (page_rec_get_next(page_get_infimum_rec(page)) != rec) {
- /* Updated record is not the first user record on its page */
-
+ /* Updated record is not the first user record on its page */
+
return;
}
space = buf_frame_get_space_id(page);
prev_page_no = btr_page_get_prev(page, mtr);
-
+
ut_ad(prev_page_no != FIL_NULL);
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
/* We must already have an x-latch to prev_page! */
ut_ad(mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
lock_rec_reset_and_inherit_gap_locks(page_get_supremum_rec(prev_page),
rec);
@@ -1786,9 +1786,9 @@
ulint n_ext_vect;
ulint reserve_flag;
ulint* offsets = NULL;
-
+
*big_rec = NULL;
-
+
page = btr_cur_get_page(cursor);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
@@ -1827,7 +1827,7 @@
} else {
reserve_flag = FSP_NORMAL;
}
-
+
success = fsp_reserve_free_extents(&n_reserved,
index->space,
n_extents, reserve_flag, mtr);
@@ -1837,12 +1837,12 @@
return(err);
}
}
-
+
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
trx = thr_get_trx(thr);
-
+
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
@@ -1863,7 +1863,7 @@
update it back again. */
ut_a(big_rec_vec == NULL);
-
+
btr_rec_free_updated_extern_fields(index, rec, offsets,
update, TRUE, mtr);
}
@@ -1882,8 +1882,8 @@
ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
REC_MAX_DATA_SIZE))) {
- big_rec_vec = dtuple_convert_big_rec(index, new_entry,
- ext_vect, n_ext_vect);
+ big_rec_vec = dtuple_convert_big_rec(index, new_entry,
+ ext_vect, n_ext_vect);
if (big_rec_vec == NULL) {
err = DB_TOO_BIG_RECORD;
@@ -1921,7 +1921,7 @@
lock_rec_restore_from_page_infimum(rec, page);
rec_set_field_extern_bits(rec, index,
ext_vect, n_ext_vect, mtr);
-
+
if (!rec_get_deleted_flag(rec, rec_offs_comp(offsets))) {
/* The new inserted record owns its possible externally
stored fields */
@@ -2009,7 +2009,7 @@
ut_ad(flags < 256);
ut_ad(val <= 1);
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index,
page_rec_is_comp(rec)
@@ -2056,13 +2056,14 @@
ulint offset;
rec_t* rec;
- ut_ad(!page || !!page_is_comp(page) == index->table->comp);
+ ut_ad(!page
+ || !!page_is_comp(page) == dict_table_is_comp(index->table));
if (end_ptr < ptr + 2) {
return(NULL);
}
-
+
flags = mach_read_from_1(ptr);
ptr++;
val = mach_read_from_1(ptr);
@@ -2087,7 +2088,7 @@
if (page) {
rec = page + offset;
-
+
if (!(flags & BTR_KEEP_SYS_FLAG)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@@ -2108,7 +2109,7 @@
rec_set_deleted_flag(rec, page_is_comp(page), val);
}
-
+
return(ptr);
}
@@ -2142,7 +2143,7 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
#ifdef UNIV_DEBUG
@@ -2186,11 +2187,11 @@
rec_set_deleted_flag(rec, rec_offs_comp(offsets), val);
trx = thr_get_trx(thr);
-
+
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_rec_sys_fields(rec, index, offsets, trx, roll_ptr);
}
-
+
if (block->is_hashed) {
rw_lock_x_unlock(&btr_search_latch);
}
@@ -2256,7 +2257,7 @@
return(NULL);
}
-
+
val = mach_read_from_1(ptr);
ptr++;
@@ -2267,17 +2268,17 @@
if (page) {
rec = page + offset;
-
+
/* We do not need to reserve btr_search_latch, as the page
is only being recovered, and there cannot be a hash index to
it. */
rec_set_deleted_flag(rec, page_is_comp(page), val);
}
-
+
return(ptr);
}
-
+
/***************************************************************
Sets a secondary index record delete mark to TRUE or FALSE. */
@@ -2315,8 +2316,8 @@
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == cursor->index->table->comp);
-
+ == dict_table_is_comp(cursor->index->table));
+
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
@@ -2375,7 +2376,7 @@
MTR_MEMO_PAGE_X_FIX));
ut_ad(btr_page_get_level(btr_cur_get_page(cursor), mtr) == 0);
- btr_compress(cursor, mtr);
+ btr_compress(cursor, mtr);
}
/*****************************************************************
@@ -2441,7 +2442,7 @@
/* This is intended only for leaf page deletions */
page = btr_cur_get_page(cursor);
-
+
ut_ad(btr_page_get_level(page, mtr) == 0);
rec = btr_cur_get_rec(cursor);
@@ -2513,7 +2514,7 @@
ulint level;
mem_heap_t* heap;
ulint* offsets;
-
+
page = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
@@ -2555,26 +2556,26 @@
}
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
- && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
- != buf_frame_get_page_no(page))) {
+ && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
+ != buf_frame_get_page_no(page))) {
/* If there is only one record, drop the whole page in
btr_discard_page, if this is not the root page */
-
+
btr_discard_page(cursor, mtr);
*err = DB_SUCCESS;
ret = TRUE;
- goto return_after_reservations;
+ goto return_after_reservations;
}
lock_update_delete(rec);
level = btr_page_get_level(page, mtr);
if (level > 0
- && UNIV_UNLIKELY(rec == page_rec_get_next(
- page_get_infimum_rec(page)))) {
+ && UNIV_UNLIKELY(rec == page_rec_get_next(
+ page_get_infimum_rec(page)))) {
rec_t* next_rec = page_rec_get_next(rec);
@@ -2602,7 +2603,7 @@
btr_insert_on_non_leaf_level(tree,
level + 1, node_ptr, mtr);
}
- }
+ }
btr_search_update_hash_on_delete(cursor);
@@ -2612,7 +2613,7 @@
ut_ad(btr_check_node_ptr(tree, page, mtr));
*err = DB_SUCCESS;
-
+
return_after_reservations:
mem_heap_free(heap);
@@ -2661,7 +2662,7 @@
}
rec = btr_cur_get_rec(cursor);
-
+
slot = cursor->path_arr + (root_height - height);
slot->nth_rec = page_rec_get_n_recs_before(rec);
@@ -2687,8 +2688,8 @@
btr_path_t* slot1;
btr_path_t* slot2;
ibool diverged;
- ibool diverged_lot;
- ulint divergence_level;
+ ibool diverged_lot;
+ ulint divergence_level;
ib_longlong n_rows;
ulint i;
mtr_t mtr;
@@ -2698,7 +2699,7 @@
cursor.path_arr = path1;
if (dtuple_get_n_fields(tuple1) > 0) {
-
+
btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr);
@@ -2707,7 +2708,7 @@
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, &mtr);
}
-
+
mtr_commit(&mtr);
mtr_start(&mtr);
@@ -2715,7 +2716,7 @@
cursor.path_arr = path2;
if (dtuple_get_n_fields(tuple2) > 0) {
-
+
btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr);
@@ -2724,48 +2725,48 @@
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, &mtr);
}
-
+
mtr_commit(&mtr);
/* We have the path information for the range in path1 and path2 */
n_rows = 1;
- diverged = FALSE; /* This becomes true when the path is not
- the same any more */
- diverged_lot = FALSE; /* This becomes true when the paths are
- not the same or adjacent any more */
+ diverged = FALSE; /* This becomes true when the path is not
+ the same any more */
+ diverged_lot = FALSE; /* This becomes true when the paths are
+ not the same or adjacent any more */
divergence_level = 1000000; /* This is the level where paths diverged
- a lot */
- for (i = 0; ; i++) {
+ a lot */
+ for (i = 0; ; i++) {
ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
-
+
slot1 = path1 + i;
slot2 = path2 + i;
if (slot1->nth_rec == ULINT_UNDEFINED
|| slot2->nth_rec == ULINT_UNDEFINED) {
- if (i > divergence_level + 1) {
- /* In trees whose height is > 1 our algorithm
- tends to underestimate: multiply the estimate
- by 2: */
+ if (i > divergence_level + 1) {
+ /* In trees whose height is > 1 our algorithm
+ tends to underestimate: multiply the estimate
+ by 2: */
- n_rows = n_rows * 2;
- }
+ n_rows = n_rows * 2;
+ }
/* Do not estimate the number of rows in the range
- to over 1 / 2 of the estimated rows in the whole
+ to over 1 / 2 of the estimated rows in the whole
table */
if (n_rows > index->table->stat_n_rows / 2) {
- n_rows = index->table->stat_n_rows / 2;
+ n_rows = index->table->stat_n_rows / 2;
/* If there are just 0 or 1 rows in the table,
then we estimate all rows are in the range */
-
- if (n_rows == 0) {
- n_rows = index->table->stat_n_rows;
- }
+
+ if (n_rows == 0) {
+ n_rows = index->table->stat_n_rows;
+ }
}
return(n_rows);
@@ -2779,7 +2780,7 @@
n_rows = slot2->nth_rec - slot1->nth_rec;
if (n_rows > 1) {
- diverged_lot = TRUE;
+ diverged_lot = TRUE;
divergence_level = i;
}
} else {
@@ -2791,28 +2792,28 @@
} else if (diverged && !diverged_lot) {
- if (slot1->nth_rec < slot1->n_recs
- || slot2->nth_rec > 1) {
+ if (slot1->nth_rec < slot1->n_recs
+ || slot2->nth_rec > 1) {
- diverged_lot = TRUE;
+ diverged_lot = TRUE;
divergence_level = i;
n_rows = 0;
- if (slot1->nth_rec < slot1->n_recs) {
- n_rows += slot1->n_recs
- - slot1->nth_rec;
+ if (slot1->nth_rec < slot1->n_recs) {
+ n_rows += slot1->n_recs
+ - slot1->nth_rec;
}
if (slot2->nth_rec > 1) {
- n_rows += slot2->nth_rec - 1;
+ n_rows += slot2->nth_rec - 1;
}
- }
+ }
} else if (diverged_lot) {
n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
/ 2;
- }
+ }
}
}
@@ -2855,13 +2856,13 @@
memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong));
/* We sample some pages in the index to get an estimate */
-
+
for (i = 0; i < BTR_KEY_VAL_ESTIMATE_N_PAGES; i++) {
rec_t* supremum;
mtr_start(&mtr);
btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, &cursor, &mtr);
-
+
/* Count the number of different key values for each prefix of
the key on this index page. If the prefix does not determine
the index record uniquely in te B-tree, then we subtract one
@@ -2906,7 +2907,7 @@
total_external_size +=
btr_rec_get_externally_stored_len(
rec, offsets_rec);
-
+
rec = next_rec;
/* Initialize offsets_rec for the next round
and assign the old offsets_rec buffer to
@@ -2917,7 +2918,7 @@
offsets_next_rec = offsets_tmp;
}
}
-
+
if (n_cols == dict_index_get_n_unique_in_tree(index)) {
@@ -2931,7 +2932,7 @@
in the table. */
if (btr_page_get_prev(page, &mtr) != FIL_NULL
- || btr_page_get_next(page, &mtr) != FIL_NULL) {
+ || btr_page_get_next(page, &mtr) != FIL_NULL) {
n_diff[n_cols]++;
}
@@ -2948,10 +2949,10 @@
/* If we saw k borders between different key values on
BTR_KEY_VAL_ESTIMATE_N_PAGES leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */
-
+
/* We must take into account that our sample actually represents
also the pages used for external storage of fields (those pages are
- included in index->stat_n_leaf_pages) */
+ included in index->stat_n_leaf_pages) */
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] =
@@ -2960,9 +2961,9 @@
+ BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ total_external_size
+ not_empty_flag)
- / (BTR_KEY_VAL_ESTIMATE_N_PAGES
- + total_external_size);
-
+ / (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ + total_external_size);
+
/* If the tree is small, smaller than <
10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then
the above estimate is ok. For bigger trees it is common that we
@@ -2977,10 +2978,10 @@
if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) {
add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES;
}
-
+
index->stat_n_diff_key_vals[j] += add_on;
}
-
+
mem_free(n_diff);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -3016,7 +3017,7 @@
data = rec_get_nth_field(rec, offsets, i, &local_len);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
-
+
extern_len = mach_read_from_4(data + local_len
+ BTR_EXTERN_LEN + 4);
@@ -3045,7 +3046,7 @@
ulint byte_val;
data = rec_get_nth_field(rec, offsets, i, &local_len);
-
+
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
@@ -3057,7 +3058,7 @@
} else {
byte_val = byte_val | BTR_EXTERN_OWNER_FLAG;
}
-
+
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, byte_val,
MLOG_1BYTE, mtr);
}
@@ -3087,7 +3088,7 @@
for (i = 0; i < n; i++) {
if (rec_offs_nth_extern(offsets, i)) {
-
+
/* Check it is not in updated fields */
is_updated = FALSE;
@@ -3136,7 +3137,7 @@
return;
}
-
+
for (i = 0; i < n_ext_vec; i++) {
/* Check ext_vec[i] is in updated fields */
@@ -3154,14 +3155,14 @@
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
-
+
len -= BTR_EXTERN_FIELD_REF_SIZE;
byte_val = mach_read_from_1(data + len
+ BTR_EXTERN_LEN);
byte_val = byte_val | BTR_EXTERN_INHERITED_FLAG;
-
+
mach_write_to_1(data + len + BTR_EXTERN_LEN, byte_val);
}
}
@@ -3191,7 +3192,7 @@
btr_cur_set_ownership_of_extern_field(rec, offsets, i,
TRUE, mtr);
}
- }
+ }
}
/***********************************************************************
@@ -3216,15 +3217,15 @@
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
-
+
len -= BTR_EXTERN_FIELD_REF_SIZE;
byte_val = mach_read_from_1(data + len + BTR_EXTERN_LEN);
byte_val = byte_val & (~BTR_EXTERN_OWNER_FLAG);
-
+
mach_write_to_1(data + len + BTR_EXTERN_LEN, byte_val);
- }
+ }
}
/***********************************************************************
@@ -3251,7 +3252,7 @@
if (update) {
n = upd_get_n_fields(update);
-
+
for (i = 0; i < n; i++) {
if (upd_get_nth_field(update, i)->extern_storage) {
@@ -3268,7 +3269,7 @@
for (i = 0; i < n; i++) {
if (rec_offs_nth_extern(offsets, i)) {
-
+
/* Check it is not in updated fields */
is_updated = FALSE;
@@ -3287,7 +3288,7 @@
n_pushed++;
}
}
- }
+ }
return(n_pushed);
}
@@ -3333,8 +3334,8 @@
big_rec_t* big_rec_vec, /* in: vector containing fields
to be stored externally */
mtr_t* local_mtr __attribute__((unused))) /* in: mtr
- containing the latch to rec and to the
- tree */
+ containing the latch to rec and to the
+ tree */
{
byte* data;
ulint local_len;
@@ -3356,9 +3357,9 @@
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec),
MTR_MEMO_PAGE_X_FIX));
ut_a(index->type & DICT_CLUSTERED);
-
+
space_id = buf_frame_get_space_id(rec);
-
+
/* We have to create a file segment to the tablespace
for each field and put the pointer to the field in rec */
@@ -3382,7 +3383,7 @@
} else {
hint_page_no = prev_page_no + 1;
}
-
+
page = btr_page_alloc(index->tree, hint_page_no,
FSP_NO_DIR, 0, &mtr);
if (page == NULL) {
@@ -3392,6 +3393,9 @@
return(DB_OUT_OF_FILE_SPACE);
}
+ mlog_write_ulint(page + FIL_PAGE_TYPE,
+ FIL_PAGE_TYPE_BLOB, MLOG_2BYTES, &mtr);
+
page_no = buf_frame_get_page_no(page);
if (prev_page_no != FIL_NULL) {
@@ -3403,7 +3407,7 @@
buf_page_dbg_add_level(prev_page,
SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
-
+
mlog_write_ulint(prev_page + FIL_PAGE_DATA
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
page_no, MLOG_4BYTES, &mtr);
@@ -3431,7 +3435,7 @@
mlog_write_ulint(page + FIL_PAGE_DATA
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
FIL_NULL, MLOG_4BYTES, &mtr);
-
+
extern_len -= store_len;
rec_page = buf_page_get(space_id,
@@ -3457,7 +3461,7 @@
+ BTR_EXTERN_PAGE_NO,
page_no,
MLOG_4BYTES, &mtr);
-
+
mlog_write_ulint(data + local_len
+ BTR_EXTERN_OFFSET,
FIL_PAGE_DATA,
@@ -3504,9 +3508,9 @@
ibool do_not_free_inherited,/* in: TRUE if called in a
rollback and we do not want to free
inherited fields */
- mtr_t* local_mtr __attribute__((unused))) /* in: mtr
- containing the latch to data an an
- X-latch to the index tree */
+ mtr_t* local_mtr __attribute__((unused))) /* in: mtr
+ containing the latch to data an an
+ X-latch to the index tree */
{
page_t* page;
page_t* rec_page;
@@ -3525,7 +3529,7 @@
MTR_MEMO_PAGE_X_FIX));
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
-
+
for (;;) {
mtr_start(&mtr);
@@ -3574,7 +3578,7 @@
return;
}
-
+
page = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
@@ -3637,7 +3641,7 @@
MTR_MEMO_PAGE_X_FIX));
/* Free possible externally stored fields in the record */
- ut_ad(index->table->comp == !!rec_offs_comp(offsets));
+ ut_ad(dict_table_is_comp(index->table) == !!rec_offs_comp(offsets));
n_fields = rec_offs_n_fields(offsets);
for (i = 0; i < n_fields; i++) {
@@ -3684,7 +3688,7 @@
for (i = 0; i < n_fields; i++) {
ufield = upd_get_nth_field(update, i);
-
+
if (rec_offs_nth_extern(offsets, ufield->field_no)) {
data = rec_get_nth_field(rec, offsets,
@@ -3735,7 +3739,7 @@
/* Currently a BLOB cannot be bigger that 4 GB; we
leave the 4 upper bytes in the length field unused */
-
+
extern_len = mach_read_from_4(data + local_len + BTR_EXTERN_LEN + 4);
buf = mem_heap_alloc(heap, local_len + extern_len);
@@ -3745,11 +3749,11 @@
if (extern_len == 0) {
*len = copied_len;
-
+
return(buf);
}
- for (;;) {
+ for (;;) {
mtr_start(&mtr);
page = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
@@ -3777,7 +3781,7 @@
ut_a(copied_len == local_len + extern_len);
*len = copied_len;
-
+
return(buf);
}
--- 1.18/storage/innobase/btr/btr0pcur.c 2005-08-25 20:49:44 +04:00
+++ 1.19/storage/innobase/btr/btr0pcur.c 2006-03-10 19:22:02 +03:00
@@ -30,7 +30,7 @@
pcur->btr_cur.index = NULL;
btr_pcur_init(pcur);
-
+
return(pcur);
}
@@ -53,7 +53,7 @@
cursor->old_rec = NULL;
cursor->old_n_fields = 0;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
-
+
cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
@@ -79,7 +79,7 @@
dict_tree_t* tree;
page_t* page;
ulint offs;
-
+
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
@@ -92,9 +92,9 @@
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_S_FIX)
- || mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_S_FIX)
+ || mtr_memo_contains(mtr, buf_block_align(page),
+ MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
@@ -115,7 +115,7 @@
}
return;
- }
+ }
if (page_rec_is_supremum_low(offs)) {
@@ -138,7 +138,7 @@
&cursor->old_rec_buf,
&cursor->buf_size);
- cursor->block_when_stored = buf_block_align(page);
+ cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
}
@@ -158,17 +158,17 @@
mem_free(pcur_receive->old_rec_buf);
}
- ut_memcpy((byte*)pcur_receive, (byte*)pcur_donate, sizeof(btr_pcur_t));
+ ut_memcpy(pcur_receive, pcur_donate, sizeof(btr_pcur_t));
if (pcur_donate->old_rec_buf) {
pcur_receive->old_rec_buf = mem_alloc(pcur_donate->buf_size);
-
+
ut_memcpy(pcur_receive->old_rec_buf, pcur_donate->old_rec_buf,
pcur_donate->buf_size);
pcur_receive->old_rec = pcur_receive->old_rec_buf
+ (pcur_donate->old_rec - pcur_donate->old_rec_buf);
- }
+ }
pcur_receive->old_n_fields = pcur_donate->old_n_fields;
}
@@ -195,7 +195,7 @@
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 */
{
dict_tree_t* tree;
@@ -206,21 +206,21 @@
mem_heap_t* heap;
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
- || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
- && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
- ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t));
+ || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
+ && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
+ ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known, 0);
}
-
+
ut_error;
}
if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
- /* In these cases we do not try an optimistic restoration,
- but always do a search */
+ /* In these cases we do not try an optimistic restoration,
+ but always do a search */
btr_cur_open_at_index_side(
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
@@ -232,7 +232,7 @@
return(FALSE);
}
-
+
ut_a(cursor->old_rec);
ut_a(cursor->old_n_fields);
@@ -241,10 +241,10 @@
if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */
-
+
if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode,
- cursor->block_when_stored, page,
- cursor->modify_clock, mtr))) {
+ cursor->block_when_stored, page,
+ cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
@@ -285,14 +285,14 @@
/* If optimistic restoration did not succeed, open the cursor anew */
heap = mem_heap_create(256);
-
+
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
-
+
if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
mode = PAGE_CUR_LE;
} else if (cursor->rel_pos == BTR_PCUR_AFTER) {
@@ -304,13 +304,13 @@
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
mode, latch_mode, cursor, 0, mtr);
-
+
/* Restore the old search mode */
cursor->search_mode = old_mode;
if (cursor->rel_pos == BTR_PCUR_ON
- && btr_pcur_is_on_user_rec(cursor, mtr)
- && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
+ && btr_pcur_is_on_user_rec(cursor, mtr)
+ && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor),
btr_pcur_get_btr_cur(cursor)->index,
NULL, ULINT_UNDEFINED, &heap))) {
@@ -335,7 +335,7 @@
/* We have to store new position information, modify_clock etc.,
to the cursor because it can now be on a different page, the record
under it may have been removed, etc. */
-
+
btr_pcur_store_position(cursor, mtr);
return(FALSE);
@@ -358,12 +358,12 @@
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
-
+
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
-
+
btr_leaf_page_release(page, cursor->latch_mode, mtr);
-
- cursor->latch_mode = BTR_NO_LATCHES;
+
+ cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_WAS_POSITIONED;
}
@@ -386,25 +386,25 @@
page_t* page;
page_t* next_page;
- ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
+ ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
- ut_ad(btr_pcur_is_after_last_on_page(cursor, mtr));
+ ut_ad(btr_pcur_is_after_last_on_page(cursor, mtr));
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
-
+
page = btr_pcur_get_page(cursor);
next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page);
- ut_ad(next_page_no != FIL_NULL);
+ ut_ad(next_page_no != FIL_NULL);
next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr);
ut_a(page_is_comp(next_page) == page_is_comp(page));
buf_block_align(next_page)->check_index_page_at_flush = TRUE;
btr_leaf_page_release(page, cursor->latch_mode, mtr);
-
+
page_cur_set_before_first(next_page, btr_pcur_get_page_cur(cursor));
page_check_dir(next_page);
@@ -436,11 +436,11 @@
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
- ut_ad(btr_pcur_is_before_first_on_page(cursor, mtr));
- ut_ad(!btr_pcur_is_before_first_in_tree(cursor, mtr));
-
+ ut_ad(btr_pcur_is_before_first_on_page(cursor, mtr));
+ ut_ad(!btr_pcur_is_before_first_in_tree(cursor, mtr));
+
latch_mode = cursor->latch_mode;
-
+
if (latch_mode == BTR_SEARCH_LEAF) {
latch_mode2 = BTR_SEARCH_PREV;
@@ -459,7 +459,7 @@
mtr_start(mtr);
- btr_pcur_restore_position(latch_mode2, cursor, mtr);
+ btr_pcur_restore_position(latch_mode2, cursor, mtr);
page = btr_pcur_get_page(cursor);
@@ -467,7 +467,7 @@
space = buf_frame_get_space_id(page);
if (btr_pcur_is_before_first_on_page(cursor, mtr)
- && (prev_page_no != FIL_NULL)) {
+ && (prev_page_no != FIL_NULL)) {
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
@@ -476,11 +476,11 @@
page_cur_set_after_last(prev_page,
btr_pcur_get_page_cur(cursor));
} else if (prev_page_no != FIL_NULL) {
-
+
/* The repositioned cursor did not end on an infimum record on
a page. Cursor repositioning acquired a latch also on the
previous page, but we do not need the latch: release it. */
-
+
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(prev_page, latch_mode, mtr);
@@ -506,7 +506,7 @@
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
-
+
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
if (btr_pcur_is_before_first_on_page(cursor, mtr)) {
@@ -542,14 +542,14 @@
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 */
{
btr_pcur_open(index, tuple, mode, latch_mode, cursor, mtr);
if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {
-
+
if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
btr_pcur_move_to_next_user_rec(cursor, mtr);
--- 1.38/storage/innobase/btr/btr0sea.c 2006-02-08 13:58:49 +03:00
+++ 1.39/storage/innobase/btr/btr0sea.c 2006-03-10 19:22:02 +03:00
@@ -103,7 +103,7 @@
table = btr_search_sys->hash_index;
heap = table->heap;
-
+
/* Note that we peek the value of heap->free_block without reserving
the latch: this is ok, because we will not guarantee that there will
be enough free space in the hash table. */
@@ -133,9 +133,9 @@
{
/* We allocate the search latch from dynamic memory:
see above at the global variable definition */
-
+
btr_search_latch_temp = mem_alloc(sizeof(rw_lock_t));
-
+
rw_lock_create(&btr_search_latch);
btr_search_sys = mem_alloc(sizeof(btr_search_sys_t));
@@ -169,10 +169,10 @@
info->last_hash_succ = FALSE;
- info->n_hash_succ = 0;
- info->n_hash_fail = 0;
- info->n_patt_succ = 0;
- info->n_searches = 0;
+ info->n_hash_succ = 0;
+ info->n_hash_fail = 0;
+ info->n_patt_succ = 0;
+ info->n_searches = 0;
/* Set some sensible values */
info->n_fields = 1;
@@ -191,7 +191,7 @@
void
btr_search_info_update_hash(
/*========================*/
- 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 */
{
dict_index_t* index;
@@ -223,7 +223,7 @@
hash prefix */
if (info->n_fields >= n_unique && cursor->up_match >= n_unique) {
-
+
info->n_hash_potential++;
return;
@@ -244,20 +244,20 @@
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp > 0)
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
- goto set_new_recomm;
+ goto set_new_recomm;
}
info->n_hash_potential++;
return;
-
+
set_new_recomm:
/* We have to set a new recommendation; skip the hash analysis
for a while to avoid unnecessary CPU time usage when there is no
chance for success */
-
+
info->hash_analysis = 0;
-
+
cmp = ut_pair_cmp(cursor->up_match, cursor->up_bytes,
cursor->low_match, cursor->low_bytes);
if (cmp == 0) {
@@ -282,7 +282,7 @@
info->n_fields = cursor->low_match + 1;
info->n_bytes = 0;
- } else {
+ } else {
info->n_fields = cursor->low_match;
info->n_bytes = cursor->low_bytes + 1;
}
@@ -300,7 +300,7 @@
info->n_fields = cursor->up_match + 1;
info->n_bytes = 0;
- } else {
+ } else {
info->n_fields = cursor->up_match;
info->n_bytes = cursor->up_bytes + 1;
}
@@ -308,7 +308,7 @@
info->side = BTR_SEARCH_RIGHT_SIDE;
}
}
-
+
/*************************************************************************
Updates the block search info on hash successes. NOTE that info and
block->n_hash_helps, n_fields, n_bytes, side are NOT protected by any
@@ -337,19 +337,19 @@
ut_a(info->magic_n == BTR_SEARCH_MAGIC_N);
if ((block->n_hash_helps > 0)
- && (info->n_hash_potential > 0)
- && (block->n_fields == info->n_fields)
- && (block->n_bytes == info->n_bytes)
- && (block->side == info->side)) {
-
+ && (info->n_hash_potential > 0)
+ && (block->n_fields == info->n_fields)
+ && (block->n_bytes == info->n_bytes)
+ && (block->side == info->side)) {
+
if ((block->is_hashed)
- && (block->curr_n_fields == info->n_fields)
- && (block->curr_n_bytes == info->n_bytes)
- && (block->curr_side == info->side)) {
+ && (block->curr_n_fields == info->n_fields)
+ && (block->curr_n_bytes == info->n_bytes)
+ && (block->curr_side == info->side)) {
/* The search would presumably have succeeded using
the hash index */
-
+
info->last_hash_succ = TRUE;
}
@@ -366,19 +366,19 @@
}
if ((block->n_hash_helps > page_get_n_recs(block->frame)
- / BTR_SEARCH_PAGE_BUILD_LIMIT)
- && (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
+ / BTR_SEARCH_PAGE_BUILD_LIMIT)
+ && (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
- if ((!block->is_hashed)
- || (block->n_hash_helps
+ if ((!block->is_hashed)
+ || (block->n_hash_helps
> 2 * page_get_n_recs(block->frame))
- || (block->n_fields != block->curr_n_fields)
- || (block->n_bytes != block->curr_n_bytes)
- || (block->side != block->curr_side)) {
+ || (block->n_fields != block->curr_n_fields)
+ || (block->n_bytes != block->curr_n_bytes)
+ || (block->side != block->curr_side)) {
- /* Build a new hash index on the page */
+ /* Build a new hash index on the page */
- return(TRUE);
+ return(TRUE);
}
}
@@ -415,21 +415,21 @@
ut_a(!block->is_hashed || block->index == cursor->index);
if (block->is_hashed
- && (info->n_hash_potential > 0)
- && (block->curr_n_fields == info->n_fields)
- && (block->curr_n_bytes == info->n_bytes)
- && (block->curr_side == info->side)) {
+ && (info->n_hash_potential > 0)
+ && (block->curr_n_fields == info->n_fields)
+ && (block->curr_n_bytes == info->n_bytes)
+ && (block->curr_side == info->side)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- rec = btr_cur_get_rec(cursor);
+ rec = btr_cur_get_rec(cursor);
+
+ if (!page_rec_is_user_rec(rec)) {
- if (!page_rec_is_user_rec(rec)) {
+ return;
+ }
- return;
- }
-
tree_id = ((cursor->index)->tree)->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index,
offsets_, ULINT_UNDEFINED, &heap),
@@ -444,22 +444,22 @@
ha_insert_for_fold(btr_search_sys->hash_index, fold, rec);
}
-}
-
+}
+
/*************************************************************************
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 */
{
buf_block_t* block;
ibool build_index;
ulint* params;
ulint* params2;
-
+
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
@@ -480,7 +480,7 @@
btr_search_check_free_space_in_heap();
}
-
+
if (cursor->flag == BTR_CUR_HASH_FAIL) {
/* Update the hash node reference, if appropriate */
@@ -511,7 +511,7 @@
optimizations */
params2 = params + btr_search_this_is_zero;
-
+
btr_search_build_page_hash_index(cursor->index,
block->frame,
params2[0],
@@ -531,15 +531,15 @@
/*===================*/
/* out: TRUE if success */
btr_cur_t* cursor, /* in: guessed cursor position */
- ibool can_only_compare_to_cursor_rec,
- /* in: if we do not have a latch on the page
+ ibool can_only_compare_to_cursor_rec,
+ /* in: if we do not have a latch on the page
of cursor, but only a latch on
- btr_search_latch, then ONLY the columns
+ btr_search_latch, then ONLY the columns
of the record UNDER the cursor are
protected, not the next or previous record
in the chain: we cannot look at the next or
previous record to check our guess! */
- dtuple_t* tuple, /* in: data tuple */
+ dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */
mtr_t* mtr) /* in: mtr */
@@ -556,7 +556,7 @@
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
n_unique = dict_index_get_n_unique_in_tree(cursor->index);
-
+
rec = btr_cur_get_rec(cursor);
ut_ad(page_rec_is_user_rec(rec));
@@ -579,7 +579,7 @@
if (match >= n_unique) {
success = TRUE;
goto exit_func;
- }
+ }
} else if (mode == PAGE_CUR_LE) {
if (cmp == -1) {
goto exit_func;
@@ -598,8 +598,8 @@
}
if (can_only_compare_to_cursor_rec) {
- /* Since we could not determine if our guess is right just by
- looking at the record under the cursor, return FALSE */
+ /* Since we could not determine if our guess is right just by
+ looking at the record under the cursor, return FALSE */
goto exit_func;
}
@@ -610,7 +610,7 @@
rec_t* prev_rec;
ut_ad(!page_rec_is_infimum(rec));
-
+
prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) {
@@ -635,7 +635,7 @@
rec_t* next_rec;
ut_ad(!page_rec_is_supremum(rec));
-
+
next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) {
@@ -676,18 +676,18 @@
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, ...;
+ ulint latch_mode, /* in: BTR_SEARCH_LEAF, ...;
NOTE that only if has_search_latch
is 0, we will have a latch set on
the cursor page, otherwise we assume
the caller uses his search latch
to protect the record! */
- btr_cur_t* cursor, /* out: tree cursor */
+ 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 */
@@ -699,7 +699,7 @@
ulint fold;
ulint tuple_n_fields;
dulint tree_id;
- ibool can_only_compare_to_cursor_rec = TRUE;
+ ibool can_only_compare_to_cursor_rec = TRUE;
#ifdef notdefined
btr_cur_t cursor2;
btr_pcur_t pcur;
@@ -729,7 +729,7 @@
if (UNIV_UNLIKELY(tuple_n_fields == cursor->n_fields)
&& (cursor->n_bytes > 0)) {
- return(FALSE);
+ return(FALSE);
}
tree_id = (index->tree)->id;
@@ -741,7 +741,7 @@
cursor->fold = fold;
cursor->flag = BTR_CUR_HASH;
-
+
if (UNIV_LIKELY(!has_search_latch)) {
rw_lock_s_lock(&btr_search_latch);
}
@@ -778,7 +778,7 @@
if (UNIV_UNLIKELY(block->state == BUF_BLOCK_REMOVE_HASH)) {
if (UNIV_LIKELY(!has_search_latch)) {
-
+
btr_leaf_page_release(page, latch_mode, mtr);
}
@@ -798,29 +798,29 @@
record to determine if our guess for the cursor position is
right. */
if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0)
- || !btr_search_check_guess(cursor, can_only_compare_to_cursor_rec,
- tuple, mode, mtr)) {
+ || !btr_search_check_guess(cursor,
+ can_only_compare_to_cursor_rec, tuple, mode, mtr)) {
if (UNIV_LIKELY(!has_search_latch)) {
- btr_leaf_page_release(page, latch_mode, mtr);
+ btr_leaf_page_release(page, latch_mode, mtr);
}
goto failure;
}
if (UNIV_LIKELY(info->n_hash_potential < BTR_SEARCH_BUILD_LIMIT + 5)) {
-
+
info->n_hash_potential++;
}
#ifdef notdefined
/* These lines of code can be used in a debug version to check
the correctness of the searched cursor position: */
-
+
info->last_hash_succ = FALSE;
/* Currently, does not work if the following fails: */
ut_ad(!has_search_latch);
-
+
btr_leaf_page_release(page, latch_mode, mtr);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
@@ -831,7 +831,7 @@
/* If mode is PAGE_CUR_GE, then the binary search
in the index tree may actually take us to the supremum
of the previous page */
-
+
info->last_hash_succ = FALSE;
btr_pcur_open_on_user_rec(index, tuple, mode, latch_mode,
@@ -854,14 +854,14 @@
&& buf_block_peek_if_too_old(block)) {
buf_page_make_young(page);
- }
+ }
/* Increment the page get statistics though we did not really
fix the page: for user info only */
buf_pool->n_page_gets++;
- return(TRUE);
+ return(TRUE);
/*-------------------------------------------*/
failure_unlock:
@@ -889,7 +889,8 @@
void
btr_search_drop_page_hash_index(
/*============================*/
- page_t* page) /* in: index page, s- or x-latched */
+ page_t* page) /* in: index page, s- or x-latched, or an index page
+ for which we know that block->buf_fix_count == 0 */
{
hash_table_t* table;
buf_block_t* block;
@@ -904,18 +905,19 @@
ulint* folds;
ulint i;
mem_heap_t* heap;
+ dict_index_t* index;
ulint* offsets;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
-
+retry:
rw_lock_s_lock(&btr_search_latch);
block = buf_block_align(page);
- if (!block->is_hashed) {
+ if (UNIV_LIKELY(!block->is_hashed)) {
rw_lock_s_unlock(&btr_search_latch);
@@ -926,17 +928,22 @@
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
- || rw_lock_own(&(block->lock), RW_LOCK_EX)
- || (block->buf_fix_count == 0));
+ || rw_lock_own(&(block->lock), RW_LOCK_EX)
+ || (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
+ index = block->index;
- ut_a(n_fields + n_bytes > 0);
+ /* NOTE: The fields of block must not be accessed after
+ releasing btr_search_latch, as the index page might only
+ be s-latched! */
rw_lock_s_unlock(&btr_search_latch);
-
+
+ ut_a(n_fields + n_bytes > 0);
+
n_recs = page_get_n_recs(page);
/* Calculate and cache fold values into an array for fast deletion
@@ -949,33 +956,21 @@
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
- if (!page_rec_is_supremum(rec)) {
- ut_a(n_fields <= rec_get_n_fields(rec, block->index));
+ tree_id = btr_page_get_index_id(page);
- if (n_bytes > 0) {
- ut_a(n_fields < rec_get_n_fields(rec, block->index));
- }
- }
+ ut_a(0 == ut_dulint_cmp(tree_id, index->id));
- tree_id = btr_page_get_index_id(page);
-
prev_fold = 0;
heap = NULL;
offsets = NULL;
- if (block->index == NULL) {
-
- mem_analyze_corruption((byte*)block);
-
- ut_a(block->index != NULL);
- }
-
while (!page_rec_is_supremum(rec)) {
/* FIXME: in a mixed tree, not all records may have enough
ordering fields: */
- offsets = rec_get_offsets(rec, block->index,
- offsets, n_fields + (n_bytes > 0), &heap);
+ offsets = rec_get_offsets(rec, index, offsets,
+ n_fields + (n_bytes > 0), &heap);
+ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
if (fold == prev_fold && prev_fold != 0) {
@@ -999,6 +994,26 @@
rw_lock_x_lock(&btr_search_latch);
+ if (UNIV_UNLIKELY(!block->is_hashed)) {
+ /* Someone else has meanwhile dropped the hash index */
+
+ goto cleanup;
+ }
+
+ ut_a(block->index == index);
+
+ if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
+ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
+
+ /* Someone else has meanwhile built a new hash index on the
+ page, with different parameters */
+
+ rw_lock_x_unlock(&btr_search_latch);
+
+ mem_free(folds);
+ goto retry;
+ }
+
for (i = 0; i < n_cached; i++) {
ha_remove_all_nodes_to_page(table, folds[i], page);
@@ -1006,8 +1021,20 @@
block->is_hashed = FALSE;
block->index = NULL;
+cleanup:
+ if (UNIV_UNLIKELY(block->n_pointers)) {
+ /* Corruption */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: Corruption of adaptive hash index. After dropping\n"
+"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
+ index->name, (ulong) block->n_pointers);
+ rw_lock_x_unlock(&btr_search_latch);
- rw_lock_x_unlock(&btr_search_latch);
+ btr_search_validate();
+ } else {
+ rw_lock_x_unlock(&btr_search_latch);
+ }
mem_free(folds);
}
@@ -1032,14 +1059,14 @@
return;
}
-
+
mtr_start(&mtr);
/* We assume that if the caller has a latch on the page, then the
caller has already dropped the hash index for the page, and we never
get here. Therefore we can acquire the s-latch to the page without
having to fear a deadlock. */
-
+
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
@@ -1098,10 +1125,10 @@
#endif /* UNIV_SYNC_DEBUG */
rw_lock_s_lock(&btr_search_latch);
-
+
if (block->is_hashed && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_side != side))) {
+ || (block->curr_n_bytes != n_bytes)
+ || (block->curr_side != side))) {
rw_lock_s_unlock(&btr_search_latch);
@@ -1118,15 +1145,15 @@
}
/* Check that the values for hash index build are sensible */
-
+
if (n_fields + n_bytes == 0) {
return;
}
if (dict_index_get_n_unique_in_tree(index) < n_fields
- || (dict_index_get_n_unique_in_tree(index) == n_fields
- && n_bytes > 0)) {
+ || (dict_index_get_n_unique_in_tree(index) == n_fields
+ && n_bytes > 0)) {
return;
}
@@ -1164,20 +1191,20 @@
recs[n_cached] = rec;
n_cached++;
}
-
+
for (;;) {
next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) {
if (side == BTR_SEARCH_RIGHT_SIDE) {
-
+
folds[n_cached] = fold;
recs[n_cached] = rec;
n_cached++;
}
- break;
+ break;
}
offsets = rec_get_offsets(next_rec, index, offsets,
@@ -1209,21 +1236,21 @@
rw_lock_x_lock(&btr_search_latch);
if (block->is_hashed && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_side != side))) {
+ || (block->curr_n_bytes != n_bytes)
+ || (block->curr_side != side))) {
goto exit_func;
}
-
+
block->is_hashed = TRUE;
block->n_hash_helps = 0;
-
+
block->curr_n_fields = n_fields;
block->curr_n_bytes = n_bytes;
block->curr_side = side;
block->index = index;
for (i = 0; i < n_cached; i++) {
-
+
ha_insert_for_fold(table, folds[i], recs[i]);
}
@@ -1272,7 +1299,7 @@
ut_a(!block->is_hashed || block->index == index);
rw_lock_s_lock(&btr_search_latch);
-
+
if (new_block->is_hashed) {
rw_lock_s_unlock(&btr_search_latch);
@@ -1393,13 +1420,13 @@
rw_lock_x_lock(&btr_search_latch);
if ((cursor->flag == BTR_CUR_HASH)
- && (cursor->n_fields == block->curr_n_fields)
- && (cursor->n_bytes == block->curr_n_bytes)
- && (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
-
- table = btr_search_sys->hash_index;
-
- ha_search_and_update_if_found(table, cursor->fold, rec,
+ && (cursor->n_fields == block->curr_n_fields)
+ && (cursor->n_bytes == block->curr_n_bytes)
+ && (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
+
+ table = btr_search_sys->hash_index;
+
+ ha_search_and_update_if_found(table, cursor->fold, rec,
page_rec_get_next(rec));
rw_lock_x_unlock(&btr_search_latch);
@@ -1421,7 +1448,7 @@
and the new record has been inserted next
to the cursor */
{
- hash_table_t* table;
+ hash_table_t* table;
buf_block_t* block;
rec_t* rec;
rec_t* ins_rec;
@@ -1450,7 +1477,7 @@
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
-
+
if (!block->is_hashed) {
return;
@@ -1494,10 +1521,10 @@
goto check_next_rec;
}
-
- if (fold != ins_fold) {
- if (!locked) {
+ if (fold != ins_fold) {
+
+ if (!locked) {
rw_lock_x_lock(&btr_search_latch);
@@ -1516,22 +1543,22 @@
if (side == BTR_SEARCH_RIGHT_SIDE) {
- if (!locked) {
+ if (!locked) {
rw_lock_x_lock(&btr_search_latch);
locked = TRUE;
}
-
+
ha_insert_for_fold(table, ins_fold, ins_rec);
}
goto function_exit;
}
-
+
if (ins_fold != next_fold) {
- if (!locked) {
-
+ if (!locked) {
+
rw_lock_x_lock(&btr_search_latch);
locked = TRUE;
@@ -1548,8 +1575,8 @@
} else {
ha_insert_for_fold(table, next_fold, next_rec);
}
- }
-
+ }
+
function_exit:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -1573,14 +1600,29 @@
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint i;
+ ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
-
+
+ /* How many cells to check before temporarily releasing
+ btr_search_latch. */
+ ulint chunk_size = 10000;
+
rw_lock_x_lock(&btr_search_latch);
- for (i = 0; i < hash_get_n_cells(btr_search_sys->hash_index); i++) {
+ cell_count = hash_get_n_cells(btr_search_sys->hash_index);
+
+ for (i = 0; i < cell_count; i++) {
+ /* We release btr_search_latch every once in a while to
+ give other queries a chance to run. */
+ if ((i != 0) && ((i % chunk_size) == 0)) {
+ rw_lock_x_unlock(&btr_search_latch);
+ os_thread_yield();
+ rw_lock_x_lock(&btr_search_latch);
+ }
+
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
while (node != NULL) {
@@ -1592,11 +1634,11 @@
+ (block->curr_n_bytes > 0), &heap);
if (!block->is_hashed
- || node->fold != rec_fold((rec_t*)(node->data),
- offsets,
- block->curr_n_fields,
- block->curr_n_bytes,
- btr_page_get_index_id(page))) {
+ || node->fold != rec_fold((rec_t*)(node->data),
+ offsets,
+ block->curr_n_fields,
+ block->curr_n_bytes,
+ btr_page_get_index_id(page))) {
ok = FALSE;
ut_print_timestamp(stderr);
@@ -1610,9 +1652,9 @@
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
offsets,
- block->curr_n_fields,
- block->curr_n_bytes,
- btr_page_get_index_id(page)));
+ block->curr_n_fields,
+ block->curr_n_bytes,
+ btr_page_get_index_id(page)));
fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data,
@@ -1620,11 +1662,11 @@
fprintf(stderr, "\nInnoDB: on that page."
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n",
- page, (ulong) block->is_hashed,
- (ulong) block->curr_n_fields,
- (ulong) block->curr_n_bytes, (ulong) block->curr_side);
+ page, (ulong) block->is_hashed,
+ (ulong) block->curr_n_fields,
+ (ulong) block->curr_n_bytes, (ulong) block->curr_side);
- if (n_page_dumps < 20) {
+ if (n_page_dumps < 20) {
buf_page_print(page);
n_page_dumps++;
}
@@ -1633,10 +1675,21 @@
node = node->next;
}
}
-
- if (!ha_validate(btr_search_sys->hash_index)) {
- ok = FALSE;
+ for (i = 0; i < cell_count; i += chunk_size) {
+ ulint end_index = ut_min(i + chunk_size - 1, cell_count - 1);
+
+ /* We release btr_search_latch every once in a while to
+ give other queries a chance to run. */
+ if (i != 0) {
+ rw_lock_x_unlock(&btr_search_latch);
+ os_thread_yield();
+ rw_lock_x_lock(&btr_search_latch);
+ }
+
+ if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
+ ok = FALSE;
+ }
}
rw_lock_x_unlock(&btr_search_latch);
--- 1.50/storage/innobase/buf/buf0buf.c 2005-10-06 12:26:04 +04:00
+++ 1.51/storage/innobase/buf/buf0buf.c 2006-03-10 19:22:02 +03:00
@@ -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. */
@@ -42,7 +42,7 @@
IMPLEMENTATION OF THE BUFFER POOL
=================================
-Performance improvement:
+Performance improvement:
------------------------
Thread scheduling in NT may be so slow that the OS wait mechanism should
not be used even in waiting for disk reads to complete.
@@ -239,33 +239,33 @@
ulint
buf_calc_page_new_checksum(
/*=======================*/
- /* out: checksum */
- byte* page) /* in: buffer page */
+ /* out: checksum */
+ byte* page) /* in: buffer page */
{
- ulint checksum;
+ ulint checksum;
- /* Since the field FIL_PAGE_FILE_FLUSH_LSN, and in versions <= 4.1.x
- ..._ARCH_LOG_NO, are written outside the buffer pool to the first
- pages of data files, we have to skip them in the page checksum
- calculation.
+ /* Since the field FIL_PAGE_FILE_FLUSH_LSN, and in versions <= 4.1.x
+ ..._ARCH_LOG_NO, are written outside the buffer pool to the first
+ pages of data files, we have to skip them in the page checksum
+ calculation.
We must also skip the field FIL_PAGE_SPACE_OR_CHKSUM where the
checksum is stored, and also the last 8 bytes of page because
there we store the old formula checksum. */
-
- checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
+
+ checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
- + ut_fold_binary(page + FIL_PAGE_DATA,
- UNIV_PAGE_SIZE - FIL_PAGE_DATA
- - FIL_PAGE_END_LSN_OLD_CHKSUM);
- checksum = checksum & 0xFFFFFFFFUL;
+ + ut_fold_binary(page + FIL_PAGE_DATA,
+ UNIV_PAGE_SIZE - FIL_PAGE_DATA
+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
+ checksum = checksum & 0xFFFFFFFFUL;
- return(checksum);
+ return(checksum);
}
/************************************************************************
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! */
@@ -273,16 +273,16 @@
ulint
buf_calc_page_old_checksum(
/*=======================*/
- /* out: checksum */
- byte* page) /* in: buffer page */
+ /* out: checksum */
+ byte* page) /* in: buffer page */
{
- ulint checksum;
-
- checksum = ut_fold_binary(page, FIL_PAGE_FILE_FLUSH_LSN);
+ ulint checksum;
+
+ checksum = ut_fold_binary(page, FIL_PAGE_FILE_FLUSH_LSN);
- checksum = checksum & 0xFFFFFFFFUL;
+ checksum = checksum & 0xFFFFFFFFUL;
- return(checksum);
+ return(checksum);
}
/************************************************************************
@@ -302,11 +302,11 @@
dulint current_lsn;
#endif
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
- != mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ != mach_read_from_4(read_buf + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
/* Stored log sequence numbers at the start and the end
- of page do not match */
+ of page do not match */
return(TRUE);
}
@@ -314,8 +314,8 @@
#ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on && log_peek_lsn(¤t_lsn)) {
if (ut_dulint_cmp(current_lsn,
- mach_read_from_8(read_buf + FIL_PAGE_LSN))
- < 0) {
+ mach_read_from_8(read_buf + FIL_PAGE_LSN))
+ < 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -324,53 +324,58 @@
"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB log files. See\n"
"http://dev.mysql.com/doc/mysql/en/backing-up.html for more information.\n",
- (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
- (ulong) ut_dulint_get_high(
- mach_read_from_8(read_buf + FIL_PAGE_LSN)),
- (ulong) ut_dulint_get_low(
- mach_read_from_8(read_buf + FIL_PAGE_LSN)),
- (ulong) ut_dulint_get_high(current_lsn),
- (ulong) ut_dulint_get_low(current_lsn));
+ (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
+ (ulong) ut_dulint_get_high(
+ mach_read_from_8(read_buf + FIL_PAGE_LSN)),
+ (ulong) ut_dulint_get_low(
+ mach_read_from_8(read_buf + FIL_PAGE_LSN)),
+ (ulong) ut_dulint_get_high(current_lsn),
+ (ulong) ut_dulint_get_low(current_lsn));
}
}
#endif
-
- /* If we use checksums validation, make additional check before returning
- TRUE to ensure that the checksum is not equal to BUF_NO_CHECKSUM_MAGIC which
- might be stored by InnoDB with checksums disabled.
- Otherwise, skip checksum calculation and return FALSE */
-
- if (srv_use_checksums) {
- old_checksum = buf_calc_page_old_checksum(read_buf);
-
- old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM);
-
- /* There are 2 valid formulas for old_checksum_field:
- 1. Very old versions of InnoDB only stored 8 byte lsn to the start
- and the end of the page.
- 2. Newer InnoDB versions store the old formula checksum there. */
-
- if (old_checksum_field != mach_read_from_4(read_buf + FIL_PAGE_LSN)
- && old_checksum_field != old_checksum
- && old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
-
- return(TRUE);
- }
-
- checksum = buf_calc_page_new_checksum(read_buf);
- checksum_field = mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM);
-
- /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
- (always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
-
- if (checksum_field != 0 && checksum_field != checksum
- && checksum_field != BUF_NO_CHECKSUM_MAGIC) {
-
- return(TRUE);
- }
- }
-
+
+ /* If we use checksums validation, make additional check before
+ returning TRUE to ensure that the checksum is not equal to
+ BUF_NO_CHECKSUM_MAGIC which might be stored by InnoDB with checksums
+ disabled. Otherwise, skip checksum calculation and return FALSE */
+
+ if (srv_use_checksums) {
+ old_checksum = buf_calc_page_old_checksum(read_buf);
+
+ old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
+
+ /* There are 2 valid formulas for old_checksum_field:
+
+ 1. Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page.
+
+ 2. Newer InnoDB versions store the old formula checksum
+ there. */
+
+ if (old_checksum_field != mach_read_from_4(read_buf
+ + FIL_PAGE_LSN)
+ && old_checksum_field != old_checksum
+ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
+
+ return(TRUE);
+ }
+
+ checksum = buf_calc_page_new_checksum(read_buf);
+ checksum_field = mach_read_from_4(read_buf +
+ FIL_PAGE_SPACE_OR_CHKSUM);
+
+ /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
+ (always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
+
+ if (checksum_field != 0 && checksum_field != checksum
+ && checksum_field != BUF_NO_CHECKSUM_MAGIC) {
+
+ return(TRUE);
+ }
+ }
+
return(FALSE);
}
@@ -393,12 +398,12 @@
fputs("InnoDB: End of page dump\n", stderr);
checksum = srv_use_checksums ?
- buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
+ buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
old_checksum = srv_use_checksums ?
- buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
+ buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
ut_print_timestamp(stderr);
- fprintf(stderr,
+ fprintf(stderr,
" InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n",
(ulong) checksum, (ulong) old_checksum,
@@ -417,18 +422,19 @@
(ulong) mach_read_from_4(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_INSERT) {
- fprintf(stderr,
+ == TRX_UNDO_INSERT) {
+ fprintf(stderr,
"InnoDB: Page may be an insert undo log page\n");
} else if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_UPDATE) {
- fprintf(stderr,
+ == TRX_UNDO_UPDATE) {
+ fprintf(stderr,
"InnoDB: Page may be an update undo log page\n");
}
- if (fil_page_get_type(read_buf) == FIL_PAGE_INDEX) {
- fprintf(stderr,
+ switch (fil_page_get_type(read_buf)) {
+ case FIL_PAGE_INDEX:
+ fprintf(stderr,
"InnoDB: Page may be an index page where index id is %lu %lu\n",
(ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)),
(ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf)));
@@ -438,19 +444,50 @@
if (dict_sys != NULL) {
- index = dict_index_find_on_id_low(
+ index = dict_index_find_on_id_low(
btr_page_get_index_id(read_buf));
- if (index) {
+ if (index) {
fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index);
fputs(")\n", stderr);
}
}
- } else if (fil_page_get_type(read_buf) == FIL_PAGE_INODE) {
+ break;
+ case FIL_PAGE_INODE:
fputs("InnoDB: Page may be an 'inode' page\n", stderr);
- } else if (fil_page_get_type(read_buf) == FIL_PAGE_IBUF_FREE_LIST) {
+ break;
+ case FIL_PAGE_IBUF_FREE_LIST:
fputs("InnoDB: Page may be an insert buffer free list page\n",
stderr);
+ break;
+ case FIL_PAGE_TYPE_ALLOCATED:
+ fputs("InnoDB: Page may be a freshly allocated page\n",
+ stderr);
+ break;
+ case FIL_PAGE_IBUF_BITMAP:
+ fputs("InnoDB: Page may be an insert buffer bitmap page\n",
+ stderr);
+ break;
+ case FIL_PAGE_TYPE_SYS:
+ fputs("InnoDB: Page may be a system page\n",
+ stderr);
+ break;
+ case FIL_PAGE_TYPE_TRX_SYS:
+ fputs("InnoDB: Page may be a transaction system page\n",
+ stderr);
+ break;
+ case FIL_PAGE_TYPE_FSP_HDR:
+ fputs("InnoDB: Page may be a file space header page\n",
+ stderr);
+ break;
+ case FIL_PAGE_TYPE_XDES:
+ fputs("InnoDB: Page may be an extent descriptor page\n",
+ stderr);
+ break;
+ case FIL_PAGE_TYPE_BLOB:
+ fputs("InnoDB: Page may be a BLOB page\n",
+ stderr);
+ break;
}
}
@@ -464,14 +501,19 @@
byte* frame) /* in: pointer to buffer frame, or NULL if in
the case of AWE there is no frame */
{
+ block->magic_n = 0;
+
block->state = BUF_BLOCK_NOT_USED;
-
+
block->frame = frame;
block->awe_info = NULL;
+ block->buf_fix_count = 0;
+ block->io_fix = 0;
+
block->modify_clock = ut_dulint_zero;
-
+
block->file_page_was_freed = FALSE;
block->check_index_page_at_flush = FALSE;
@@ -513,12 +555,12 @@
byte* frame;
ulint i;
buf_block_t* block;
-
+
ut_a(max_size == curr_size);
ut_a(srv_use_awe || n_frames == max_size);
-
+
if (n_frames > curr_size) {
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n"
"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n"
"InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames);
@@ -542,18 +584,18 @@
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
UNIV_PAGE_SIZE * (n_frames + 1));
-
+
/* Allocate the physical memory for AWE and the AWE info array
for buf_pool */
if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) {
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n"
-"InnoDB: Trying to allocate %lu database pages.\n",
+"InnoDB: Trying to allocate %lu database pages.\n",
(ulong) curr_size);
- return(NULL);
+ return(NULL);
}
if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
@@ -605,7 +647,7 @@
}
buf_pool->blocks_of_frames = ut_malloc(sizeof(void*) * n_frames);
-
+
if (buf_pool->blocks_of_frames == NULL) {
return(NULL);
@@ -626,7 +668,7 @@
} else {
frame = NULL;
}
-
+
buf_block_init(block, frame);
if (srv_use_awe) {
@@ -647,14 +689,14 @@
buf_pool->n_pages_written = 0;
buf_pool->n_pages_created = 0;
buf_pool->n_pages_awe_remapped = 0;
-
+
buf_pool->n_page_gets = 0;
buf_pool->n_page_gets_old = 0;
buf_pool->n_pages_read_old = 0;
buf_pool->n_pages_written_old = 0;
buf_pool->n_pages_created_old = 0;
buf_pool->n_pages_awe_remapped_old = 0;
-
+
/* 2. Initialize flushing fields
---------------------------- */
UT_LIST_INIT(buf_pool->flush_list);
@@ -669,7 +711,7 @@
buf_pool->ulint_clock = 1;
buf_pool->freed_page_clock = 0;
-
+
/* 3. Initialize LRU fields
---------------------------- */
UT_LIST_INIT(buf_pool->LRU);
@@ -695,7 +737,7 @@
if (srv_use_awe) {
/* Add to the list of blocks mapped to
frames */
-
+
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
}
@@ -708,15 +750,15 @@
mutex_exit(&(buf_pool->mutex));
if (srv_use_adaptive_hash_indexes) {
- btr_search_sys_create(
+ btr_search_sys_create(
curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64);
} else {
- /* Create only a small dummy system */
- btr_search_sys_create(1000);
+ /* Create only a small dummy system */
+ btr_search_sys_create(1000);
}
return(buf_pool);
-}
+}
/************************************************************************
Maps the page of block to a frame, if not mapped yet. Unmaps some page
@@ -749,9 +791,9 @@
bck = UT_LIST_GET_LAST(buf_pool->awe_LRU_free_mapped);
- while (bck) {
+ while (bck) {
if (bck->state == BUF_BLOCK_FILE_PAGE
- && (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
+ && (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
/* We have to skip this */
bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck);
@@ -770,7 +812,7 @@
- buf_pool->frame_zero))
>> UNIV_PAGE_SIZE_SHIFT))
= block;
-
+
bck->frame = NULL;
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
@@ -783,7 +825,7 @@
}
buf_pool->n_pages_awe_remapped++;
-
+
return;
}
}
@@ -822,7 +864,7 @@
/*=================*/
buf_block_t* block) /* in: block to make younger */
{
- if (buf_pool->freed_page_clock >= block->freed_page_clock
+ if (buf_pool->freed_page_clock >= block->freed_page_clock
+ 1 + (buf_pool->curr_size / 1024)) {
/* There has been freeing activity in the LRU list:
@@ -839,11 +881,11 @@
void
buf_page_make_young(
-/*=================*/
+/*================*/
buf_frame_t* frame) /* in: buffer frame of a file page */
{
buf_block_t* block;
-
+
mutex_enter(&(buf_pool->mutex));
block = buf_block_align(frame);
@@ -893,7 +935,7 @@
{
buf_block_free(buf_block_align(frame));
}
-
+
/************************************************************************
Returns the buffer control block if the page can be found in the buffer
pool. NOTE that it is possible that the page is not yet read
@@ -938,7 +980,7 @@
if (block) {
block->check_index_page_at_flush = FALSE;
}
-
+
mutex_exit(&(buf_pool->mutex));
}
@@ -1074,14 +1116,14 @@
ulint fix_type;
ibool success;
ibool must_read;
-
+
ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH)
- || (rw_latch == RW_X_LATCH)
- || (rw_latch == RW_NO_LATCH));
+ || (rw_latch == RW_X_LATCH)
+ || (rw_latch == RW_NO_LATCH));
ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
- || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
+ || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, offset));
#endif
@@ -1090,7 +1132,7 @@
mutex_enter_fast(&(buf_pool->mutex));
block = NULL;
-
+
if (guess) {
block = buf_block_align(guess);
@@ -1130,7 +1172,7 @@
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
must_read = FALSE;
-
+
if (block->io_fix == BUF_IO_READ) {
must_read = TRUE;
@@ -1142,7 +1184,7 @@
return(NULL);
}
- }
+ }
/* If AWE is enabled and the page is not mapped to a frame, then
map it */
@@ -1153,10 +1195,10 @@
/* We set second parameter TRUE because the block is in the
LRU list and we must put it to awe_LRU_free_mapped list once
mapped to a frame */
-
+
buf_awe_map_page_to_frame(block, TRUE);
}
-
+
#ifdef UNIV_SYNC_DEBUG
buf_block_buf_fix_inc_debug(block, file, line);
#else
@@ -1172,7 +1214,7 @@
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->file_page_was_freed == FALSE);
-#endif
+#endif
mutex_exit(&(buf_pool->mutex));
#ifdef UNIV_DEBUG
@@ -1203,7 +1245,7 @@
block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch));
-#endif
+#endif
mutex_exit(&(buf_pool->mutex));
return(NULL);
@@ -1211,24 +1253,24 @@
} else if (rw_latch == RW_NO_LATCH) {
if (must_read) {
- /* Let us wait until the read operation
+ /* Let us wait until the read operation
completes */
- for (;;) {
- mutex_enter(&(buf_pool->mutex));
+ for (;;) {
+ mutex_enter(&(buf_pool->mutex));
+
+ if (block->io_fix == BUF_IO_READ) {
- if (block->io_fix == BUF_IO_READ) {
+ mutex_exit(&(buf_pool->mutex));
- mutex_exit(&(buf_pool->mutex));
-
- /* Sleep 20 milliseconds */
+ /* Sleep 20 milliseconds */
- os_thread_sleep(20000);
+ os_thread_sleep(20000);
} else {
-
- mutex_exit(&(buf_pool->mutex));
- break;
+ mutex_exit(&(buf_pool->mutex));
+
+ break;
}
}
}
@@ -1257,7 +1299,7 @@
#ifdef UNIV_IBUF_DEBUG
ut_a(ibuf_count_get(block->space, block->offset) == 0);
#endif
- return(block->frame);
+ return(block->frame);
}
/************************************************************************
@@ -1284,11 +1326,11 @@
ut_ad(mtr && block);
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
-
+
mutex_enter(&(buf_pool->mutex));
/* If AWE is used, block may have a different frame now, e.g., NULL */
-
+
if (UNIV_UNLIKELY(block->state != BUF_BLOCK_FILE_PAGE)
|| UNIV_UNLIKELY(block->frame != guess)) {
exit_func:
@@ -1326,7 +1368,7 @@
if (UNIV_UNLIKELY(!success)) {
mutex_enter(&(buf_pool->mutex));
-
+
block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch));
@@ -1345,7 +1387,7 @@
}
mutex_enter(&(buf_pool->mutex));
-
+
block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch));
@@ -1406,20 +1448,20 @@
ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
-
+
mutex_enter(&(buf_pool->mutex));
block = buf_block_align(guess);
if (block->state == BUF_BLOCK_REMOVE_HASH) {
- /* Another thread is just freeing the block from the LRU list
- of the buffer pool: do not try to access this page; this
+ /* Another thread is just freeing the block from the LRU list
+ of the buffer pool: do not try to access this page; this
attempt to access the page can only come through the hash
index because when the buffer block state is ..._REMOVE_HASH,
we have already removed it from the page address hash table
of the buffer pool. */
- mutex_exit(&(buf_pool->mutex));
+ mutex_exit(&(buf_pool->mutex));
return(FALSE);
}
@@ -1448,14 +1490,14 @@
file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
-
+
if (!success) {
mutex_enter(&(buf_pool->mutex));
-
+
block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch));
-#endif
+#endif
mutex_exit(&(buf_pool->mutex));
return(FALSE);
@@ -1499,27 +1541,27 @@
/* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N;
- block->state = BUF_BLOCK_FILE_PAGE;
- block->space = space;
- block->offset = offset;
+ block->state = BUF_BLOCK_FILE_PAGE;
+ block->space = space;
+ block->offset = offset;
block->lock_hash_val = 0;
block->lock_mutex = NULL;
-
+
block->freed_page_clock = 0;
block->newest_modification = ut_dulint_zero;
block->oldest_modification = ut_dulint_zero;
-
+
block->accessed = FALSE;
- block->buf_fix_count = 0;
+ block->buf_fix_count = 0;
block->io_fix = 0;
block->n_hash_helps = 0;
block->is_hashed = FALSE;
- block->n_fields = 1;
- block->n_bytes = 0;
- block->side = BTR_SEARCH_LEFT_SIDE;
+ block->n_fields = 1;
+ block->n_bytes = 0;
+ block->side = BTR_SEARCH_LEFT_SIDE;
block->file_page_was_freed = FALSE;
}
@@ -1543,31 +1585,31 @@
/* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N;
- block->state = BUF_BLOCK_FILE_PAGE;
- block->space = space;
- block->offset = offset;
+ block->state = BUF_BLOCK_FILE_PAGE;
+ block->space = space;
+ block->offset = offset;
block->check_index_page_at_flush = FALSE;
block->index = NULL;
-
+
block->lock_hash_val = lock_rec_hash(space, offset);
block->lock_mutex = NULL;
-
+
/* Insert into the hash table of file pages */
- if (buf_page_hash_get(space, offset)) {
- fprintf(stderr,
+ if (buf_page_hash_get(space, offset)) {
+ fprintf(stderr,
"InnoDB: Error: page %lu %lu already found from the hash table\n",
(ulong) space,
(ulong) offset);
#ifdef UNIV_DEBUG
- buf_print();
- buf_LRU_print();
- buf_validate();
- buf_LRU_validate();
+ buf_print();
+ buf_LRU_print();
+ buf_validate();
+ buf_LRU_validate();
#endif /* UNIV_DEBUG */
- ut_a(0);
- }
+ ut_a(0);
+ }
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(space, offset), block);
@@ -1576,16 +1618,16 @@
block->newest_modification = ut_dulint_zero;
block->oldest_modification = ut_dulint_zero;
-
+
block->accessed = FALSE;
- block->buf_fix_count = 0;
+ block->buf_fix_count = 0;
block->io_fix = 0;
block->n_hash_helps = 0;
block->is_hashed = FALSE;
- block->n_fields = 1;
- block->n_bytes = 0;
- block->side = BTR_SEARCH_LEFT_SIDE;
+ block->n_fields = 1;
+ block->n_bytes = 0;
+ block->side = BTR_SEARCH_LEFT_SIDE;
block->file_page_was_freed = FALSE;
}
@@ -1600,7 +1642,7 @@
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(
@@ -1626,9 +1668,9 @@
ut_ad(!ibuf_bitmap_page(offset));
ut_ad(ibuf_inside());
-
+
mtr_start(&mtr);
-
+
if (!ibuf_page_low(space, offset, &mtr)) {
mtr_commit(&mtr);
@@ -1638,7 +1680,7 @@
} else {
ut_ad(mode == BUF_READ_ANY_PAGE);
}
-
+
block = buf_block_alloc();
ut_a(block);
@@ -1651,7 +1693,7 @@
}
if (*err == DB_TABLESPACE_DELETED
- || NULL != buf_page_hash_get(space, offset)) {
+ || NULL != buf_page_hash_get(space, offset)) {
/* The page belongs to a space which has been deleted or is
being deleted, or the page is already in buf_pool, return */
@@ -1668,26 +1710,26 @@
}
ut_ad(block);
-
+
buf_page_init(space, offset, block);
/* The block must be put to the LRU list, to the old blocks */
- buf_LRU_add_block(block, TRUE); /* TRUE == to old blocks */
-
+ buf_LRU_add_block(block, TRUE); /* TRUE == to old blocks */
+
block->io_fix = BUF_IO_READ;
buf_pool->n_pend_reads++;
-
+
/* We set a pass-type x-lock on the frame because then the same
thread which called for the read operation (and is running now at
this point of code) can wait for the read to complete by waiting
for the x-lock on the frame; if the x-lock were recursive, the
same thread would illegally get the x-lock before the page read
is completed. The x-lock is cleared by the io-handler thread. */
-
+
rw_lock_x_lock_gen(&(block->lock), BUF_IO_READ);
-
- mutex_exit(&(buf_pool->mutex));
+
+ mutex_exit(&(buf_pool->mutex));
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
@@ -1695,7 +1737,7 @@
}
return(block);
-}
+}
/************************************************************************
Initializes a page to the buffer buf_pool. The page is usually not read
@@ -1715,11 +1757,11 @@
buf_frame_t* frame;
buf_block_t* block;
buf_block_t* free_block = NULL;
-
+
ut_ad(mtr);
free_block = buf_LRU_get_free_block();
-
+
mutex_enter(&(buf_pool->mutex));
block = buf_page_hash_get(space, offset);
@@ -1750,12 +1792,12 @@
#endif /* UNIV_DEBUG */
block = free_block;
-
+
buf_page_init(space, offset, block);
/* The block must be put to the LRU list */
buf_LRU_add_block(block, FALSE);
-
+
#ifdef UNIV_SYNC_DEBUG
buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
#else
@@ -1764,7 +1806,7 @@
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
block->accessed = TRUE;
-
+
buf_pool->n_pages_created++;
mutex_exit(&(buf_pool->mutex));
@@ -1779,6 +1821,10 @@
frame = block->frame;
+ memset(frame + FIL_PAGE_PREV, 0xff, 4);
+ memset(frame + FIL_PAGE_NEXT, 0xff, 4);
+ mach_write_to_2(frame + FIL_PAGE_TYPE, FIL_PAGE_TYPE_ALLOCATED);
+
/* Reset to zero the file flush lsn field in the page; if the first
page of an ibdata file is 'created' in this function into the buffer
pool then we lose the original contents of the file flush lsn stamp.
@@ -1811,7 +1857,7 @@
{
ulint io_type;
ulint read_page_no;
-
+
ut_ad(block);
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
@@ -1827,7 +1873,7 @@
+ FIL_PAGE_OFFSET);
if (read_page_no != 0
&& !trx_doublewrite_page_inside(read_page_no)
- && read_page_no != block->offset) {
+ && read_page_no != block->offset) {
fprintf(stderr,
"InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n",
@@ -1837,16 +1883,16 @@
to the 4 first bytes of the page end lsn field */
if (buf_page_is_corrupted(block->frame)) {
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
-
+
fputs(
"InnoDB: You may have to recover from a backup.\n", stderr);
buf_page_print(block->frame);
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
fputs(
@@ -1864,13 +1910,13 @@
"InnoDB: See also "
"http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
-
+
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs(
"InnoDB: Ending processing because of a corrupt database page.\n",
stderr);
- exit(1);
- }
+ exit(1);
+ }
}
if (recv_recovery_is_on()) {
@@ -1883,24 +1929,24 @@
block->space, block->offset, TRUE);
}
}
-
+
#ifdef UNIV_IBUF_DEBUG
ut_a(ibuf_count_get(block->space, block->offset) == 0);
#endif
mutex_enter(&(buf_pool->mutex));
-
+
/* Because this thread which does the unlocking is not the same that
did the locking, we use a pass value != 0 in unlock, which simply
removes the newest lock debug record, without checking the thread
id. */
block->io_fix = 0;
-
+
if (io_type == BUF_IO_READ) {
/* NOTE that the call to ibuf may have moved the ownership of
the x-latch to this OS thread: do not let this confuse you in
- debugging! */
-
+ debugging! */
+
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->n_pages_read++;
@@ -1930,7 +1976,7 @@
}
#endif /* UNIV_DEBUG */
}
-
+
mutex_exit(&(buf_pool->mutex));
#ifdef UNIV_DEBUG
@@ -1953,13 +1999,13 @@
ibool freed;
ut_ad(buf_all_freed());
-
+
freed = TRUE;
while (freed) {
freed = buf_LRU_search_and_free_block(100);
}
-
+
mutex_enter(&(buf_pool->mutex));
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
@@ -1984,7 +2030,7 @@
ulint n_flush = 0;
ulint n_free = 0;
ulint n_page = 0;
-
+
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
@@ -2001,8 +2047,8 @@
#ifdef UNIV_IBUF_DEBUG
ut_a((block->io_fix == BUF_IO_READ)
- || ibuf_count_get(block->space, block->offset)
- == 0);
+ || ibuf_count_get(block->space, block->offset)
+ == 0);
#endif
if (block->io_fix == BUF_IO_WRITE) {
@@ -2025,18 +2071,18 @@
ut_a(rw_lock_is_locked(&(block->lock),
RW_LOCK_EX));
}
-
+
n_lru++;
if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) {
n_flush++;
- }
-
+ }
+
} else if (block->state == BUF_BLOCK_NOT_USED) {
n_free++;
}
- }
+ }
if (n_lru + n_free > buf_pool->curr_size) {
fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free);
@@ -2054,14 +2100,14 @@
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
-
+
mutex_exit(&(buf_pool->mutex));
ut_a(buf_LRU_validate());
ut_a(buf_flush_validate());
return(TRUE);
-}
+}
/*************************************************************************
Prints info of the buffer buf_pool data structure. */
@@ -2077,9 +2123,9 @@
ulint j;
dulint id;
ulint n_found;
- buf_frame_t* frame;
+ buf_frame_t* frame;
dict_index_t* index;
-
+
ut_ad(buf_pool);
size = buf_pool->curr_size;
@@ -2088,7 +2134,7 @@
counts = mem_alloc(sizeof(ulint) * size);
mutex_enter(&(buf_pool->mutex));
-
+
fprintf(stderr,
"buf_pool size %lu\n"
"database pages %lu\n"
@@ -2109,7 +2155,7 @@
(ulong) buf_pool->n_pages_written);
/* Count the number of blocks belonging to each index in the buffer */
-
+
n_found = 0;
for (i = 0; i < size; i++) {
@@ -2147,8 +2193,8 @@
fprintf(stderr,
"Block count for index %lu in buffer is about %lu",
- (ulong) ut_dulint_get_low(index_ids[i]),
- (ulong) counts[i]);
+ (ulong) ut_dulint_get_low(index_ids[i]),
+ (ulong) counts[i]);
if (index) {
putc(' ', stderr);
@@ -2157,12 +2203,12 @@
putc('\n', stderr);
}
-
+
mem_free(index_ids);
mem_free(counts);
ut_a(buf_validate());
-}
+}
#endif /* UNIV_DEBUG */
/*************************************************************************
@@ -2171,23 +2217,23 @@
ulint
buf_get_latched_pages_number(void)
{
- buf_block_t* block;
- ulint i;
- ulint fixed_pages_number = 0;
+ buf_block_t* block;
+ ulint i;
+ ulint fixed_pages_number = 0;
- mutex_enter(&(buf_pool->mutex));
+ mutex_enter(&(buf_pool->mutex));
- for (i = 0; i < buf_pool->curr_size; i++) {
+ for (i = 0; i < buf_pool->curr_size; i++) {
- block = buf_pool_get_nth_block(buf_pool, i);
+ block = buf_pool_get_nth_block(buf_pool, i);
- if (((block->buf_fix_count != 0) || (block->io_fix != 0)) &&
- block->magic_n == BUF_BLOCK_MAGIC_N )
- fixed_pages_number++;
- }
+ if (((block->buf_fix_count != 0) || (block->io_fix != 0)) &&
+ block->magic_n == BUF_BLOCK_MAGIC_N )
+ fixed_pages_number++;
+ }
- mutex_exit(&(buf_pool->mutex));
- return fixed_pages_number;
+ mutex_exit(&(buf_pool->mutex));
+ return fixed_pages_number;
}
/*************************************************************************
@@ -2216,10 +2262,10 @@
mutex_enter(&(buf_pool->mutex));
ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
- / (1 + UT_LIST_GET_LEN(buf_pool->LRU)
- + UT_LIST_GET_LEN(buf_pool->free));
+ / (1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ + UT_LIST_GET_LEN(buf_pool->free));
- /* 1 + is there to avoid division by zero */
+ /* 1 + is there to avoid division by zero */
mutex_exit(&(buf_pool->mutex));
@@ -2237,17 +2283,17 @@
time_t current_time;
double time_elapsed;
ulint size;
-
+
ut_ad(buf_pool);
size = buf_pool->curr_size;
mutex_enter(&(buf_pool->mutex));
-
+
if (srv_use_awe) {
fprintf(stderr,
"AWE: Buffer pool memory frames %lu\n",
(ulong) buf_pool->n_frames);
-
+
fprintf(stderr,
"AWE: Database pages and free buffers mapped in frames %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
@@ -2294,13 +2340,12 @@
- buf_pool->n_pages_awe_remapped_old)
/ time_elapsed);
}
-
+
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
fprintf(file, "Buffer pool hit rate %lu / 1000\n",
- (ulong) (1000
- - ((1000 *
- (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
- / (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
+ (ulong) (1000 -
+ ((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
+ / (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
@@ -2322,12 +2367,12 @@
buf_refresh_io_stats(void)
/*======================*/
{
- buf_pool->last_printout_time = time(NULL);
+ buf_pool->last_printout_time = time(NULL);
buf_pool->n_page_gets_old = buf_pool->n_page_gets;
buf_pool->n_pages_read_old = buf_pool->n_pages_read;
buf_pool->n_pages_created_old = buf_pool->n_pages_created;
buf_pool->n_pages_written_old = buf_pool->n_pages_written;
- buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped;
+ buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped;
}
/*************************************************************************
@@ -2339,7 +2384,7 @@
{
buf_block_t* block;
ulint i;
-
+
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
@@ -2355,15 +2400,15 @@
fprintf(stderr,
"Page %lu %lu still fixed or dirty\n",
(ulong) block->space, (ulong) block->offset);
- ut_error;
+ ut_error;
}
}
- }
+ }
mutex_exit(&(buf_pool->mutex));
return(TRUE);
-}
+}
/*************************************************************************
Checks that there currently are no pending i/o-operations for the buffer
--- 1.31/storage/innobase/buf/buf0flu.c 2005-10-06 12:26:04 +04:00
+++ 1.32/storage/innobase/buf/buf0flu.c 2006-03-10 19:22:02 +03:00
@@ -30,7 +30,7 @@
flushed along with the original page. */
#define BUF_FLUSH_AREA ut_min(BUF_READ_AHEAD_AREA,\
- buf_pool->curr_size / 16)
+ buf_pool->curr_size / 16)
/**********************************************************************
Validates the flush list. */
@@ -55,10 +55,10 @@
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
- || (ut_dulint_cmp(
- (UT_LIST_GET_FIRST(buf_pool->flush_list))
- ->oldest_modification,
- block->oldest_modification) <= 0));
+ || (ut_dulint_cmp(
+ (UT_LIST_GET_FIRST(buf_pool->flush_list))
+ ->oldest_modification,
+ block->oldest_modification) <= 0));
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
@@ -77,7 +77,7 @@
{
buf_block_t* prev_b;
buf_block_t* b;
-
+
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@@ -120,18 +120,18 @@
fprintf(stderr,
" InnoDB: Error: buffer block state %lu in the LRU list!\n",
(ulong)block->state);
- ut_print_buf(stderr, (byte*)block, sizeof(buf_block_t));
+ ut_print_buf(stderr, block, sizeof(buf_block_t));
return(FALSE);
}
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
- || (block->buf_fix_count != 0)
- || (block->io_fix != 0)) {
+ || (block->buf_fix_count != 0)
+ || (block->io_fix != 0)) {
return(FALSE);
}
-
+
return(TRUE);
}
@@ -152,13 +152,13 @@
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
- && (block->io_fix == 0)) {
- if (flush_type != BUF_FLUSH_LRU) {
+ && (block->io_fix == 0)) {
+ if (flush_type != BUF_FLUSH_LRU) {
return(TRUE);
} else if (block->buf_fix_count == 0) {
-
+
/* If we are flushing the LRU list, to avoid deadlocks
we require the block not to be bufferfixed, and hence
not latched. */
@@ -166,7 +166,7 @@
return(TRUE);
}
}
-
+
return(FALSE);
}
@@ -205,7 +205,7 @@
buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
- && (buf_pool->init_flush[block->flush_type] == FALSE)) {
+ && (buf_pool->init_flush[block->flush_type] == FALSE)) {
/* The running flush batch has ended */
@@ -235,7 +235,7 @@
return;
}
-
+
mutex_enter(&(trx_doublewrite->mutex));
/* Write first to doublewrite buffer blocks. We use synchronous
@@ -252,17 +252,17 @@
for (i = 0; i < trx_doublewrite->first_free; i++) {
block = trx_doublewrite->buf_block_arr[i];
- ut_a(block->state == BUF_BLOCK_FILE_PAGE);
+ ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
- != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
"InnoDB: before posting to the doublewrite buffer.\n");
- }
+ }
if (block->check_index_page_at_flush
&& !page_simple_validate(block->frame)) {
@@ -281,27 +281,27 @@
}
}
- /* increment the doublewrite flushed pages counter */
- srv_dblwr_pages_written+= trx_doublewrite->first_free;
- srv_dblwr_writes++;
-
+ /* increment the doublewrite flushed pages counter */
+ srv_dblwr_pages_written+= trx_doublewrite->first_free;
+ srv_dblwr_writes++;
+
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
} else {
len = trx_doublewrite->first_free * UNIV_PAGE_SIZE;
}
-
+
fil_io(OS_FILE_WRITE,
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block1, 0, len,
- (void*)trx_doublewrite->write_buf, NULL);
-
+ (void*)trx_doublewrite->write_buf, NULL);
+
write_buf = trx_doublewrite->write_buf;
- for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
- if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
- != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
+ if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
@@ -312,23 +312,23 @@
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = (trx_doublewrite->first_free
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
-
+
fil_io(OS_FILE_WRITE,
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block2, 0, len,
- (void*)(trx_doublewrite->write_buf
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
+ (void*)(trx_doublewrite->write_buf
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
NULL);
write_buf = trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
len2 += UNIV_PAGE_SIZE) {
- if (mach_read_from_4(write_buf + len2
- + FIL_PAGE_LSN + 4)
- != mach_read_from_4(write_buf + len2
+ if (mach_read_from_4(write_buf + len2
+ + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(write_buf + len2
+ UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
@@ -349,32 +349,33 @@
block = trx_doublewrite->buf_block_arr[i];
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
- != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
"InnoDB: after posting and flushing the doublewrite buffer.\n"
"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
- (ulong)block->buf_fix_count, (ulong)block->io_fix,
- (ulong)block->state);
- }
+ (ulong)block->buf_fix_count,
+ (ulong)block->io_fix,
+ (ulong)block->state);
+ }
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
- (void*)block->frame, (void*)block);
+ (void*)block->frame, (void*)block);
}
-
+
/* Wake possible simulated aio thread to actually post the
writes to the operating system */
os_aio_simulated_wake_handler_threads();
/* Wait that all async writes to tablespaces have been posted to
- the OS */
-
+ the OS */
+
os_aio_wait_until_no_pending_writes();
/* Now we flush the data to disk (for example, with fsync) */
@@ -385,7 +386,7 @@
trx_doublewrite->first_free = 0;
- mutex_exit(&(trx_doublewrite->mutex));
+ mutex_exit(&(trx_doublewrite->mutex));
}
/************************************************************************
@@ -442,7 +443,7 @@
dulint newest_lsn, /* in: newest modification lsn to the page */
ulint space, /* in: space id */
ulint page_no) /* in: page number */
-{
+{
/* Write the newest modification lsn to the page header and trailer */
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
@@ -451,13 +452,13 @@
/* Write the page number and the space id */
mach_write_to_4(page + FIL_PAGE_OFFSET, page_no);
- mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space);
+ mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space);
/* Store the new formula checksum */
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums ?
- buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
+ buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
/* We overwrite the first 4 bytes of the end lsn field to store
the old formula checksum. Since it depends also on the field
@@ -466,7 +467,7 @@
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums ?
- buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
+ buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
}
/************************************************************************
@@ -500,13 +501,13 @@
#else
/* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
-#endif
+#endif
buf_flush_init_for_writing(block->frame, block->newest_modification,
block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
- (void*)block->frame, (void*)block);
+ (void*)block->frame, (void*)block);
} else {
buf_flush_post_to_doublewrite_buf(block);
}
@@ -529,7 +530,7 @@
{
buf_block_t* block;
ibool locked;
-
+
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
@@ -540,8 +541,8 @@
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (flush_type == BUF_FLUSH_LIST
- && block && buf_flush_ready_for_flush(block, flush_type)) {
-
+ && block && buf_flush_ready_for_flush(block, flush_type)) {
+
block->io_fix = BUF_IO_WRITE;
/* If AWE is enabled and the page is not mapped to a frame,
@@ -553,7 +554,7 @@
/* We set second parameter TRUE because the block is
in the LRU list and we must put it to
awe_LRU_free_mapped list once mapped to a frame */
-
+
buf_awe_map_page_to_frame(block, TRUE);
}
@@ -567,7 +568,7 @@
(buf_pool->n_flush[flush_type])++;
locked = FALSE;
-
+
/* If the simulated aio thread is not running, we must
not wait for any latch, as we may end up in a deadlock:
if buf_fix_count == 0, then we know we need not wait */
@@ -595,7 +596,7 @@
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block);
-
+
return(1);
} else if (flush_type == BUF_FLUSH_LRU && block
@@ -620,7 +621,7 @@
/* We set second parameter TRUE because the block is
in the LRU list and we must put it to
awe_LRU_free_mapped list once mapped to a frame */
-
+
buf_awe_map_page_to_frame(block, TRUE);
}
@@ -638,7 +639,7 @@
/* Note that the s-latch is acquired before releasing the
buf_pool mutex: this ensures that the latch is acquired
immediately. */
-
+
mutex_exit(&(buf_pool->mutex));
buf_flush_write_block_low(block);
@@ -647,7 +648,7 @@
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE && block
&& buf_flush_ready_for_flush(block, flush_type)) {
-
+
block->io_fix = BUF_IO_WRITE;
/* If AWE is enabled and the page is not mapped to a frame,
@@ -659,7 +660,7 @@
/* We set second parameter TRUE because the block is
in the LRU list and we must put it to
awe_LRU_free_mapped list once mapped to a frame */
-
+
buf_awe_map_page_to_frame(block, TRUE);
}
@@ -681,18 +682,18 @@
fprintf(stderr,
"Flushing single page space %lu, page no %lu \n",
(ulong) block->space,
- (ulong) block->offset);
+ (ulong) block->offset);
}
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block);
-
+
return(1);
} else {
mutex_exit(&(buf_pool->mutex));
return(0);
- }
+ }
}
/***************************************************************
@@ -719,13 +720,13 @@
if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
/* If there is little space, it is better not to flush any
block except from the end of the LRU list */
-
+
low = offset;
high = offset + 1;
}
/* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
-
+
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
}
@@ -738,12 +739,12 @@
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (block && flush_type == BUF_FLUSH_LRU && i != offset
- && !block->old) {
+ && !block->old) {
- /* We avoid flushing 'non-old' blocks in an LRU flush,
- because the flushed blocks are soon freed */
+ /* We avoid flushing 'non-old' blocks in an LRU flush,
+ because the flushed blocks are soon freed */
- continue;
+ continue;
}
if (block && buf_flush_ready_for_flush(block, flush_type)
@@ -767,7 +768,7 @@
mutex_enter(&(buf_pool->mutex));
}
}
-
+
mutex_exit(&(buf_pool->mutex));
return(count);
@@ -798,64 +799,64 @@
exceed min_n), otherwise ignored */
{
buf_block_t* block;
- ulint page_count = 0;
+ ulint page_count = 0;
ulint old_page_count;
ulint space;
ulint offset;
ibool found;
-
+
ut_ad((flush_type == BUF_FLUSH_LRU)
- || (flush_type == BUF_FLUSH_LIST));
+ || (flush_type == BUF_FLUSH_LIST));
ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE));
mutex_enter(&(buf_pool->mutex));
if ((buf_pool->n_flush[flush_type] > 0)
- || (buf_pool->init_flush[flush_type] == TRUE)) {
+ || (buf_pool->init_flush[flush_type] == TRUE)) {
/* There is already a flush batch of the same type running */
-
+
mutex_exit(&(buf_pool->mutex));
return(ULINT_UNDEFINED);
}
(buf_pool->init_flush)[flush_type] = TRUE;
-
+
for (;;) {
/* If we have flushed enough, leave the loop */
if (page_count >= min_n) {
break;
}
-
+
/* Start from the end of the list looking for a suitable
block to be flushed. */
-
- if (flush_type == BUF_FLUSH_LRU) {
+
+ if (flush_type == BUF_FLUSH_LRU) {
block = UT_LIST_GET_LAST(buf_pool->LRU);
- } else {
+ } else {
ut_ad(flush_type == BUF_FLUSH_LIST);
block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (!block
- || (ut_dulint_cmp(block->oldest_modification,
- lsn_limit) >= 0)) {
+ || (ut_dulint_cmp(block->oldest_modification,
+ lsn_limit) >= 0)) {
/* We have flushed enough */
break;
}
- }
-
- found = FALSE;
-
+ }
+
+ found = FALSE;
+
/* Note that after finding a single flushable page, we try to
flush also all its neighbors, and after that start from the
END of the LRU list or flush list again: the list may change
during the flushing and we cannot safely preserve within this
function a pointer to a block in the list! */
- while ((block != NULL) && !found) {
+ while ((block != NULL) && !found) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (buf_flush_ready_for_flush(block, flush_type)) {
@@ -863,11 +864,11 @@
found = TRUE;
space = block->space;
offset = block->offset;
-
+
mutex_exit(&(buf_pool->mutex));
old_page_count = page_count;
-
+
/* Try to flush also all the neighbors */
page_count +=
buf_flush_try_neighbors(space, offset,
@@ -887,19 +888,19 @@
block = UT_LIST_GET_PREV(flush_list, block);
}
- }
+ }
- /* If we could not find anything to flush, leave the loop */
+ /* If we could not find anything to flush, leave the loop */
- if (!found) {
- break;
- }
+ if (!found) {
+ break;
+ }
}
(buf_pool->init_flush)[flush_type] = FALSE;
if ((buf_pool->n_flush[flush_type] == 0)
- && (buf_pool->init_flush[flush_type] == FALSE)) {
+ && (buf_pool->init_flush[flush_type] == FALSE)) {
/* The running flush batch has ended */
@@ -920,9 +921,9 @@
(ulong) page_count);
}
#endif /* UNIV_DEBUG */
-
- if (page_count != ULINT_UNDEFINED)
- srv_buf_pool_flushed+= page_count;
+
+ if (page_count != ULINT_UNDEFINED)
+ srv_buf_pool_flushed+= page_count;
return(page_count);
}
@@ -936,9 +937,9 @@
ulint type) /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
ut_ad((type == BUF_FLUSH_LRU) || (type == BUF_FLUSH_LIST));
-
+
os_event_wait(buf_pool->no_flush[type]);
-}
+}
/**********************************************************************
Gives a recommendation of how many blocks should be flushed to establish
@@ -954,7 +955,7 @@
buf_block_t* block;
ulint n_replaceable;
ulint distance = 0;
-
+
mutex_enter(&(buf_pool->mutex));
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
@@ -962,26 +963,26 @@
block = UT_LIST_GET_LAST(buf_pool->LRU);
while ((block != NULL)
- && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
- + BUF_FLUSH_EXTRA_MARGIN)
- && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
+ && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
+ + BUF_FLUSH_EXTRA_MARGIN)
+ && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
if (buf_flush_ready_for_replace(block)) {
n_replaceable++;
}
distance++;
-
+
block = UT_LIST_GET_PREV(LRU, block);
}
-
+
mutex_exit(&(buf_pool->mutex));
if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
return(0);
}
-
+
return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN
- n_replaceable);
}
@@ -991,7 +992,7 @@
of replaceable pages there or in the free list. VERY IMPORTANT: this function
is called also by threads which have locks on pages. To avoid deadlocks, we
flush only pages such that the s-lock required for flushing can be acquired
-immediately, without waiting. */
+immediately, without waiting. */
void
buf_flush_free_margin(void)
@@ -1001,15 +1002,15 @@
ulint n_flushed;
n_to_flush = buf_flush_LRU_recommendation();
-
+
if (n_to_flush > 0) {
n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
ut_dulint_zero);
if (n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running;
let us wait for it to end */
-
- buf_flush_wait_batch_end(BUF_FLUSH_LRU);
+
+ buf_flush_wait_batch_end(BUF_FLUSH_LRU);
}
}
}
@@ -1024,7 +1025,7 @@
{
buf_block_t* block;
dulint om;
-
+
UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list);
block = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -1033,7 +1034,7 @@
om = block->oldest_modification;
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(ut_dulint_cmp(om, ut_dulint_zero) > 0);
-
+
block = UT_LIST_GET_NEXT(flush_list, block);
if (block) {
@@ -1054,11 +1055,11 @@
/* out: TRUE if ok */
{
ibool ret;
-
+
mutex_enter(&(buf_pool->mutex));
ret = buf_flush_validate_low();
-
+
mutex_exit(&(buf_pool->mutex));
return(ret);
--- 1.26/storage/innobase/buf/buf0lru.c 2005-06-21 10:49:15 +04:00
+++ 1.27/storage/innobase/buf/buf0lru.c 2006-03-10 19:22:02 +03:00
@@ -80,21 +80,21 @@
scan_again:
mutex_enter(&(buf_pool->mutex));
-
+
all_freed = TRUE;
-
+
block = UT_LIST_GET_LAST(buf_pool->LRU);
while (block != NULL) {
- ut_a(block->state == BUF_BLOCK_FILE_PAGE);
+ ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (block->space == id
- && (block->buf_fix_count > 0 || block->io_fix != 0)) {
+ && (block->buf_fix_count > 0 || block->io_fix != 0)) {
/* We cannot remove this page during this scan yet;
maybe the system is currently reading it in, or
flushing the modifications to the file */
-
+
all_freed = FALSE;
goto next_page;
@@ -106,12 +106,12 @@
printf(
"Dropping space %lu page %lu\n",
(ulong) block->space,
- (ulong) block->offset);
+ (ulong) block->offset);
}
#endif
if (block->is_hashed) {
page_no = block->offset;
-
+
mutex_exit(&(buf_pool->mutex));
/* Note that the following call will acquire
@@ -129,7 +129,7 @@
blocks */
block->oldest_modification = ut_dulint_zero;
- UT_LIST_REMOVE(flush_list,
+ UT_LIST_REMOVE(flush_list,
buf_pool->flush_list, block);
}
@@ -142,11 +142,11 @@
}
mutex_exit(&(buf_pool->mutex));
-
+
if (!all_freed) {
os_thread_sleep(20000);
- goto scan_again;
+ goto scan_again;
}
}
@@ -193,7 +193,7 @@
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
@@ -205,12 +205,12 @@
ibool freed;
mutex_enter(&(buf_pool->mutex));
-
+
freed = FALSE;
block = UT_LIST_GET_LAST(buf_pool->LRU);
while (block != NULL) {
- ut_a(block->in_LRU_list);
+ ut_a(block->in_LRU_list);
if (buf_flush_ready_for_replace(block)) {
#ifdef UNIV_DEBUG
@@ -218,7 +218,7 @@
fprintf(stderr,
"Putting space %lu page %lu to free list\n",
(ulong) block->space,
- (ulong) block->offset);
+ (ulong) block->offset);
}
#endif /* UNIV_DEBUG */
@@ -229,7 +229,7 @@
/* Remove possible adaptive hash index built on the
page; in the case of AWE the block may not have a
frame at all */
-
+
if (block->frame) {
btr_search_drop_page_hash_index(block->frame);
}
@@ -246,26 +246,26 @@
distance++;
if (!freed && n_iterations <= 10
- && distance > 100 + (n_iterations * buf_pool->curr_size)
- / 10) {
+ && distance > 100 + (n_iterations * buf_pool->curr_size)
+ / 10) {
buf_pool->LRU_flush_ended = 0;
mutex_exit(&(buf_pool->mutex));
-
+
return(FALSE);
}
}
if (buf_pool->LRU_flush_ended > 0) {
buf_pool->LRU_flush_ended--;
}
- if (!freed) {
+ if (!freed) {
buf_pool->LRU_flush_ended = 0;
}
mutex_exit(&(buf_pool->mutex));
-
+
return(freed);
}
-
+
/**********************************************************************
Tries to remove LRU flushed blocks from the end of the LRU list and put them
to the free list. This is beneficial for the efficiency of the insert buffer
@@ -286,12 +286,12 @@
mutex_exit(&(buf_pool->mutex));
buf_LRU_search_and_free_block(1);
-
+
mutex_enter(&(buf_pool->mutex));
}
mutex_exit(&(buf_pool->mutex));
-}
+}
/**********************************************************************
Returns TRUE if less than 15 % of the buffer pool is available. This can be
@@ -310,7 +310,7 @@
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 7) {
-
+
ret = TRUE;
}
@@ -334,16 +334,16 @@
buf_block_t* block = NULL;
ibool freed;
ulint n_iterations = 1;
- ibool mon_value_was = FALSE;
+ ibool mon_value_was = FALSE;
ibool started_monitor = FALSE;
loop:
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 10) {
- ut_print_timestamp(stderr);
+ ut_print_timestamp(stderr);
- fprintf(stderr,
+ fprintf(stderr,
" InnoDB: ERROR: over 9 / 10 of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
@@ -354,18 +354,18 @@
(ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
ut_error;
-
+
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 5) {
if (!buf_lru_switched_on_innodb_mon) {
- /* Over 80 % of the buffer pool is occupied by lock
+ /* Over 80 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory
leak! */
- ut_print_timestamp(stderr);
- fprintf(stderr,
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
" InnoDB: WARNING: over 4 / 5 of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
@@ -389,21 +389,21 @@
buf_lru_switched_on_innodb_mon = FALSE;
srv_print_innodb_monitor = FALSE;
}
-
+
/* If there is a block in the free list, take it */
if (UT_LIST_GET_LEN(buf_pool->free) > 0) {
-
+
block = UT_LIST_GET_FIRST(buf_pool->free);
ut_a(block->in_free_list);
UT_LIST_REMOVE(free, buf_pool->free, block);
block->in_free_list = FALSE;
ut_a(block->state != BUF_BLOCK_FILE_PAGE);
- ut_a(!block->in_LRU_list);
+ ut_a(!block->in_LRU_list);
if (srv_use_awe) {
if (block->frame) {
/* Remove from the list of mapped pages */
-
+
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
} else {
@@ -414,18 +414,18 @@
buf_awe_map_page_to_frame(block, FALSE);
}
}
-
+
block->state = BUF_BLOCK_READY_FOR_USE;
mutex_exit(&(buf_pool->mutex));
if (started_monitor) {
srv_print_innodb_monitor = mon_value_was;
- }
+ }
return(block);
}
-
+
/* If no block was in the free list, search from the end of the LRU
list and try to free a block there */
@@ -456,7 +456,7 @@
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes,
(ulong) os_n_file_reads, (ulong) os_n_file_writes,
- (ulong) os_n_fsyncs);
+ (ulong) os_n_fsyncs);
mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE;
@@ -467,7 +467,7 @@
/* No free block was found: try to flush the LRU list */
buf_flush_free_margin();
- ++srv_buf_pool_wait_free;
+ ++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
@@ -492,8 +492,8 @@
n_iterations++;
- goto loop;
-}
+ goto loop;
+}
/***********************************************************************
Moves the LRU_old pointer so that the length of the old blocks list
@@ -519,9 +519,9 @@
ut_a(buf_pool->LRU_old->in_LRU_list);
/* Update the LRU_old pointer if necessary */
-
+
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
-
+
buf_pool->LRU_old = UT_LIST_GET_PREV(LRU,
buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE;
@@ -561,16 +561,16 @@
while (block != NULL) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
- ut_a(block->in_LRU_list);
+ ut_a(block->in_LRU_list);
block->old = TRUE;
block = UT_LIST_GET_NEXT(LRU, block);
}
buf_pool->LRU_old = UT_LIST_GET_FIRST(buf_pool->LRU);
buf_pool->LRU_old_len = UT_LIST_GET_LEN(buf_pool->LRU);
-
+
buf_LRU_old_adjust_len();
-}
+}
/**********************************************************************
Removes a block from the LRU list. */
@@ -585,7 +585,7 @@
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
-
+
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->in_LRU_list);
@@ -611,10 +611,10 @@
if (srv_use_awe && block->frame) {
/* Remove from the list of mapped pages */
-
+
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
- }
+ }
/* If the LRU list is so short that LRU_old not defined, return */
if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
@@ -624,7 +624,7 @@
return;
}
- ut_ad(buf_pool->LRU_old);
+ ut_ad(buf_pool->LRU_old);
/* Update the LRU_old_len field if necessary */
if (block->old) {
@@ -634,7 +634,7 @@
/* Adjust the length of the old block list if necessary */
buf_LRU_old_adjust_len();
-}
+}
/**********************************************************************
Adds a block to the LRU list end. */
@@ -645,7 +645,7 @@
buf_block_t* block) /* in: control block */
{
buf_block_t* last_block;
-
+
ut_ad(buf_pool);
ut_ad(block);
#ifdef UNIV_SYNC_DEBUG
@@ -662,7 +662,7 @@
block->LRU_position = last_block->LRU_position;
} else {
block->LRU_position = buf_pool_clock_tic();
- }
+ }
ut_a(!block->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, block);
@@ -670,11 +670,11 @@
if (srv_use_awe && block->frame) {
/* Add to the list of mapped pages */
-
+
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
}
-
+
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
buf_pool->LRU_old_len++;
@@ -695,7 +695,7 @@
buf_LRU_old_init();
}
-}
+}
/**********************************************************************
Adds a block to the LRU list. */
@@ -710,7 +710,7 @@
the start, regardless of this parameter */
{
ulint cl;
-
+
ut_ad(buf_pool);
ut_ad(block);
#ifdef UNIV_SYNC_DEBUG
@@ -727,7 +727,7 @@
/* Add to the list of mapped pages; for simplicity we always
add to the start, even if the user would have set 'old'
TRUE */
-
+
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
}
@@ -736,7 +736,7 @@
UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, block);
- block->LRU_position = cl;
+ block->LRU_position = cl;
block->freed_page_clock = buf_pool->freed_page_clock;
} else {
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old,
@@ -765,8 +765,8 @@
defined: init it */
buf_LRU_old_init();
- }
-}
+ }
+}
/**********************************************************************
Adds a block to the LRU list. */
@@ -820,25 +820,25 @@
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
-
+
ut_a((block->state == BUF_BLOCK_MEMORY)
- || (block->state == BUF_BLOCK_READY_FOR_USE));
+ || (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0);
ut_a(!block->in_free_list);
block->state = BUF_BLOCK_NOT_USED;
-#ifdef UNIV_DEBUG
+#ifdef UNIV_DEBUG
/* Wipe contents of page to reveal possible stale pointers to it */
memset(block->frame, '\0', UNIV_PAGE_SIZE);
-#endif
+#endif
UT_LIST_ADD_FIRST(free, buf_pool->free, block);
block->in_free_list = TRUE;
if (srv_use_awe && block->frame) {
/* Add to the list of mapped pages */
-
+
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
}
@@ -859,7 +859,7 @@
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
-
+
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->io_fix == 0);
ut_a(block->buf_fix_count == 0);
@@ -870,31 +870,31 @@
buf_pool->freed_page_clock += 1;
/* Note that if AWE is enabled the block may not have a frame at all */
-
- buf_block_modify_clock_inc(block);
-
- if (block != buf_page_hash_get(block->space, block->offset)) {
- fprintf(stderr,
+
+ buf_block_modify_clock_inc(block);
+
+ if (block != buf_page_hash_get(block->space, block->offset)) {
+ fprintf(stderr,
"InnoDB: Error: page %lu %lu not found from the hash table\n",
(ulong) block->space,
(ulong) block->offset);
- if (buf_page_hash_get(block->space, block->offset)) {
- fprintf(stderr,
+ if (buf_page_hash_get(block->space, block->offset)) {
+ fprintf(stderr,
"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n",
buf_page_hash_get(block->space, block->offset),
- (ulong) buf_page_hash_get(block->space, block->offset)->space,
- (ulong) buf_page_hash_get(block->space, block->offset)->offset,
+ (ulong) buf_page_hash_get(block->space, block->offset)->space,
+ (ulong) buf_page_hash_get(block->space, block->offset)->offset,
block);
- }
+ }
#ifdef UNIV_DEBUG
- buf_print();
- buf_LRU_print();
- buf_validate();
- buf_LRU_validate();
+ buf_print();
+ buf_LRU_print();
+ buf_validate();
+ buf_LRU_validate();
#endif
- ut_a(0);
- }
+ ut_a(0);
+ }
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(block->space, block->offset),
@@ -934,7 +934,7 @@
ulint old_len;
ulint new_len;
ulint LRU_pos;
-
+
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
@@ -946,7 +946,7 @@
ut_a(old_len >= new_len - BUF_LRU_OLD_TOLERANCE);
ut_a(old_len <= new_len + BUF_LRU_OLD_TOLERANCE);
}
-
+
UT_LIST_VALIDATE(LRU, buf_block_t, buf_pool->LRU);
block = UT_LIST_GET_FIRST(buf_pool->LRU);
@@ -979,7 +979,7 @@
if (buf_pool->LRU_old) {
ut_a(buf_pool->LRU_old_len == old_len);
- }
+ }
UT_LIST_VALIDATE(free, buf_block_t, buf_pool->free);
@@ -1005,7 +1005,7 @@
buf_block_t* block;
buf_frame_t* frame;
ulint len;
-
+
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
--- 1.19/storage/innobase/buf/buf0rea.c 2005-06-21 10:49:15 +04:00
+++ 1.20/storage/innobase/buf/buf0rea.c 2006-03-10 19:22:02 +03:00
@@ -79,14 +79,14 @@
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
-
+
if (trx_doublewrite && space == TRX_SYS_SPACE
&& ( (offset >= trx_doublewrite->block1
- && offset < trx_doublewrite->block1
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
- || (offset >= trx_doublewrite->block2
- && offset < trx_doublewrite->block2
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
+ && offset < trx_doublewrite->block1
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
+ || (offset >= trx_doublewrite->block2
+ && offset < trx_doublewrite->block2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: trying to read doublewrite buffer page %lu\n",
@@ -112,9 +112,9 @@
/* Trx sys header is so low in the latching order that we play
safe and do not leave the i/o-completion to an asynchronous
i/o-thread. Ibuf bitmap pages must always be read with
- syncronous i/o, to make sure they do not get involved in
- thread deadlocks. */
-
+ syncronous i/o, to make sure they do not get involved in
+ thread deadlocks. */
+
sync = TRUE;
}
@@ -125,16 +125,16 @@
block = buf_page_init_for_read(err, mode, space, tablespace_version,
offset);
if (block == NULL) {
-
+
return(0);
}
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
- "Posting read request for page %lu, sync %lu\n",
+ "Posting read request for page %lu, sync %lu\n",
(ulong) offset,
- (ulong) sync);
+ (ulong) sync);
}
#endif
@@ -151,9 +151,9 @@
fil_read */
buf_page_io_complete(block);
}
-
+
return(1);
-}
+}
/************************************************************************
Applies a random read-ahead in buf_pool if there are at least a threshold
@@ -188,15 +188,15 @@
ulint i;
if (srv_startup_is_before_trx_rollback_phase) {
- /* No read-ahead to avoid thread deadlocks */
- return(0);
+ /* No read-ahead to avoid thread deadlocks */
+ return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
- no read-ahead, as that could break the ibuf page access
- order */
+ no read-ahead, as that could break the ibuf page access
+ order */
return(0);
}
@@ -219,7 +219,7 @@
/* Get the minimum LRU_position field value for an initial segment
of the LRU list, to determine which blocks have recently been added
to the start of the list. */
-
+
LRU_recent_limit = buf_LRU_get_recent_limit();
mutex_enter(&(buf_pool->mutex));
@@ -229,7 +229,7 @@
mutex_exit(&(buf_pool->mutex));
return(0);
- }
+ }
/* Count how many blocks in the area have been recently accessed,
that is, reside near the start of the LRU list. */
@@ -238,15 +238,15 @@
block = buf_page_hash_get(space, i);
if ((block)
- && (block->LRU_position > LRU_recent_limit)
- && block->accessed) {
+ && (block->LRU_position > LRU_recent_limit)
+ && block->accessed) {
recent_blocks++;
}
}
mutex_exit(&(buf_pool->mutex));
-
+
if (recent_blocks < BUF_READ_AHEAD_RANDOM_THRESHOLD) {
/* Do nothing */
@@ -270,7 +270,7 @@
if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, i);
+ space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -285,7 +285,7 @@
/* In simulated aio we wake the aio handler threads only after
queuing all aio requests, in native aio the following call does
nothing: */
-
+
os_aio_simulated_wake_handler_threads();
#ifdef UNIV_DEBUG
@@ -293,11 +293,11 @@
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset,
- (ulong) count);
+ (ulong) count);
}
#endif /* UNIV_DEBUG */
- ++srv_read_ahead_rnd;
+ ++srv_read_ahead_rnd;
return(count);
}
@@ -330,9 +330,9 @@
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, offset);
- srv_buf_pool_reads+= count2;
+ srv_buf_pool_reads+= count2;
if (err == DB_TABLESPACE_DELETED) {
- ut_print_timestamp(stderr);
+ ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
@@ -391,17 +391,17 @@
ulint low, high;
ulint err;
ulint i;
-
+
if (srv_startup_is_before_trx_rollback_phase) {
- /* No read-ahead to avoid thread deadlocks */
- return(0);
+ /* No read-ahead to avoid thread deadlocks */
+ return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
- no read-ahead, as that could break the ibuf page access
- order */
+ no read-ahead, as that could break the ibuf page access
+ order */
return(0);
}
@@ -437,7 +437,7 @@
mutex_exit(&(buf_pool->mutex));
return(0);
- }
+ }
/* Check that almost all pages in the area have been accessed; if
offset == low, the accesses must be in a descending order, otherwise,
@@ -453,14 +453,15 @@
for (i = low; i < high; i++) {
block = buf_page_hash_get(space, i);
-
+
if ((block == NULL) || !block->accessed) {
/* Not accessed */
fail_count++;
- } else if (pred_block && (ut_ulint_cmp(block->LRU_position,
- pred_block->LRU_position)
- != asc_or_desc)) {
+ } else if (pred_block
+ && (ut_ulint_cmp(block->LRU_position,
+ pred_block->LRU_position)
+ != asc_or_desc)) {
/* Accesses not in the right order */
fail_count++;
@@ -489,27 +490,27 @@
}
frame = block->frame;
-
+
/* Read the natural predecessor and successor page addresses from
the page; NOTE that because the calling thread may have an x-latch
on the page, we do not acquire an s-latch on the page, this is to
prevent deadlocks. Even if we read values which are nonsense, the
- algorithm will work. */
+ algorithm will work. */
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
mutex_exit(&(buf_pool->mutex));
-
+
if ((offset == low) && (succ_offset == offset + 1)) {
- /* This is ok, we can continue */
- new_offset = pred_offset;
+ /* This is ok, we can continue */
+ new_offset = pred_offset;
} else if ((offset == high - 1) && (pred_offset == offset - 1)) {
- /* This is ok, we can continue */
- new_offset = succ_offset;
+ /* This is ok, we can continue */
+ new_offset = succ_offset;
} else {
/* Successor or predecessor not in the right order */
@@ -548,7 +549,7 @@
full read batch to be posted, we use special heuristics here */
os_aio_simulated_put_read_threads_to_sleep();
-
+
for (i = low; i < high; i++) {
/* It is only sensible to do read-ahead in the non-sync
aio mode: hence FALSE as the first parameter */
@@ -556,7 +557,7 @@
if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, i);
+ space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -571,7 +572,7 @@
/* In simulated aio we wake the aio handler threads only after
queuing all aio requests, in native aio the following call does
nothing: */
-
+
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
@@ -585,7 +586,7 @@
}
#endif /* UNIV_DEBUG */
- ++srv_read_ahead_seq;
+ ++srv_read_ahead_seq;
return(count);
}
@@ -616,11 +617,11 @@
ut_ad(!ibuf_inside());
#ifdef UNIV_IBUF_DEBUG
ut_a(n_stored < UNIV_PAGE_SIZE);
-#endif
+#endif
while (buf_pool->n_pend_reads >
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
os_thread_sleep(500000);
- }
+ }
for (i = 0; i < n_stored; i++) {
if ((i + 1 == n_stored) && sync) {
@@ -639,7 +640,7 @@
page_nos[i], FALSE);
}
}
-
+
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
@@ -704,14 +705,14 @@
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
- tablespace_version, page_nos[i]);
+ tablespace_version, page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
- | OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, page_nos[i]);
+ | OS_AIO_SIMULATED_WAKE_LATER,
+ space, tablespace_version, page_nos[i]);
}
}
-
+
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
--- 1.19/storage/innobase/data/data0data.c 2005-10-06 12:26:04 +04:00
+++ 1.20/storage/innobase/data/data0data.c 2006-03-10 19:22:03 +03:00
@@ -18,24 +18,24 @@
#include "dict0dict.h"
#include "btr0cur.h"
+#ifdef UNIV_DEBUG
byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */
-#ifdef UNIV_DEBUG
ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */
#endif /* UNIV_DEBUG */
/* 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 */
{
dfield_set_data(field, data, len);
}
-void*
+void*
dfield_get_data_noninline(
dfield_t* field) /* in: field */
{
@@ -47,15 +47,15 @@
{
return(dfield_get_len(field));
}
-ulint
+ulint
dtuple_get_n_fields_noninline(
- dtuple_t* tuple) /* in: tuple */
+ dtuple_t* tuple) /* in: tuple */
{
return(dtuple_get_n_fields(tuple));
}
-dfield_t*
+dfield_t*
dtuple_get_nth_field_noninline(
- dtuple_t* tuple, /* in: tuple */
+ dtuple_t* tuple, /* in: tuple */
ulint n) /* in: index of field */
{
return(dtuple_get_nth_field(tuple, n));
@@ -83,7 +83,7 @@
}
if (0 != ut_memcmp(field->data, data, len)) {
-
+
return(FALSE);
}
@@ -122,18 +122,18 @@
return(FALSE);
}
-
+
for (i = 0; i < n_fields; i++) {
field1 = dtuple_get_nth_field(tuple1, i);
field2 = dtuple_get_nth_field(tuple2, i);
if (0 != cmp_dfield_dfield(field1, field2)) {
-
+
return(FALSE);
- }
+ }
}
-
+
return(TRUE);
}
@@ -144,12 +144,12 @@
dtuple_create_for_mysql(
/*====================*/
/* out, own created dtuple */
- void** heap, /* out: created memory heap */
- ulint n_fields) /* in: number of fields */
+ void** heap, /* out: created memory heap */
+ ulint n_fields) /* in: number of fields */
{
- *heap = (void*)mem_heap_create(500);
-
- return(dtuple_create(*((mem_heap_t**)heap), n_fields));
+ *heap = (void*)mem_heap_create(500);
+
+ return(dtuple_create(*((mem_heap_t**)heap), n_fields));
}
/*************************************************************************
@@ -160,12 +160,12 @@
/*==================*/
void* heap) /* in: memory heap where tuple was created */
{
- mem_heap_free((mem_heap_t*)heap);
+ mem_heap_free((mem_heap_t*)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(
@@ -189,7 +189,7 @@
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
- || dfield_get_type(field)->mtype < DATA_VARCHAR) {
+ || dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
"InnoDB: Error: data field type %lu, len %lu\n",
@@ -211,8 +211,8 @@
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
- ulint i;
-
+ ulint i;
+
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n",
@@ -247,7 +247,7 @@
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
- || dfield_get_type(field)->mtype < DATA_VARCHAR) {
+ || dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
"InnoDB: Error: data field type %lu, len %lu\n",
@@ -270,7 +270,7 @@
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
- ulint i;
+ ulint i;
for (i = 0; i < dtuple_get_n_fields(tuple); i++) {
@@ -294,11 +294,11 @@
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
- byte* data;
- ulint n_fields;
- ulint len;
- ulint i;
- ulint j;
+ byte* data;
+ ulint n_fields;
+ ulint len;
+ ulint i;
+ ulint j;
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
@@ -311,7 +311,7 @@
field = dtuple_get_nth_field(tuple, i);
len = dfield_get_len(field);
-
+
if (len != UNIV_SQL_NULL) {
data = field->data;
@@ -357,7 +357,7 @@
mtype = dtype_get_mtype(dfield_get_type(dfield));
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
-
+
for (i = 0; i < len; i++) {
int c = *data++;
putc(isprint(c) ? c : ' ', stderr);
@@ -372,7 +372,7 @@
/*****************************************************************
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(
@@ -399,7 +399,7 @@
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
print_also_hex = FALSE;
-
+
for (i = 0; i < len; i++) {
int c = *data++;
if (!isprint(c)) {
@@ -415,9 +415,9 @@
}
fputs(" Hex: ", stderr);
-
+
data = dfield_get_data(dfield);
-
+
for (i = 0; i < len; i++) {
fprintf(stderr, "%02lx", (ulint)*data);
@@ -431,6 +431,22 @@
}
}
+/*****************************************************************
+Print a dfield value using ut_print_buf. */
+
+void
+dfield_print_raw(
+/*=============*/
+ FILE* f, /* in: output stream */
+ dfield_t* dfield) /* in: dfield */
+{
+ if (dfield->len != UNIV_SQL_NULL) {
+ ut_print_buf(f, dfield->data, dfield->len);
+ } else {
+ fputs(" SQL NULL", f);
+ }
+}
+
/**************************************************************
The following function prints the contents of a tuple. */
@@ -440,7 +456,6 @@
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */
{
- dfield_t* field;
ulint n_fields;
ulint i;
@@ -451,13 +466,7 @@
for (i = 0; i < n_fields; i++) {
fprintf(f, " %lu:", (ulong) i);
- field = dtuple_get_nth_field(tuple, i);
-
- if (field->len != UNIV_SQL_NULL) {
- ut_print_buf(f, field->data, field->len);
- } else {
- fputs(" SQL NULL", f);
- }
+ dfield_print_raw(f, dtuple_get_nth_field(tuple, i));
putc(';', f);
}
@@ -497,7 +506,7 @@
ibool is_externally_stored;
ulint i;
ulint j;
-
+
ut_a(dtuple_check_typed_no_assert(entry));
size = rec_get_converted_size(index, entry);
@@ -525,9 +534,9 @@
n_fields = 0;
while (rec_get_converted_size(index, entry)
- >= ut_min(page_get_free_space_of_empty(
- index->table->comp) / 2,
- REC_MAX_DATA_SIZE)) {
+ >= ut_min(page_get_free_space_of_empty(
+ dict_table_is_comp(index->table)) / 2,
+ REC_MAX_DATA_SIZE)) {
longest = 0;
for (i = dict_index_get_n_unique_in_tree(index);
@@ -545,25 +554,27 @@
}
}
}
-
+
if (!is_externally_stored) {
dfield = dtuple_get_nth_field(entry, i);
if (dfield->len != UNIV_SQL_NULL &&
- dfield->len > longest) {
+ dfield->len > longest) {
- longest = dfield->len;
+ longest = dfield->len;
- longest_i = i;
+ longest_i = i;
}
}
}
-
+
/* We do not store externally fields which are smaller than
DICT_MAX_INDEX_COL_LEN */
- ut_a(DICT_MAX_INDEX_COL_LEN > REC_1BYTE_OFFS_LIMIT);
+#if DICT_MAX_INDEX_COL_LEN <= REC_1BYTE_OFFS_LIMIT
+# error "DICT_MAX_INDEX_COL_LEN <= REC_1BYTE_OFFS_LIMIT"
+#endif
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
+ DICT_MAX_INDEX_COL_LEN) {
@@ -589,7 +600,7 @@
vector->fields[n_fields].field_no = longest_i;
ut_a(dfield->len > DICT_MAX_INDEX_COL_LEN);
-
+
vector->fields[n_fields].len = dfield->len
- DICT_MAX_INDEX_COL_LEN;
@@ -610,7 +621,7 @@
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE);
n_fields++;
- }
+ }
vector->n_fields = n_fields;
return(vector);
@@ -630,10 +641,10 @@
freed in this function */
{
dfield_t* dfield;
- ulint i;
+ ulint i;
for (i = 0; i < vector->n_fields; i++) {
-
+
dfield = dtuple_get_nth_field(entry,
vector->fields[i].field_no);
/* Copy data from big rec vector */
@@ -641,10 +652,10 @@
ut_memcpy(((byte*)dfield->data)
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
vector->fields[i].data,
- vector->fields[i].len);
+ vector->fields[i].len);
dfield->len = dfield->len + vector->fields[i].len
- BTR_EXTERN_FIELD_REF_SIZE;
- }
+ }
mem_heap_free(vector->heap);
}
--- 1.21/storage/innobase/data/data0type.c 2005-06-21 10:49:15 +04:00
+++ 1.22/storage/innobase/data/data0type.c 2006-03-10 19:22:03 +03:00
@@ -30,7 +30,7 @@
ulint prefix_len, /* in: prefix length in bytes of the index
(this has to be divided by mbmaxlen to get the
number of CHARACTERS n in the prefix) */
- ulint data_len, /* in: length of the string in bytes */
+ ulint data_len, /* in: length of the string in bytes */
const char* str); /* in: character string */
/* At the database startup we store the default-charset collation number of
@@ -41,7 +41,7 @@
ulint data_mysql_default_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
-dtype_t* dtype_binary = &dtype_binary_val;
+dtype_t* dtype_binary = &dtype_binary_val;
/*************************************************************************
Determine how many bytes the first n characters of the given string occupy.
@@ -97,9 +97,9 @@
/* out: TRUE if string type */
ulint mtype) /* in: InnoDB main data type code: DATA_CHAR, ... */
{
- if (mtype <= DATA_BLOB
- || mtype == DATA_MYSQL
- || mtype == DATA_VARMYSQL) {
+ if (mtype <= DATA_BLOB
+ || mtype == DATA_MYSQL
+ || mtype == DATA_VARMYSQL) {
return(TRUE);
}
@@ -119,9 +119,9 @@
ulint mtype, /* in: main data type */
ulint prtype) /* in: precise type */
{
- if ((mtype == DATA_FIXBINARY)
- || (mtype == DATA_BINARY)
- || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
+ if ((mtype == DATA_FIXBINARY)
+ || (mtype == DATA_BINARY)
+ || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
return(TRUE);
}
@@ -143,8 +143,8 @@
ulint prtype) /* in: precise type */
{
if (dtype_is_string_type(mtype) == TRUE
- && dtype_is_binary_string_type(mtype, prtype) == FALSE) {
-
+ && dtype_is_binary_string_type(mtype, prtype) == FALSE) {
+
return(TRUE);
}
@@ -190,7 +190,7 @@
{
ut_a(type);
ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL));
-
+
if (type->mtype == DATA_SYS) {
ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS);
}
@@ -211,7 +211,7 @@
ulint mtype;
ulint prtype;
ulint len;
-
+
ut_a(type);
mtype = type->mtype;
@@ -233,7 +233,7 @@
}
len = type->len;
-
+
if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
@@ -252,7 +252,7 @@
} else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr);
} else {
- fprintf(stderr, "prtype %lu", (ulong) mtype);
+ fprintf(stderr, "prtype %lu", (ulong) prtype);
}
}
--- 1.15/storage/innobase/dict/dict0boot.c 2005-06-21 10:49:15 +04:00
+++ 1.16/storage/innobase/dict/dict0boot.c 2006-03-10 19:22:03 +03:00
@@ -29,14 +29,14 @@
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 */
{
dict_hdr_t* header;
ut_ad(mtr);
-
+
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
@@ -59,21 +59,21 @@
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
- || (type == DICT_HDR_MIX_ID));
+ || (type == DICT_HDR_MIX_ID));
mtr_start(&mtr);
dict_hdr = dict_hdr_get(&mtr);
- id = mtr_read_dulint(dict_hdr + type, &mtr);
+ id = mtr_read_dulint(dict_hdr + type, &mtr);
id = ut_dulint_add(id, 1);
-
- mlog_write_dulint(dict_hdr + type, id, &mtr);
+
+ mlog_write_dulint(dict_hdr + type, id, &mtr);
mtr_commit(&mtr);
return(id);
-}
+}
/**************************************************************************
Writes the current value of the row id counter to the dictionary header file
@@ -96,11 +96,11 @@
mtr_start(&mtr);
dict_hdr = dict_hdr_get(&mtr);
-
- mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
+
+ mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
mtr_commit(&mtr);
-}
+}
/*********************************************************************
Creates the file page for the dictionary header. This function is
@@ -116,7 +116,7 @@
ulint hdr_page_no;
ulint root_page_no;
page_t* page;
-
+
ut_ad(mtr);
/* Create the dictionary header file block in a new, allocated file
@@ -125,7 +125,7 @@
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
hdr_page_no = buf_frame_get_page_no(page);
-
+
ut_a(DICT_HDR_PAGE_NO == hdr_page_no);
dict_header = dict_hdr_get(mtr);
@@ -147,7 +147,7 @@
/* Create the B-tree roots for the clustered indexes of the basic
system tables */
- /*--------------------------*/
+ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
@@ -157,7 +157,7 @@
mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no,
MLOG_4BYTES, mtr);
- /*--------------------------*/
+ /*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE,
DICT_TABLE_IDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
@@ -167,7 +167,7 @@
mlog_write_ulint(dict_header + DICT_HDR_TABLE_IDS, root_page_no,
MLOG_4BYTES, mtr);
- /*--------------------------*/
+ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
@@ -177,7 +177,7 @@
mlog_write_ulint(dict_header + DICT_HDR_COLUMNS, root_page_no,
MLOG_4BYTES, mtr);
- /*--------------------------*/
+ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
@@ -187,7 +187,7 @@
mlog_write_ulint(dict_header + DICT_HDR_INDEXES, root_page_no,
MLOG_4BYTES, mtr);
- /*--------------------------*/
+ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
@@ -197,7 +197,7 @@
mlog_write_ulint(dict_header + DICT_HDR_FIELDS, root_page_no,
MLOG_4BYTES, mtr);
- /*--------------------------*/
+ /*--------------------------*/
return(TRUE);
}
@@ -217,12 +217,12 @@
ibool success;
mtr_start(&mtr);
-
+
/* Create the hash tables etc. */
dict_init();
mutex_enter(&(dict_sys->mutex));
-
+
/* Get the dictionary header */
dict_hdr = dict_hdr_get(&mtr);
@@ -237,16 +237,15 @@
header. */
dict_sys->row_id = ut_dulint_add(
- ut_dulint_align_up(
- mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
- &mtr),
- DICT_HDR_ROW_ID_WRITE_MARGIN),
- DICT_HDR_ROW_ID_WRITE_MARGIN);
+ ut_dulint_align_up(
+ mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID, &mtr),
+ DICT_HDR_ROW_ID_WRITE_MARGIN),
+ DICT_HDR_ROW_ID_WRITE_MARGIN);
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
- table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, FALSE);
+ table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
@@ -258,14 +257,14 @@
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
table->id = DICT_TABLES_ID;
-
+
dict_table_add_to_cache(table);
dict_sys->sys_tables = table;
-
+
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
- dict_mem_index_add_field(index, "NAME", 0, 0);
+ dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID;
@@ -275,14 +274,14 @@
/*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1);
- dict_mem_index_add_field(index, "ID", 0, 0);
+ dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
- table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, FALSE);
+ table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
@@ -291,7 +290,7 @@
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0);
-
+
table->id = DICT_COLUMNS_ID;
dict_table_add_to_cache(table);
@@ -300,15 +299,15 @@
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
- dict_mem_index_add_field(index, "TABLE_ID", 0, 0);
- dict_mem_index_add_field(index, "POS", 0, 0);
+ dict_mem_index_add_field(index, "TABLE_ID", 0);
+ dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
- table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, FALSE);
+ table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
@@ -336,15 +335,15 @@
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
- dict_mem_index_add_field(index, "TABLE_ID", 0, 0);
- dict_mem_index_add_field(index, "ID", 0, 0);
+ dict_mem_index_add_field(index, "TABLE_ID", 0);
+ dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
- table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, FALSE);
+ table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
@@ -357,8 +356,8 @@
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
- dict_mem_index_add_field(index, "INDEX_ID", 0, 0);
- dict_mem_index_add_field(index, "POS", 0, 0);
+ dict_mem_index_add_field(index, "INDEX_ID", 0);
+ dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
@@ -378,7 +377,7 @@
dict_load_sys_table(dict_sys->sys_columns);
dict_load_sys_table(dict_sys->sys_indexes);
dict_load_sys_table(dict_sys->sys_fields);
-
+
mutex_exit(&(dict_sys->mutex));
}
@@ -407,7 +406,7 @@
dict_hdr_create(&mtr);
mtr_commit(&mtr);
-
+
dict_boot();
dict_insert_initial_data();
--- 1.34/storage/innobase/dict/dict0crea.c 2005-06-21 10:49:15 +04:00
+++ 1.35/storage/innobase/dict/dict0crea.c 2006-03-10 19:22:03 +03:00
@@ -33,7 +33,7 @@
dict_create_sys_tables_tuple(
/*=========================*/
/* out: the tuple which should be inserted */
- dict_table_t* table, /* in: table */
+ dict_table_t* table, /* in: table */
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
{
@@ -45,7 +45,7 @@
ut_ad(table && heap);
sys_tables = dict_sys->sys_tables;
-
+
entry = dtuple_create(heap, 8 + DATA_N_SYS_COLS);
/* 0: NAME -----------------------------*/
@@ -62,9 +62,13 @@
/* 4: N_COLS ---------------------------*/
dfield = dtuple_get_nth_field(entry, 2);
+#if DICT_TF_COMPACT != 1
+#error
+#endif
+
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->n_def
- | ((ulint) table->comp << 31));
+ | ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
/* 5: TYPE -----------------------------*/
dfield = dtuple_get_nth_field(entry, 3);
@@ -91,7 +95,7 @@
/* 8: CLUSTER_NAME ---------------------*/
dfield = dtuple_get_nth_field(entry, 6);
- if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
+ if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
dfield_set_data(dfield, table->cluster_name,
ut_strlen(table->cluster_name));
ut_error; /* Oracle-style clusters are not supported yet */
@@ -108,9 +112,9 @@
/*----------------------------------*/
dict_table_copy_types(entry, sys_tables);
-
+
return(entry);
-}
+}
/*********************************************************************
Based on a table object, this function builds the entry to be inserted
@@ -120,7 +124,7 @@
dict_create_sys_columns_tuple(
/*==========================*/
/* out: the tuple which should be inserted */
- dict_table_t* table, /* in: table */
+ dict_table_t* table, /* in: table */
ulint i, /* in: column number */
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
@@ -136,7 +140,7 @@
column = dict_table_get_nth_col(table, i);
sys_columns = dict_sys->sys_columns;
-
+
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
/* 0: TABLE_ID -----------------------*/
@@ -190,7 +194,7 @@
dict_table_copy_types(entry, sys_columns);
return(entry);
-}
+}
/*******************************************************************
Builds a table definition to insert. */
@@ -236,7 +240,7 @@
cluster_table = dict_table_get_low(table->cluster_name);
if (cluster_table == NULL) {
-
+
return(DB_CLUSTER_NOT_FOUND);
}
@@ -244,7 +248,7 @@
table->space = cluster_table->space;
table->mix_len = cluster_table->mix_len;
-
+
table->mix_id = dict_hdr_get_new_id(DICT_HDR_MIX_ID);
}
@@ -256,7 +260,7 @@
- page 2 is the first inode page,
- page 3 will contain the root of the clustered index of the
table we create here. */
-
+
table->space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) {
@@ -281,7 +285,7 @@
mtr_start(&mtr);
fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
-
+
mtr_commit(&mtr);
}
@@ -306,7 +310,7 @@
row = dict_create_sys_columns_tuple(node->table, node->col_no,
node->heap);
ins_node_set_new_row(node->col_def, row);
-
+
return(DB_SUCCESS);
}
@@ -318,7 +322,7 @@
dict_create_sys_indexes_tuple(
/*==========================*/
/* out: the tuple which should be inserted */
- dict_index_t* index, /* in: index */
+ dict_index_t* index, /* in: index */
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
{
@@ -336,7 +340,7 @@
sys_indexes = dict_sys->sys_indexes;
table = dict_table_get_low(index->table_name);
-
+
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
/* 0: TABLE_ID -----------------------*/
@@ -400,7 +404,7 @@
dict_table_copy_types(entry, sys_indexes);
return(entry);
-}
+}
/*********************************************************************
Based on an index object, this function builds the entry to be inserted
@@ -410,7 +414,7 @@
dict_create_sys_fields_tuple(
/*=========================*/
/* out: the tuple which should be inserted */
- dict_index_t* index, /* in: index */
+ dict_index_t* index, /* in: index */
ulint i, /* in: field number */
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
@@ -426,15 +430,15 @@
ut_ad(index && heap);
for (j = 0; j < index->n_fields; j++) {
- if (dict_index_get_nth_field(index, j)->prefix_len > 0) {
- index_contains_column_prefix_field = TRUE;
+ if (dict_index_get_nth_field(index, j)->prefix_len > 0) {
+ index_contains_column_prefix_field = TRUE;
}
}
field = dict_index_get_nth_field(index, i);
sys_fields = dict_sys->sys_fields;
-
+
entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
/* 0: INDEX_ID -----------------------*/
@@ -449,19 +453,19 @@
dfield = dtuple_get_nth_field(entry, 1);
ptr = mem_heap_alloc(heap, 4);
-
+
if (index_contains_column_prefix_field) {
/* If there are column prefix fields in the index, then
we store the number of the field to the 2 HIGH bytes
and the prefix length to the 2 low bytes, */
- mach_write_to_4(ptr, (i << 16) + field->prefix_len);
+ mach_write_to_4(ptr, (i << 16) + field->prefix_len);
} else {
- /* Else we store the number of the field to the 2 LOW bytes.
+ /* Else we store the number of the field to the 2 LOW bytes.
This is to keep the storage format compatible with
InnoDB versions < 4.0.14. */
-
- mach_write_to_4(ptr, i);
+
+ mach_write_to_4(ptr, i);
}
dfield_set_data(dfield, ptr, 4);
@@ -473,9 +477,9 @@
/*---------------------------------*/
dict_table_copy_types(entry, sys_fields);
-
+
return(entry);
-}
+}
/*********************************************************************
Creates the tuple with which the index entry is searched for writing the index
@@ -498,13 +502,13 @@
search_tuple = dtuple_create(heap, 2);
- field1 = dtuple_get_nth_field(tuple, 0);
- field2 = dtuple_get_nth_field(search_tuple, 0);
+ field1 = dtuple_get_nth_field(tuple, 0);
+ field2 = dtuple_get_nth_field(search_tuple, 0);
dfield_copy(field2, field1);
- field1 = dtuple_get_nth_field(tuple, 1);
- field2 = dtuple_get_nth_field(search_tuple, 1);
+ field1 = dtuple_get_nth_field(tuple, 1);
+ field2 = dtuple_get_nth_field(search_tuple, 1);
dfield_copy(field2, field1);
@@ -547,8 +551,8 @@
node->table = table;
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
- || (index->type & DICT_CLUSTERED));
-
+ || (index->type & DICT_CLUSTERED));
+
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
/* Inherit the space id from the table; we store all indexes of a
@@ -577,7 +581,7 @@
dtuple_t* row;
index = node->index;
-
+
row = dict_create_sys_fields_tuple(index, node->field_no, node->heap);
ins_node_set_new_row(node->field_def, row);
@@ -605,7 +609,7 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
- index = node->index;
+ index = node->index;
table = node->table;
sys_indexes = dict_sys->sys_indexes;
@@ -626,7 +630,7 @@
mtr_start(&mtr);
search_tuple = dict_create_search_tuple(node->ind_row, node->heap);
-
+
btr_pcur_open(UT_LIST_GET_FIRST(sys_indexes->indexes),
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
&pcur, &mtr);
@@ -634,7 +638,7 @@
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
node->page_no = btr_create(index->type, index->space, index->id,
- table->comp, &mtr);
+ dict_table_is_comp(table), &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
@@ -666,16 +670,16 @@
ulint space;
byte* ptr;
ulint len;
-
+
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
- ut_a(!dict_sys->sys_indexes->comp);
+ ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
ut_ad(len == 4);
-
+
root_page_no = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
if (root_page_no == FIL_NULL) {
@@ -706,7 +710,7 @@
/* Then we free the root page in the same mini-transaction where
we write FIL_NULL to the appropriate field in the SYS_INDEXES
record: this mini-transaction marks the B-tree totally freed */
-
+
/* printf("Dropping index tree in space %lu root page %lu\n", space,
root_page_no); */
btr_free_root(space, root_page_no, mtr);
@@ -743,7 +747,7 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
- ut_a(!dict_sys->sys_indexes->comp);
+ ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
ut_ad(len == 4);
@@ -853,7 +857,7 @@
tab_node_t* node;
node = mem_heap_alloc(heap, sizeof(tab_node_t));
-
+
node->common.type = QUE_NODE_CREATE_TABLE;
node->table = table;
@@ -862,9 +866,9 @@
node->heap = mem_heap_create(256);
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
- heap);
+ heap);
node->tab_def->common.parent = node;
-
+
node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns,
heap);
node->col_def->common.parent = node;
@@ -899,7 +903,7 @@
node->heap = mem_heap_create(256);
node->ind_def = ins_node_create(INS_DIRECT,
- dict_sys->sys_indexes, heap);
+ dict_sys->sys_indexes, heap);
node->ind_def->common.parent = node;
node->field_def = ins_node_create(INS_DIRECT,
@@ -931,7 +935,7 @@
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
-
+
node = thr->run_node;
ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_TABLE);
@@ -950,7 +954,7 @@
goto function_exit;
}
-
+
node->state = TABLE_BUILD_COL_DEF;
node->col_no = 0;
@@ -971,7 +975,7 @@
}
node->col_no++;
-
+
thr->run_node = node->col_def;
return(thr);
@@ -985,7 +989,7 @@
/* Table was correctly defined: do NOT commit the transaction
(CREATE TABLE does NOT do an implicit commit of the current
transaction) */
-
+
node->state = TABLE_ADD_TO_CACHE;
/* thr->run_node = node->commit_node;
@@ -1018,7 +1022,7 @@
thr->run_node = que_node_get_parent(node);
return(thr);
-}
+}
/***************************************************************
Creates an index. This is a high-level function used in SQL execution
@@ -1041,7 +1045,7 @@
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
-
+
node = thr->run_node;
ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_INDEX);
@@ -1058,7 +1062,7 @@
goto function_exit;
}
-
+
node->state = INDEX_BUILD_FIELD_DEF;
node->field_no = 0;
@@ -1079,7 +1083,7 @@
}
node->field_no++;
-
+
thr->run_node = node->field_def;
return(thr);
@@ -1105,7 +1109,7 @@
/* Index was correctly defined: do NOT commit the transaction
(CREATE INDEX does NOT currently do an implicit commit of
the current transaction) */
-
+
node->state = INDEX_ADD_TO_CACHE;
/* thr->run_node = node->commit_node;
@@ -1141,7 +1145,7 @@
thr->run_node = que_node_get_parent(node);
return(thr);
-}
+}
/********************************************************************
Creates the foreign key constraints system tables inside InnoDB
@@ -1159,29 +1163,29 @@
que_t* graph;
ulint error;
trx_t* trx;
- const char* str;
+ const char* str;
mutex_enter(&(dict_sys->mutex));
table1 = dict_table_get_low("SYS_FOREIGN");
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
-
+
if (table1 && table2
- && UT_LIST_GET_LEN(table1->indexes) == 3
- && UT_LIST_GET_LEN(table2->indexes) == 1) {
+ && UT_LIST_GET_LEN(table1->indexes) == 3
+ && UT_LIST_GET_LEN(table2->indexes) == 1) {
- /* Foreign constraint system tables have already been
- created, and they are ok */
+ /* Foreign constraint system tables have already been
+ created, and they are ok */
mutex_exit(&(dict_sys->mutex));
- return(DB_SUCCESS);
- }
+ return(DB_SUCCESS);
+ }
mutex_exit(&(dict_sys->mutex));
trx = trx_allocate_for_mysql();
-
+
trx->op_info = "creating foreign key sys tables";
row_mysql_lock_data_dictionary(trx);
@@ -1204,7 +1208,7 @@
/* NOTE: in dict_load_foreigns we use the fact that
there are 2 secondary indexes on SYS_FOREIGN, and they
are defined just like below */
-
+
/* NOTE: when designing InnoDB's foreign key support in 2001, we made
an error and made the table names and the foreign key id of type
'CHAR' (internally, really a VARCHAR). We should have made the type
@@ -1243,7 +1247,7 @@
if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: error %lu in creation\n",
(ulong) error);
-
+
ut_a(error == DB_OUT_OF_FILE_SPACE);
fprintf(stderr, "InnoDB: creation failed\n");
@@ -1258,14 +1262,14 @@
}
que_graph_free(graph);
-
+
trx->op_info = "";
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free_for_mysql(trx);
- if (error == DB_SUCCESS) {
+ if (error == DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Foreign key constraint system tables created\n");
}
@@ -1324,7 +1328,7 @@
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
- "InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
+"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
return(DB_ERROR);
}
@@ -1432,12 +1436,12 @@
"in front of the user-defined constraint name).\n",
ef);
fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
- "constraint names as case-insensitive, with the\n"
- "MySQL standard latin1_swedish_ci collation. If you\n"
- "create tables or databases whose names differ only in\n"
- "the character case, then collisions in constraint\n"
- "names can occur. Workaround: name your constraints\n"
- "explicitly with unique names.\n",
+ "constraint names as case-insensitive, with the\n"
+ "MySQL standard latin1_swedish_ci collation. If you\n"
+ "create tables or databases whose names differ only in\n"
+ "the character case, then collisions in constraint\n"
+ "names can occur. Workaround: name your constraints\n"
+ "explicitly with unique names.\n",
ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -1446,7 +1450,7 @@
}
if (error != DB_SUCCESS) {
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: Foreign key constraint creation failed:\n"
"InnoDB: internal error number %lu\n", (ulong) error);
@@ -1461,7 +1465,7 @@
return(error);
}
-
+
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
goto loop;
--- 1.75/storage/innobase/dict/dict0dict.c 2006-02-08 13:58:49 +03:00
+++ 1.76/storage/innobase/dict/dict0dict.c 2006-03-10 19:22:03 +03:00
@@ -132,7 +132,7 @@
/*=================*/
/* out: TRUE if success */
dict_table_t* table, /* in: table */
- dict_index_t* index); /* in: index */
+ dict_index_t* index); /* in: index */
/***********************************************************************
Builds the internal dictionary cache representation for a clustered
index, containing also system fields not defined by the user. */
@@ -144,7 +144,7 @@
of the clustered index */
dict_table_t* table, /* in: table */
dict_index_t* index); /* in: user representation of a clustered
- index */
+ index */
/***********************************************************************
Builds the internal dictionary cache representation for a non-clustered
index, containing also system fields not defined by the user. */
@@ -156,7 +156,7 @@
of the non-clustered index */
dict_table_t* table, /* in: table */
dict_index_t* index); /* in: user representation of a non-clustered
- index */
+ index */
/**************************************************************************
Removes a foreign constraint struct from the dictionary cache. */
static
@@ -196,9 +196,10 @@
/* Stream for storing detailed information about the latest foreign key
and unique key errors */
FILE* dict_foreign_err_file = NULL;
-mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign
+mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign
and unique error buffers */
-
+
+#ifndef UNIV_HOTBACKUP
/**********************************************************************
Makes all characters in a NUL-terminated UTF-8 string lower case. */
@@ -209,6 +210,7 @@
{
innobase_casedn_str(a);
}
+#endif /* !UNIV_HOTBACKUP */
/************************************************************************
Checks if the database name in two table names is the same. */
@@ -263,7 +265,7 @@
ut_a(s);
return(s - name);
}
-
+
/************************************************************************
Reserves the dictionary system mutex for MySQL. */
@@ -273,7 +275,7 @@
{
mutex_enter(&(dict_sys->mutex));
}
-
+
/************************************************************************
Releases the dictionary system mutex for MySQL. */
@@ -283,7 +285,7 @@
{
mutex_exit(&(dict_sys->mutex));
}
-
+
/************************************************************************
Decrements the count of open MySQL handles to a table. */
@@ -297,7 +299,7 @@
ut_a(table->n_mysql_handles_opened > 0);
table->n_mysql_handles_opened--;
-
+
mutex_exit(&(dict_sys->mutex));
}
@@ -350,7 +352,7 @@
{
return(dict_table_get_index(table, name));
}
-
+
/************************************************************************
Initializes the autoinc counter. It is not an error to initialize an already
initialized counter. */
@@ -390,7 +392,7 @@
value = table->autoinc;
table->autoinc = table->autoinc + 1;
}
-
+
mutex_exit(&(table->autoinc_mutex));
return(value);
@@ -407,7 +409,7 @@
mutex_enter(&(table->autoinc_mutex));
table->autoinc = table->autoinc - 1;
-
+
mutex_exit(&(table->autoinc_mutex));
}
@@ -431,7 +433,7 @@
} else {
value = table->autoinc;
}
-
+
mutex_exit(&(table->autoinc_mutex));
return(value);
@@ -476,7 +478,7 @@
if (value >= table->autoinc) {
table->autoinc = value + 1;
}
- }
+ }
mutex_exit(&(table->autoinc_mutex));
}
@@ -497,7 +499,7 @@
dict_col_t* col;
ulint pos;
ulint n_fields;
-
+
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
@@ -509,7 +511,7 @@
}
n_fields = dict_index_get_n_fields(index);
-
+
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
@@ -537,7 +539,7 @@
dict_col_t* col;
ulint pos;
ulint n_fields;
-
+
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
@@ -549,7 +551,7 @@
col = dict_table_get_nth_col(index->table, n);
n_fields = dict_index_get_n_fields(index);
-
+
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
@@ -582,21 +584,21 @@
dict_field_t* field2;
ulint n_fields;
ulint pos;
-
+
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
field2 = dict_index_get_nth_field(index2, n);
n_fields = dict_index_get_n_fields(index);
-
+
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
if (field->col == field2->col
- && (field->prefix_len == 0
+ && (field->prefix_len == 0
|| (field->prefix_len >= field2->prefix_len
- && field2->prefix_len != 0))) {
+ && field2->prefix_len != 0))) {
return(pos);
}
@@ -616,7 +618,7 @@
trx_t* trx) /* in: transaction handle */
{
dict_table_t* table;
-
+
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
|| trx->dict_operation_lock_mode == RW_X_LATCH) {
/* It is a system table which will always exist in the table
@@ -634,7 +636,7 @@
mutex_enter(&(dict_sys->mutex));
table = dict_table_get_on_id_low(table_id, trx);
-
+
mutex_exit(&(dict_sys->mutex));
return(table);
@@ -672,7 +674,7 @@
dict_col_t* col;
ulint pos;
ulint n_fields;
-
+
ut_ad(table);
col = dict_table_get_nth_col(table, n);
@@ -680,7 +682,7 @@
index = dict_table_get_first_index(table);
n_fields = dict_index_get_n_unique(index);
-
+
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
@@ -745,17 +747,17 @@
UT_NOT_USED(trx);
mutex_enter(&(dict_sys->mutex));
-
+
table = dict_table_get_low(table_name);
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
- if (!table->stat_initialized) {
+ if (!table->stat_initialized) {
dict_update_statistics(table);
}
}
-
+
return(table);
}
@@ -775,22 +777,22 @@
UT_NOT_USED(trx);
mutex_enter(&(dict_sys->mutex));
-
+
table = dict_table_get_low(table_name);
if (table != NULL) {
- table->n_mysql_handles_opened++;
+ table->n_mysql_handles_opened++;
}
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
- if (!table->stat_initialized && !table->ibd_file_missing) {
+ if (!table->stat_initialized && !table->ibd_file_missing) {
dict_update_statistics(table);
}
}
-
+
return(table);
}
@@ -805,7 +807,7 @@
ulint fold;
ulint id_fold;
ulint i;
-
+
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -813,12 +815,12 @@
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(table->cached == FALSE);
-
+
fold = ut_fold_string(table->name);
id_fold = ut_fold_dulint(table->id);
-
+
table->cached = TRUE;
-
+
/* NOTE: the system columns MUST be added in the following order
(so that they can be indexed by the numerical value of DATA_ROW_ID,
etc.) and as the last columns of the table memory object.
@@ -847,7 +849,7 @@
#endif
/* This check reminds that if a new system column is added to
- the program, it should be dealt with here */
+ the program, it should be dealt with here */
#if DATA_N_SYS_COLS != 4
#error "DATA_N_SYS_COLS != 4"
#endif
@@ -909,7 +911,7 @@
{
dict_table_t* table;
dict_index_t* index;
-
+
table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
while (table) {
@@ -951,16 +953,16 @@
char* old_name;
ibool success;
ulint i;
-
+
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
old_size = mem_heap_get_size(table->heap);
-
+
fold = ut_fold_string(new_name);
-
+
/* Look for a table with the same name: error if such exists */
{
dict_table_t* table2;
@@ -969,7 +971,7 @@
if (table2) {
fprintf(stderr,
"InnoDB: Error: dictionary cache already contains a table of name %s\n",
- new_name);
+ new_name);
return(FALSE);
}
}
@@ -1018,7 +1020,7 @@
while (index != NULL) {
index->table_name = table->name;
-
+
index = dict_table_get_next_index(index);
}
@@ -1030,7 +1032,7 @@
constraints from the dictionary cache here. The foreign key
constraints will be inherited to the new table from the
system tables through a call of dict_load_foreigns. */
-
+
/* Remove the foreign constraints from the cache */
foreign = UT_LIST_GET_LAST(table->foreign_list);
@@ -1046,14 +1048,14 @@
while (foreign != NULL) {
foreign->referenced_table = NULL;
foreign->referenced_index = NULL;
-
+
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
/* Make the list of referencing constraints empty */
UT_LIST_INIT(table->referenced_list);
-
+
return(TRUE);
}
@@ -1085,10 +1087,10 @@
old_id = mem_strdup(foreign->id);
if (ut_strlen(foreign->id) > ut_strlen(old_name)
- + ((sizeof dict_ibfk) - 1)
- && 0 == ut_memcmp(foreign->id, old_name,
- ut_strlen(old_name))
- && 0 == ut_memcmp(
+ + ((sizeof dict_ibfk) - 1)
+ && 0 == ut_memcmp(foreign->id, old_name,
+ ut_strlen(old_name))
+ && 0 == ut_memcmp(
foreign->id + ut_strlen(old_name),
dict_ibfk, (sizeof dict_ibfk) - 1)) {
@@ -1096,11 +1098,11 @@
if (ut_strlen(table->name) > ut_strlen(old_name)) {
foreign->id = mem_heap_alloc(
- foreign->heap,
+ foreign->heap,
ut_strlen(table->name)
+ ut_strlen(old_id) + 1);
}
-
+
/* Replace the prefix 'databasename/tablename'
with the new names */
strcpy(foreign->id, table->name);
@@ -1112,16 +1114,16 @@
db_len = dict_get_db_name_len(table->name) + 1;
if (dict_get_db_name_len(table->name)
- > dict_get_db_name_len(foreign->id)) {
+ > dict_get_db_name_len(foreign->id)) {
foreign->id = mem_heap_alloc(
- foreign->heap,
- db_len + ut_strlen(old_id) + 1);
+ foreign->heap,
+ db_len + ut_strlen(old_id) + 1);
}
/* Replace the database prefix in id with the
one from table->name */
-
+
ut_memcpy(foreign->id, table->name, db_len);
strcpy(foreign->id + db_len,
@@ -1194,7 +1196,7 @@
dict_index_t* index;
ulint size;
ulint i;
-
+
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -1222,7 +1224,7 @@
while (foreign != NULL) {
foreign->referenced_table = NULL;
foreign->referenced_index = NULL;
-
+
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
@@ -1308,7 +1310,7 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
| Thread |
|---|
| • bk commit into 5.1 tree (aivanov:1.2159) | Alex Ivanov Notebook | 10 Mar |