1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Applied innodb-5.1-ss269 snapshot.

Fixed BUGS:
  #3300: "UPDATE statement with no index column in where condition locks
    all rows"
    Implement semi-consistent read to reduce lock conflicts at the cost
    of breaking serializability.
    ha_innobase::unlock_row(): reset the "did semi consistent read" flag
    ha_innobase::was_semi_consistent_read(),
    ha_innobase::try_semi_consistent_read(): new methods
    row_prebuilt_t, row_create_prebuilt(): add field row_read_type for
    keeping track of semi-consistent reads
    row_vers_build_for_semi_consistent_read(),
    row_sel_build_committed_vers_for_mysql(): new functions
    row_search_for_mysql(): implement semi-consistent reads

  #9802: "Foreign key checks disallow alter table".
    Added test cases.

  #12456: "Cursor shows incorrect data - DML does not affect,
    probably caching"
    This patch implements a high-granularity read view to be used with
    cursors. In this high-granularity consistent read view modifications 
    done by the creating transaction after the cursor is created or 
   future transactions are not visible. But those modifications that 
   transaction did before the cursor was created are visible.

  #12701: "Support >4GB buffer pool and log files on 64-bit Windows"
    Do not call os_file_create_tmpfile() at runtime. Instead, create all
    tempfiles at startup and guard access to them with mutexes.

  #13778: "If FOREIGN_KEY_CHECKS=0, one can create inconsistent FOREIGN KEYs".
    When FOREIGN_KEY_CHECKS=0 we still need to check that datatypes between
    foreign key references are compatible.

  #14189: "VARBINARY and BINARY variables: trailing space ignored with InnoDB"
    innobase_init(): Assert that
    DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number.
    dtype_get_pad_char(): Do not pad VARBINARY or BINARY columns.
    row_ins_cascade_calc_update_vec(): Refuse ON UPDATE CASCADE when trying
    to change the length of a VARBINARY column that refers to or is referenced
    by a BINARY column. BINARY columns are no longer padded on comparison,
    and thus they cannot be padded on storage either.

  #14747: "Race condition can cause btr_search_drop_page_hash_index() to crash"
    Note that buf_block_t::index should be protected by btr_search_latch
    or an s-latch or x-latch on the index page.
    btr_search_drop_page_hash_index(): Read block->index while holding
    btr_search_latch and use the cached value in the loop.  Remove some
    redundant assertions.

  #15108: "mysqld crashes when innodb_log_file_size is set > 4G"

  #15308: "Problem of Order with Enum Column in Primary Key"

  #15550: "mysqld crashes in printing a FOREIGN KEY error in InnoDB"
    row_ins_foreign_report_add_err(): When printing the parent record,
    use the index in the parent table rather than the index in the child table.

  #15653: "Slow inserts to InnoDB if many thousands of .ibd files"
    Keep track on unflushed modifications to file spaces.  When there are tens
    of thousands of file spaces, flushing all files in fil_flush_file_spaces()
    would be very slow.
    fil_flush_file_spaces(): Only flush unflushed file spaces.
    fil_space_t, fil_system_t: Add a list of unflushed spaces.

  #15991: "innodb-file-per-table + symlink database + rename = cr"
   os_file_handle_error(): Map the error codes EXDEV, ENOTDIR, and EISDIR
   to the new code OS_FILE_PATH_ERROR. Treat this code as OS_FILE_PATH_ERROR.
   This fixes the crash on RENAME TABLE when the .ibd file is a symbolic link
   to a different file system.

  #16157: "InnoDB crashes when main location settings are empty"
    This patch is from Heikki.

  #16298: "InnoDB segfaults in INSERTs in upgrade of 4.0 -> 5.0 tables
    with VARCHAR BINARY"
    dict_load_columns(): Set the charset-collation code
    DATA_MYSQL_BINARY_CHARSET_COLL for those binary string columns
    that lack a charset-collation code, i.e., the tables were created
    with an older version of MySQL/InnoDB than 4.1.2.

  #16229: "MySQL/InnoDB uses full explicit table locks in trigger processing"
    Take a InnoDB table lock only if user has explicitly requested a table
    lock. Added some additional comments to store_lock() and external_lock().

  #16387: "InnoDB crash when dropping a foreign key <table>_ibfk_0"
    Do not mistake TABLENAME_ibfk_0 for auto-generated id.
    dict_table_get_highest_foreign_id(): Ignore foreign constraint
    identifiers starting with the pattern TABLENAME_ibfk_0.

  #16582: "InnoDB: Error in an adaptive hash index pointer to page"
    Account for a race condition when dropping the adaptive hash index
    for a B-tree page.
    btr_search_drop_page_hash_index(): Retry the operation if a hash index
    with different parameters was built meanwhile.  Add diagnostics for the
    case that hash node pointers to the page remain.
    btr_search_info_update_hash(), btr_search_info_update_slow():
    Document the parameter "info" as in/out.

  #16814: "SHOW INNODB STATUS format error in LATEST FOREIGN KEY ERROR
    section"
    Add a missing newline to the LAST FOREIGN KEY ERROR section in SHOW
    INNODB STATUS output.
    dict_foreign_error_report(): Always print a newline after invoking
    dict_print_info_on_foreign_key_in_create_format().

  #16827: "Better InnoDB error message if ibdata files omitted from my.cnf"

  #17126: "CHECK TABLE on InnoDB causes a short hang during check of adaptive
    hash"
    CHECK TABLE blocking other queries, by releasing the btr_search_latch
    periodically during the adaptive hash table validation.

  #17405: "Valgrind: conditional jump or move depends on unititialised values"
    buf_block_init(): Reset magic_n, buf_fix_count and io_fix to avoid
    testing uninitialized variables.



mysql-test/r/innodb.result:
  Applied innodb-5.1-ss269 snapshot.
mysql-test/t/innodb.test:
  Applied innodb-5.1-ss269 snapshot.
sql/ha_innodb.cc:
  Applied innodb-5.1-ss269 snapshot.
sql/ha_innodb.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0btr.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0cur.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0pcur.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/btr/btr0sea.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0buf.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0flu.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0lru.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/buf/buf0rea.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/data/data0data.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/data/data0type.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0boot.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0crea.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0dict.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0load.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dict/dict0mem.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/dyn/dyn0dyn.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/eval/eval0eval.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/eval/eval0proc.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/fil/fil0fil.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/fsp/fsp0fsp.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/fut/fut0lst.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ha/ha0ha.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ha/hash0hash.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ibuf/ibuf0ibuf.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0btr.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0btr.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0cur.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0cur.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0pcur.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0pcur.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0sea.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0sea.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/btr0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0buf.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0buf.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0flu.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0flu.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/buf0lru.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0data.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0data.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0type.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/data0type.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/db0err.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0boot.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0boot.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0crea.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0dict.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0dict.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0load.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dict0mem.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dyn0dyn.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/dyn0dyn.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0eval.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0eval.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0proc.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/eval0proc.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fil0fil.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fsp0fsp.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/fut0lst.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ha0ha.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/hash0hash.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/hash0hash.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ibuf0ibuf.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ibuf0ibuf.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/lock0lock.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/lock0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0log.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0log.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/log0recv.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mach0data.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mach0data.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0dbg.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0dbg.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0mem.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0mem.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mem0pool.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0log.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0mtr.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/mtr0mtr.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0file.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0proc.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0sync.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0sync.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/os0thread.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0cur.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0cur.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0page.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0page.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/page0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0grm.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0opt.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0pars.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0sym.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/pars0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0que.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0que.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/que0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/read0read.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/read0read.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0cmp.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0cmp.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0rec.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/rem0rec.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0ins.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0mysql.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0purge.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0row.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0row.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0sel.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0sel.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0uins.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0umod.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0undo.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0upd.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0upd.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/row0vers.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/srv0srv.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/srv0start.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0arr.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0rw.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0rw.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0sync.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/sync0sync.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0purge.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0purge.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rec.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0roll.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rseg.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0rseg.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0sys.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0sys.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0trx.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0trx.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0undo.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0undo.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/trx0xa.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/univ.i:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/usr0sess.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/usr0types.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0byte.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0byte.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0dbg.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0lst.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0mem.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0mem.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0rnd.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0rnd.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0sort.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0ut.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/include/ut0ut.ic:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/lock/lock0lock.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/log/log0log.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/log/log0recv.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mach/mach0data.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0dbg.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0mem.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mem/mem0pool.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mtr/mtr0log.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/mtr/mtr0mtr.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0file.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0proc.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0sync.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/os/os0thread.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/page/page0cur.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/page/page0page.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/lexyy.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.h:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0grm.y:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0lex.l:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0opt.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0pars.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/pars/pars0sym.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/que/que0que.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/read/read0read.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/rem/rem0cmp.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/rem/rem0rec.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0ins.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0mysql.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0purge.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0row.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0sel.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0uins.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0umod.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0undo.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0upd.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/row/row0vers.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0que.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0srv.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/srv/srv0start.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0arr.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0rw.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/sync/sync0sync.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/thr/thr0loc.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0purge.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0rec.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0roll.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0rseg.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0sys.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0trx.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/trx/trx0undo.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/usr/usr0sess.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0byte.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0dbg.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0mem.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0rnd.c:
  Applied innodb-5.1-ss269 snapshot.
storage/innobase/ut/ut0ut.c:
  Applied innodb-5.1-ss269 snapshot.
mysql-test/r/innodb_unsafe_binlog.result:
  New BitKeeper file ``mysql-test/r/innodb_unsafe_binlog.result''
mysql-test/t/innodb_unsafe_binlog-master.opt:
  New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog-master.opt''
mysql-test/t/innodb_unsafe_binlog.test:
  New BitKeeper file ``mysql-test/t/innodb_unsafe_binlog.test''
storage/innobase/pars/make_bison.sh:
  New BitKeeper file ``storage/innobase/pars/make_bison.sh''
This commit is contained in:
unknown
2006-03-10 19:22:21 +03:00
parent 1cef1679a4
commit 050f14ac37
217 changed files with 17729 additions and 14911 deletions

View File

@@ -1784,7 +1784,7 @@ innodb_sync_spin_loops 20
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 20
set global innodb_thread_concurrency=1000;
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 1000
@@ -2661,6 +2661,32 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
a hex(b) hex(c) filler
1 61626364656667 61626364656667 boo
4 D0B1 D0B1 eight
4 5B 5B five
4 E880BD E880BD four
4 E880BDD0B1E880BD E880BDD0B1E880BD seven
4 E880BDE880BD E880BDE880BD six
3 71727374757677 71727374757677 three
2 696A6B696C6D6E 696A6B696C6D6E two
select a,hex(b),hex(c),filler from t2 order by filler;
a hex(b) hex(c) filler
4 05630563 05630563 email
4 0563 0563 email
4 05612020 05612020 email
4 01FC 01FC email
4 0120 0120 email
4 00640065 00640065 email
4 00E400E50068 00E400E50068 email
4 0000E400 0000E400 email
4 0000563001FC0563 0000563001FC0563 email
1 0061006200630064006500660067 0061006200630064006500660067 one
3 0071007200730074007500760077 0071007200730074007500760077 three
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2689,6 +2715,32 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
a hex(b) hex(c) filler
1 61626364656667 61626364656667 boo
4 D0B1 D0B1 eight
4 5B 5B five
4 E880BD E880BD four
4 E880BDD0B1E880BD E880BDD0B1E880BD seven
4 E880BDE880BD E880BDE880BD six
3 71727374757677 71727374757677 three
2 696A6B696C6D6E 696A6B696C6D6E two
select a,hex(b),hex(c),filler from t2 order by filler;
a hex(b) hex(c) filler
4 05630563 05630563 email
4 0563 0563 email
4 05612020 05612020 email
4 01FC 01FC email
4 0120 0120 email
4 00640065 00640065 email
4 00E400E50068 00E400E50068 email
4 0000E400 0000E400 email
4 0000563001FC0563 0000563001FC0563 email
1 0061006200630064006500660067 0061006200630064006500660067 one
3 0071007200730074007500760077 0071007200730074007500760077 three
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2717,6 +2769,32 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
a hex(b) hex(c) filler
1 61626364656667 61626364656667 boo
4 D0B1 D0B1 eight
4 5B 5B five
4 E880BD E880BD four
4 E880BDD0B1E880BD E880BDD0B1E880BD seven
4 E880BDE880BD E880BDE880BD six
3 71727374757677 71727374757677 three
2 696A6B696C6D6E 696A6B696C6D6E two
select a,hex(b),hex(c),filler from t2 order by filler;
a hex(b) hex(c) filler
4 0120 0120 email
4 01FC 01FC email
4 0563 0563 email
4 0000563001FC0563 0000563001FC0563 email
4 0000E400 0000E400 email
4 00640065 00640065 email
4 00E400E50068 00E400E50068 email
4 05612020 05612020 email
4 05630563 05630563 email
1 0061006200630064006500660067 0061006200630064006500660067 one
3 0071007200730074007500760077 0071007200730074007500760077 three
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2741,9 +2819,92 @@ insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
a hex(b) hex(c) filler
1 61626364656667 61626364656667 boo
4 D0B1 D0B1 eight
4 5B 5B five
4 E880BD E880BD four
3 71727374757677 71727374757677 three
2 696A6B696C6D6E 696A6B696C6D6E two
select a,hex(b),hex(c),filler from t2 order by filler;
a hex(b) hex(c) filler
4 0000E400 0000E400 email
4 00640065 00640065 email
4 00E400E50068 00E400E50068 email
4 0120 0120 email
4 01FC 01FC email
4 05612020 05612020 email
4 0563 0563 email
1 61626364656667 61626364656667 one
3 71727374757677 71727374757677 three
2 696A6B696C6D6E 696A6B696C6D6E two
drop table t1;
drop table t2;
commit;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
ERROR HY000: Can't create table 'test.t1' (errno: 150)
set foreign_key_checks=1;
drop table t2;
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
ERROR HY000: Can't create table 'test.t2' (errno: 150)
set foreign_key_checks=1;
drop table t1;
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb;
alter table t1 modify column a int;
Got one of the listed errors
set foreign_key_checks=1;
drop table t2,t1;
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
alter table t1 convert to character set utf8;
set foreign_key_checks=1;
drop table t2,t1;
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
rename table t3 to t1;
ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150)
set foreign_key_checks=1;
drop table t2,t3;
create table t1(a int primary key) row_format=redundant engine=innodb;
create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
create table t3(a int primary key) row_format=compact engine=innodb;
create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
insert into t1 values(1);
insert into t3 values(1);
insert into t2 values(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
insert into t4 values(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
insert into t2 values(1);
insert into t4 values(1);
update t1 set a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t2 set a=2;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t3 set a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
update t4 set a=2;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
truncate t3;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t2;
truncate t4;
truncate t1;
truncate t3;
drop table t4,t3,t2,t1;
create table t1 (a varchar(255) character set utf8,
b varchar(255) character set utf8,
c varchar(255) character set utf8,
@@ -2757,7 +2918,284 @@ d varchar(255) character set utf8,
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
End of 5.0 tests
create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
insert into t2 values (0x41),(0x4120);
insert into t3 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
insert into t3 values (0x41),(0x4100);
insert into t4 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
insert into t4 values (0x41),(0x4100);
select hex(s1) from t1;
hex(s1)
41
4100
4120
select hex(s1) from t2;
hex(s1)
4100
4120
select hex(s1) from t3;
hex(s1)
4100
41
select hex(s1) from t4;
hex(s1)
4100
41
drop table t1,t2,t3,t4;
create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
insert into t2 values(0x42);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x123456 where a=2;
select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x12 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x12345678 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x123457 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
hex(s1)
1220
update t1 set s1=0x1200 where a=1;
select hex(s1) from t2;
hex(s1)
1200
update t1 set s1=0x4200 where a=1;
select hex(s1) from t2;
hex(s1)
4200
delete from t1 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a=2;
update t2 set s1=0x4120;
delete from t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a!=3;
select a,hex(s1) from t1;
a hex(s1)
3 4120
select hex(s1) from t2;
hex(s1)
4120
drop table t2,t1;
create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41);
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
41
update t1 set s1=0x1234 where a=1;
select hex(s1) from t2;
hex(s1)
41
update t1 set s1=0x12 where a=2;
select hex(s1) from t2;
hex(s1)
12
delete from t1 where a=1;
delete from t1 where a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
select a,hex(s1) from t1;
a hex(s1)
2 12
select hex(s1) from t2;
hex(s1)
12
drop table t2,t1;
CREATE TABLE t1 (
ind enum('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind enum('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
INSERT INTO t1 VALUES ('1', ''),('2', '');
INSERT INTO t2 VALUES ('1', ''),('2', '');
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
hex(ind) hex(string1)
31
32
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
hex(ind) hex(string1)
0031
0032
drop table t1,t2;
CREATE TABLE t1 (
ind set('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind set('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
INSERT INTO t1 VALUES ('1', ''),('2', '');
INSERT INTO t2 VALUES ('1', ''),('2', '');
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
hex(ind) hex(string1)
31
32
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
hex(ind) hex(string1)
0031
0032
drop table t1,t2;
CREATE TABLE t1 (
ind bit not null,
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind bit not null,
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
insert into t1 values(0,''),(1,'');
insert into t2 values(0,''),(1,'');
select hex(ind),hex(string1) from t1 order by string1;
hex(ind) hex(string1)
0
1
select hex(ind),hex(string1) from t2 order by string1;
hex(ind) hex(string1)
0
1
drop table t1,t2;
create table t2 (
a int, b char(10), filler char(10), primary key(a, b(2))
) character set utf8 engine = innodb;
insert into t2 values (1,'abcdefg','one');
insert into t2 values (2,'ijkilmn','two');
insert into t2 values (3, 'qrstuvw','three');
update t2 set a=5, filler='booo' where a=1;
drop table t2;
create table t2 (
a int, b char(10), filler char(10), primary key(a, b(2))
) character set ucs2 engine = innodb;
insert into t2 values (1,'abcdefg','one');
insert into t2 values (2,'ijkilmn','two');
insert into t2 values (3, 'qrstuvw','three');
update t2 set a=5, filler='booo' where a=1;
drop table t2;
create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
insert into t1 values(1,'abcdefg'),(2,'defghijk');
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
select a,hex(b) from t1 order by b;
a hex(b)
1 61626364656667
2 6465666768696A6B
6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
update t1 set b = 'three' where a = 6;
drop table t1;
create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
insert into t1 values(1,'abcdefg'),(2,'defghijk');
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
select a,hex(b) from t1 order by b;
a hex(b)
1 61626364656667
2 6465666768696A6B
6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
update t1 set b = 'three' where a = 6;
drop table t1;
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2(a INT) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
KEY `t2_ibfk_0` (`a`),
CONSTRAINT `t2_ibfk_0` FOREIGN KEY (`a`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
commit;
set autocommit = 0;
update t1 set b = 5 where a = 2;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
set autocommit = 0;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
commit;
commit;
drop trigger t1t;
drop table t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
insert into t2(a) values (1),(2),(3);
insert into t3(a) values (1),(2),(3);
insert into t4(a) values (1),(2),(3);
insert into t3(a) values (5),(7),(8);
insert into t4(a) values (5),(7),(8);
insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
create trigger t1t before insert on t1 for each row begin
INSERT INTO t2 SET a = NEW.a;
end |
create trigger t2t before insert on t2 for each row begin
DELETE FROM t3 WHERE a = NEW.a;
end |
create trigger t3t before delete on t3 for each row begin
UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
end |
create trigger t4t before update on t4 for each row begin
UPDATE t5 SET b = b + 1 where a = NEW.a;
end |
commit;
set autocommit = 0;
update t1 set b = b + 5 where a = 1;
update t2 set b = b + 5 where a = 1;
update t3 set b = b + 5 where a = 1;
update t4 set b = b + 5 where a = 1;
insert into t5(a) values(20);
set autocommit = 0;
insert into t1(a) values(7);
insert into t2(a) values(8);
delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3;
commit;
drop trigger t1t;
drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
CREATE TABLE t1 (
field1 varchar(8) NOT NULL DEFAULT '',
field2 varchar(8) NOT NULL DEFAULT '',

View File

@@ -0,0 +1,35 @@
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;

View File

@@ -1273,7 +1273,7 @@ show variables like "innodb_sync_spin_loops";
# Test for innodb_thread_concurrency variable
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1000;
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
@@ -1610,6 +1610,10 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1639,6 +1643,10 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1668,6 +1676,10 @@ insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1693,10 +1705,102 @@ insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
update t1 set filler = 'boo' where a = 1;
update t2 set filler ='email' where a = 4;
select a,hex(b),hex(c),filler from t1 order by filler;
select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
commit;
# tests for bugs #9802 and #13778
# test that FKs between invalid types are not accepted
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1005
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
set foreign_key_checks=1;
drop table t2;
# test that FKs between different charsets are not accepted in CREATE even
# when f_k_c is 0
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1005
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
set foreign_key_checks=1;
drop table t1;
# test that invalid datatype conversions with ALTER are not allowed
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb;
-- error 1025,1025
alter table t1 modify column a int;
set foreign_key_checks=1;
drop table t2,t1;
# test that charset conversions with ALTER are allowed when f_k_c is 0
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
alter table t1 convert to character set utf8;
set foreign_key_checks=1;
drop table t2,t1;
# test that RENAME does not allow invalid charsets when f_k_c is 0
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1025
rename table t3 to t1;
set foreign_key_checks=1;
drop table t2,t3;
# test that foreign key errors are reported correctly (Bug #15550)
create table t1(a int primary key) row_format=redundant engine=innodb;
create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
create table t3(a int primary key) row_format=compact engine=innodb;
create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
insert into t1 values(1);
insert into t3 values(1);
-- error 1452
insert into t2 values(2);
-- error 1452
insert into t4 values(2);
insert into t2 values(1);
insert into t4 values(1);
-- error 1451
update t1 set a=2;
-- error 1452
update t2 set a=2;
-- error 1451
update t3 set a=2;
-- error 1452
update t4 set a=2;
-- error 1451
truncate t1;
-- error 1451
truncate t3;
truncate t2;
truncate t4;
truncate t1;
truncate t3;
drop table t4,t3,t2,t1;
#
# Test that we can create a large (>1K) key
#
@@ -1714,7 +1818,272 @@ create table t1 (a varchar(255) character set utf8,
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
--echo End of 5.0 tests
# test the padding of BINARY types and collations (Bug #14189)
create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100);
-- error 1062
insert into t2 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120);
-- error 1062
insert into t3 values (0x41),(0x4120),(0x4100);
insert into t3 values (0x41),(0x4100);
-- error 1062
insert into t4 values (0x41),(0x4120),(0x4100);
insert into t4 values (0x41),(0x4100);
select hex(s1) from t1;
select hex(s1) from t2;
select hex(s1) from t3;
select hex(s1) from t4;
drop table t1,t2,t3,t4;
create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
-- error 1452
insert into t2 values(0x42);
insert into t2 values(0x41);
select hex(s1) from t2;
update t1 set s1=0x123456 where a=2;
select hex(s1) from t2;
-- error 1451
update t1 set s1=0x12 where a=1;
-- error 1451
update t1 set s1=0x12345678 where a=1;
-- error 1451
update t1 set s1=0x123457 where a=1;
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
update t1 set s1=0x1200 where a=1;
select hex(s1) from t2;
update t1 set s1=0x4200 where a=1;
select hex(s1) from t2;
-- error 1451
delete from t1 where a=1;
delete from t1 where a=2;
update t2 set s1=0x4120;
-- error 1451
delete from t1;
delete from t1 where a!=3;
select a,hex(s1) from t1;
select hex(s1) from t2;
drop table t2,t1;
create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41);
insert into t2 values(0x41);
select hex(s1) from t2;
update t1 set s1=0x1234 where a=1;
select hex(s1) from t2;
update t1 set s1=0x12 where a=2;
select hex(s1) from t2;
delete from t1 where a=1;
-- error 1451
delete from t1 where a=2;
select a,hex(s1) from t1;
select hex(s1) from t2;
drop table t2,t1;
#
# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
#
CREATE TABLE t1 (
ind enum('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind enum('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
INSERT INTO t1 VALUES ('1', ''),('2', '');
INSERT INTO t2 VALUES ('1', ''),('2', '');
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
drop table t1,t2;
CREATE TABLE t1 (
ind set('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind set('0','1','2') NOT NULL default '0',
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
INSERT INTO t1 VALUES ('1', ''),('2', '');
INSERT INTO t2 VALUES ('1', ''),('2', '');
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
drop table t1,t2;
CREATE TABLE t1 (
ind bit not null,
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
ind bit not null,
string1 varchar(250) NOT NULL,
PRIMARY KEY (ind)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
insert into t1 values(0,''),(1,'');
insert into t2 values(0,''),(1,'');
select hex(ind),hex(string1) from t1 order by string1;
select hex(ind),hex(string1) from t2 order by string1;
drop table t1,t2;
# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
create table t2 (
a int, b char(10), filler char(10), primary key(a, b(2))
) character set utf8 engine = innodb;
insert into t2 values (1,'abcdefg','one');
insert into t2 values (2,'ijkilmn','two');
insert into t2 values (3, 'qrstuvw','three');
update t2 set a=5, filler='booo' where a=1;
drop table t2;
create table t2 (
a int, b char(10), filler char(10), primary key(a, b(2))
) character set ucs2 engine = innodb;
insert into t2 values (1,'abcdefg','one');
insert into t2 values (2,'ijkilmn','two');
insert into t2 values (3, 'qrstuvw','three');
update t2 set a=5, filler='booo' where a=1;
drop table t2;
create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
insert into t1 values(1,'abcdefg'),(2,'defghijk');
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
select a,hex(b) from t1 order by b;
update t1 set b = 'three' where a = 6;
drop table t1;
create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
insert into t1 values(1,'abcdefg'),(2,'defghijk');
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
select a,hex(b) from t1 order by b;
update t1 set b = 'three' where a = 6;
drop table t1;
# Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387)
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2(a INT) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2;
DROP TABLE t2,t1;
#
# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing
#
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
commit;
connection b;
set autocommit = 0;
update t1 set b = 5 where a = 2;
connection a;
delimiter |;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
delimiter ;|
set autocommit = 0;
connection a;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
connection b;
commit;
connection a;
commit;
drop trigger t1t;
drop table t1;
disconnect a;
disconnect b;
#
# Another trigger test
#
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
insert into t2(a) values (1),(2),(3);
insert into t3(a) values (1),(2),(3);
insert into t4(a) values (1),(2),(3);
insert into t3(a) values (5),(7),(8);
insert into t4(a) values (5),(7),(8);
insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
delimiter |;
create trigger t1t before insert on t1 for each row begin
INSERT INTO t2 SET a = NEW.a;
end |
create trigger t2t before insert on t2 for each row begin
DELETE FROM t3 WHERE a = NEW.a;
end |
create trigger t3t before delete on t3 for each row begin
UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
end |
create trigger t4t before update on t4 for each row begin
UPDATE t5 SET b = b + 1 where a = NEW.a;
end |
delimiter ;|
commit;
set autocommit = 0;
update t1 set b = b + 5 where a = 1;
update t2 set b = b + 5 where a = 1;
update t3 set b = b + 5 where a = 1;
update t4 set b = b + 5 where a = 1;
insert into t5(a) values(20);
connection b;
set autocommit = 0;
insert into t1(a) values(7);
insert into t2(a) values(8);
delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3;
commit;
drop trigger t1t;
drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
connection default;
disconnect a;
disconnect b;
#
# Test that cascading updates leading to duplicate keys give the correct

View File

@@ -0,0 +1 @@
--innodb_locks_unsafe_for_binlog=true

View File

@@ -0,0 +1,55 @@
-- 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;

File diff suppressed because it is too large Load Diff

View File

@@ -52,7 +52,6 @@ class ha_innobase: public handler
THR_LOCK_DATA lock;
INNOBASE_SHARE *share;
gptr alloc_ptr;
byte* upd_buff; /* buffer used in updates */
byte* key_val_buff; /* buffer used in converting
search key values from MySQL format
@@ -62,7 +61,6 @@ class ha_innobase: public handler
two buffers */
ulong int_table_flags;
uint primary_key;
uint last_dup_key;
ulong start_of_scan; /* this is set to 1 when we are
starting a table scan but have not
yet fetched any row, else 0 */
@@ -70,7 +68,6 @@ class ha_innobase: public handler
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
or undefined */
uint num_write_row; /* number of write_row() calls */
ulong max_supported_row_length(const byte *buf);
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const byte* record);
@@ -213,12 +210,9 @@ class ha_innobase: public handler
};
extern SHOW_VAR innodb_status_variables[];
extern uint innobase_init_flags, innobase_lock_type;
extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size, innobase_fast_shutdown;
extern ulong innobase_fast_shutdown;
extern ulong innobase_large_page_size;
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
extern long innobase_lock_scan_time;
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
extern longlong innobase_buffer_pool_size, innobase_log_file_size;
extern long innobase_log_buffer_size;
@@ -239,10 +233,11 @@ extern my_bool innobase_log_archive,
innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_create_status_file;
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
calling innobase_end() if you want
InnoDB to shut down without
flushing the buffer pool: this
is equivalent to a 'crash' */
calling innobase_end() if
you want InnoDB to shut down
without flushing the buffer
pool: this is equivalent to
a 'crash' */
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
@@ -254,8 +249,6 @@ extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
}
extern TYPELIB innobase_lock_typelib;
bool innobase_init(void);
int innobase_end(ha_panic_function type);
bool innobase_flush_logs(void);
@@ -323,9 +316,6 @@ int innobase_rollback_by_xid(
XID *xid); /* in : X/Open XA Transaction Identification */
int innobase_xa_end(THD *thd);
int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name,
my_off_t end_offset);

View File

@@ -144,7 +144,7 @@ btr_root_get(
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);
}
@@ -259,7 +259,7 @@ btr_page_create(
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
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);
@@ -846,7 +846,7 @@ btr_page_reorganize_low(
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
ut_ad(!!page_is_comp(page) == index->table->comp);
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);
@@ -1416,15 +1416,12 @@ btr_insert_on_non_leaf_level(
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,
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);
}
@@ -2014,7 +2011,7 @@ btr_compress(
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));
@@ -2413,6 +2410,7 @@ btr_print_tree(
}
#endif /* UNIV_BTR_PRINT */
#ifdef UNIV_DEBUG
/****************************************************************
Checks that the node pointer to a page is appropriate. */
@@ -2458,6 +2456,7 @@ btr_check_node_ptr(
return(TRUE);
}
#endif /* UNIV_DEBUG */
/****************************************************************
Display identification information for a record. */
@@ -2481,7 +2480,7 @@ the index. */
ibool
btr_index_rec_validate(
/*====================*/
/*===================*/
/* out: TRUE if ok */
rec_t* rec, /* in: index record */
dict_index_t* index, /* in: index */
@@ -2508,11 +2507,13 @@ btr_index_rec_validate(
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);
}

View File

@@ -513,7 +513,7 @@ retry_page_get:
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;
@@ -1304,7 +1304,7 @@ btr_cur_update_in_place_log(
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
@@ -1390,7 +1390,7 @@ btr_cur_parse_update_in_place(
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
@@ -1443,7 +1443,7 @@ btr_cur_update_in_place(
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,7 +1466,7 @@ btr_cur_update_in_place(
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
@@ -1558,7 +1558,7 @@ btr_cur_optimistic_update(
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);
@@ -2009,7 +2009,7 @@ btr_cur_del_mark_set_clust_rec_log(
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,7 +2056,8 @@ btr_cur_parse_del_mark_set_clust_rec(
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) {
@@ -2142,7 +2143,7 @@ btr_cur_del_mark_set_clust_rec(
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
@@ -2315,7 +2316,7 @@ btr_cur_del_mark_set_sec_rec(
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);
@@ -3392,6 +3393,9 @@ btr_store_big_rec_extern_fields(
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) {
@@ -3637,7 +3641,7 @@ btr_rec_free_externally_stored_fields(
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++) {

View File

@@ -158,7 +158,7 @@ btr_pcur_copy_stored_position(
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) {
@@ -208,7 +208,7 @@ btr_pcur_restore_position(
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));
ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known, 0);
}

View File

@@ -191,7 +191,7 @@ static
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;
@@ -452,7 +452,7 @@ Updates the search info. */
void
btr_search_info_update_slow(
/*========================*/
btr_search_t* info, /* in: search info */
btr_search_t* info, /* in/out: search info */
btr_cur_t* cursor) /* in: cursor which was just positioned */
{
buf_block_t* block;
@@ -798,8 +798,8 @@ btr_search_guess_on_hash(
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);
}
@@ -889,7 +889,8 @@ Drops a page hash index. */
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 @@ btr_search_drop_page_hash_index(
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);
@@ -932,11 +934,16 @@ btr_search_drop_page_hash_index(
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 @@ btr_search_drop_page_hash_index(
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));
if (n_bytes > 0) {
ut_a(n_fields < rec_get_n_fields(rec, block->index));
}
}
tree_id = btr_page_get_index_id(page);
ut_a(0 == ut_dulint_cmp(tree_id, index->id));
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 @@ next_rec:
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,9 +1021,21 @@ next_rec:
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);
btr_search_validate();
} else {
rw_lock_x_unlock(&btr_search_latch);
}
mem_free(folds);
}
@@ -1573,14 +1600,29 @@ btr_search_validate(void)
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) {
@@ -1634,10 +1676,21 @@ btr_search_validate(void)
}
}
if (!ha_validate(btr_search_sys->hash_index)) {
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);
if (UNIV_LIKELY_NULL(heap)) {

View File

@@ -335,10 +335,10 @@ buf_page_is_corrupted(
}
#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 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);
@@ -347,11 +347,15 @@ buf_page_is_corrupted(
- 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)
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) {
@@ -359,7 +363,8 @@ buf_page_is_corrupted(
}
checksum = buf_calc_page_new_checksum(read_buf);
checksum_field = mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM);
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 */
@@ -427,7 +432,8 @@ buf_page_print(
"InnoDB: Page may be an update undo log page\n");
}
if (fil_page_get_type(read_buf) == FIL_PAGE_INDEX) {
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)),
@@ -446,11 +452,42 @@ buf_page_print(
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,12 +501,17 @@ buf_block_init(
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;
@@ -839,7 +881,7 @@ the buffer pool. */
void
buf_page_make_young(
/*=================*/
/*================*/
buf_frame_t* frame) /* in: buffer frame of a file page */
{
buf_block_t* block;
@@ -1779,6 +1821,10 @@ buf_page_create(
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.
@@ -2297,9 +2343,8 @@ buf_print_io(
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))
(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",

View File

@@ -120,7 +120,7 @@ buf_flush_ready_for_replace(
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);
}
@@ -357,7 +357,8 @@ buf_flush_buffered_writes(void)
"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->buf_fix_count,
(ulong)block->io_fix,
(ulong)block->state);
}
ut_a(block->state == BUF_BLOCK_FILE_PAGE);

View File

@@ -458,7 +458,8 @@ buf_read_ahead_linear(
/* Not accessed */
fail_count++;
} else if (pred_block && (ut_ulint_cmp(block->LRU_position,
} else if (pred_block
&& (ut_ulint_cmp(block->LRU_position,
pred_block->LRU_position)
!= asc_or_desc)) {
/* Accesses not in the right order */

View File

@@ -18,10 +18,10 @@ Created 5/30/1994 Heikki Tuuri
#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 */
@@ -431,6 +431,22 @@ dfield_print_also_hex(
}
}
/*****************************************************************
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 @@ dtuple_print(
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
ulint n_fields;
ulint i;
@@ -451,13 +466,7 @@ dtuple_print(
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);
}
@@ -526,7 +535,7 @@ dtuple_convert_big_rec(
while (rec_get_converted_size(index, entry)
>= ut_min(page_get_free_space_of_empty(
index->table->comp) / 2,
dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) {
longest = 0;
@@ -563,7 +572,9 @@ dtuple_convert_big_rec(
/* 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) {

View File

@@ -252,7 +252,7 @@ dtype_print(
} else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr);
} else {
fprintf(stderr, "prtype %lu", (ulong) mtype);
fprintf(stderr, "prtype %lu", (ulong) prtype);
}
}

View File

@@ -238,15 +238,14 @@ dict_boot(void)
dict_sys->row_id = ut_dulint_add(
ut_dulint_align_up(
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
&mtr),
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);
@@ -265,7 +264,7 @@ dict_boot(void)
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 @@ dict_boot(void)
/*-------------------------*/
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);
@@ -300,15 +299,15 @@ dict_boot(void)
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 @@ dict_boot(void)
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 @@ dict_boot(void)
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(

View File

@@ -62,9 +62,13 @@ dict_create_sys_tables_tuple(
/* 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);
@@ -634,7 +638,7 @@ dict_create_index_tree_step(
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); */
@@ -671,7 +675,7 @@ dict_drop_index_tree(
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);
@@ -743,7 +747,7 @@ dict_truncate_index_tree(
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);

View File

@@ -199,6 +199,7 @@ FILE* dict_foreign_err_file = NULL;
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 @@ dict_casedn_str(
{
innobase_casedn_str(a);
}
#endif /* !UNIV_HOTBACKUP */
/************************************************************************
Checks if the database name in two table names is the same. */
@@ -1605,12 +1607,11 @@ dict_index_add_col(
/*===============*/
dict_index_t* index, /* in: index */
dict_col_t* col, /* in: column */
ulint order, /* in: order criterion */
ulint prefix_len) /* in: column prefix length */
{
dict_field_t* field;
dict_mem_index_add_field(index, col->name, order, prefix_len);
dict_mem_index_add_field(index, col->name, prefix_len);
field = dict_index_get_nth_field(index, index->n_def - 1);
@@ -1632,17 +1633,6 @@ dict_index_add_col(
if (!(dtype_get_prtype(&col->type) & DATA_NOT_NULL)) {
index->n_nullable++;
}
if (index->n_def > 1) {
const dict_field_t* field2 =
dict_index_get_nth_field(index, index->n_def - 2);
field->fixed_offs = (!field2->fixed_len ||
field2->fixed_offs == ULINT_UNDEFINED)
? ULINT_UNDEFINED
: field2->fixed_len + field2->fixed_offs;
} else {
field->fixed_offs = 0;
}
}
/***********************************************************************
@@ -1664,8 +1654,7 @@ dict_index_copy(
for (i = start; i < end; i++) {
field = dict_index_get_nth_field(index2, i);
dict_index_add_col(index1, field->col, field->order,
field->prefix_len);
dict_index_add_col(index1, field->col, field->prefix_len);
}
}
@@ -1750,9 +1739,7 @@ dict_index_build_internal_clust(
/* Create a new index object with certainly enough fields */
new_index = dict_mem_index_create(table->name,
index->name,
table->space,
index->type,
index->name, table->space, index->type,
index->n_fields + table->n_cols);
/* Copy other relevant data from the old index struct to the new
@@ -1769,7 +1756,7 @@ dict_index_build_internal_clust(
/* Add the mix id column */
dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_MIX_ID), 0, 0);
dict_table_get_sys_col(table, DATA_MIX_ID), 0);
/* Copy the rest of fields */
dict_index_copy(new_index, index, table->mix_len,
@@ -1801,21 +1788,27 @@ dict_index_build_internal_clust(
trx_id_pos = new_index->n_def;
ut_ad(DATA_ROW_ID == 0);
ut_ad(DATA_TRX_ID == 1);
ut_ad(DATA_ROLL_PTR == 2);
#if DATA_ROW_ID != 0
# error "DATA_ROW_ID != 0"
#endif
#if DATA_TRX_ID != 1
# error "DATA_TRX_ID != 1"
#endif
#if DATA_ROLL_PTR != 2
# error "DATA_ROLL_PTR != 2"
#endif
if (!(index->type & DICT_UNIQUE)) {
dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_ROW_ID), 0, 0);
dict_table_get_sys_col(table, DATA_ROW_ID), 0);
trx_id_pos++;
}
dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_TRX_ID), 0, 0);
dict_table_get_sys_col(table, DATA_TRX_ID), 0);
dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_ROLL_PTR), 0, 0);
dict_table_get_sys_col(table, DATA_ROLL_PTR), 0);
for (i = 0; i < trx_id_pos; i++) {
@@ -1869,7 +1862,7 @@ dict_index_build_internal_clust(
ut_ad(col->type.mtype != DATA_SYS);
if (col->aux == ULINT_UNDEFINED) {
dict_index_add_col(new_index, col, 0, 0);
dict_index_add_col(new_index, col, 0);
}
}
@@ -1927,11 +1920,8 @@ dict_index_build_internal_non_clust(
/* Create a new index */
new_index = dict_mem_index_create(table->name,
index->name,
index->space,
index->type,
index->n_fields
+ 1 + clust_index->n_uniq);
index->name, index->space, index->type,
index->n_fields + 1 + clust_index->n_uniq);
/* Copy other relevant data from the old index
struct to the new struct: it inherits the values */
@@ -1973,7 +1963,7 @@ dict_index_build_internal_non_clust(
field = dict_index_get_nth_field(clust_index, i);
if (field->col->aux == ULINT_UNDEFINED) {
dict_index_add_col(new_index, field->col, 0,
dict_index_add_col(new_index, field->col,
field->prefix_len);
}
}
@@ -2104,8 +2094,11 @@ dict_foreign_find_index(
dict_table_t* table, /* in: table */
const char** columns,/* in: array of column names */
ulint n_cols, /* in: number of columns */
dict_index_t* types_idx)/* in: NULL or an index to whose types the
dict_index_t* types_idx, /* in: NULL or an index to whose types the
column types must match */
ibool check_charsets) /* in: whether to check charsets.
only has an effect if types_idx !=
NULL. */
{
#ifndef UNIV_HOTBACKUP
dict_index_t* index;
@@ -2135,7 +2128,8 @@ dict_foreign_find_index(
if (types_idx && !cmp_types_are_equal(
dict_index_get_nth_type(index, i),
dict_index_get_nth_type(types_idx, i))) {
dict_index_get_nth_type(types_idx, i),
check_charsets)) {
break;
}
@@ -2157,6 +2151,7 @@ dict_foreign_find_index(
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(NULL);
#endif /* UNIV_HOTBACKUP */
}
@@ -2190,8 +2185,9 @@ dict_foreign_error_report(
fputs(msg, file);
fputs(" Constraint:\n", file);
dict_print_info_on_foreign_key_in_create_format(file, NULL, fk, TRUE);
putc('\n', file);
if (fk->foreign_index) {
fputs("\nThe index in the foreign key in table is ", file);
fputs("The index in the foreign key in table is ", file);
ut_print_name(file, NULL, fk->foreign_index->name);
fputs(
"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
@@ -2212,7 +2208,8 @@ dict_foreign_add_to_cache(
/*======================*/
/* out: DB_SUCCESS or error code */
dict_foreign_t* foreign, /* in, own: foreign key constraint */
ibool check_types) /* in: TRUE=check type compatibility */
ibool check_charsets) /* in: TRUE=check charset
compatibility */
{
dict_table_t* for_table;
dict_table_t* ref_table;
@@ -2248,16 +2245,10 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->referenced_table == NULL && ref_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->foreign_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(ref_table,
(const char**) for_in_cache->referenced_col_names,
for_in_cache->n_fields,
types_idx);
for_in_cache->foreign_index, check_charsets);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,
@@ -2281,16 +2272,10 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->foreign_table == NULL && for_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->referenced_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(for_table,
(const char**) for_in_cache->foreign_col_names,
for_in_cache->n_fields,
types_idx);
for_in_cache->referenced_index, check_charsets);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,
@@ -2564,6 +2549,7 @@ dict_scan_col(
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(NULL);
#endif /* UNIV_HOTBACKUP */
}
@@ -2669,6 +2655,7 @@ dict_scan_table_name(
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(NULL);
#endif /* UNIV_HOTBACKUP */
}
@@ -2810,7 +2797,8 @@ dict_table_get_highest_foreign_id(
if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
&& 0 == ut_memcmp(foreign->id, table->name, len)
&& 0 == ut_memcmp(foreign->id + len,
dict_ibfk, (sizeof dict_ibfk) - 1)) {
dict_ibfk, (sizeof dict_ibfk) - 1)
&& foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
/* It is of the >= 4.0.18 format */
id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1),
@@ -3005,8 +2993,7 @@ loop:
command, determine if there are any foreign keys, and
if so, immediately reject the command if the table is a
temporary one. For now, this kludge will work. */
if (reject_fks && (UT_LIST_GET_LEN(table->foreign_list) > 0))
{
if (reject_fks && (UT_LIST_GET_LEN(table->foreign_list) > 0)) {
return DB_CANNOT_ADD_CONSTRAINT;
}
@@ -3097,7 +3084,7 @@ col_loop1:
/* Try to find an index which contains the columns
as the first fields and in the right order */
index = dict_foreign_find_index(table, column_names, i, NULL);
index = dict_foreign_find_index(table, column_names, i, NULL, TRUE);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
@@ -3362,8 +3349,7 @@ try_find_index:
if (referenced_table) {
index = dict_foreign_find_index(referenced_table,
column_names, i,
foreign->foreign_index);
column_names, i, foreign->foreign_index, TRUE);
if (!index) {
dict_foreign_free(foreign);
mutex_enter(&dict_foreign_err_mutex);
@@ -3705,7 +3691,7 @@ dict_tree_find_index_low(
&& UNIV_UNLIKELY(table->type != DICT_TABLE_ORDINARY)) {
/* Get the mix id of the record */
ut_a(!table->comp);
ut_a(!dict_table_is_comp(table));
mix_id = mach_dulint_read_compressed(
rec_get_nth_field_old(rec, table->mix_len, &len));
@@ -3801,7 +3787,7 @@ dict_is_mixed_table_rec(
byte* mix_id_field;
ulint len;
ut_ad(!table->comp);
ut_ad(!dict_table_is_comp(table));
mix_id_field = rec_get_nth_field_old(rec,
table->mix_len, &len);
@@ -3864,7 +3850,7 @@ dict_tree_build_node_ptr(
on non-leaf levels we remove the last field, which
contains the page number of the child page */
ut_a(!ind->table->comp);
ut_a(!dict_table_is_comp(ind->table));
n_unique = rec_get_n_fields_old(rec);
if (level > 0) {
@@ -3927,7 +3913,7 @@ dict_tree_copy_rec_order_prefix(
index = dict_tree_find_index_low(tree, rec);
if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) {
ut_a(!index->table->comp);
ut_a(!dict_table_is_comp(index->table));
n = rec_get_n_fields_old(rec);
} else {
n = dict_index_get_n_unique_in_tree(index);
@@ -3954,7 +3940,8 @@ dict_tree_build_data_tuple(
ind = dict_tree_find_index_low(tree, rec);
ut_ad(ind->table->comp || n_fields <= rec_get_n_fields_old(rec));
ut_ad(dict_table_is_comp(ind->table)
|| n_fields <= rec_get_n_fields_old(rec));
tuple = dtuple_create(heap, n_fields);
@@ -3978,7 +3965,7 @@ dict_index_calc_min_rec_len(
ulint sum = 0;
ulint i;
if (UNIV_LIKELY(index->table->comp)) {
if (dict_table_is_comp(index->table)) {
ulint nullable = 0;
sum = REC_N_NEW_EXTRA_BYTES;
for (i = 0; i < dict_index_get_n_fields(index); i++) {
@@ -4278,7 +4265,7 @@ dict_index_print_low(
}
fprintf(stderr,
" INDEX: name %s, id %lu %lu, fields %lu/%lu, type %lu\n"
" INDEX: name %s, id %lu %lu, fields %lu/%lu, uniq %lu, type %lu\n"
" root page %lu, appr.key vals %lu,"
" leaf pages %lu, size pages %lu\n"
" FIELDS: ",
@@ -4286,7 +4273,9 @@ dict_index_print_low(
(ulong) ut_dulint_get_high(tree->id),
(ulong) ut_dulint_get_low(tree->id),
(ulong) index->n_user_defined_cols,
(ulong) index->n_fields, (ulong) index->type,
(ulong) index->n_fields,
(ulong) index->n_uniq,
(ulong) index->type,
(ulong) tree->page,
(ulong) n_vals,
(ulong) index->stat_n_leaf_pages,

View File

@@ -58,7 +58,7 @@ dict_get_first_table_name_in_db(
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!sys_tables->comp);
ut_a(!dict_table_is_comp(sys_tables));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -94,7 +94,7 @@ loop:
return(NULL);
}
if (!rec_get_deleted_flag(rec, sys_tables->comp)) {
if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */
@@ -169,7 +169,7 @@ loop:
field = rec_get_nth_field_old(rec, 0, &len);
if (!rec_get_deleted_flag(rec, sys_tables->comp)) {
if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */
@@ -235,7 +235,7 @@ dict_check_tablespaces_and_store_max_id(
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!sys_tables->comp);
ut_a(!dict_table_is_comp(sys_tables));
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
@@ -264,7 +264,7 @@ loop:
field = rec_get_nth_field_old(rec, 0, &len);
if (!rec_get_deleted_flag(rec, sys_tables->comp)) {
if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */
@@ -343,7 +343,7 @@ dict_load_columns(
sys_columns = dict_table_get_low("SYS_COLUMNS");
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
ut_a(!sys_columns->comp);
ut_a(!dict_table_is_comp(sys_columns));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -362,7 +362,7 @@ dict_load_columns(
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_a(!rec_get_deleted_flag(rec, sys_columns->comp));
ut_a(!rec_get_deleted_flag(rec, 0));
field = rec_get_nth_field_old(rec, 0, &len);
ut_ad(len == 8);
@@ -385,14 +385,24 @@ dict_load_columns(
field = rec_get_nth_field_old(rec, 6, &len);
prtype = mach_read_from_4(field);
if (dtype_is_non_binary_string_type(mtype, prtype)
&& dtype_get_charset_coll(prtype) == 0) {
/* This is a non-binary string type, and the table
was created with < 4.1.2. Use the default charset. */
if (dtype_get_charset_coll(prtype) == 0
&& dtype_is_string_type(mtype)) {
/* The table was created with < 4.1.2. */
if (dtype_is_binary_string_type(mtype, prtype)) {
/* Use the binary collation for
string columns of binary type. */
prtype = dtype_form_prtype(prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
} else {
/* Use the default charset for
other than binary columns. */
prtype = dtype_form_prtype(prtype,
data_mysql_default_charset_coll);
}
}
field = rec_get_nth_field_old(rec, 7, &len);
col_len = mach_read_from_4(field);
@@ -466,7 +476,7 @@ dict_load_fields(
sys_fields = dict_table_get_low("SYS_FIELDS");
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
ut_a(!sys_fields->comp);
ut_a(!dict_table_is_comp(sys_fields));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -484,7 +494,7 @@ dict_load_fields(
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
if (rec_get_deleted_flag(rec, sys_fields->comp)) {
if (rec_get_deleted_flag(rec, 0)) {
dict_load_report_deleted_index(table->name, i);
}
@@ -523,7 +533,7 @@ dict_load_fields(
field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index,
mem_heap_strdupl(heap, (char*) field, len), 0, prefix_len);
mem_heap_strdupl(heap, (char*) field, len), prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -579,7 +589,7 @@ dict_load_indexes(
sys_indexes = dict_table_get_low("SYS_INDEXES");
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
ut_a(!sys_indexes->comp);
ut_a(!dict_table_is_comp(sys_indexes));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -607,7 +617,7 @@ dict_load_indexes(
break;
}
if (rec_get_deleted_flag(rec, table->comp)) {
if (rec_get_deleted_flag(rec, dict_table_is_comp(table))) {
dict_load_report_deleted_index(table->name,
ULINT_UNDEFINED);
@@ -729,6 +739,7 @@ dict_load_table(
ulint len;
ulint space;
ulint n_cols;
ulint flags;
ulint err;
mtr_t mtr;
@@ -742,7 +753,7 @@ dict_load_table(
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!sys_tables->comp);
ut_a(!dict_table_is_comp(sys_tables));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -755,7 +766,7 @@ dict_load_table(
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, sys_tables->comp)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
btr_pcur_close(&pcur);
@@ -817,10 +828,15 @@ dict_load_table(
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
flags = 0;
/* The high-order bit of N_COLS is the "compact format" flag. */
table = dict_mem_table_create(name, space,
n_cols & ~0x80000000UL,
!!(n_cols & 0x80000000UL));
if (n_cols & 0x80000000UL) {
flags |= DICT_TF_COMPACT;
}
table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
flags);
table->ibd_file_missing = ibd_file_missing;
@@ -928,7 +944,7 @@ dict_load_table_on_id(
sys_tables = dict_sys->sys_tables;
sys_table_ids = dict_table_get_next_index(
dict_table_get_first_index(sys_tables));
ut_a(!sys_tables->comp);
ut_a(!dict_table_is_comp(sys_tables));
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
@@ -945,7 +961,7 @@ dict_load_table_on_id(
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, sys_tables->comp)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
btr_pcur_close(&pcur);
@@ -1042,7 +1058,7 @@ dict_load_foreign_cols(
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
ut_a(!sys_foreign_cols->comp);
ut_a(!dict_table_is_comp(sys_foreign_cols));
tuple = dtuple_create(foreign->heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -1057,7 +1073,7 @@ dict_load_foreign_cols(
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_a(!rec_get_deleted_flag(rec, sys_foreign_cols->comp));
ut_a(!rec_get_deleted_flag(rec, 0));
field = rec_get_nth_field_old(rec, 0, &len);
ut_a(len == ut_strlen(id));
@@ -1091,7 +1107,7 @@ dict_load_foreign(
/* out: DB_SUCCESS or error code */
const char* id, /* in: foreign constraint id as a
null-terminated string */
ibool check_types)/* in: TRUE=check type compatibility */
ibool check_charsets)/* in: TRUE=check charset compatibility */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
@@ -1115,7 +1131,7 @@ dict_load_foreign(
sys_foreign = dict_table_get_low("SYS_FOREIGN");
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
ut_a(!sys_foreign->comp);
ut_a(!dict_table_is_comp(sys_foreign));
tuple = dtuple_create(heap2, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -1128,7 +1144,7 @@ dict_load_foreign(
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, sys_foreign->comp)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
fprintf(stderr,
@@ -1204,7 +1220,7 @@ dict_load_foreign(
a new foreign key constraint but loading one from the data
dictionary. */
return(dict_foreign_add_to_cache(foreign, check_types));
return(dict_foreign_add_to_cache(foreign, check_charsets));
}
/***************************************************************************
@@ -1219,7 +1235,8 @@ dict_load_foreigns(
/*===============*/
/* out: DB_SUCCESS or error code */
const char* table_name, /* in: table name */
ibool check_types) /* in: TRUE=check type compatibility */
ibool check_charsets) /* in: TRUE=check charset
compatibility */
{
btr_pcur_t pcur;
mem_heap_t* heap;
@@ -1249,7 +1266,7 @@ dict_load_foreigns(
return(DB_ERROR);
}
ut_a(!sys_foreign->comp);
ut_a(!dict_table_is_comp(sys_foreign));
mtr_start(&mtr);
/* Get the secondary index based on FOR_NAME from table
@@ -1304,7 +1321,7 @@ loop:
goto next_rec;
}
if (rec_get_deleted_flag(rec, sys_foreign->comp)) {
if (rec_get_deleted_flag(rec, 0)) {
goto next_rec;
}
@@ -1319,7 +1336,7 @@ loop:
/* Load the foreign constraint definition to the dictionary cache */
err = dict_load_foreign(id, check_types);
err = dict_load_foreign(id, check_charsets);
if (err != DB_SUCCESS) {
btr_pcur_close(&pcur);

View File

@@ -36,13 +36,13 @@ dict_mem_table_create(
ignored if the table is made a member of
a cluster */
ulint n_cols, /* in: number of columns */
ibool comp) /* in: TRUE=compact page format */
ulint flags) /* in: table flags */
{
dict_table_t* table;
mem_heap_t* heap;
ut_ad(name);
ut_ad(comp == FALSE || comp == TRUE);
ut_ad(!(flags & ~DICT_TF_COMPACT));
heap = mem_heap_create(DICT_HEAP_SIZE);
@@ -51,12 +51,12 @@ dict_mem_table_create(
table->heap = heap;
table->type = DICT_TABLE_ORDINARY;
table->flags = flags;
table->name = mem_heap_strdup(heap, name);
table->dir_path_of_temp_table = NULL;
table->space = space;
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
table->comp = comp;
table->n_def = 0;
table->n_cols = n_cols + DATA_N_SYS_COLS;
table->mem_fix = 0;
@@ -114,7 +114,7 @@ dict_mem_cluster_create(
dict_table_t* cluster;
/* Clustered tables cannot work with the compact record format. */
cluster = dict_mem_table_create(name, space, n_cols, FALSE);
cluster = dict_mem_table_create(name, space, n_cols, 0);
cluster->type = DICT_TABLE_CLUSTER;
cluster->mix_len = mix_len;
@@ -261,8 +261,6 @@ dict_mem_index_add_field(
/*=====================*/
dict_index_t* index, /* in: index */
const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len) /* in: 0 or the column prefix length
in a MySQL index like
INDEX (textcol(25)) */
@@ -277,8 +275,6 @@ dict_mem_index_add_field(
field = dict_index_get_nth_field(index, index->n_def - 1);
field->name = name;
field->order = order;
field->prefix_len = prefix_len;
}

View File

@@ -181,6 +181,11 @@ struct fil_space_struct {
hash_node_t name_hash;/* hash chain the name_hash table */
rw_lock_t latch; /* latch protecting the file space storage
allocation */
UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
/* list of spaces with at least one unflushed
file we have written to */
ibool is_in_unflushed_spaces; /* TRUE if this space is
currently in the list above */
UT_LIST_NODE_T(fil_space_t) space_list;
/* list of all spaces */
ibuf_data_t* ibuf_data;
@@ -213,6 +218,12 @@ struct fil_system_struct {
not put to this list: they are opened
after the startup, and kept open until
shutdown */
UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces;
/* base node for the list of those
tablespaces whose files contain
unflushed writes; those spaces have
at least one file node where
modification_counter > flush_counter */
ulint n_open; /* number of files currently open */
ulint max_n_open; /* n_open is not allowed to exceed
this */
@@ -389,6 +400,36 @@ fil_space_get_ibuf_data(
return(space->ibuf_data);
}
/**************************************************************************
Checks if all the file nodes in a space are flushed. The caller must hold
the fil_system mutex. */
static
ibool
fil_space_is_flushed(
/*=================*/
/* out: TRUE if all are flushed */
fil_space_t* space) /* in: space */
{
fil_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(fil_system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_FIRST(space->chain);
while (node) {
if (node->modification_counter > node->flush_counter) {
return(FALSE);
}
node = UT_LIST_GET_NEXT(chain, node);
}
return(TRUE);
}
/***********************************************************************
Appends a new file to the chain of files of a space. File must be closed. */
@@ -469,10 +510,12 @@ fil_node_open_file(
ulint size_low;
ulint size_high;
ibool ret;
ibool success;
#ifndef UNIV_HOTBACKUP
byte* buf2;
byte* page;
ibool success;
ulint space_id;
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
@@ -505,9 +548,6 @@ fil_node_open_file(
ut_a(0);
}
ut_a(space->purpose != FIL_LOG);
ut_a(space->id != 0);
os_file_get_size(node->handle, &size_low, &size_high);
size_bytes = (((ib_longlong)size_high) << 32)
@@ -516,6 +556,9 @@ fil_node_open_file(
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
#else
ut_a(space->purpose != FIL_LOG);
ut_a(space->id != 0);
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Error: the size of single-table tablespace file %s\n"
@@ -841,6 +884,16 @@ fil_node_free(
node->modification_counter = node->flush_counter;
if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces,
system->unflushed_spaces,
space);
}
fil_node_close_file(node, system);
}
@@ -1004,6 +1057,8 @@ try_again:
HASH_INSERT(fil_space_t, name_hash, system->name_hash,
ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
UT_LIST_ADD_LAST(space_list, system->space_list, space);
mutex_exit(&(system->mutex));
@@ -1099,6 +1154,13 @@ fil_space_free(
HASH_DELETE(fil_space_t, name_hash, system->name_hash,
ut_fold_string(space->name), space);
if (space->is_in_unflushed_spaces) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces,
space);
}
UT_LIST_REMOVE(space_list, system->space_list, space);
ut_a(space->magic_n == FIL_SPACE_MAGIC_N);
@@ -1250,6 +1312,7 @@ fil_system_create(
system->tablespace_version = 0;
UT_LIST_INIT(system->unflushed_spaces);
UT_LIST_INIT(system->space_list);
return(system);
@@ -1581,7 +1644,7 @@ Decrements the count of pending insert buffer page merges. */
void
fil_decr_pending_ibuf_merges(
/*========================*/
/*=========================*/
ulint id) /* in: space id */
{
fil_system_t* system = fil_system;
@@ -2744,6 +2807,7 @@ fil_load_single_table_tablespace(
filename);
srv_normalize_path_for_win(filepath);
#ifdef __WIN__
# ifndef UNIV_HOTBACKUP
/* If lower_case_table_names is 0 or 2, then MySQL allows database
directory names with upper case letters. On Windows, all table and
database names in InnoDB are internally always in lower case. Put the
@@ -2751,6 +2815,7 @@ fil_load_single_table_tablespace(
internal data dictionary. */
dict_casedn_str(filepath);
# endif /* !UNIV_HOTBACKUP */
#endif
file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
OS_FILE_READ_ONLY, &success);
@@ -3496,6 +3561,7 @@ fil_extend_space_to_desired_size(
*actual_size = space->size;
#ifndef UNIV_HOTBACKUP
if (space_id == 0) {
ulint pages_per_mb = (1024 * 1024) / UNIV_PAGE_SIZE;
@@ -3505,6 +3571,7 @@ fil_extend_space_to_desired_size(
srv_data_file_sizes[srv_n_data_files - 1] =
(node->size / pages_per_mb) * pages_per_mb;
}
#endif /* !UNIV_HOTBACKUP */
/*
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
@@ -3545,8 +3612,8 @@ fil_extend_tablespaces_to_stored_len(void)
ut_a(space->purpose == FIL_TABLESPACE);
mutex_exit(&(system->mutex)); /* no need to protect with a
mutex, because this is a single-
threaded operation */
mutex, because this is a
single-threaded operation */
error = fil_read(TRUE, space->id, 0, 0, UNIV_PAGE_SIZE, buf,
NULL);
ut_a(error == DB_SUCCESS);
@@ -3742,6 +3809,14 @@ fil_node_complete_io(
if (type == OS_FILE_WRITE) {
system->modification_counter++;
node->modification_counter = system->modification_counter;
if (!node->space->is_in_unflushed_spaces) {
node->space->is_in_unflushed_spaces = TRUE;
UT_LIST_ADD_FIRST(unflushed_spaces,
system->unflushed_spaces,
node->space);
}
}
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
@@ -3751,6 +3826,31 @@ fil_node_complete_io(
}
}
/************************************************************************
Report information about an invalid page access. */
static
void
fil_report_invalid_page_access(
/*===========================*/
ulint block_offset, /* in: block offset */
ulint space_id, /* in: space id */
const char* space_name, /* in: space name */
ulint byte_offset, /* in: byte offset */
ulint len, /* in: I/O length */
ulint type) /* in: I/O type */
{
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu.\n"
"InnoDB: If you get this error at mysqld startup, please check that\n"
"InnoDB: your my.cnf matches the ibdata files that you have in the\n"
"InnoDB: MySQL server.\n",
(ulong) block_offset, (ulong) space_id, space_name,
(ulong) byte_offset, (ulong) len, (ulong) type);
}
/************************************************************************
Reads or writes data. This operation is asynchronous (aio). */
@@ -3857,14 +3957,8 @@ fil_io(
for (;;) {
if (node == NULL) {
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu\n",
(ulong) block_offset, (ulong) space_id,
space->name, (ulong) byte_offset, (ulong) len,
(ulong) type);
fil_report_invalid_page_access(block_offset, space_id,
space->name, byte_offset, len, type);
ut_error;
}
@@ -3893,15 +3987,10 @@ fil_io(
if (space->purpose == FIL_TABLESPACE && space->id != 0
&& node->size <= block_offset) {
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu\n",
(ulong) block_offset, (ulong) space_id,
space->name, (ulong) byte_offset, (ulong) len,
(ulong) type);
ut_a(0);
fil_report_invalid_page_access(block_offset, space_id,
space->name, byte_offset, len, type);
ut_error;
}
/* Now we have made the changes in the data structures of system */
@@ -4162,6 +4251,16 @@ retry:
skip_flush:
if (node->flush_counter < old_mod_counter) {
node->flush_counter = old_mod_counter;
if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces,
system->unflushed_spaces,
space);
}
}
if (space->purpose == FIL_TABLESPACE) {
@@ -4193,13 +4292,13 @@ fil_flush_file_spaces(
mutex_enter(&(system->mutex));
space = UT_LIST_GET_FIRST(system->space_list);
space = UT_LIST_GET_FIRST(system->unflushed_spaces);
while (space) {
if (space->purpose == purpose && !space->is_being_deleted) {
space->n_pending_flushes++; /* prevent dropping of the
space while we are
space->n_pending_flushes++; /* prevent dropping of
the space while we are
flushing */
mutex_exit(&(system->mutex));
@@ -4209,7 +4308,7 @@ fil_flush_file_spaces(
space->n_pending_flushes--;
}
space = UT_LIST_GET_NEXT(space_list, space);
space = UT_LIST_GET_NEXT(unflushed_spaces, space);
}
mutex_exit(&(system->mutex));

View File

@@ -610,8 +610,10 @@ xdes_calc_descriptor_page(
/* out: descriptor page offset */
ulint offset) /* in: page offset */
{
ut_ad(UNIV_PAGE_SIZE > XDES_ARR_OFFSET
+ (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE) * XDES_SIZE);
#if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
+ (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE) * XDES_SIZE
# error
#endif
return(ut_2pow_round(offset, XDES_DESCRIBED_PER_PAGE));
}
@@ -789,7 +791,7 @@ Inits a file page whose prior contents should be ignored. */
static
void
fsp_init_file_page_low(
/*=====================*/
/*===================*/
byte* ptr) /* in: pointer to a page */
{
page_t* page;
@@ -807,7 +809,6 @@ fsp_init_file_page_low(
/***************************************************************
Inits a file page whose prior contents should be ignored. */
static
void
fsp_init_file_page(
@@ -891,9 +892,13 @@ fsp_header_init(
fsp_init_file_page(page, mtr);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_FSP_HDR,
MLOG_2BYTES, mtr);
header = FSP_HEADER_OFFSET + page;
mlog_write_ulint(header + FSP_SPACE_ID, space, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_NOT_USED, 0, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_SIZE, size, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FREE_LIMIT, 0, MLOG_4BYTES, mtr);
@@ -935,8 +940,8 @@ fsp_header_get_space_id(
if (id != fsp_id) {
fprintf(stderr,
"InnoDB: Error: space id in fsp header %lu, but in the page header %lu\n",
(ulong) fsp_id,
(ulong) id);
(ulong) fsp_id, (ulong) id);
return(ULINT_UNDEFINED);
}
@@ -1252,6 +1257,8 @@ fsp_fill_free_list(
SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(descr_page, mtr);
mlog_write_ulint(descr_page + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_XDES, MLOG_2BYTES, mtr);
}
/* Initialize the ibuf bitmap page in a separate
@@ -1279,7 +1286,9 @@ fsp_fill_free_list(
mtr);
xdes_init(descr, mtr);
ut_ad(XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE == 0);
#if XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE
# error "XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE != 0"
#endif
if (0 == i % XDES_DESCRIBED_PER_PAGE) {
@@ -1716,7 +1725,8 @@ fsp_alloc_seg_inode_page(
buf_block_align(page)->check_index_page_at_flush = FALSE;
fil_page_set_type(page, FIL_PAGE_INODE);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_INODE,
MLOG_2BYTES, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
@@ -2087,6 +2097,8 @@ fseg_create_general(
header = byte_offset
+ buf_page_get(space, page, RW_X_LATCH, mtr);
mlog_write_ulint(header - byte_offset + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_SYS, MLOG_2BYTES, mtr);
}
mlog_write_ulint(header + FSEG_HDR_OFFSET,
@@ -2844,8 +2856,9 @@ fsp_get_available_space_in_free_extents(
if (size < FSP_EXTENT_SIZE) {
ut_a(space != 0); /* This must be a single-table
tablespace */
return(0); /* TODO: count free frag pages and return
a value based on that */
return(0); /* TODO: count free frag pages and
return a value based on that */
}
/* Below we play safe when counting free extents above the free limit:
@@ -3721,18 +3734,22 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr(space, node_addr, RW_X_LATCH,
&mtr) - FSEG_INODE_PAGE_NODE;
seg_inode_page = fut_get_ptr(space, node_addr,
RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode(seg_inode_page,
n, &mtr);
ut_a(ut_dulint_cmp(mach_read_from_8(seg_inode + FSEG_ID),
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_NOT_FULL, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
&mtr);
descr_count += flst_get_len(seg_inode + FSEG_FULL,
&mtr);
descr_count += flst_get_len(seg_inode + FSEG_NOT_FULL,
&mtr);
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
@@ -3762,22 +3779,24 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr(space, node_addr, RW_X_LATCH,
&mtr) - FSEG_INODE_PAGE_NODE;
seg_inode_page = fut_get_ptr(space, node_addr,
RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode(seg_inode_page,
n, &mtr);
if (ut_dulint_cmp(mach_read_from_8(seg_inode + FSEG_ID),
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
if (ut_dulint_cmp(mach_read_from_8(
seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
&mtr);
descr_count += flst_get_len(seg_inode + FSEG_FULL,
&mtr);
descr_count += flst_get_len(seg_inode + FSEG_NOT_FULL,
&mtr);
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages(
seg_inode, &mtr);
}
next_node_addr = flst_get_next_addr(seg_inode_page
@@ -3796,6 +3815,7 @@ fsp_validate(
ut_a(frag_n_used == n_used);
mtr_commit(&mtr2);
return(TRUE);
}
@@ -3884,12 +3904,13 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr(space, node_addr, RW_X_LATCH,
&mtr) - FSEG_INODE_PAGE_NODE;
seg_inode_page = fut_get_ptr(space, node_addr,
RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode(seg_inode_page,
n, &mtr);
ut_a(ut_dulint_cmp(mach_read_from_8(seg_inode + FSEG_ID),
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp(mach_read_from_8(
seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_print_low(seg_inode, &mtr);
@@ -3919,12 +3940,13 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr(space, node_addr, RW_X_LATCH,
&mtr) - FSEG_INODE_PAGE_NODE;
seg_inode_page = fut_get_ptr(space, node_addr,
RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode(seg_inode_page,
n, &mtr);
if (ut_dulint_cmp(mach_read_from_8(seg_inode + FSEG_ID),
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
if (ut_dulint_cmp(mach_read_from_8(
seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_print_low(seg_inode, &mtr);

View File

@@ -281,20 +281,26 @@ ha_remove_all_nodes_to_page(
}
/*****************************************************************
Validates a hash table. */
Validates a given range of the cells in hash table. */
ibool
ha_validate(
/*========*/
/* out: TRUE if ok */
hash_table_t* table) /* in: hash table */
hash_table_t* table, /* in: hash table */
ulint start_index, /* in: start index */
ulint end_index) /* in: end index */
{
hash_cell_t* cell;
ha_node_t* node;
ibool ok = TRUE;
ulint i;
for (i = 0; i < hash_get_n_cells(table); i++) {
ut_a(start_index <= end_index);
ut_a(start_index < hash_get_n_cells(table));
ut_a(end_index < hash_get_n_cells(table));
for (i = start_index; i <= end_index; i++) {
cell = hash_get_nth_cell(table, i);

View File

@@ -140,8 +140,7 @@ access order rules. */
/* The insert buffer control structure */
ibuf_t* ibuf = NULL;
static
ulint ibuf_rnd = 986058871;
static ulint ibuf_rnd = 986058871;
ulint ibuf_flush_count = 0;
@@ -533,7 +532,7 @@ ibuf_data_init_for_space(
sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);
/* use old-style record format for the insert buffer */
table = dict_mem_table_create(buf, space, 2, FALSE);
table = dict_mem_table_create(buf, space, 2, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0);
@@ -545,8 +544,8 @@ ibuf_data_init_for_space(
index = dict_mem_index_create(buf, "CLUST_IND", space,
DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2);
dict_mem_index_add_field(index, "PAGE_NO", 0, 0);
dict_mem_index_add_field(index, "TYPES", 0, 0);
dict_mem_index_add_field(index, "PAGE_NO", 0);
dict_mem_index_add_field(index, "TYPES", 0);
index->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
@@ -574,18 +573,18 @@ ibuf_bitmap_page_init(
{
ulint bit_offset;
ulint byte_offset;
ulint i;
/* Write all zeros to the bitmap */
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
byte_offset = bit_offset / 8 + 1;
byte_offset = bit_offset / 8 + 1; /* better: (bit_offset + 7) / 8 */
for (i = IBUF_BITMAP; i < IBUF_BITMAP + byte_offset; i++) {
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
*(page + i) = (byte)0;
}
memset(page + IBUF_BITMAP, 0, byte_offset);
/* The remaining area (up to the page trailer) is uninitialized. */
mlog_write_initial_log_record(page, MLOG_IBUF_BITMAP_INIT, mtr);
}
@@ -621,8 +620,9 @@ ibuf_bitmap_page_get_bits(
page_t* page, /* in: bitmap page */
ulint page_no,/* in: page whose bits to get */
ulint bit, /* in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */
mtr_t* mtr __attribute__((unused))) /* in: mtr containing an x-latch
to the bitmap page */
mtr_t* mtr __attribute__((unused))) /* in: mtr containing an
x-latch to the bitmap
page */
{
ulint byte_offset;
ulint bit_offset;
@@ -630,7 +630,9 @@ ibuf_bitmap_page_get_bits(
ulint value;
ut_ad(bit < IBUF_BITS_PER_PAGE);
ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
#if IBUF_BITS_PER_PAGE % 2
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
@@ -672,12 +674,15 @@ ibuf_bitmap_page_set_bits(
ulint map_byte;
ut_ad(bit < IBUF_BITS_PER_PAGE);
ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
#if IBUF_BITS_PER_PAGE % 2
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_IBUF_DEBUG
ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE)
|| (0 == ibuf_count_get(buf_frame_get_space_id(page), page_no)));
|| (0 == ibuf_count_get(buf_frame_get_space_id(page),
page_no)));
#endif
bit_offset = (page_no % XDES_DESCRIBED_PER_PAGE) * IBUF_BITS_PER_PAGE
+ bit;
@@ -1122,13 +1127,18 @@ ibuf_dummy_index_create(
{
dict_table_t* table;
dict_index_t* index;
table = dict_mem_table_create("IBUF_DUMMY",
DICT_HDR_SPACE, n, comp);
DICT_HDR_SPACE, n, comp ? DICT_TF_COMPACT : 0);
index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY",
DICT_HDR_SPACE, 0, n);
index->table = table;
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
index->cached = TRUE;
return(index);
}
/************************************************************************
@@ -1136,7 +1146,7 @@ Add a column to the dummy index */
static
void
ibuf_dummy_index_add_col(
/*====================*/
/*=====================*/
dict_index_t* index, /* in: dummy index */
dtype_t* type, /* in: the data type of the column */
ulint len) /* in: length of the column */
@@ -1148,7 +1158,7 @@ ibuf_dummy_index_add_col(
dtype_get_len(type),
dtype_get_prec(type));
dict_index_add_col(index,
dict_table_get_nth_col(index->table, i), 0, len);
dict_table_get_nth_col(index->table, i), len);
}
/************************************************************************
Deallocates a dummy index for inserting a record to a non-clustered index.
@@ -1156,7 +1166,7 @@ Deallocates a dummy index for inserting a record to a non-clustered index.
static
void
ibuf_dummy_index_free(
/*====================*/
/*==================*/
dict_index_t* index) /* in: dummy index */
{
dict_table_t* table = index->table;
@@ -1676,7 +1686,8 @@ ibuf_add_free_page(
flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
fil_page_set_type(page, FIL_PAGE_IBUF_FREE_LIST);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST,
MLOG_2BYTES, &mtr);
ibuf_data->seg_size++;
ibuf_data->free_list_len++;
@@ -2448,7 +2459,7 @@ ibuf_update_max_tablespace_id(void)
ibuf_data = fil_space_get_ibuf_data(0);
ibuf_index = ibuf_data->index;
ut_a(!ibuf_index->table->comp);
ut_a(!dict_table_is_comp(ibuf_index->table));
ibuf_enter();
@@ -2592,7 +2603,7 @@ ibuf_insert_low(
the first fields and the type information for other fields, and which
will be inserted to the insert buffer. */
ibuf_entry = ibuf_entry_build(entry, index->table->comp,
ibuf_entry = ibuf_entry_build(entry, dict_table_is_comp(index->table),
space, page_no, heap);
/* Open a cursor to the insert buffer tree to calculate if we can add
@@ -2763,7 +2774,8 @@ ibuf_insert(
ut_a(!(index->type & DICT_CLUSTERED));
if (rec_get_converted_size(index, entry)
>= page_get_free_space_of_empty(index->table->comp) / 2) {
>= page_get_free_space_of_empty(
dict_table_is_comp(index->table)) / 2) {
return(FALSE);
}
@@ -2810,7 +2822,8 @@ ibuf_insert_to_index_page(
ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry));
if (UNIV_UNLIKELY(index->table->comp != (ibool)!!page_is_comp(page))) {
if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
!= (ibool)!!page_is_comp(page))) {
fputs(
"InnoDB: Trying to insert a record from the insert buffer to an index page\n"
"InnoDB: but the 'compact' flag does not match!\n", stderr);

View File

@@ -277,6 +277,7 @@ btr_node_ptr_delete(
dict_tree_t* tree, /* in: index tree */
page_t* page, /* in: page whose node pointer is deleted */
mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
/****************************************************************
Checks that the node pointer to a page is appropriate. */
@@ -287,6 +288,7 @@ btr_check_node_ptr(
dict_tree_t* tree, /* in: index tree */
page_t* page, /* in: index page */
mtr_t* mtr); /* in: mtr */
#endif /* UNIV_DEBUG */
/*****************************************************************
Tries to merge the page first to the left immediate brother if such a
brother exists, and the node pointers to the current page and to the
@@ -412,7 +414,7 @@ the index. */
ibool
btr_index_rec_validate(
/*====================*/
/*===================*/
/* out: TRUE if ok */
rec_t* rec, /* in: index record */
dict_index_t* index, /* in: index */

View File

@@ -53,7 +53,8 @@ btr_cur_get_page(
btr_cur_t* cursor) /* in: tree cursor */
{
page_t* page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur)));
ut_ad(!!page_is_comp(page) == cursor->index->table->comp);
ut_ad(!!page_is_comp(page)
== dict_table_is_comp(cursor->index->table));
return(page);
}

View File

@@ -16,7 +16,7 @@ Updates the search info. */
void
btr_search_info_update_slow(
/*========================*/
btr_search_t* info, /* in: search info */
btr_search_t* info, /* in/out: search info */
btr_cur_t* cursor);/* in: cursor which was just positioned */
/************************************************************************

View File

@@ -266,7 +266,7 @@ the buffer pool. */
void
buf_page_make_young(
/*=================*/
/*================*/
buf_frame_t* frame); /* in: buffer frame of a file page */
/************************************************************************
Returns TRUE if the page can be found in the buffer pool hash table. NOTE
@@ -745,8 +745,6 @@ struct buf_block_struct{
buffer pool which are index pages,
but this flag is not set because
we do not keep track of all pages */
dict_index_t* index; /* index for which the adaptive
hash index has been created */
/* 2. Page flushing fields */
UT_LIST_NODE_T(buf_block_t) flush_list;
@@ -833,7 +831,13 @@ struct buf_block_struct{
records with the same prefix should be
indexed in the hash index */
/* The following 4 fields are protected by btr_search_latch: */
/* These 6 fields may only be modified when we have
an x-latch on btr_search_latch AND
a) we are holding an s-latch or x-latch on block->lock or
b) we know that block->buf_fix_count == 0.
An exception to this is when we init or create a page
in the buffer pool in buf0buf.c. */
ibool is_hashed; /* TRUE if hash index has already been
built on this page; note that it does
@@ -850,6 +854,8 @@ struct buf_block_struct{
ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE in hash
indexing */
dict_index_t* index; /* Index for which the adaptive
hash index has been created. */
/* 6. Debug fields */
#ifdef UNIV_SYNC_DEBUG
rw_lock_t debug_latch; /* in the debug version, each thread

View File

@@ -82,7 +82,8 @@ buf_pool_is_block(
void* ptr) /* in: pointer to memory */
{
if ((buf_pool->blocks <= (buf_block_t*)ptr)
&& ((buf_block_t*)ptr < buf_pool->blocks + buf_pool->max_size)) {
&& ((buf_block_t*)ptr < buf_pool->blocks
+ buf_pool->max_size)) {
return(TRUE);
}

View File

@@ -320,6 +320,14 @@ void
dfield_print_also_hex(
/*==================*/
dfield_t* dfield); /* in: dfield */
/*****************************************************************
Print a dfield value using ut_print_buf. */
void
dfield_print_raw(
/*=============*/
FILE* f, /* in: output stream */
dfield_t* dfield); /* in: dfield */
/**************************************************************
The following function prints the contents of a tuple. */

View File

@@ -9,7 +9,9 @@ Created 5/30/1994 Heikki Tuuri
#include "mem0mem.h"
#include "ut0rnd.h"
#ifdef UNIV_DEBUG
extern byte data_error;
#endif /* UNIV_DEBUG */
/*************************************************************************
Gets pointer to the type struct of SQL data field. */
@@ -145,7 +147,8 @@ dfield_datas_are_binary_equal(
if ((len != field2->len)
|| ((len != UNIV_SQL_NULL)
&& (0 != ut_memcmp(field1->data, field2->data, len)))) {
&& (0 != ut_memcmp(field1->data, field2->data,
len)))) {
return(FALSE);
}

View File

@@ -13,6 +13,7 @@ Created 1/16/1996 Heikki Tuuri
extern ulint data_mysql_default_charset_coll;
#define DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL 8
#define DATA_MYSQL_BINARY_CHARSET_COLL 63
/* SQL data type struct */
typedef struct dtype_struct dtype_t;
@@ -311,7 +312,7 @@ dtype_get_pad_char(
/*===============*/
/* out: padding character code, or
ULINT_UNDEFINED if no padding specified */
dtype_t* type); /* in: type */
const dtype_t* type); /* in: type */
/***************************************************************************
Returns the size of a fixed size data type, 0 if not a fixed size type. */
UNIV_INLINE

View File

@@ -8,6 +8,7 @@ Created 1/16/1996 Heikki Tuuri
#include "mach0data.h"
#ifndef UNIV_HOTBACKUP
/**********************************************************************
Get the variable length bounds of the given character set.
@@ -20,6 +21,7 @@ innobase_get_cset_width(
ulint cset, /* in: MySQL charset-collation code */
ulint* mbminlen, /* out: minimum length of a char (in bytes) */
ulint* mbmaxlen); /* out: maximum length of a char (in bytes) */
#endif /* !UNIV_HOTBACKUP */
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */
@@ -55,9 +57,21 @@ dtype_set_mblen(
{
ut_ad(type);
if (dtype_is_string_type(type->mtype)) {
#ifndef UNIV_HOTBACKUP
innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
&type->mbminlen, &type->mbmaxlen);
ut_ad(type->mbminlen <= type->mbmaxlen);
#else /* !UNIV_HOTBACKUP */
#ifdef notdefined
printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n",
type->mtype, type->prtype);
#endif
ut_a(type->mtype <= DATA_BINARY);
#ifdef notdefined
ut_a(type->prtype == (DATA_BINARY | DATA_NOT_NULL));
#endif
type->mbminlen = type->mbmaxlen = 1;
#endif /* !UNIV_HOTBACKUP */
} else {
type->mbminlen = type->mbmaxlen = 0;
}
@@ -188,27 +202,36 @@ dtype_get_pad_char(
/*===============*/
/* out: padding character code, or
ULINT_UNDEFINED if no padding specified */
dtype_t* type) /* in: type */
const dtype_t* type) /* in: type */
{
if (type->mtype == DATA_CHAR
|| type->mtype == DATA_VARCHAR
|| type->mtype == DATA_BINARY
|| type->mtype == DATA_FIXBINARY
|| type->mtype == DATA_MYSQL
|| type->mtype == DATA_VARMYSQL
|| (type->mtype == DATA_BLOB
&& (type->prtype & DATA_BINARY_TYPE) == 0)) {
switch (type->mtype) {
case DATA_FIXBINARY:
case DATA_BINARY:
if (UNIV_UNLIKELY(dtype_get_charset_coll(type->prtype)
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Starting from 5.0.18, do not pad
VARBINARY or BINARY columns. */
return(ULINT_UNDEFINED);
}
/* Fall through */
case DATA_CHAR:
case DATA_VARCHAR:
case DATA_MYSQL:
case DATA_VARMYSQL:
/* Space is the padding character for all char and binary
strings, and starting from 5.0.3, also for TEXT strings. */
return((ulint)' ');
return(0x20);
case DATA_BLOB:
if ((type->prtype & DATA_BINARY_TYPE) == 0) {
return(0x20);
}
/* Fall through */
default:
/* No padding specified */
return(ULINT_UNDEFINED);
}
}
/**************************************************************************
Stores for a type the information which determines its alphabetical ordering
@@ -329,7 +352,6 @@ dtype_new_read_for_order_and_null_size(
dtype_set_mblen(type);
}
#ifndef UNIV_HOTBACKUP
/***************************************************************************
Returns the size of a fixed size data type, 0 if not a fixed size type. */
UNIV_INLINE
@@ -374,6 +396,11 @@ dtype_get_fixed_size(
if (type->prtype & DATA_BINARY_TYPE) {
return(dtype_get_len(type));
} else {
#ifdef UNIV_HOTBACKUP
if (type->mbminlen == type->mbmaxlen) {
return(dtype_get_len(type));
}
#else /* UNIV_HOTBACKUP */
/* We play it safe here and ask MySQL for
mbminlen and mbmaxlen. Although
type->mbminlen and type->mbmaxlen are
@@ -405,6 +432,7 @@ dtype_get_fixed_size(
if (mbminlen == mbmaxlen) {
return(dtype_get_len(type));
}
#endif /* !UNIV_HOTBACKUP */
}
/* fall through for variable-length charsets */
case DATA_VARCHAR:
@@ -476,7 +504,6 @@ dtype_get_min_size(
return(0);
}
#endif /* !UNIV_HOTBACKUP */
/***************************************************************************
Returns a stored SQL NULL size for a type. For fixed length types it is

View File

@@ -50,7 +50,9 @@ dict_sys_read_row_id(
/* out: row id */
byte* field) /* in: record field */
{
ut_ad(DATA_ROW_ID_LEN == 6);
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
#endif
return(mach_read_from_6(field));
}
@@ -64,7 +66,9 @@ dict_sys_write_row_id(
byte* field, /* in: record field */
dulint row_id) /* in: row id */
{
ut_ad(DATA_ROW_ID_LEN == 6);
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
#endif
mach_write_to_6(field, row_id);
}

View File

@@ -26,6 +26,7 @@ Created 1/8/1996 Heikki Tuuri
#include "ut0byte.h"
#include "trx0types.h"
#ifndef UNIV_HOTBACKUP
/**********************************************************************
Makes all characters in a NUL-terminated UTF-8 string lower case. */
@@ -33,6 +34,7 @@ void
dict_casedn_str(
/*============*/
char* a); /* in/out: string to put in lower case */
#endif /* !UNIV_HOTBACKUP */
/************************************************************************
Get the database name length in a table name. */
@@ -197,7 +199,8 @@ dict_foreign_add_to_cache(
/*======================*/
/* out: DB_SUCCESS or error code */
dict_foreign_t* foreign, /* in, own: foreign key constraint */
ibool check_types); /* in: TRUE=check type compatibility */
ibool check_charsets);/* in: TRUE=check charset
compatibility */
/*************************************************************************
Checks if a table is referenced by foreign keys. */
@@ -305,7 +308,7 @@ Checks if a table is in the dictionary cache. */
UNIV_INLINE
dict_table_t*
dict_table_check_if_in_cache_low(
/*==============================*/
/*=============================*/
/* out: table, NULL if not found */
const char* table_name); /* in: table name */
/**************************************************************************
@@ -484,6 +487,15 @@ dict_table_get_sys_col_no(
dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/************************************************************************
Check whether the table uses the compact page format. */
UNIV_INLINE
ibool
dict_table_is_comp(
/*===============*/
/* out: TRUE if table uses the
compact page format */
const dict_table_t* table); /* in: table */
/************************************************************************
Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns. */
@@ -659,7 +671,6 @@ dict_index_add_col(
/*===============*/
dict_index_t* index, /* in: index */
dict_col_t* col, /* in: column */
ulint order, /* in: order criterion */
ulint prefix_len); /* in: column prefix length */
/***********************************************************************
Copies types of fields contained in index to tuple. */
@@ -679,13 +690,6 @@ dict_index_get_tree(
/* out: index tree */
dict_index_t* index); /* in: index */
/*************************************************************************
Gets the field order criterion. */
UNIV_INLINE
ulint
dict_field_get_order(
/*=================*/
dict_field_t* field);
/*************************************************************************
Gets the field column. */
UNIV_INLINE
dict_col_t*

View File

@@ -189,6 +189,25 @@ dict_table_get_sys_col_no(
return(table->n_cols - DATA_N_SYS_COLS + sys);
}
/************************************************************************
Check whether the table uses the compact page format. */
UNIV_INLINE
ibool
dict_table_is_comp(
/*===============*/
/* out: TRUE if table uses the
compact page format */
const dict_table_t* table) /* in: table */
{
ut_ad(table);
#if DICT_TF_COMPACT != TRUE
#error
#endif
return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT));
}
/************************************************************************
Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. */
@@ -326,19 +345,6 @@ dict_index_get_tree(
return(index->tree);
}
/*************************************************************************
Gets the field order criterion. */
UNIV_INLINE
ulint
dict_field_get_order(
/*=================*/
dict_field_t* field)
{
ut_ad(field);
return(field->order);
}
/*************************************************************************
Gets the field column. */
UNIV_INLINE
@@ -494,7 +500,7 @@ Checks if a table is in the dictionary cache. */
UNIV_INLINE
dict_table_t*
dict_table_check_if_in_cache_low(
/*==============================*/
/*=============================*/
/* out: table, NULL if not found */
const char* table_name) /* in: table name */
{

View File

@@ -82,7 +82,8 @@ dict_load_foreigns(
/*===============*/
/* out: DB_SUCCESS or error code */
const char* table_name, /* in: table name */
ibool check_types); /* in: TRUE=check type compatibility */
ibool check_charsets);/* in: TRUE=check charsets
compatibility */
/************************************************************************
Prints to the standard output information on all tables found in the data
dictionary system table. */

View File

@@ -33,15 +33,15 @@ combination of types */
other index */
#define DICT_IBUF 8 /* insert buffer tree */
/* Flags for ordering an index field: OR'ing of the flags allowed */
#define DICT_DESCEND 1 /* in descending order (default ascending) */
/* Types for a table object */
#define DICT_TABLE_ORDINARY 1
#define DICT_TABLE_CLUSTER_MEMBER 2
#define DICT_TABLE_CLUSTER 3 /* this means that the table is
really a cluster definition */
/* Table flags */
#define DICT_TF_COMPACT 1 /* compact page format */
/**************************************************************************
Creates a table memory object. */
@@ -55,7 +55,7 @@ dict_mem_table_create(
is ignored if the table is made
a member of a cluster */
ulint n_cols, /* in: number of columns */
ibool comp); /* in: TRUE=compact page format */
ulint flags); /* in: table flags */
/**************************************************************************
Creates a cluster memory object. */
@@ -116,8 +116,6 @@ dict_mem_index_add_field(
/*=====================*/
dict_index_t* index, /* in: index */
const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len); /* in: 0 or the column prefix length
in a MySQL index like
INDEX (textcol(25)) */
@@ -163,8 +161,6 @@ UTF-8 charset. In that charset, a character may take at most 3 bytes. */
struct dict_field_struct{
dict_col_t* col; /* pointer to the table column */
const char* name; /* name of the column */
ulint order; /* flags for ordering this field:
DICT_DESCEND, ... */
ulint prefix_len; /* 0 or the length of the column
prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25));
@@ -175,10 +171,6 @@ struct dict_field_struct{
ulint fixed_len; /* 0 or the fixed length of the
column if smaller than
DICT_MAX_INDEX_COL_LEN */
ulint fixed_offs; /* offset to the field, or
ULINT_UNDEFINED if it is not fixed
within the record (due to preceding
variable-length fields) */
};
/* Data structure for an index tree */
@@ -311,6 +303,7 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
struct dict_table_struct{
dulint id; /* id of the table or cluster */
ulint type; /* DICT_TABLE_ORDINARY, ... */
ulint flags; /* DICT_TF_COMPACT, ... */
mem_heap_t* heap; /* memory heap */
const char* name; /* table name */
const char* dir_path_of_temp_table;/* NULL or the directory path
@@ -328,7 +321,6 @@ struct dict_table_struct{
ibool tablespace_discarded;/* this flag is set TRUE when the
user calls DISCARD TABLESPACE on this table,
and reset to FALSE in IMPORT TABLESPACE */
ibool comp; /* flag: TRUE=compact page format */
hash_node_t name_hash; /* hash chain node */
hash_node_t id_hash; /* hash chain node */
ulint n_def; /* number of columns defined so far */

View File

@@ -106,7 +106,9 @@ dyn_array_create(
size sizeof(dyn_array_t) */
{
ut_ad(arr);
ut_ad(DYN_ARRAY_DATA_SIZE < DYN_BLOCK_FULL_FLAG);
#if DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG
# error "DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG"
#endif
arr->heap = NULL;
arr->used = 0;

View File

@@ -77,7 +77,7 @@ Gets a iboolean value from a query node. */
UNIV_INLINE
ibool
eval_node_get_ibool_val(
/*===================*/
/*====================*/
/* out: iboolean value */
que_node_t* node); /* in: query graph node */
/*********************************************************************

View File

@@ -149,7 +149,7 @@ Gets a iboolean value from a query node. */
UNIV_INLINE
ibool
eval_node_get_ibool_val(
/*===================*/
/*====================*/
/* out: iboolean value */
que_node_t* node) /* in: query graph node */
{
@@ -170,7 +170,7 @@ Sets a iboolean value as the value of a function node. */
UNIV_INLINE
void
eval_node_set_ibool_val(
/*===================*/
/*====================*/
func_node_t* func_node, /* in: function node */
ibool val) /* in: value to set */
{

View File

@@ -63,7 +63,20 @@ extern fil_addr_t fil_addr_null;
#define FIL_PAGE_LSN 16 /* lsn of the end of the newest
modification log record to the page */
#define FIL_PAGE_TYPE 24 /* file page type: FIL_PAGE_INDEX,...,
2 bytes */
2 bytes.
The contents of this field can only
be trusted in the following case:
if the page is an uncompressed
B-tree index page, then it is
guaranteed that the value is
FIL_PAGE_INDEX.
The opposite does not hold.
In tablespaces created by
MySQL/InnoDB 5.1.7 or later, the
contents of this field is valid
for all uncompressed pages. */
#define FIL_PAGE_FILE_FLUSH_LSN 26 /* this is only defined for the
first page in a data file: the file
has been flushed to disk at least up
@@ -79,11 +92,19 @@ extern fil_addr_t fil_addr_null;
to the last 4 bytes of FIL_PAGE_LSN */
#define FIL_PAGE_DATA_END 8
/* File page types */
#define FIL_PAGE_INDEX 17855
#define FIL_PAGE_UNDO_LOG 2
#define FIL_PAGE_INODE 3
#define FIL_PAGE_IBUF_FREE_LIST 4
/* File page types (values of FIL_PAGE_TYPE) */
#define FIL_PAGE_INDEX 17855 /* B-tree node */
#define FIL_PAGE_UNDO_LOG 2 /* Undo log page */
#define FIL_PAGE_INODE 3 /* Index node */
#define FIL_PAGE_IBUF_FREE_LIST 4 /* Insert buffer free list */
/* File page types introduced in MySQL/InnoDB 5.1.7 */
#define FIL_PAGE_TYPE_ALLOCATED 0 /* Freshly allocated page */
#define FIL_PAGE_IBUF_BITMAP 5 /* Insert buffer bitmap */
#define FIL_PAGE_TYPE_SYS 6 /* System page */
#define FIL_PAGE_TYPE_TRX_SYS 7 /* Transaction system data */
#define FIL_PAGE_TYPE_FSP_HDR 8 /* File space header */
#define FIL_PAGE_TYPE_XDES 9 /* Extent descriptor page */
#define FIL_PAGE_TYPE_BLOB 10 /* Uncompressed BLOB page */
/* Space types */
#define FIL_TABLESPACE 501
@@ -271,7 +292,7 @@ Decrements the count of pending insert buffer page merges. */
void
fil_decr_pending_ibuf_merges(
/*========================*/
/*=========================*/
ulint id); /* in: space id */
/***********************************************************************
Parses the body of a log record written about an .ibd file operation. That is,

View File

@@ -99,13 +99,15 @@ ha_remove_all_nodes_to_page(
ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */
/*****************************************************************
Validates a hash table. */
Validates a given range of the cells in hash table. */
ibool
ha_validate(
/*========*/
/* out: TRUE if ok */
hash_table_t* table); /* in: hash table */
hash_table_t* table, /* in: hash table */
ulint start_index, /* in: start index */
ulint end_index); /* in: end index */
/*****************************************************************
Prints info of a hash table. */

View File

@@ -109,8 +109,8 @@ do {\
\
while (struct3333->NAME != DATA) {\
\
ut_a(struct3333);\
struct3333 = struct3333->NAME;\
ut_a(struct3333);\
}\
\
struct3333->NAME = DATA->NAME;\

View File

@@ -206,8 +206,9 @@ ibuf_update_free_bits_if_full(
before = ibuf_index_page_calc_free_bits(max_ins_size);
if (max_ins_size >= increase) {
ut_ad(ULINT_UNDEFINED > UNIV_PAGE_SIZE);
#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(max_ins_size
- increase);
#ifdef UNIV_IBUF_DEBUG

View File

@@ -477,7 +477,7 @@ searching for a lock in the hash table. */
UNIV_INLINE
ulint
lock_rec_fold(
/*===========*/
/*==========*/
/* out: folded value */
ulint space, /* in: space */
ulint page_no);/* in: page number */

View File

@@ -281,7 +281,7 @@ Reads a float. It is stored in a little-endian format. */
UNIV_INLINE
float
mach_float_read(
/*=============*/
/*============*/
/* out: float read */
byte* b); /* in: pointer to memory from where to read */
/*************************************************************
@@ -289,7 +289,7 @@ Writes a float. It is stored in a little-endian format. */
UNIV_INLINE
void
mach_float_write(
/*==============*/
/*=============*/
byte* b, /* in: pointer to memory where to write */
float d); /* in: float */
/*************************************************************

View File

@@ -578,7 +578,7 @@ Reads a float. It is stored in a little-endian format. */
UNIV_INLINE
float
mach_float_read(
/*=============*/
/*============*/
/* out: float read */
byte* b) /* in: pointer to memory from where to read */
{
@@ -604,7 +604,7 @@ Writes a float. It is stored in a little-endian format. */
UNIV_INLINE
void
mach_float_write(
/*==============*/
/*=============*/
byte* b, /* in: pointer to memory where to write */
float d) /* in: float */
{

View File

@@ -25,8 +25,7 @@ UNIV_MEM_ALIGNMENT. In the debug version there are also
check fields at the both ends of the field. */
#ifdef UNIV_MEM_DEBUG
#define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\
+ MEM_FIELD_TRAILER_SIZE,\
UNIV_MEM_ALIGNMENT)
+ MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT)
#else
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
#endif
@@ -115,7 +114,7 @@ the neighborhood of a given pointer. */
void
mem_analyze_corruption(
/*===================*/
byte* ptr); /* in: pointer to place of possible corruption */
void* ptr); /* in: pointer to place of possible corruption */
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers. Can only be used in the debug version. */

View File

@@ -68,22 +68,19 @@ Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__)
(N), NULL, MEM_HEAP_DYNAMIC, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
__FILE__, __LINE__)
(N), NULL, MEM_HEAP_BUFFER, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
(N), NULL, MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER,\
__FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for fast
@@ -92,8 +89,7 @@ caller, N is its size, and this memory block is not freed by
mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__)
(N), (B), MEM_HEAP_DYNAMIC, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory

View File

@@ -73,10 +73,18 @@ mlog_catenate_ulint(
mlog = &(mtr->log);
ut_ad(MLOG_1BYTE == 1);
ut_ad(MLOG_2BYTES == 2);
ut_ad(MLOG_4BYTES == 4);
#if MLOG_1BYTE != 1
# error "MLOG_1BYTE != 1"
#endif
#if MLOG_2BYTES != 2
# error "MLOG_2BYTES != 2"
#endif
#if MLOG_4BYTES != 4
# error "MLOG_4BYTES != 4"
#endif
#if MLOG_8BYTES != 8
# error "MLOG_8BYTES != 8"
#endif
ptr = dyn_array_push(mlog, type);
if (type == MLOG_4BYTES) {

View File

@@ -47,10 +47,10 @@ flag value must give the length also! */
has been called only once,
this flag is ORed to the type
of that first log record */
#define MLOG_1BYTE ((byte)1) /* one byte is written */
#define MLOG_2BYTES ((byte)2) /* 2 bytes ... */
#define MLOG_4BYTES ((byte)4) /* 4 bytes ... */
#define MLOG_8BYTES ((byte)8) /* 8 bytes ... */
#define MLOG_1BYTE (1) /* one byte is written */
#define MLOG_2BYTES (2) /* 2 bytes ... */
#define MLOG_4BYTES (4) /* 4 bytes ... */
#define MLOG_8BYTES (8) /* 8 bytes ... */
#define MLOG_REC_INSERT ((byte)9) /* record insert */
#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /* mark clustered index record
deleted */
@@ -220,7 +220,7 @@ Reads 8 bytes from a file page buffered in the buffer pool. */
dulint
mtr_read_dulint(
/*===========*/
/*============*/
/* out: value read */
byte* ptr, /* in: pointer from where to read */
mtr_t* mtr); /* in: mini-transaction handle */

View File

@@ -91,9 +91,10 @@ log. */
#define OS_FILE_NOT_FOUND 71
#define OS_FILE_DISK_FULL 72
#define OS_FILE_ALREADY_EXISTS 73
#define OS_FILE_AIO_RESOURCES_RESERVED 74 /* wait for OS aio resources
#define OS_FILE_PATH_ERROR 74
#define OS_FILE_AIO_RESOURCES_RESERVED 75 /* wait for OS aio resources
to become available again */
#define OS_FILE_ERROR_NOT_SPECIFIED 75
#define OS_FILE_ERROR_NOT_SPECIFIED 76
/* Types for aio operations */
#define OS_FILE_READ 10
@@ -182,12 +183,15 @@ void
os_io_init_simple(void);
/*===================*/
/***************************************************************************
Creates a temporary file. */
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
On Netware, this function is like tmpfile(3), because the C run-time
library of Netware does not expose the delete-on-close flag. */
FILE*
os_file_create_tmpfile(void);
/*========================*/
/* out: temporary file handle (never NULL) */
/* out: temporary file handle, or NULL on error */
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned

View File

@@ -116,19 +116,20 @@ Allocates large pages memory. */
void*
os_mem_alloc_large(
/*=================*/
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error);/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/********************************************************************
Frees large pages memory. */
void
os_mem_free_large(
/*=================*/
/*==============*/
void *ptr); /* in: number of bytes */
/********************************************************************
Sets the priority boost for threads released from waiting within the current

View File

@@ -80,7 +80,7 @@ os_thread_create(
thread */
int
os_thread_join(
/*=============*/
/*===========*/
os_thread_id_t thread_id); /* in: id of the thread to join */
/*********************************************************************
Exits the current thread. */

View File

@@ -436,7 +436,7 @@ TRUE if the record is the infimum record on a page. */
UNIV_INLINE
ibool
page_rec_is_infimum_low(
/*=====================*/
/*====================*/
/* out: TRUE if the infimum record */
ulint offset);/* in: record offset on page */
@@ -733,7 +733,7 @@ debugging purposes. */
void
page_print(
/*======*/
/*=======*/
page_t* page, /* in: index page */
dict_index_t* index, /* in: dictionary index of the page */
ulint dn, /* in: print dn first and last entries

View File

@@ -284,7 +284,7 @@ TRUE if the record is the infimum record on a page. */
UNIV_INLINE
ibool
page_rec_is_infimum_low(
/*=====================*/
/*====================*/
/* out: TRUE if the infimum record */
ulint offset) /* in: record offset on page */
{

View File

@@ -1,90 +1,220 @@
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#define PARS_INT_LIT 257
#define PARS_FLOAT_LIT 258
#define PARS_STR_LIT 259
#define PARS_NULL_LIT 260
#define PARS_ID_TOKEN 261
#define PARS_AND_TOKEN 262
#define PARS_OR_TOKEN 263
#define PARS_NOT_TOKEN 264
#define PARS_GE_TOKEN 265
#define PARS_LE_TOKEN 266
#define PARS_NE_TOKEN 267
#define PARS_PROCEDURE_TOKEN 268
#define PARS_IN_TOKEN 269
#define PARS_OUT_TOKEN 270
#define PARS_INT_TOKEN 271
#define PARS_INTEGER_TOKEN 272
#define PARS_FLOAT_TOKEN 273
#define PARS_CHAR_TOKEN 274
#define PARS_IS_TOKEN 275
#define PARS_BEGIN_TOKEN 276
#define PARS_END_TOKEN 277
#define PARS_IF_TOKEN 278
#define PARS_THEN_TOKEN 279
#define PARS_ELSE_TOKEN 280
#define PARS_ELSIF_TOKEN 281
#define PARS_LOOP_TOKEN 282
#define PARS_WHILE_TOKEN 283
#define PARS_RETURN_TOKEN 284
#define PARS_SELECT_TOKEN 285
#define PARS_SUM_TOKEN 286
#define PARS_COUNT_TOKEN 287
#define PARS_DISTINCT_TOKEN 288
#define PARS_FROM_TOKEN 289
#define PARS_WHERE_TOKEN 290
#define PARS_FOR_TOKEN 291
#define PARS_DDOT_TOKEN 292
#define PARS_CONSISTENT_TOKEN 293
#define PARS_READ_TOKEN 294
#define PARS_ORDER_TOKEN 295
#define PARS_BY_TOKEN 296
#define PARS_ASC_TOKEN 297
#define PARS_DESC_TOKEN 298
#define PARS_INSERT_TOKEN 299
#define PARS_INTO_TOKEN 300
#define PARS_VALUES_TOKEN 301
#define PARS_UPDATE_TOKEN 302
#define PARS_SET_TOKEN 303
#define PARS_DELETE_TOKEN 304
#define PARS_CURRENT_TOKEN 305
#define PARS_OF_TOKEN 306
#define PARS_CREATE_TOKEN 307
#define PARS_TABLE_TOKEN 308
#define PARS_INDEX_TOKEN 309
#define PARS_UNIQUE_TOKEN 310
#define PARS_CLUSTERED_TOKEN 311
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 312
#define PARS_ON_TOKEN 313
#define PARS_ASSIGN_TOKEN 314
#define PARS_DECLARE_TOKEN 315
#define PARS_CURSOR_TOKEN 316
#define PARS_SQL_TOKEN 317
#define PARS_OPEN_TOKEN 318
#define PARS_FETCH_TOKEN 319
#define PARS_CLOSE_TOKEN 320
#define PARS_NOTFOUND_TOKEN 321
#define PARS_TO_CHAR_TOKEN 322
#define PARS_TO_NUMBER_TOKEN 323
#define PARS_TO_BINARY_TOKEN 324
#define PARS_BINARY_TO_NUMBER_TOKEN 325
#define PARS_SUBSTR_TOKEN 326
#define PARS_REPLSTR_TOKEN 327
#define PARS_CONCAT_TOKEN 328
#define PARS_INSTR_TOKEN 329
#define PARS_LENGTH_TOKEN 330
#define PARS_SYSDATE_TOKEN 331
#define PARS_PRINTF_TOKEN 332
#define PARS_ASSERT_TOKEN 333
#define PARS_RND_TOKEN 334
#define PARS_RND_STR_TOKEN 335
#define PARS_ROW_PRINTF_TOKEN 336
#define PARS_COMMIT_TOKEN 337
#define PARS_ROLLBACK_TOKEN 338
#define PARS_WORK_TOKEN 339
#define NEG 340
/* A Bison parser, made by GNU Bison 1.875d. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
PARS_INT_LIT = 258,
PARS_FLOAT_LIT = 259,
PARS_STR_LIT = 260,
PARS_NULL_LIT = 261,
PARS_ID_TOKEN = 262,
PARS_AND_TOKEN = 263,
PARS_OR_TOKEN = 264,
PARS_NOT_TOKEN = 265,
PARS_GE_TOKEN = 266,
PARS_LE_TOKEN = 267,
PARS_NE_TOKEN = 268,
PARS_PROCEDURE_TOKEN = 269,
PARS_IN_TOKEN = 270,
PARS_OUT_TOKEN = 271,
PARS_BINARY_TOKEN = 272,
PARS_BLOB_TOKEN = 273,
PARS_INT_TOKEN = 274,
PARS_INTEGER_TOKEN = 275,
PARS_FLOAT_TOKEN = 276,
PARS_CHAR_TOKEN = 277,
PARS_IS_TOKEN = 278,
PARS_BEGIN_TOKEN = 279,
PARS_END_TOKEN = 280,
PARS_IF_TOKEN = 281,
PARS_THEN_TOKEN = 282,
PARS_ELSE_TOKEN = 283,
PARS_ELSIF_TOKEN = 284,
PARS_LOOP_TOKEN = 285,
PARS_WHILE_TOKEN = 286,
PARS_RETURN_TOKEN = 287,
PARS_SELECT_TOKEN = 288,
PARS_SUM_TOKEN = 289,
PARS_COUNT_TOKEN = 290,
PARS_DISTINCT_TOKEN = 291,
PARS_FROM_TOKEN = 292,
PARS_WHERE_TOKEN = 293,
PARS_FOR_TOKEN = 294,
PARS_DDOT_TOKEN = 295,
PARS_CONSISTENT_TOKEN = 296,
PARS_READ_TOKEN = 297,
PARS_ORDER_TOKEN = 298,
PARS_BY_TOKEN = 299,
PARS_ASC_TOKEN = 300,
PARS_DESC_TOKEN = 301,
PARS_INSERT_TOKEN = 302,
PARS_INTO_TOKEN = 303,
PARS_VALUES_TOKEN = 304,
PARS_UPDATE_TOKEN = 305,
PARS_SET_TOKEN = 306,
PARS_DELETE_TOKEN = 307,
PARS_CURRENT_TOKEN = 308,
PARS_OF_TOKEN = 309,
PARS_CREATE_TOKEN = 310,
PARS_TABLE_TOKEN = 311,
PARS_INDEX_TOKEN = 312,
PARS_UNIQUE_TOKEN = 313,
PARS_CLUSTERED_TOKEN = 314,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 315,
PARS_ON_TOKEN = 316,
PARS_ASSIGN_TOKEN = 317,
PARS_DECLARE_TOKEN = 318,
PARS_CURSOR_TOKEN = 319,
PARS_SQL_TOKEN = 320,
PARS_OPEN_TOKEN = 321,
PARS_FETCH_TOKEN = 322,
PARS_CLOSE_TOKEN = 323,
PARS_NOTFOUND_TOKEN = 324,
PARS_TO_CHAR_TOKEN = 325,
PARS_TO_NUMBER_TOKEN = 326,
PARS_TO_BINARY_TOKEN = 327,
PARS_BINARY_TO_NUMBER_TOKEN = 328,
PARS_SUBSTR_TOKEN = 329,
PARS_REPLSTR_TOKEN = 330,
PARS_CONCAT_TOKEN = 331,
PARS_INSTR_TOKEN = 332,
PARS_LENGTH_TOKEN = 333,
PARS_SYSDATE_TOKEN = 334,
PARS_PRINTF_TOKEN = 335,
PARS_ASSERT_TOKEN = 336,
PARS_RND_TOKEN = 337,
PARS_RND_STR_TOKEN = 338,
PARS_ROW_PRINTF_TOKEN = 339,
PARS_COMMIT_TOKEN = 340,
PARS_ROLLBACK_TOKEN = 341,
PARS_WORK_TOKEN = 342,
NEG = 343
};
#endif
#define PARS_INT_LIT 258
#define PARS_FLOAT_LIT 259
#define PARS_STR_LIT 260
#define PARS_NULL_LIT 261
#define PARS_ID_TOKEN 262
#define PARS_AND_TOKEN 263
#define PARS_OR_TOKEN 264
#define PARS_NOT_TOKEN 265
#define PARS_GE_TOKEN 266
#define PARS_LE_TOKEN 267
#define PARS_NE_TOKEN 268
#define PARS_PROCEDURE_TOKEN 269
#define PARS_IN_TOKEN 270
#define PARS_OUT_TOKEN 271
#define PARS_BINARY_TOKEN 272
#define PARS_BLOB_TOKEN 273
#define PARS_INT_TOKEN 274
#define PARS_INTEGER_TOKEN 275
#define PARS_FLOAT_TOKEN 276
#define PARS_CHAR_TOKEN 277
#define PARS_IS_TOKEN 278
#define PARS_BEGIN_TOKEN 279
#define PARS_END_TOKEN 280
#define PARS_IF_TOKEN 281
#define PARS_THEN_TOKEN 282
#define PARS_ELSE_TOKEN 283
#define PARS_ELSIF_TOKEN 284
#define PARS_LOOP_TOKEN 285
#define PARS_WHILE_TOKEN 286
#define PARS_RETURN_TOKEN 287
#define PARS_SELECT_TOKEN 288
#define PARS_SUM_TOKEN 289
#define PARS_COUNT_TOKEN 290
#define PARS_DISTINCT_TOKEN 291
#define PARS_FROM_TOKEN 292
#define PARS_WHERE_TOKEN 293
#define PARS_FOR_TOKEN 294
#define PARS_DDOT_TOKEN 295
#define PARS_CONSISTENT_TOKEN 296
#define PARS_READ_TOKEN 297
#define PARS_ORDER_TOKEN 298
#define PARS_BY_TOKEN 299
#define PARS_ASC_TOKEN 300
#define PARS_DESC_TOKEN 301
#define PARS_INSERT_TOKEN 302
#define PARS_INTO_TOKEN 303
#define PARS_VALUES_TOKEN 304
#define PARS_UPDATE_TOKEN 305
#define PARS_SET_TOKEN 306
#define PARS_DELETE_TOKEN 307
#define PARS_CURRENT_TOKEN 308
#define PARS_OF_TOKEN 309
#define PARS_CREATE_TOKEN 310
#define PARS_TABLE_TOKEN 311
#define PARS_INDEX_TOKEN 312
#define PARS_UNIQUE_TOKEN 313
#define PARS_CLUSTERED_TOKEN 314
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 315
#define PARS_ON_TOKEN 316
#define PARS_ASSIGN_TOKEN 317
#define PARS_DECLARE_TOKEN 318
#define PARS_CURSOR_TOKEN 319
#define PARS_SQL_TOKEN 320
#define PARS_OPEN_TOKEN 321
#define PARS_FETCH_TOKEN 322
#define PARS_CLOSE_TOKEN 323
#define PARS_NOTFOUND_TOKEN 324
#define PARS_TO_CHAR_TOKEN 325
#define PARS_TO_NUMBER_TOKEN 326
#define PARS_TO_BINARY_TOKEN 327
#define PARS_BINARY_TO_NUMBER_TOKEN 328
#define PARS_SUBSTR_TOKEN 329
#define PARS_REPLSTR_TOKEN 330
#define PARS_CONCAT_TOKEN 331
#define PARS_INSTR_TOKEN 332
#define PARS_LENGTH_TOKEN 333
#define PARS_SYSDATE_TOKEN 334
#define PARS_PRINTF_TOKEN 335
#define PARS_ASSERT_TOKEN 336
#define PARS_RND_TOKEN 337
#define PARS_RND_STR_TOKEN 338
#define PARS_ROW_PRINTF_TOKEN 339
#define PARS_COMMIT_TOKEN 340
#define PARS_ROLLBACK_TOKEN 341
#define PARS_WORK_TOKEN 342
#define NEG 343
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;

View File

@@ -46,6 +46,8 @@ extern pars_res_word_t pars_rnd_str_token;
extern pars_res_word_t pars_count_token;
extern pars_res_word_t pars_sum_token;
extern pars_res_word_t pars_distinct_token;
extern pars_res_word_t pars_binary_token;
extern pars_res_word_t pars_blob_token;
extern pars_res_word_t pars_int_token;
extern pars_res_word_t pars_char_token;
extern pars_res_word_t pars_float_token;
@@ -336,10 +338,15 @@ Parses a column definition at a table creation. */
sym_node_t*
pars_column_def(
/*============*/
/* out: column sym table node */
sym_node_t* sym_node, /* in: column node in the symbol
table */
pars_res_word_t* type); /* in: data type */
/* out: column sym table
node */
sym_node_t* sym_node, /* in: column node in the
symbol table */
pars_res_word_t* type, /* in: data type */
sym_node_t* len, /* in: length of column, or
NULL */
void* is_not_null); /* in: if not NULL, column
is of type NOT NULL. */
/*************************************************************************
Parses a table creation operation. */

View File

@@ -233,6 +233,7 @@ que_thr_peek_stop(
|| trx->que_state == TRX_QUE_LOCK_WAIT
|| (UT_LIST_GET_LEN(trx->signals) > 0
&& trx->que_state == TRX_QUE_RUNNING)) {
return(TRUE);
}

View File

@@ -25,8 +25,11 @@ read_view_t*
read_view_open_now(
/*===============*/
/* out, own: read view struct */
trx_t* cr_trx, /* in: creating transaction, or NULL */
mem_heap_t* heap); /* in: memory heap from which allocated */
dulint cr_trx_id, /* in: trx_id of creating
transaction, or (0, 0) used in
purge */
mem_heap_t* heap); /* in: memory heap from which
allocated */
/*************************************************************************
Makes a copy of the oldest existing read view, or opens a new. The view
must be closed with ..._close. */
@@ -35,8 +38,11 @@ read_view_t*
read_view_oldest_copy_or_open_new(
/*==============================*/
/* out, own: read view struct */
trx_t* cr_trx, /* in: creating transaction, or NULL */
mem_heap_t* heap); /* in: memory heap from which allocated */
dulint cr_trx_id, /* in: trx_id of creating
transaction, or (0, 0) used in
purge */
mem_heap_t* heap); /* in: memory heap from which
allocated */
/*************************************************************************
Closes a read view. */
@@ -101,6 +107,10 @@ read_cursor_set_for_mysql(
read should not see the modifications to the database. */
struct read_view_struct{
ulint type; /* VIEW_NORMAL, VIEW_HIGH_GRANULARITY */
dulint undo_no; /* (0, 0) or if type is VIEW_HIGH_GRANULARITY
transaction undo_no when this high-granularity
consistent read view was created */
ibool can_be_too_old; /* TRUE if the system has had to purge old
versions which this read view should be able
to access: the read view can bump into the
@@ -121,12 +131,23 @@ struct read_view_struct{
serialized, except the reading transaction
itself; the trx ids in this array are in a
descending order */
trx_t* creator; /* Pointer to the creating transaction, or
NULL if used in purge */
dulint creator_trx_id; /* trx id of creating transaction, or
(0, 0) used in purge */
UT_LIST_NODE_T(read_view_t) view_list;
/* List of read views in trx_sys */
};
/* Read view types */
#define VIEW_NORMAL 1 /* Normal consistent read view
where transaction does not see changes
made by active transactions except
creating transaction. */
#define VIEW_HIGH_GRANULARITY 2 /* High-granularity read view where
transaction does not see changes
made by active transactions and own
changes after a point in time when this
read view was created. */
/* Implement InnoDB framework to support consistent read views in
cursors. This struct holds both heap where consistent read view
is allocated and pointer to a read view. */

View File

@@ -24,7 +24,8 @@ cmp_types_are_equal(
/* out: TRUE if the types are considered
equal in comparisons */
dtype_t* type1, /* in: type 1 */
dtype_t* type2); /* in: type 2 */
dtype_t* type2, /* in: type 2 */
ibool check_charsets); /* in: whether to check charsets */
/*****************************************************************
This function is used to compare two data fields for which we know the
data type. */

View File

@@ -182,7 +182,7 @@ The following function tells if a new-style record is a node pointer. */
UNIV_INLINE
ibool
rec_get_node_ptr_flag(
/*=================*/
/*==================*/
/* out: TRUE if node pointer */
rec_t* rec); /* in: physical record */
/**********************************************************
@@ -191,7 +191,7 @@ of the record in the heap of the index page. */
UNIV_INLINE
ulint
rec_get_heap_no(
/*=============*/
/*============*/
/* out: heap order number */
rec_t* rec, /* in: physical record */
ulint comp); /* in: nonzero=compact page format */
@@ -201,7 +201,7 @@ field in the record. */
UNIV_INLINE
void
rec_set_heap_no(
/*=============*/
/*============*/
rec_t* rec, /* in: physical record */
ulint comp, /* in: nonzero=compact page format */
ulint heap_no);/* in: the heap number */
@@ -399,7 +399,7 @@ The following function returns the number of fields in a record. */
UNIV_INLINE
ulint
rec_offs_n_fields(
/*===============*/
/*==============*/
/* out: number of fields */
const ulint* offsets);/* in: array returned by rec_get_offsets() */
/**************************************************************

View File

@@ -268,9 +268,12 @@ rec_get_next_offs(
ulint comp) /* in: nonzero=compact page format */
{
ulint field_value;
ut_ad(REC_NEXT_MASK == 0xFFFFUL);
ut_ad(REC_NEXT_SHIFT == 0);
#if REC_NEXT_MASK != 0xFFFFUL
# error "REC_NEXT_MASK != 0xFFFFUL"
#endif
#if REC_NEXT_SHIFT
# error "REC_NEXT_SHIFT != 0"
#endif
field_value = mach_read_from_2(rec - REC_NEXT);
@@ -317,8 +320,12 @@ rec_set_next_offs(
{
ut_ad(rec);
ut_ad(UNIV_PAGE_SIZE > next);
ut_ad(REC_NEXT_MASK == 0xFFFFUL);
ut_ad(REC_NEXT_SHIFT == 0);
#if REC_NEXT_MASK != 0xFFFFUL
# error "REC_NEXT_MASK != 0xFFFFUL"
#endif
#if REC_NEXT_SHIFT
# error "REC_NEXT_SHIFT != 0"
#endif
if (comp) {
ulint field_value;
@@ -414,9 +421,11 @@ rec_get_n_fields(
{
ut_ad(rec);
ut_ad(index);
if (UNIV_UNLIKELY(!index->table->comp)) {
if (!dict_table_is_comp(index->table)) {
return(rec_get_n_fields_old(rec));
}
switch (rec_get_status(rec)) {
case REC_STATUS_ORDINARY:
return(dict_index_get_n_fields(index));
@@ -624,7 +633,7 @@ The following function tells if a new-style record is a node pointer. */
UNIV_INLINE
ibool
rec_get_node_ptr_flag(
/*=================*/
/*==================*/
/* out: TRUE if node pointer */
rec_t* rec) /* in: physical record */
{
@@ -637,7 +646,7 @@ heap of the index page. */
UNIV_INLINE
ulint
rec_get_heap_no(
/*=============*/
/*============*/
/* out: heap order number */
rec_t* rec, /* in: physical record */
ulint comp) /* in: nonzero=compact page format */
@@ -659,7 +668,7 @@ The following function is used to set the heap number field in the record. */
UNIV_INLINE
void
rec_set_heap_no(
/*=============*/
/*============*/
rec_t* rec, /* in: physical record */
ulint comp, /* in: nonzero=compact page format */
ulint heap_no)/* in: the heap number */
@@ -795,7 +804,7 @@ The following function returns the number of fields in a record. */
UNIV_INLINE
ulint
rec_offs_n_fields(
/*===============*/
/*==============*/
/* out: number of fields */
const ulint* offsets)/* in: array returned by rec_get_offsets() */
{
@@ -1019,7 +1028,7 @@ rec_set_nth_field_extern_bit(
where rec is, or NULL; in the NULL case
we do not write to log about the change */
{
if (UNIV_LIKELY(index->table->comp)) {
if (dict_table_is_comp(index->table)) {
rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr);
} else {
rec_set_nth_field_extern_bit_old(rec, i, val, mtr);
@@ -1434,7 +1443,7 @@ rec_get_converted_size(
? dict_index_get_n_unique_in_tree(index) + 1
: dict_index_get_n_fields(index)));
if (UNIV_LIKELY(index->table->comp)) {
if (dict_table_is_comp(index->table)) {
return(rec_get_converted_size_new(index, dtuple));
}

View File

@@ -687,7 +687,6 @@ struct row_prebuilt_struct {
#define ROW_READ_TRY_SEMI_CONSISTENT 1
#define ROW_READ_DID_SEMI_CONSISTENT 2
#ifndef UNIV_NONINL
#include "row0mysql.ic"
#endif

View File

@@ -34,6 +34,18 @@ extern ibool srv_lower_case_table_names;
extern mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
extern FILE* srv_monitor_file;
/* Mutex for locking srv_dict_tmpfile.
This mutex has a very high rank; threads reserving it should not
be holding any InnoDB latches. */
extern mutex_t srv_dict_tmpfile_mutex;
/* Temporary file for output from the data dictionary */
extern FILE* srv_dict_tmpfile;
/* Mutex for locking srv_misc_tmpfile.
This mutex has a very low rank; threads reserving it should not
acquire any further latches or sleep before releasing this one. */
extern mutex_t srv_misc_tmpfile_mutex;
/* Temporary file for miscellanous diagnostic output */
extern FILE* srv_misc_tmpfile;
/* Server parameters which are read from the initfile */
@@ -183,7 +195,6 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
#define kernel_mutex (*kernel_mutex_temp)
#define SRV_MAX_N_IO_THREADS 100
#define SRV_CONCURRENCY_THRESHOLD 20
/* Array of English strings describing the current state of an
i/o handler thread */
@@ -252,11 +263,13 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */
extern srv_sys_t* srv_sys;
/* Alternatives for the file flush option in Unix; see the InnoDB manual about
what these mean */
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is currently mapped
to a call of fsync() because fdatasync()
seemed to corrupt files in Linux and Solaris */
/* Alternatives for the file flush option in Unix; see the InnoDB manual
about what these mean */
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is
currently mapped to a call of
fsync() because fdatasync() seemed
to corrupt files in Linux and
Solaris */
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4

View File

@@ -66,12 +66,12 @@ sync_array_wait_event(
sync_array_t* arr, /* in: wait array */
ulint index); /* in: index of the reserved cell */
/**********************************************************************
Frees the cell. NOTE! sync_array_wait_event frees the cell
automatically! */
Frees the cell safely by reserving the sync array mutex and decrementing
n_reserved if necessary. Should only be called from mutex_spin_wait. */
void
sync_array_free_cell(
/*=================*/
sync_array_free_cell_protected(
/*===========================*/
sync_array_t* arr, /* in: wait array */
ulint index); /* in: index of the cell in array */
/**************************************************************************

View File

@@ -23,7 +23,8 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name,/* in: file name where mutex requested */
const char* file_name, /* in: file name where mutex
requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -148,9 +149,9 @@ mutex_reset_lock_word(
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand
that our asm code resets eax: tell it
explicitly that after the third ':' */
"eax"); /* gcc does not seem to understand that our asm code
resets eax: tell it explicitly that after the third
':' */
#else
mutex->lock_word = 0;
@@ -254,8 +255,7 @@ mutex_enter_func(
mutex->count_using++;
#endif /* UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex))
{
if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
@@ -263,5 +263,4 @@ mutex_enter_func(
}
mutex_spin_wait(mutex, file_name, line);
}

View File

@@ -232,7 +232,7 @@ were set after this savepoint are deleted. */
ulint
trx_release_savepoint_for_mysql(
/*================================*/
/*============================*/
/* out: if no savepoint
of the name found then
DB_NO_SAVEPOINT,

View File

@@ -16,7 +16,9 @@ typedef byte trx_sysf_rseg_t;
/* Rollback segment specification slot offsets */
/*-------------------------------------------------------------*/
#define TRX_SYS_RSEG_SPACE 0 /* space where the the segment
header is placed */
header is placed; starting with
MySQL/InnoDB 5.1.7, this is
UNIV_UNDEFINED if the slot is unused */
#define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the the segment
header is placed; this is FIL_NULL
if the slot is unused */

View File

@@ -207,7 +207,7 @@ Does the transaction prepare for MySQL. */
ulint
trx_prepare_for_mysql(
/*=================*/
/*==================*/
/* out: 0 or error number */
trx_t* trx); /* in: trx handle */
/**************************************************************************
@@ -357,7 +357,7 @@ trx_print(
/*======*/
FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */
uint max_query_len); /* in: max query length to print, or 0 to
ulint max_query_len); /* in: max query length to print, or 0 to
use the default max length */
#ifndef UNIV_HOTBACKUP

View File

@@ -71,7 +71,7 @@ Gets an undo log page and x-latches it. */
UNIV_INLINE
page_t*
trx_undo_page_get(
/*===============*/
/*==============*/
/* out: pointer to page x-latched */
ulint space, /* in: space where placed */
ulint page_no, /* in: page number */
@@ -81,7 +81,7 @@ Gets an undo log page and s-latches it. */
UNIV_INLINE
page_t*
trx_undo_page_get_s_latched(
/*=========================*/
/*========================*/
/* out: pointer to page s-latched */
ulint space, /* in: space where placed */
ulint page_no, /* in: page number */
@@ -278,7 +278,7 @@ Parses the redo log entry of an undo log page initialization. */
byte*
trx_undo_parse_page_init(
/*======================*/
/*=====================*/
/* out: end of log record or NULL */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */

View File

@@ -20,7 +20,9 @@ trx_undo_build_roll_ptr(
ulint page_no, /* in: page number */
ulint offset) /* in: offset of the undo entry within page */
{
ut_ad(DATA_ROLL_PTR_LEN == 7);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
ut_ad(rseg_id < 128);
return(ut_dulint_create(is_insert * 128 * 256 * 256
@@ -44,10 +46,12 @@ trx_undo_decode_roll_ptr(
{
ulint low;
ulint high;
ut_ad(DATA_ROLL_PTR_LEN == 7);
ut_ad(TRUE == 1);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
high = ut_dulint_get_high(roll_ptr);
low = ut_dulint_get_low(roll_ptr);
@@ -70,10 +74,12 @@ trx_undo_roll_ptr_is_insert(
dulint roll_ptr) /* in: roll pointer */
{
ulint high;
ut_ad(DATA_ROLL_PTR_LEN == 7);
ut_ad(TRUE == 1);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
high = ut_dulint_get_high(roll_ptr);
return(high / (256 * 256 * 128));
@@ -106,8 +112,9 @@ trx_read_roll_ptr(
/* out: roll ptr */
byte* ptr) /* in: pointer to memory from where to read */
{
ut_ad(DATA_ROLL_PTR_LEN == 7);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
return(mach_read_from_7(ptr));
}
@@ -116,7 +123,7 @@ Gets an undo log page and x-latches it. */
UNIV_INLINE
page_t*
trx_undo_page_get(
/*===============*/
/*==============*/
/* out: pointer to page x-latched */
ulint space, /* in: space where placed */
ulint page_no, /* in: page number */
@@ -138,7 +145,7 @@ Gets an undo log page and s-latches it. */
UNIV_INLINE
page_t*
trx_undo_page_get_s_latched(
/*=========================*/
/*========================*/
/* out: pointer to page s-latched */
ulint space, /* in: space where placed */
ulint page_no, /* in: page number */

View File

@@ -265,6 +265,9 @@ it is read or written. */
/* Tell the compiler that cond is unlikely to hold */
#define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE)
/* Compile-time constant of the given array's size. */
#define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"

View File

@@ -216,7 +216,7 @@ aligned address. */
UNIV_INLINE
ulint
ut_align_offset(
/*==========*/
/*============*/
/* out: distance from aligned
pointer */
const void* ptr, /* in: pointer */

View File

@@ -368,8 +368,9 @@ ut_bit_get_nth(
ulint n) /* in: nth bit requested */
{
ut_ad(n < 8 * sizeof(ulint));
ut_ad(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
return(1 & (a >> n));
}
@@ -385,8 +386,9 @@ ut_bit_set_nth(
ibool val) /* in: value for the bit to set */
{
ut_ad(n < 8 * sizeof(ulint));
ut_ad(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
if (val) {
return((1 << n) | a);
} else {

View File

@@ -38,10 +38,11 @@ ut_malloc_low(
/*==========*/
/* out, own: allocated memory */
ulint n, /* in: number of bytes to allocate */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined. */

View File

@@ -65,7 +65,7 @@ random number to work reliably. */
UNIV_INLINE
ulint
ut_hash_ulint(
/*=========*/
/*==========*/
/* out: hash value */
ulint key, /* in: value to be hashed */
ulint table_size); /* in: hash table size */

View File

@@ -130,7 +130,7 @@ or some random number for the hash table to work reliably. */
UNIV_INLINE
ulint
ut_hash_ulint(
/*=========*/
/*==========*/
/* out: hash value */
ulint key, /* in: value to be hashed */
ulint table_size) /* in: hash table size */

View File

@@ -202,7 +202,7 @@ void
ut_print_buf(
/*=========*/
FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */
const void* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */
/**************************************************************************
@@ -231,7 +231,7 @@ Outputs a fixed-length string, quoted as an SQL identifier. */
void
ut_print_namel(
/*==========*/
/*===========*/
FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction (NULL=no quotes) */
const char* name, /* in: name to print */

View File

@@ -396,7 +396,7 @@ lock_deadlock_recursive(
ulint* cost, /* in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */
uint depth); /* in: recursion depth: if this exceeds
ulint depth); /* in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
return LOCK_VICTIM_IS_START */
@@ -1067,7 +1067,7 @@ Sets the nth bit of a record lock to TRUE. */
UNIV_INLINE
void
lock_rec_set_nth_bit(
/*==================*/
/*=================*/
lock_t* lock, /* in: record lock */
ulint i) /* in: index of the bit */
{
@@ -1530,6 +1530,7 @@ lock_rec_has_expl(
return(NULL);
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Checks if some other transaction has a lock request in the queue. */
static
@@ -1572,6 +1573,7 @@ lock_rec_other_has_expl_req(
return(NULL);
}
#endif /* !UNIV_HOTBACKUP */
/*************************************************************************
Checks if some other transaction has a conflicting explicit lock request
@@ -1729,7 +1731,7 @@ lock_rec_create(
page_no = buf_frame_get_page_no(page);
heap_no = rec_get_heap_no(rec, page_is_comp(page));
ut_ad(!!page_is_comp(page) == index->table->comp);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
/* If rec is the supremum record, then we reset the gap and
LOCK_REC_NOT_GAP bits, as all locks on the supremum are
@@ -3230,7 +3232,7 @@ lock_deadlock_recursive(
ulint* cost, /* in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */
uint depth) /* in: recursion depth: if this exceeds
ulint depth) /* in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
return LOCK_VICTIM_IS_START */
{
@@ -3762,6 +3764,7 @@ lock_rec_unlock(
ulint lock_mode) /* in: LOCK_S or LOCK_X */
{
lock_t* lock;
lock_t* release_lock = NULL;
ulint heap_no;
ut_ad(trx && rec);
@@ -3772,21 +3775,23 @@ lock_rec_unlock(
lock = lock_rec_get_first(rec);
/* Remove the record lock */
/* Find the last lock with the same lock_mode and transaction
from the record. */
while (lock != NULL) {
if (lock->trx == trx && lock_get_mode(lock) == lock_mode) {
release_lock = lock;
ut_a(!lock_get_wait(lock));
lock_rec_reset_nth_bit(lock, heap_no);
break;
}
lock = lock_rec_get_next(rec, lock);
}
if (UNIV_UNLIKELY(lock == NULL)) {
/* If a record lock is found, release the record lock */
if (UNIV_LIKELY(release_lock != NULL)) {
lock_rec_reset_nth_bit(release_lock, heap_no);
} else {
mutex_exit(&kernel_mutex);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -3883,9 +3888,9 @@ lock_release_off_kernel(
&& 0 != ut_dulint_cmp(trx->undo_no,
ut_dulint_zero)) {
/* The trx may have modified the table.
We block the use of the MySQL query cache
for all currently active transactions. */
/* The trx may have modified the table. We
block the use of the MySQL query cache for
all currently active transactions. */
table = lock->un_member.tab_lock.table;
@@ -4166,6 +4171,7 @@ lock_rec_print(
}
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Calculates the number of record lock structs in the record lock hash table. */
static
@@ -4195,7 +4201,6 @@ lock_get_n_rec_locks(void)
return(n_locks);
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Prints info of locks for all transactions. */
@@ -4471,8 +4476,7 @@ lock_rec_queue_validate(
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state
== TRX_COMMITTED_IN_MEMORY);
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
@@ -4879,8 +4883,7 @@ lock_rec_convert_impl_to_expl(
impl_trx)) {
lock_rec_add_to_queue(LOCK_REC | LOCK_X
| LOCK_REC_NOT_GAP, rec, index,
impl_trx);
| LOCK_REC_NOT_GAP, rec, index, impl_trx);
}
}
}

View File

@@ -1344,7 +1344,8 @@ loop:
if (!flush_to_disk
&& (ut_dulint_cmp(log_sys->written_to_all_lsn, lsn) >= 0
|| (ut_dulint_cmp(log_sys->written_to_some_lsn, lsn) >= 0
|| (ut_dulint_cmp(log_sys->written_to_some_lsn, lsn)
>= 0
&& wait != LOG_WAIT_ALL_GROUPS))) {
mutex_exit(&(log_sys->mutex));
@@ -1356,7 +1357,8 @@ loop:
/* A write (+ possibly flush to disk) is running */
if (flush_to_disk
&& ut_dulint_cmp(log_sys->current_flush_lsn, lsn) >= 0) {
&& ut_dulint_cmp(log_sys->current_flush_lsn, lsn)
>= 0) {
/* The write + flush will write enough: wait for it to
complete */
@@ -1699,7 +1701,9 @@ log_group_checkpoint(
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE);
#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE
# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE"
#endif
buf = group->checkpoint_buf;
@@ -3061,9 +3065,10 @@ loop:
mutex_enter(&kernel_mutex);
/* Check that there are no longer transactions. We need this wait even
for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose them. */
/* Check that there are no longer transactions. We need this wait
even for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose
them. */
if (trx_n_mysql_transactions > 0
|| UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
@@ -3075,19 +3080,18 @@ loop:
if (srv_fast_shutdown == 2) {
/* In this fastest shutdown we do not flush the buffer pool:
it is essentially a 'crash' of the InnoDB server.
Make sure that the log is all flushed to disk, so that
we can recover all committed transactions in a crash
recovery.
We must not write the lsn stamps to the data files, since at a
startup InnoDB deduces from the stamps if the previous
shutdown was clean. */
it is essentially a 'crash' of the InnoDB server. Make sure
that the log is all flushed to disk, so that we can recover
all committed transactions in a crash recovery. We must not
write the lsn stamps to the data files, since at a startup
InnoDB deduces from the stamps if the previous shutdown was
clean. */
log_buffer_flush_to_disk();
return; /* We SKIP ALL THE REST !! */
}
/* Check that the master thread is suspended */
if (srv_n_threads_active[SRV_MASTER] != 0) {
@@ -3134,7 +3138,8 @@ loop:
#ifdef UNIV_LOG_ARCHIVE
|| (srv_log_archive_on
&& ut_dulint_cmp(lsn,
ut_dulint_add(log_sys->archived_lsn, LOG_BLOCK_HDR_SIZE))
ut_dulint_add(log_sys->archived_lsn,
LOG_BLOCK_HDR_SIZE))
!= 0)
#endif /* UNIV_LOG_ARCHIVE */
) {

View File

@@ -769,7 +769,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_INSERT, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
index, page, mtr);
}
@@ -778,7 +779,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_CLUST_DELETE_MARK, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = btr_cur_parse_del_mark_set_clust_rec(ptr,
end_ptr, index, page);
}
@@ -799,7 +801,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_UPDATE_IN_PLACE, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = btr_cur_parse_update_in_place(ptr, end_ptr,
page, index);
}
@@ -810,7 +813,8 @@ recv_parse_or_apply_log_rec_body(
type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
index, page, mtr);
}
@@ -819,7 +823,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_LIST_END_COPY_CREATED, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = page_parse_copy_rec_list_to_created_page(ptr,
end_ptr, index, page, mtr);
}
@@ -828,7 +833,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_PAGE_REORGANIZE, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
page, mtr);
}
@@ -862,7 +868,8 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_DELETE, &index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)==index->table->comp);
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = page_cur_parse_delete_rec(ptr, end_ptr,
index, page, mtr);
}
@@ -1536,7 +1543,8 @@ recv_apply_log_recs_for_backup(void)
recv_addr->page_no + 1);
if (!success) {
fprintf(stderr,
"InnoDB: Fatal error: cannot extend tablespace %lu to hold %lu pages\n",
"InnoDB: Fatal error: cannot extend"
" tablespace %lu to hold %lu pages\n",
recv_addr->space, recv_addr->page_no);
exit(1);
@@ -1550,8 +1558,10 @@ recv_apply_log_recs_for_backup(void)
page, NULL);
if (error != DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Fatal error: cannot read from tablespace %lu page number %lu\n",
(ulong) recv_addr->space, (ulong) recv_addr->page_no);
"InnoDB: Fatal error: cannot read from tablespace"
" %lu page number %lu\n",
(ulong) recv_addr->space,
(ulong) recv_addr->page_no);
exit(1);
}
@@ -3064,22 +3074,22 @@ recv_reset_log_files_for_backup(
byte* buf;
ulint i;
ulint log_dir_len;
char* name;
static const
char logfilename[] = "ib_logfile";
char name[5000];
static const char ib_logfile_basename[] = "ib_logfile";
log_dir_len = strlen(log_dir);
/* reserve space for log_dir, "ib_logfile" and a number */
name = memcpy(mem_alloc(log_dir_len + ((sizeof logfilename) + 11)),
log_dir, log_dir_len);
memcpy(name + log_dir_len, logfilename, sizeof logfilename);
/* full path name of ib_logfile consists of log dir path + basename
+ number. This must fit in the name buffer.
*/
ut_a(log_dir_len + strlen(ib_logfile_basename) + 11 < sizeof(name));
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
memset(buf, '\0', LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
for (i = 0; i < n_log_files; i++) {
sprintf(name + log_dir_len + sizeof logfilename, "%lu", (ulong) i);
sprintf(name, "%s%s%lu", log_dir,
ib_logfile_basename, (ulong)i);
log_file = os_file_create_simple(name, OS_FILE_CREATE,
OS_FILE_READ_WRITE, &success);
@@ -3117,7 +3127,7 @@ recv_reset_log_files_for_backup(
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
LOG_BLOCK_HDR_SIZE);
strcpy(name + log_dir_len + sizeof logfilename, "0");
sprintf(name, "%s%s%lu", log_dir, ib_logfile_basename, (ulong)0);
log_file = os_file_create_simple(name, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success);
@@ -3132,7 +3142,6 @@ recv_reset_log_files_for_backup(
os_file_flush(log_file);
os_file_close(log_file);
mem_free(name);
ut_free(buf);
}
#endif /* UNIV_HOTBACKUP */
@@ -3219,7 +3228,9 @@ ask_again:
fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,
group->archive_space_id, FALSE);
ut_a(RECV_SCAN_SIZE >= LOG_FILE_HDR_SIZE);
#if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE
# error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE"
#endif
/* Read the archive file header */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0, 0,

View File

@@ -733,18 +733,18 @@ the neighborhood of a given pointer. */
void
mem_analyze_corruption(
/*===================*/
byte* ptr) /* in: pointer to place of possible corruption */
void* ptr) /* in: pointer to place of possible corruption */
{
byte* p;
ulint i;
ulint dist;
fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
ut_print_buf(stderr, ptr - 250, 500);
ut_print_buf(stderr, (byte*)ptr - 250, 500);
fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
p = ptr;
p = (byte*)ptr;
dist = 0;
for (i = 0; i < 10; i++) {
@@ -781,7 +781,7 @@ mem_analyze_corruption(
fprintf(stderr,
"InnoDB: Scanning forward trying to find next allocated mem blocks\n");
p = ptr;
p = (byte*)ptr;
dist = 0;
for (i = 0; i < 10; i++) {

View File

@@ -141,7 +141,7 @@ mem_heap_create_block(
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)heap);
mem_analyze_corruption(heap);
}
/* In dynamic allocation, calculate the size: block header + data. */
@@ -286,7 +286,7 @@ mem_heap_block_free(
ibool init_block;
if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)block);
mem_analyze_corruption(block);
}
UT_LIST_REMOVE(list, heap->base, block);
@@ -361,7 +361,7 @@ mem_validate_all_blocks(void)
while (block) {
if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)block);
mem_analyze_corruption(block);
}
block = UT_LIST_GET_NEXT(mem_block_list, block);

View File

@@ -157,8 +157,9 @@ mem_area_get_free(
/* out: TRUE if free */
mem_area_t* area) /* in: area */
{
ut_ad(TRUE == MEM_AREA_FREE);
#if TRUE != MEM_AREA_FREE
# error "TRUE != MEM_AREA_FREE"
#endif
return(area->size_and_free & MEM_AREA_FREE);
}
@@ -171,8 +172,9 @@ mem_area_set_free(
mem_area_t* area, /* in: area */
ibool free) /* in: free bit value */
{
ut_ad(TRUE == MEM_AREA_FREE);
#if TRUE != MEM_AREA_FREE
# error "TRUE != MEM_AREA_FREE"
#endif
area->size_and_free = (area->size_and_free & ~MEM_AREA_FREE)
| free;
}
@@ -292,7 +294,7 @@ mem_pool_fill_free_list(
}
if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) {
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
@@ -361,7 +363,7 @@ mem_area_alloc(
"InnoDB: element is not marked free!\n",
(ulong) n);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
/* Try to analyze a strange assertion failure reported at
mysql@lists.mysql.com where the free bit IS 1 in the
@@ -380,7 +382,7 @@ mem_area_alloc(
"InnoDB: Error: Removing element from mem pool free list %lu\n"
"InnoDB: though the list length is 0!\n",
(ulong) n);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
@@ -473,7 +475,7 @@ mem_area_free(
"InnoDB: Error: Freeing element to mem pool free list though the\n"
"InnoDB: element is marked free!\n");
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
@@ -484,7 +486,7 @@ mem_area_free(
"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n"
"InnoDB: previous allocated area!\n");
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
@@ -500,7 +502,7 @@ mem_area_free(
"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n"
"InnoDB: Possibly a memory overrun of the buffer being freed here.\n",
(ulong) size, (ulong) next_size);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}

View File

@@ -407,7 +407,7 @@ mlog_open_and_write_index(
const byte* log_start;
const byte* log_end;
ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
if (!page_rec_is_comp(rec)) {
log_start = log_ptr = mlog_open(mtr, 11 + size);
@@ -518,7 +518,8 @@ mlog_parse_index(
} else {
n = n_uniq = 1;
}
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n, comp);
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n,
comp ? DICT_TF_COMPACT : 0);
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
DICT_HDR_SPACE, 0, n);
ind->table = table;
@@ -541,7 +542,7 @@ mlog_parse_index(
len & 0x8000 ? DATA_NOT_NULL : 0,
len & 0x7fff, 0);
dict_index_add_col(ind,
dict_table_get_nth_col(table, i), 0, 0);
dict_table_get_nth_col(table, i), 0);
}
ptr += 2;
}

View File

@@ -302,7 +302,7 @@ Reads 8 bytes from a file page buffered in the buffer pool. */
dulint
mtr_read_dulint(
/*===========*/
/*============*/
/* out: value read */
byte* ptr, /* in: pointer from where to read */
mtr_t* mtr __attribute__((unused)))

View File

@@ -160,13 +160,10 @@ time_t os_last_printout;
ibool os_has_said_disk_full = FALSE;
/* The mutex protecting the following counts of pending pread and pwrite
operations */
/* The mutex protecting the following counts of pending I/O operations */
static os_mutex_t os_file_count_mutex;
ulint os_file_n_pending_preads = 0;
ulint os_file_n_pending_pwrites = 0;
/* These are not protected by any mutex */
ulint os_n_pending_writes = 0;
ulint os_n_pending_reads = 0;
@@ -314,6 +311,8 @@ os_file_get_last_error(
return(OS_FILE_NOT_FOUND);
} else if (err == EEXIST) {
return(OS_FILE_ALREADY_EXISTS);
} else if (err == EXDEV || err == ENOTDIR || err == EISDIR) {
return(OS_FILE_PATH_ERROR);
} else {
return(100 + err);
}
@@ -363,7 +362,8 @@ os_file_handle_error(
return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS) {
} else if (err == OS_FILE_ALREADY_EXISTS
|| err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else {
@@ -467,7 +467,8 @@ os_file_handle_error_no_exit(
return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS) {
} else if (err == OS_FILE_ALREADY_EXISTS
|| err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else {
@@ -501,7 +502,8 @@ os_io_init_simple(void)
#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
/*************************************************************************
Creates a temporary file. This function is defined in ha_innodb.cc. */
Creates a temporary file that will be deleted on close.
This function is defined in ha_innodb.cc. */
int
innobase_mysql_tmpfile(void);
@@ -510,49 +512,26 @@ innobase_mysql_tmpfile(void);
#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
/***************************************************************************
Creates a temporary file. */
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
On Netware, this function is like tmpfile(3), because the C run-time
library of Netware does not expose the delete-on-close flag. */
FILE*
os_file_create_tmpfile(void)
/*========================*/
/* out: temporary file handle, or NULL on error */
{
#ifdef UNIV_HOTBACKUP
ut_error;
return(NULL);
#else
# ifdef __NETWARE__
FILE* file = tmpfile();
# else /* __NETWARE__ */
FILE* file = NULL;
int fd = -1;
# ifdef UNIV_HOTBACKUP
int tries;
for (tries = 10; tries--; ) {
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
if (!name) {
break;
}
fd = open(name,
# ifdef __WIN__
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
# endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
S_IREAD | S_IWRITE);
if (fd >= 0) {
# ifndef __WIN__
unlink(name);
# endif /* !__WIN__ */
free(name);
break;
}
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Warning: "
"unable to create temporary file %s, retrying\n",
name);
free(name);
}
# else /* UNIV_HOTBACKUP */
fd = innobase_mysql_tmpfile();
# endif /* UNIV_HOTBACKUP */
int fd = innobase_mysql_tmpfile();
if (fd >= 0) {
file = fdopen(fd, "w+b");
@@ -572,6 +551,7 @@ os_file_create_tmpfile(void)
}
return(file);
#endif /* UNIV_HOTBACKUP */
}
/***************************************************************************
@@ -1905,12 +1885,14 @@ os_file_pread(
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads++;
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
n_bytes = pread(file, buf, (ssize_t)n, offs);
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads--;
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(n_bytes);
@@ -1920,6 +1902,10 @@ os_file_pread(
ssize_t ret;
ulint i;
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -1928,15 +1914,17 @@ os_file_pread(
ret_offset = lseek(file, offs, SEEK_SET);
if (ret_offset < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
return(-1);
ret = -1;
} else {
ret = read(file, buf, (ssize_t)n);
}
ret = read(file, buf, (ssize_t)n);
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(ret);
}
#endif
@@ -1981,12 +1969,14 @@ os_file_pwrite(
#if defined(HAVE_PWRITE) && !defined(HAVE_BROKEN_PREAD)
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_pwrites++;
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
ret = pwrite(file, buf, (ssize_t)n, offs);
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_pwrites--;
os_n_pending_writes--;
os_mutex_exit(os_file_count_mutex);
# ifdef UNIV_DO_FLUSH
@@ -2008,6 +1998,10 @@ os_file_pwrite(
off_t ret_offset;
ulint i;
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
/* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -2016,9 +2010,9 @@ os_file_pwrite(
ret_offset = lseek(file, offs, SEEK_SET);
if (ret_offset < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
ret = -1;
return(-1);
goto func_exit;
}
ret = write(file, buf, (ssize_t)n);
@@ -2036,8 +2030,13 @@ os_file_pwrite(
}
# endif /* UNIV_DO_FLUSH */
func_exit:
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
os_mutex_exit(os_file_count_mutex);
return(ret);
}
#endif
@@ -2082,6 +2081,10 @@ try_again:
low = (DWORD) offset;
high = (DWORD) offset_high;
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -2093,17 +2096,21 @@ try_again:
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
goto error_handling;
}
os_n_pending_reads++;
ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
os_n_pending_reads--;
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
if (ret && len == n) {
return(TRUE);
}
@@ -2114,12 +2121,8 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
os_n_pending_reads++;
ret = os_file_pread(file, buf, n, offset, offset_high);
os_n_pending_reads--;
if ((ulint)ret == n) {
return(TRUE);
@@ -2193,6 +2196,10 @@ try_again:
low = (DWORD) offset;
high = (DWORD) offset_high;
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -2204,17 +2211,21 @@ try_again:
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
goto error_handling;
}
os_n_pending_reads++;
ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
os_n_pending_reads--;
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
if (ret && len == n) {
return(TRUE);
}
@@ -2225,12 +2236,8 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
os_n_pending_reads++;
ret = os_file_pread(file, buf, n, offset, offset_high);
os_n_pending_reads--;
if ((ulint)ret == n) {
return(TRUE);
@@ -2310,6 +2317,10 @@ retry:
low = (DWORD) offset;
high = (DWORD) offset_high;
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
/* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -2321,6 +2332,10 @@ retry:
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
os_mutex_exit(os_file_count_mutex);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -2335,12 +2350,8 @@ retry:
return(FALSE);
}
os_n_pending_writes++;
ret = WriteFile(file, buf, (DWORD) n, &len, NULL);
os_n_pending_writes--;
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
@@ -2352,6 +2363,10 @@ retry:
os_mutex_exit(os_file_seek_mutexes[i]);
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
os_mutex_exit(os_file_count_mutex);
if (ret && len == n) {
return(TRUE);
@@ -2402,12 +2417,8 @@ retry:
#else
ssize_t ret;
os_n_pending_writes++;
ret = os_file_pwrite(file, buf, n, offset, offset_high);
os_n_pending_writes--;
if ((ulint)ret == n) {
return(TRUE);
@@ -2519,7 +2530,7 @@ This function returns information about the specified file */
ibool
os_file_get_status(
/*===========*/
/*===============*/
/* out: TRUE if stat information found */
const char* path, /* in: pathname of the file */
os_file_stat_t* stat_info) /* information of a file in a directory */
@@ -3445,9 +3456,10 @@ try_again:
/* aio was queued successfully! */
if (mode == OS_AIO_SYNC) {
/* We want a synchronous i/o operation on a file
where we also use async i/o: in Windows we must
use the same wait mechanism as for async i/o */
/* We want a synchronous i/o operation on a
file where we also use async i/o: in Windows
we must use the same wait mechanism as for
async i/o */
retval = os_aio_windows_handle(ULINT_UNDEFINED,
slot->pos,
@@ -3825,8 +3837,8 @@ consecutive_loop:
if (slot2->reserved && slot2 != slot
&& slot2->offset == slot->offset + slot->len
&& slot->offset + slot->len > slot->offset /* check that
sum does not wrap over */
/* check that sum does not wrap over */
&& slot->offset + slot->len > slot->offset
&& slot2->offset_high == slot->offset_high
&& slot2->type == slot->type
&& slot2->file == slot->file) {

View File

@@ -102,8 +102,7 @@ os_awe_enable_lock_pages_in_mem(void)
/* Open the token of the current process */
Result = OpenProcessToken(hProcess,
TOKEN_ADJUST_PRIVILEGES,
&Token);
TOKEN_ADJUST_PRIVILEGES, &Token);
if (Result != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot open process token, error %lu\n",
@@ -260,8 +259,7 @@ os_awe_allocate_physical_mem(
defined, see the note at the start of this file */
bResult = AllocateUserPhysicalPages(GetCurrentProcess(),
&NumberOfPages,
*page_info);
&NumberOfPages, *page_info);
if (bResult != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot allocate physical pages, error %lu.\n",
@@ -533,13 +531,14 @@ Allocates large pages memory. */
void*
os_mem_alloc_large(
/*=================*/
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error)/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
{
#ifdef HAVE_LARGE_PAGES
ulint size;
@@ -557,18 +556,17 @@ os_mem_alloc_large(
shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate %lu bytes. "
"errno %d\n", n, errno);
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate"
" %lu bytes. errno %d\n", n, errno);
} else {
ptr = shmat(shmid, NULL, 0);
if (ptr == (void *)-1) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to attach shared memory "
"segment, errno %d\n", errno);
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n", errno);
}
/*
Remove the shared memory segment so that it will be automatically freed
after memory is detached or process exits
*/
/* Remove the shared memory segment so that it will be
automatically freed after memory is detached or process exits */
shmctl(shmid, IPC_RMID, &buf);
}
#endif
@@ -595,7 +593,7 @@ Frees large pages memory. */
void
os_mem_free_large(
/*=================*/
/*==============*/
void *ptr) /* in: number of bytes */
{
#ifdef HAVE_LARGE_PAGES
@@ -630,7 +628,9 @@ os_process_set_priority_boost(
no_boost = TRUE;
}
ut_a(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
/* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);

View File

@@ -317,7 +317,8 @@ os_event_wait(
os_fast_mutex_lock(&(event->os_mutex));
old_signal_count = event->signal_count;
loop:
for (;;) {
if (event->is_set == TRUE
|| event->signal_count != old_signal_count) {
@@ -334,11 +335,10 @@ loop:
pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
/* Solaris manual said that spurious wakeups may occur: we have to
check if the event really has been signaled after we came here to
wait */
goto loop;
/* Solaris manual said that spurious wakeups may occur: we
have to check if the event really has been signaled after
we came here to wait */
}
#endif
}
@@ -642,8 +642,7 @@ os_fast_mutex_free(
"InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
fprintf(stderr,
"InnoDB: Byte contents of the pthread mutex at %p:\n", fast_mutex);
ut_print_buf(stderr, (const byte*)fast_mutex,
sizeof(os_fast_mutex_t));
ut_print_buf(stderr, fast_mutex, sizeof(os_fast_mutex_t));
fprintf(stderr, "\n");
}
#endif

View File

@@ -148,15 +148,6 @@ os_thread_create(
exit(1);
}
#endif
#ifdef __NETWARE__
ret = pthread_attr_setstacksize(&attr,
(size_t) NW_THD_STACKSIZE);
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
}
#endif
#ifdef __NETWARE__
ret = pthread_attr_setstacksize(&attr,
(size_t) NW_THD_STACKSIZE);
@@ -222,7 +213,7 @@ os_thread_exit(
#ifdef HAVE_PTHREAD_JOIN
int
os_thread_join(
/*=============*/
/*===========*/
os_thread_id_t thread_id) /* in: id of the thread to join */
{
return pthread_join(thread_id, NULL);

View File

@@ -173,7 +173,8 @@ page_cur_rec_field_extends(
if (dfield_get_len(dfield) != UNIV_SQL_NULL
&& rec_f_len != UNIV_SQL_NULL
&& rec_f_len >= dfield_get_len(dfield)
&& 0 == cmp_data_data_slow(type, dfield_get_data(dfield),
&& 0 == cmp_data_data_slow(type,
dfield_get_data(dfield),
dfield_get_len(dfield),
rec_f, dfield_get_len(dfield))) {
@@ -259,10 +260,8 @@ page_cur_search_with_match(
&& (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
if (page_cur_try_search_shortcut(page, index, tuple,
iup_matched_fields,
iup_matched_bytes,
ilow_matched_fields,
ilow_matched_bytes,
iup_matched_fields, iup_matched_bytes,
ilow_matched_fields, ilow_matched_bytes,
cursor)) {
return;
}
@@ -533,7 +532,8 @@ page_cur_insert_rec_write_log(
ut_a(rec_size < UNIV_PAGE_SIZE);
ut_ad(buf_frame_align(insert_rec) == buf_frame_align(cursor_rec));
ut_ad(!page_rec_is_comp(insert_rec) == !index->table->comp);
ut_ad(!page_rec_is_comp(insert_rec)
== !dict_table_is_comp(index->table));
comp = page_rec_is_comp(insert_rec);
{
@@ -774,7 +774,7 @@ page_cur_parse_insert_rec(
return(ptr + end_seg_len);
}
ut_ad(!!page_is_comp(page) == index->table->comp);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
/* Read from the log the inserted index record end segment which
differs from the cursor record */
@@ -889,7 +889,7 @@ page_cur_insert_rec_low(
page = page_cur_get_page(cursor);
comp = page_is_comp(page);
ut_ad(index->table->comp == !!comp);
ut_ad(dict_table_is_comp(index->table) == !!comp);
ut_ad(cursor->rec != page_get_supremum_rec(page));
@@ -1019,7 +1019,7 @@ page_copy_rec_list_to_created_page_write_log(
{
byte* log_ptr;
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, page, index,
page_is_comp(page)
@@ -1251,7 +1251,7 @@ page_cur_delete_rec_write_log(
{
byte* log_ptr;
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)
@@ -1343,7 +1343,7 @@ page_cur_delete_rec(
page = page_cur_get_page(cursor);
current_rec = cursor->rec;
ut_ad(rec_offs_validate(current_rec, index, offsets));
ut_ad(!!page_is_comp(page) == index->table->comp);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
/* The record must not be the supremum or infimum record. */
ut_ad(current_rec != page_get_supremum_rec(page));
@@ -1397,7 +1397,9 @@ page_cur_delete_rec(
prev_rec is owned by the same slot, i.e., PAGE_DIR_SLOT_MIN_N_OWNED
>= 2. */
ut_ad(PAGE_DIR_SLOT_MIN_N_OWNED >= 2);
#if PAGE_DIR_SLOT_MIN_N_OWNED < 2
# error "PAGE_DIR_SLOT_MIN_N_OWNED < 2"
#endif
ut_ad(cur_n_owned > 1);
if (current_rec == page_dir_slot_get_rec(cur_dir_slot)) {

View File

@@ -351,10 +351,12 @@ page_create(
index = comp ? srv_sys->dummy_ind2 : srv_sys->dummy_ind1;
ut_ad(frame && mtr);
ut_ad(PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE
<= PAGE_DATA);
ut_ad(PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE
<= PAGE_DATA);
#if PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA
# error "PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA"
#endif
#if PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE > PAGE_DATA
# error "PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE > PAGE_DATA"
#endif
/* 1. INCREMENT MODIFY CLOCK */
buf_frame_modify_clock_inc(frame);
@@ -483,7 +485,8 @@ page_copy_rec_list_end_no_locks(
page_cur_move_to_next(&cur1);
}
ut_a((ibool)!!page_is_comp(new_page) == index->table->comp);
ut_a((ibool)!!page_is_comp(new_page)
== dict_table_is_comp(index->table));
ut_a(page_is_comp(new_page) == page_is_comp(page));
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
(page_is_comp(new_page)
@@ -516,6 +519,7 @@ page_copy_rec_list_end_no_locks(
(ulong)(rec - page),
(ulong)(page_cur_get_rec(&cur1) - page),
(ulong)(page_cur_get_rec(&cur2) - new_page));
ut_error;
}
@@ -687,7 +691,7 @@ page_parse_delete_rec_list(
return(ptr);
}
ut_ad(!!page_is_comp(page) == index->table->comp);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
if (type == MLOG_LIST_END_DELETE
|| type == MLOG_COMP_LIST_END_DELETE) {
@@ -851,7 +855,7 @@ page_delete_rec_list_start(
byte type;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(!!page_is_comp(page) == index->table->comp);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
if (page_is_comp(page)) {
type = MLOG_COMP_LIST_START_DELETE;
@@ -1347,7 +1351,7 @@ page_print_list(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_a((ibool)!!page_is_comp(page) == index->table->comp);
ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
fprintf(stderr,
"--------------------------------\n"
@@ -1431,7 +1435,7 @@ debugging purposes. */
void
page_print(
/*======*/
/*=======*/
page_t* page, /* in: index page */
dict_index_t* index, /* in: dictionary index of the page */
ulint dn, /* in: print dn first and last entries
@@ -1741,7 +1745,7 @@ page_validate(
ulint* offsets = NULL;
ulint* old_offsets = NULL;
if ((ibool)!!comp != index->table->comp) {
if ((ibool)!!comp != dict_table_is_comp(index->table)) {
fputs("InnoDB: 'compact format' flag mismatch\n", stderr);
goto func_exit2;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
#!/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

File diff suppressed because it is too large Load Diff

View File

@@ -1,90 +1,220 @@
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#define PARS_INT_LIT 257
#define PARS_FLOAT_LIT 258
#define PARS_STR_LIT 259
#define PARS_NULL_LIT 260
#define PARS_ID_TOKEN 261
#define PARS_AND_TOKEN 262
#define PARS_OR_TOKEN 263
#define PARS_NOT_TOKEN 264
#define PARS_GE_TOKEN 265
#define PARS_LE_TOKEN 266
#define PARS_NE_TOKEN 267
#define PARS_PROCEDURE_TOKEN 268
#define PARS_IN_TOKEN 269
#define PARS_OUT_TOKEN 270
#define PARS_INT_TOKEN 271
#define PARS_INTEGER_TOKEN 272
#define PARS_FLOAT_TOKEN 273
#define PARS_CHAR_TOKEN 274
#define PARS_IS_TOKEN 275
#define PARS_BEGIN_TOKEN 276
#define PARS_END_TOKEN 277
#define PARS_IF_TOKEN 278
#define PARS_THEN_TOKEN 279
#define PARS_ELSE_TOKEN 280
#define PARS_ELSIF_TOKEN 281
#define PARS_LOOP_TOKEN 282
#define PARS_WHILE_TOKEN 283
#define PARS_RETURN_TOKEN 284
#define PARS_SELECT_TOKEN 285
#define PARS_SUM_TOKEN 286
#define PARS_COUNT_TOKEN 287
#define PARS_DISTINCT_TOKEN 288
#define PARS_FROM_TOKEN 289
#define PARS_WHERE_TOKEN 290
#define PARS_FOR_TOKEN 291
#define PARS_DDOT_TOKEN 292
#define PARS_CONSISTENT_TOKEN 293
#define PARS_READ_TOKEN 294
#define PARS_ORDER_TOKEN 295
#define PARS_BY_TOKEN 296
#define PARS_ASC_TOKEN 297
#define PARS_DESC_TOKEN 298
#define PARS_INSERT_TOKEN 299
#define PARS_INTO_TOKEN 300
#define PARS_VALUES_TOKEN 301
#define PARS_UPDATE_TOKEN 302
#define PARS_SET_TOKEN 303
#define PARS_DELETE_TOKEN 304
#define PARS_CURRENT_TOKEN 305
#define PARS_OF_TOKEN 306
#define PARS_CREATE_TOKEN 307
#define PARS_TABLE_TOKEN 308
#define PARS_INDEX_TOKEN 309
#define PARS_UNIQUE_TOKEN 310
#define PARS_CLUSTERED_TOKEN 311
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 312
#define PARS_ON_TOKEN 313
#define PARS_ASSIGN_TOKEN 314
#define PARS_DECLARE_TOKEN 315
#define PARS_CURSOR_TOKEN 316
#define PARS_SQL_TOKEN 317
#define PARS_OPEN_TOKEN 318
#define PARS_FETCH_TOKEN 319
#define PARS_CLOSE_TOKEN 320
#define PARS_NOTFOUND_TOKEN 321
#define PARS_TO_CHAR_TOKEN 322
#define PARS_TO_NUMBER_TOKEN 323
#define PARS_TO_BINARY_TOKEN 324
#define PARS_BINARY_TO_NUMBER_TOKEN 325
#define PARS_SUBSTR_TOKEN 326
#define PARS_REPLSTR_TOKEN 327
#define PARS_CONCAT_TOKEN 328
#define PARS_INSTR_TOKEN 329
#define PARS_LENGTH_TOKEN 330
#define PARS_SYSDATE_TOKEN 331
#define PARS_PRINTF_TOKEN 332
#define PARS_ASSERT_TOKEN 333
#define PARS_RND_TOKEN 334
#define PARS_RND_STR_TOKEN 335
#define PARS_ROW_PRINTF_TOKEN 336
#define PARS_COMMIT_TOKEN 337
#define PARS_ROLLBACK_TOKEN 338
#define PARS_WORK_TOKEN 339
#define NEG 340
/* A Bison parser, made by GNU Bison 1.875d. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
PARS_INT_LIT = 258,
PARS_FLOAT_LIT = 259,
PARS_STR_LIT = 260,
PARS_NULL_LIT = 261,
PARS_ID_TOKEN = 262,
PARS_AND_TOKEN = 263,
PARS_OR_TOKEN = 264,
PARS_NOT_TOKEN = 265,
PARS_GE_TOKEN = 266,
PARS_LE_TOKEN = 267,
PARS_NE_TOKEN = 268,
PARS_PROCEDURE_TOKEN = 269,
PARS_IN_TOKEN = 270,
PARS_OUT_TOKEN = 271,
PARS_BINARY_TOKEN = 272,
PARS_BLOB_TOKEN = 273,
PARS_INT_TOKEN = 274,
PARS_INTEGER_TOKEN = 275,
PARS_FLOAT_TOKEN = 276,
PARS_CHAR_TOKEN = 277,
PARS_IS_TOKEN = 278,
PARS_BEGIN_TOKEN = 279,
PARS_END_TOKEN = 280,
PARS_IF_TOKEN = 281,
PARS_THEN_TOKEN = 282,
PARS_ELSE_TOKEN = 283,
PARS_ELSIF_TOKEN = 284,
PARS_LOOP_TOKEN = 285,
PARS_WHILE_TOKEN = 286,
PARS_RETURN_TOKEN = 287,
PARS_SELECT_TOKEN = 288,
PARS_SUM_TOKEN = 289,
PARS_COUNT_TOKEN = 290,
PARS_DISTINCT_TOKEN = 291,
PARS_FROM_TOKEN = 292,
PARS_WHERE_TOKEN = 293,
PARS_FOR_TOKEN = 294,
PARS_DDOT_TOKEN = 295,
PARS_CONSISTENT_TOKEN = 296,
PARS_READ_TOKEN = 297,
PARS_ORDER_TOKEN = 298,
PARS_BY_TOKEN = 299,
PARS_ASC_TOKEN = 300,
PARS_DESC_TOKEN = 301,
PARS_INSERT_TOKEN = 302,
PARS_INTO_TOKEN = 303,
PARS_VALUES_TOKEN = 304,
PARS_UPDATE_TOKEN = 305,
PARS_SET_TOKEN = 306,
PARS_DELETE_TOKEN = 307,
PARS_CURRENT_TOKEN = 308,
PARS_OF_TOKEN = 309,
PARS_CREATE_TOKEN = 310,
PARS_TABLE_TOKEN = 311,
PARS_INDEX_TOKEN = 312,
PARS_UNIQUE_TOKEN = 313,
PARS_CLUSTERED_TOKEN = 314,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 315,
PARS_ON_TOKEN = 316,
PARS_ASSIGN_TOKEN = 317,
PARS_DECLARE_TOKEN = 318,
PARS_CURSOR_TOKEN = 319,
PARS_SQL_TOKEN = 320,
PARS_OPEN_TOKEN = 321,
PARS_FETCH_TOKEN = 322,
PARS_CLOSE_TOKEN = 323,
PARS_NOTFOUND_TOKEN = 324,
PARS_TO_CHAR_TOKEN = 325,
PARS_TO_NUMBER_TOKEN = 326,
PARS_TO_BINARY_TOKEN = 327,
PARS_BINARY_TO_NUMBER_TOKEN = 328,
PARS_SUBSTR_TOKEN = 329,
PARS_REPLSTR_TOKEN = 330,
PARS_CONCAT_TOKEN = 331,
PARS_INSTR_TOKEN = 332,
PARS_LENGTH_TOKEN = 333,
PARS_SYSDATE_TOKEN = 334,
PARS_PRINTF_TOKEN = 335,
PARS_ASSERT_TOKEN = 336,
PARS_RND_TOKEN = 337,
PARS_RND_STR_TOKEN = 338,
PARS_ROW_PRINTF_TOKEN = 339,
PARS_COMMIT_TOKEN = 340,
PARS_ROLLBACK_TOKEN = 341,
PARS_WORK_TOKEN = 342,
NEG = 343
};
#endif
#define PARS_INT_LIT 258
#define PARS_FLOAT_LIT 259
#define PARS_STR_LIT 260
#define PARS_NULL_LIT 261
#define PARS_ID_TOKEN 262
#define PARS_AND_TOKEN 263
#define PARS_OR_TOKEN 264
#define PARS_NOT_TOKEN 265
#define PARS_GE_TOKEN 266
#define PARS_LE_TOKEN 267
#define PARS_NE_TOKEN 268
#define PARS_PROCEDURE_TOKEN 269
#define PARS_IN_TOKEN 270
#define PARS_OUT_TOKEN 271
#define PARS_BINARY_TOKEN 272
#define PARS_BLOB_TOKEN 273
#define PARS_INT_TOKEN 274
#define PARS_INTEGER_TOKEN 275
#define PARS_FLOAT_TOKEN 276
#define PARS_CHAR_TOKEN 277
#define PARS_IS_TOKEN 278
#define PARS_BEGIN_TOKEN 279
#define PARS_END_TOKEN 280
#define PARS_IF_TOKEN 281
#define PARS_THEN_TOKEN 282
#define PARS_ELSE_TOKEN 283
#define PARS_ELSIF_TOKEN 284
#define PARS_LOOP_TOKEN 285
#define PARS_WHILE_TOKEN 286
#define PARS_RETURN_TOKEN 287
#define PARS_SELECT_TOKEN 288
#define PARS_SUM_TOKEN 289
#define PARS_COUNT_TOKEN 290
#define PARS_DISTINCT_TOKEN 291
#define PARS_FROM_TOKEN 292
#define PARS_WHERE_TOKEN 293
#define PARS_FOR_TOKEN 294
#define PARS_DDOT_TOKEN 295
#define PARS_CONSISTENT_TOKEN 296
#define PARS_READ_TOKEN 297
#define PARS_ORDER_TOKEN 298
#define PARS_BY_TOKEN 299
#define PARS_ASC_TOKEN 300
#define PARS_DESC_TOKEN 301
#define PARS_INSERT_TOKEN 302
#define PARS_INTO_TOKEN 303
#define PARS_VALUES_TOKEN 304
#define PARS_UPDATE_TOKEN 305
#define PARS_SET_TOKEN 306
#define PARS_DELETE_TOKEN 307
#define PARS_CURRENT_TOKEN 308
#define PARS_OF_TOKEN 309
#define PARS_CREATE_TOKEN 310
#define PARS_TABLE_TOKEN 311
#define PARS_INDEX_TOKEN 312
#define PARS_UNIQUE_TOKEN 313
#define PARS_CLUSTERED_TOKEN 314
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 315
#define PARS_ON_TOKEN 316
#define PARS_ASSIGN_TOKEN 317
#define PARS_DECLARE_TOKEN 318
#define PARS_CURSOR_TOKEN 319
#define PARS_SQL_TOKEN 320
#define PARS_OPEN_TOKEN 321
#define PARS_FETCH_TOKEN 322
#define PARS_CLOSE_TOKEN 323
#define PARS_NOTFOUND_TOKEN 324
#define PARS_TO_CHAR_TOKEN 325
#define PARS_TO_NUMBER_TOKEN 326
#define PARS_TO_BINARY_TOKEN 327
#define PARS_BINARY_TO_NUMBER_TOKEN 328
#define PARS_SUBSTR_TOKEN 329
#define PARS_REPLSTR_TOKEN 330
#define PARS_CONCAT_TOKEN 331
#define PARS_INSTR_TOKEN 332
#define PARS_LENGTH_TOKEN 333
#define PARS_SYSDATE_TOKEN 334
#define PARS_PRINTF_TOKEN 335
#define PARS_ASSERT_TOKEN 336
#define PARS_RND_TOKEN 337
#define PARS_RND_STR_TOKEN 338
#define PARS_ROW_PRINTF_TOKEN 339
#define PARS_COMMIT_TOKEN 340
#define PARS_ROLLBACK_TOKEN 341
#define PARS_WORK_TOKEN 342
#define NEG 343
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;

View File

@@ -44,6 +44,8 @@ yylex(void);
%token PARS_PROCEDURE_TOKEN
%token PARS_IN_TOKEN
%token PARS_OUT_TOKEN
%token PARS_BINARY_TOKEN
%token PARS_BLOB_TOKEN
%token PARS_INT_TOKEN
%token PARS_INTEGER_TOKEN
%token PARS_FLOAT_TOKEN
@@ -448,7 +450,8 @@ fetch_statement:
;
column_def:
PARS_ID_TOKEN type_name { $$ = pars_column_def($1, $2); }
PARS_ID_TOKEN type_name opt_column_len opt_not_null
{ $$ = pars_column_def($1, $2, $3, $4); }
;
column_def_list:
@@ -457,6 +460,19 @@ column_def_list:
{ $$ = que_node_list_add_last($1, $3); }
;
opt_column_len:
/* Nothing */ { $$ = NULL; }
| '(' PARS_INT_LIT ')'
{ $$ = $2; }
;
opt_not_null:
/* Nothing */ { $$ = NULL; }
| PARS_NOT_TOKEN PARS_NULL_LIT
{ $$ = &pars_int_token;
/* pass any non-NULL pointer */ }
;
not_fit_in_memory:
/* Nothing */ { $$ = NULL; }
| PARS_DOES_NOT_FIT_IN_MEM_TOKEN
@@ -506,7 +522,10 @@ rollback_statement:
type_name:
PARS_INT_TOKEN { $$ = &pars_int_token; }
| PARS_INTEGER_TOKEN { $$ = &pars_int_token; }
| PARS_CHAR_TOKEN { $$ = &pars_char_token; }
| PARS_BINARY_TOKEN { $$ = &pars_binary_token; }
| PARS_BLOB_TOKEN { $$ = &pars_blob_token; }
;
parameter_declaration:

Some files were not shown because too many files have changed in this diff Show More