Commit 32b5fb73 authored by unknown's avatar unknown

Apply the following innodb-5.1-* snapshots: ss1489, ss1496, ss1550, ss1569.

After applying the snapshots, ensure that code conforms to the final version
of WL 3914.

It is signficant that, after these changes, InnoDB does not define MYSQL_SERVER,
and can be built as an independent storage engine plugin.

Fixes:
Bug#9709:  InnoDB inconsistensy causes "Operating System Error 32/33"
Bug#18828: If InnoDB runs out of undo slots, it returns misleading 'table is full'
Bug#20090: InnoDB: Error: trying to declare trx to enter InnoDB
Bug#20352: Make ibuf_contract_for_n_pages tunable
Bug#21101: Wrong error on exceeding max row size for InnoDB table
Bug#21293: Deadlock detection prefers to kill long running FOR UPDATE queries
Bug#22819: SHOW INNODB STATUS crashes the server with an assertion failure under high load
Bug#25078: Make the replication thread to ignore innodb_thread_concurrency
Bug#25645: Assertion failure in file srv0srv.c
Bug#28138: indexing column prefixes produces corruption in InnoDB


BitKeeper/deleted/.del-Makefile.am~55504c43d99979e4:
  Delete: storage/innobase/buf/Makefile.am
BitKeeper/deleted/.del-Makefile.am~79bb55303929b560:
  Delete: storage/innobase/dict/Makefile.am
BitKeeper/deleted/.del-Makefile.am~7cd88e5f9a8d7ce8:
  Delete: storage/innobase/data/Makefile.am
BitKeeper/deleted/.del-Makefile.am~e19a1fb29b1fe527:
  Delete: storage/innobase/btr/Makefile.am
BitKeeper/deleted/.del-Makefile.am~4ae65b009d41d1d:
  Delete: storage/innobase/eval/Makefile.am
BitKeeper/deleted/.del-Makefile.am~679131a02af3f6fb:
  Delete: storage/innobase/fsp/Makefile.am
BitKeeper/deleted/.del-Makefile.am~6acac9ae30eabdb3:
  Delete: storage/innobase/dyn/Makefile.am
BitKeeper/deleted/.del-Makefile.am~a5e6b4385717fcb7:
  Delete: storage/innobase/fil/Makefile.am
BitKeeper/deleted/.del-Makefile.am~11d601934b49c19:
  Delete: storage/innobase/fut/Makefile.am
BitKeeper/deleted/.del-Makefile.am~5aab37bf3b6c430:
  Delete: storage/innobase/ibuf/Makefile.am
BitKeeper/deleted/.del-Makefile.am~af2d719bb6e66986:
  Delete: storage/innobase/handler/Makefile.am
BitKeeper/deleted/.del-Makefile.am~f0dbbc7a78648e18:
  Delete: storage/innobase/ha/Makefile.am
BitKeeper/deleted/.del-Makefile.am~41684e54a5b0d26a:
  Delete: storage/innobase/log/Makefile.am
BitKeeper/deleted/.del-Makefile.am~edd95d7290ddeff3:
  Delete: storage/innobase/lock/Makefile.am
BitKeeper/deleted/.del-Makefile.i:
  Delete: storage/innobase/include/Makefile.i
BitKeeper/deleted/.del-Makefile.am~2a6ccdba41b591a3:
  Delete: storage/innobase/mach/Makefile.am
BitKeeper/deleted/.del-Makefile.am~2bd35bda856342:
  Delete: storage/innobase/os/Makefile.am
BitKeeper/deleted/.del-Makefile.am~8448688c5ab92132:
  Delete: storage/innobase/mem/Makefile.am
BitKeeper/deleted/.del-Makefile.am~b5a7a8cfa711b6de:
  Delete: storage/innobase/mtr/Makefile.am
BitKeeper/deleted/.del-Makefile.am~2cee8a309eb8eee2:
  Delete: storage/innobase/page/Makefile.am
BitKeeper/deleted/.del-Makefile.am~3d0553f8aa9c456b:
  Delete: storage/innobase/read/Makefile.am
BitKeeper/deleted/.del-Makefile.am~7b0c4abae6684f8c:
  Delete: storage/innobase/pars/Makefile.am
BitKeeper/deleted/.del-Makefile.am~d0e0dd55cbd413f0:
  Delete: storage/innobase/que/Makefile.am
BitKeeper/deleted/.del-Makefile.am~20a219ccf7825d65:
  Delete: storage/innobase/row/Makefile.am
BitKeeper/deleted/.del-Makefile.am~37bdfb2973b2442b:
  Delete: storage/innobase/rem/Makefile.am
BitKeeper/deleted/.del-Makefile.am~557098c4e5c01ee2:
  Delete: storage/innobase/thr/Makefile.am
BitKeeper/deleted/.del-Makefile.am~fdfe12f48c2499af:
  Delete: storage/innobase/sync/Makefile.am
BitKeeper/deleted/.del-Makefile.am~feb2280a52035d8d:
  Delete: storage/innobase/srv/Makefile.am
BitKeeper/deleted/.del-Makefile.am~456d34c4816dbda4:
  Delete: storage/innobase/ut/Makefile.am
BitKeeper/deleted/.del-Makefile.am~5ec2ef0d2c35e138:
  Delete: storage/innobase/usr/Makefile.am
BitKeeper/deleted/.del-Makefile.am~d25c456e48393313:
  Delete: storage/innobase/trx/Makefile.am
mysql-test/r/innodb.result:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1421:
  Fix the innodb test by shifting some of the contents of the .result file.
  
  Approved by:	Marko
  
  
  Revision r1422:
  Fix for Bug#21101 - returns wrong error message when table column
  defs exceed the max row size.
  
  The fix returns a more appropriate error message. Add a test case to
  innodb.test and expected output to innodb.result.
mysql-test/t/innodb.test:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1422:
  Fix for Bug#21101 - returns wrong error message when table column
  defs exceed the max row size.
  
  The fix returns a more appropriate error message. Add a test case to
  innodb.test and expected output to innodb.result.
storage/innobase/btr/btr0btr.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1546:
  When buffering an insert to a prefix index of a variable-length column,
  do not incorrectly mark the column as fixed-length.  (Bug#28138)
  
  ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
  dtype_new_store_for_order_and_null_size().  Add debug assertions.
  
  btr_index_rec_validate(): Correct a comment about prefix indexes.
  
  rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
  debug assertions and comments.
  
  dict_col_type_assert_equal(): New debug function.
storage/innobase/data/data0data.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1490:
  Add #include <ctype.h>.  Apparently, this header is no longer included by
  the common headers.  This may be related to WL#2936
  (pluggable storage engines).
storage/innobase/data/data0type.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
storage/innobase/dict/dict0crea.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/dict/dict0dict.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1490:
  Add #include <ctype.h>.  Apparently, this header is no longer included by
  the common headers.  This may be related to WL#2936
  (pluggable storage engines).
  
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
  
  
  Revision r1528:
  Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
  
  
  Revision r1529:
  Revert r799, which was supposed to prevent similar cases as Bug#21638.
  In reality, the patch breaks the handling of prefix indexes of
  variable-length columns in ROW_FORMAT=COMPACT.  Reverting the patch
  is only a partial fix of Bug#28138.
  
  
  Revision r1535:
  Document that DICT_MAX_INDEX_COL_LEN must not be changed.
storage/innobase/fsp/fsp0fsp.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
  
  
  Revision r1528:
  Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
storage/innobase/ibuf/ibuf0ibuf.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1420:
  Output to the error log information about the limitations of
  UNIV_IBUF_DEBUG.
  
  innobase_start_or_create_for_mysql(): Note that crash recovery is broken
  when UNIV_IBUF_DEBUG is defined.
  
  ibuf_counts[]: Make this a two-dimensional array.  No need to allocate
  anything from the heap.  Eliminate ibuf_counts_inited, as the array
  will be zero-filled by the runtime environment.
  
  ibuf_count_check(): New function, to print out an explanation before
  assertion failure.
  
  
  Revision r1528:
  Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
  
  
  Revision r1546:
  When buffering an insert to a prefix index of a variable-length column,
  do not incorrectly mark the column as fixed-length.  (Bug#28138)
  
  ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
  dtype_new_store_for_order_and_null_size().  Add debug assertions.
  
  btr_index_rec_validate(): Correct a comment about prefix indexes.
  
  rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
  debug assertions and comments.
  
  dict_col_type_assert_equal(): New debug function.
storage/innobase/include/db0err.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/include/dict0dict.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1546:
  When buffering an insert to a prefix index of a variable-length column,
  do not incorrectly mark the column as fixed-length.  (Bug#28138)
  
  ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
  dtype_new_store_for_order_and_null_size().  Add debug assertions.
  
  btr_index_rec_validate(): Correct a comment about prefix indexes.
  
  rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
  debug assertions and comments.
  
  dict_col_type_assert_equal(): New debug function.
storage/innobase/include/dict0dict.ic:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1546:
  When buffering an insert to a prefix index of a variable-length column,
  do not incorrectly mark the column as fixed-length.  (Bug#28138)
  
  ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
  dtype_new_store_for_order_and_null_size().  Add debug assertions.
  
  btr_index_rec_validate(): Correct a comment about prefix indexes.
  
  rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
  debug assertions and comments.
  
  dict_col_type_assert_equal(): New debug function.
storage/innobase/include/dict0mem.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1535:
  Document that DICT_MAX_INDEX_COL_LEN must not be changed.
  
  
  Revision r1536:
  Change the comment to a more appropriate one. Discussed with Heikki on IM.
  
  Approved by:	Heikki
storage/innobase/include/ha_prototypes.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1482:
  Fix Bug#25078 by always letting the replication thread on the slave
  server to enter InnoDB. This can be made further customizable by the
  user if we introduce a new config parameter. This will wait until
  config parameters can be easily added.
  
  Approved by:	Marko
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
storage/innobase/include/os0file.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1431:
  Fix Bug#9709 by retrying (forever) if ERROR_SHARING_VIOLATION or
  ERROR_LOCK_VIOLATION is encountered during file operation.
  This is caused by backup software, so InnoDB should retry while the backup
  software is done with the file.
  
  Approved by:	Heikki
storage/innobase/include/rem0rec.ic:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1569:
  Fix some in:/out: comments.
  
  Approved by:	Marko
storage/innobase/include/row0mysql.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1422:
  Fix for Bug#21101 - returns wrong error message when table column
  defs exceed the max row size.
  
  The fix returns a more appropriate error message. Add a test case to
  innodb.test and expected output to innodb.result.
storage/innobase/include/trx0trx.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1462:
  Fix typo in comment.
  
  
  Revision r1486:
  Improve the comment for trx_struct::undo_no.
  
  Suggested by:	Heikki
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1497:
  Add the number of locks acquired by a transaction to its weight when
  choosing the lightest transaction to kill when a deadlock occurs.
  This fixes Bug#21293 partially.
  
  Approved by:	Heikki
  
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
storage/innobase/include/trx0undo.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/include/ut0ut.h:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1528:
  Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
storage/innobase/lock/lock0lock.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1457:
  Fix Bug#22819, remove assertion. (http://bugs.mysql.com/bug.php?id=22819)
  
  
  Revision r1497:
  Add the number of locks acquired by a transaction to its weight when
  choosing the lightest transaction to kill when a deadlock occurs.
  This fixes Bug#21293 partially.
  
  Approved by:	Heikki
  
  
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
storage/innobase/log/log0log.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1521:
  Forward port r1520 from branches/5.0
  
  Patch to allow monitor threads to stop before proceeding with normal shutdown. 
  Also have a separate time counter for tablespace monitor.
  
  reviewed by: Heikki
  
  
  Revision r1524:
  Undo bad space formatting introduced in earlier commit r1521
  
  spotted by: Marko
  
  
  Revision r1533:
  logs_empty_and_mark_files_at_shutdown(): Remove trailing whitespace that
  was added in r1521.
storage/innobase/os/os0file.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1431:
  Fix Bug#9709 by retrying (forever) if ERROR_SHARING_VIOLATION or
  ERROR_LOCK_VIOLATION is encountered during file operation.
  This is caused by backup software, so InnoDB should retry while the backup
  software is done with the file.
  
  Approved by:	Heikki
storage/innobase/rem/rem0rec.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1528:
  Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
  
  
  Revision r1531:
  rec_get_converted_size_new(): Simplify and move a debug assertion.
  
  
  Revision r1546:
  When buffering an insert to a prefix index of a variable-length column,
  do not incorrectly mark the column as fixed-length.  (Bug#28138)
  
  ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
  dtype_new_store_for_order_and_null_size().  Add debug assertions.
  
  btr_index_rec_validate(): Correct a comment about prefix indexes.
  
  rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
  debug assertions and comments.
  
  dict_col_type_assert_equal(): New debug function.
  
  
  Revision r1555:
  rec_get_converted_size_new(): The total size of the infimum and supremum
  records in ROW_FORMAT=COMPACT is REC_N_NEW_EXTRA_BYTES + 8.  The
  REC_N_NEW_EXTRA_BYTES was accidentally omitted in r1546.  This function
  should never be called on those records, though.
  
  
  Revision r1569:
  Fix some in:/out: comments.
  
  Approved by:	Marko
storage/innobase/row/row0ins.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1485:
  Minor cleanup.
  
  row_ins_check_foreign_constraint(), row_ins_scan_sec_index_for_duplicate():
  Make use of the predicates page_rec_is_infimum() and page_rec_is_supremum().
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
storage/innobase/row/row0mysql.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1422:
  Fix for Bug#21101 - returns wrong error message when table column
  defs exceed the max row size.
  
  The fix returns a more appropriate error message. Add a test case to
  innodb.test and expected output to innodb.result.
  
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/row/row0row.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
  
  
  Revision r1529:
  Revert r799, which was supposed to prevent similar cases as Bug#21638.
  In reality, the patch breaks the handling of prefix indexes of
  variable-length columns in ROW_FORMAT=COMPACT.  Reverting the patch
  is only a partial fix of Bug#28138.
storage/innobase/row/row0sel.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1452:
  Fix phantom reads (http://bugs.mysql.com/27197) following Heikki's
  patch in the bug followup.
  
  Approved by:	Heikki
  
  
  
  Revision r1455:
  Reindent with tabs instead of spaces.
  
  Spotted by:	Marko
storage/innobase/srv/srv0srv.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1424:
  Bug#20352. Added variable srv_insert_buffer_batch_size. We want to make
  this variable settable. Since the pluggable engine interface currently
  doesn't provide a usable mechanism, we will add the latter functionality
  once it's available.
  
  
  Revision r1426:
  Fix code indentation from r1424.
  
  
  Revision r1459:
  Fix typo in the comment.
  
  
  Revision r1482:
  Fix Bug#25078 by always letting the replication thread on the slave
  server to enter InnoDB. This can be made further customizable by the
  user if we introduce a new config parameter. This will wait until
  config parameters can be easily added.
  
  Approved by:	Marko
  
  
  Revision r1487:
  Fix typo in comment.
  
  Spotted by:	Marko
  
  
  Revision r1521:
  Forward port r1520 from branches/5.0
  
  Patch to allow monitor threads to stop before proceeding with normal shutdown. 
  Also have a separate time counter for tablespace monitor.
  
  reviewed by: Heikki
  
  
  Revision r1532:
  srv_lock_timeout_and_monitor_thread(): Correct the indentation that was
  broken in r1521.
  
  
  Revision r1553:
  Fix Bug#20090 as suggested in the bug followup by Heikki.
  
  Approved by:	Heikki
storage/innobase/srv/srv0start.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1420:
  Output to the error log information about the limitations of
  UNIV_IBUF_DEBUG.
  
  innobase_start_or_create_for_mysql(): Note that crash recovery is broken
  when UNIV_IBUF_DEBUG is defined.
  
  ibuf_counts[]: Make this a two-dimensional array.  No need to allocate
  anything from the heap.  Eliminate ibuf_counts_inited, as the array
  will be zero-filled by the runtime environment.
  
  ibuf_count_check(): New function, to print out an explanation before
  assertion failure.
storage/innobase/sync/sync0arr.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
storage/innobase/trx/trx0rec.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/trx/trx0trx.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1491:
  Fix typo in comment.
  
  
  Revision r1497:
  Add the number of locks acquired by a transaction to its weight when
  choosing the lightest transaction to kill when a deadlock occurs.
  This fixes Bug#21293 partially.
  
  Approved by:	Heikki
  
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
  
  
  Revision r1522:
  trx0trx.c: Add missing #include "ha_prototypes.h".
storage/innobase/trx/trx0undo.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
storage/innobase/ut/ut0ut.c:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1490:
  Add #include <ctype.h>.  Apparently, this header is no longer included by
  the common headers.  This may be related to WL#2936
  (pluggable storage engines).
mysql-test/r/innodb_trx_weight.result:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1498:
  Add a test about the behavior introduced in r1497.
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
mysql-test/include/innodb_trx_weight.inc:
  Apply the following innodb-5.1-* snapshots:  ss1489, ss1496, ss1550, ss1569.
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
  
  
  Revision r1556:
  mysql-test/innodb_trx_weight.inc: Add username root to the "connect" statement.
  The Unix user running mysql-test-run usually does not have any privileges
  on the MySQL test database.
mysql-test/t/innodb_trx_weight.test:
  Fixes after merging InnoDB snapshots.
  
  Revision r1498:
  Add a test about the behavior introduced in r1497.
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
sql/sql_class.cc:
  Fixes after merging InnoDB snapshots.
storage/innobase/Makefile.am:
  Fixes after merging InnoDB snapshots.
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
storage/innobase/handler/ha_innodb.cc:
  Fixes after merging InnoDB snapshots.
  
  Revision r1422:
  Fix for Bug#21101 - returns wrong error message when table column
  defs exceed the max row size.
  
  The fix returns a more appropriate error message. Add a test case to
  innodb.test and expected output to innodb.result.
  
  
  Revision r1423:
  Fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
  of UNDO slots in the rollback segment. This is a partial fix since the
  MySQL error code requested to properly report the error condition back
  to the client has not yet materialized. Currently we have #ifdef'd the
  error code translation in ha_innodb.cc. This will have to be changed
  as and when MySQl add the new requested code or an equivalent code
  that we can then use.
  
  Given the above, currently we will get the old behaviour, not the "fixed"
  and intended behaviour.
  
  
  
  Revision r1425:
  Fixed a missing function decoration that slipped into r1422.
  
  
  Revision r1434:
  Fix typo.
  
  
  Revision r1442:
  Potential fix for Bug#25645:
  
  "Move innobase_release_stat_resources(trx) outside the 'if' in
  ha_innobase::external_lock(). That would add more safety that whatever
  MySQL does at a query end, there would be no risk of a hang on the btr
  search latch."
  
  Also call innobase_release_temporary_latches() in the beginning of
  ha_innobase::close().
  
  Approved by:	Heikki
  
  
  Revision r1453:
  Bugfix: only call innobase_release_temporary_latches() in case of current_thd
  is not NULL, otherwise we get NULL pointer dereferencing.
  
  Approved by:	Heikki
  
  
  Revision r1474:
  Fix typo in comment: the exact prototype is in
  include/data0type.ic, not in data/data0type.ic
  
  
  
  Revision r1482:
  Fix Bug#25078 by always letting the replication thread on the slave
  server to enter InnoDB. This can be made further customizable by the
  user if we introduce a new config parameter. This will wait until
  config parameters can be easily added.
  
  Approved by:	Marko
  
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
  
  
  Revision r1489:
  thd_to_trx(), check_trx_exists(): Remove the handlerton parameter.  It is a
  singleton object whose address is stored into innodb_hton_ptr.
  
  
  Revision r1492:
  Convert innobase_buffer_pool_size and innobase_log_file_size types from
  longlong to long long because MYSQL_SYSVAR_LONGLONG marco expects long long
  type.
  
  Also change
  ((ulint)innobase_buffer_pool_size) / 1024
  to
  (ulint)(innobase_buffer_pool_size / 1024)
  and remove comment which is no longer true.
  
  Provided that innobase_buffer_pool_size is always 64bits these statements
  are equivalent if ulint is 64 bit (well it will screw up if
  innobase_buffer_pool_size is negative). And if ulint is 32 bit the later
  variant gives a little more chance that the value will fit.
  
  Approved by:	Heikki
  
  
  Revision r1493:
  ha_innodb.cc: Remove the declarations of some global InnoDB variables
  whose name starts with srv_.  These variables are declared in the header
  files that are covered by #include directives in ha_innodb.cc.
  
  
  Revision r1495:
  Introduce the function reset_template() for resetting some fields of
  row_prebuilt_t; currently prebuilt->read_just_key and
  prebuilt->keep_other_fields_on_keyread.
  
  
  Revision r1496:
  ha_innobase::extra(): Replace references to prebuilt->trx with
  thd_to_trx(ha_thd()), in order to avoid potential memory corruption.
  
  
  Revision r1501:
  Fix Bug#21293: Consider transactions that had edited non-transactional
  tables heavier than ones that had not. This helps killing the "right"
  transaction in case of a deadlock.
  
  Approved by:	Heikki
  
  
  Revision r1513:
  Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
  This makes it possible to see which expression was false by looking at the
  error message.
  
  Approved by:	Marko
  
  
  Revision r1527:
  Cleanup in ha_innodb.cc:
  
  thd_is_replication_slave_thread(), thd_has_edited_nontrans_tables():
  Remove blank line between the function comment and the function
  definition.  There should be exactly one line between the return
  type and the function comment, and this line should be one of
  '', 'static', 'UNIV_INLINE', and 'extern "C"'.
  
  
  Revision r1538:
  Do not return error in ha_innobase::info if srv_force_recovery >= 4. This is to allow for 
  normal processing of the query by MySQL instead of generating an error.
  
  Reviewed by: Heikki
  
  
  
  Revision r1551:
  ha_innobase::innobase_read_and_init_auto_inc(): Remember and restore
  prebuilt->sql_stat_start.  In an ALTER TABLE statement in the innodb_gis
  test, an ut_ad() assertion failed, because no IX lock had been acquired
  on the table, because prebuilt->sql_stat_start was inadvertently reset
  to FALSE, by this function.  This function was called via
  ha_innobase::info() and mysql_prepare_alter_table().
storage/innobase/plug.in:
  Fixes after merging InnoDB snapshots.
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
storage/innobase/handler/ha_innodb.h:
  Fixes after merging InnoDB snapshots.
  
  Revision r1488:
  Make InnoDB pluggable.  That is, merge the modifications from MySQL WL#2936
  and adapt some things.
  
  Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
  <mysql/plugin.h>.  Until the function is declared there, you can
  uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.
  
  Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
  storage/innobase/Makefile.am and storage/innobase/plug.in.
  
  plug.in: Declare InnoDB as a dynamic plugin.
  
  ha_innodb.h: Remove the declarations of many global variables.  The variables
  are no longer directly referenced outside of storage/innobase.
  
  trx_t: Add the field trx->duplicates.
  
  trx_create(): Initialize the fields trx->active_trans and trx->duplicates.
  
  innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
parent d57c1908
-- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,)
-- connection con1
SET autocommit=0;
SELECT * FROM t1 FOR UPDATE;
-- if ($con1_extra_sql_present) {
-- eval $con1_extra_sql
-- }
-- connection con2
SET autocommit=0;
SELECT * FROM t2 FOR UPDATE;
-- if ($con2_extra_sql_present) {
-- eval $con2_extra_sql
-- }
-- if ($con1_should_be_rolledback) {
-- connection con1
-- send
INSERT INTO t2 VALUES (0);
-- connection con2
INSERT INTO t1 VALUES (0);
ROLLBACK;
-- connection con1
-- error ER_LOCK_DEADLOCK
-- reap
-- }
# else
-- if (!$con1_should_be_rolledback) {
-- connection con2
-- send
INSERT INTO t1 VALUES (0);
-- connection con1
INSERT INTO t2 VALUES (0);
ROLLBACK;
-- connection con2
-- error ER_LOCK_DEADLOCK
-- reap
-- }
-- connection default
DELETE FROM t5_nontrans;
-- disconnect con1
-- disconnect con2
......@@ -3211,3 +3211,14 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
SET storage_engine=InnoDB;
......@@ -2349,6 +2349,21 @@ SHOW CREATE TABLE t1;
DROP TABLE t1,t2;
#
# Bug #21101 (Prints wrong error message if max row size is too large)
#
--error 1118
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
......
#
# Ensure that the number of locks (SELECT FOR UPDATE for example) is
# added to the number of altered rows when choosing the smallest
# transaction to kill as a victim when a deadlock is detected.
# Also transactions what had edited non-transactional tables should
# be heavier than ones that had not.
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we do not really care about what gets printed, we are only
# interested in getting the deadlock resolved according to our
# expectations
-- disable_query_log
-- disable_result_log
# we want to use "-- eval statement1; statement2" which does not work with
# prepared statements. Because this test should not behave differently with
# or without prepared statements we disable them so the test does not fail
# if someone runs ./mysql-test-run.pl --ps-protocol
-- disable_ps_protocol
-- disable_warnings
DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans;
-- enable_warnings
# we will create a simple deadlock with t1, t2 and two connections
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
# auxiliary table with a bulk of rows which will be locked by a
# transaction to increase its weight
CREATE TABLE t3 (a INT);
# auxiliary empty table which will be inserted by a
# transaction to increase its weight
CREATE TABLE t4 (a INT);
# auxiliary non-transactional table which will be edited by a
# transaction to tremendously increase its weight
CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
# insert a lot of rows in t3
INSERT INTO t3 VALUES (1);
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
# test locking weight
-- let $con1_extra_sql =
-- let $con1_extra_sql_present = 0
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
# test weight when non-transactional tables are edited
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql =
-- let $con2_extra_sql_present = 0
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
DROP TABLE t1, t2, t3, t4, t5_nontrans;
......@@ -2570,7 +2570,7 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd)
return(thd->no_trans_update.all);
}
extern "C" int thd_binlog_format(const THD *thd)
extern "C" int thd_binlog_format(const MYSQL_THD thd)
{
return (int) thd->variables.binlog_format;
}
......
This diff is collapsed.
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libbtr.a
libbtr_a_SOURCES = btr0btr.c btr0cur.c btr0pcur.c btr0sea.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -2606,8 +2606,11 @@ btr_index_rec_validate(
rec_get_nth_field(rec, offsets, i, &len);
/* Note that prefix indexes are not fixed size even when
their type is CHAR. */
/* Note that if fixed_size != 0, it equals the
length of a fixed-size column in the clustered index.
A prefix index of the column is of fixed, but different
length. When fixed_size == 0, prefix_len is the maximum
length of the prefix index column. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0
&& len != UNIV_SQL_NULL && fixed_size
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libbuf.a
libbuf_a_SOURCES = buf0buf.c buf0flu.c buf0lru.c buf0rea.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libdata.a
libdata_a_SOURCES = data0data.c data0type.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -18,6 +18,8 @@ Created 5/30/1994 Heikki Tuuri
#include "dict0dict.h"
#include "btr0cur.h"
#include <ctype.h>
#ifdef UNIV_DEBUG
byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */
......
......@@ -190,7 +190,8 @@ dtype_validate(
dtype_t* type) /* in: type struct to validate */
{
ut_a(type);
ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL));
ut_a(type->mtype >= DATA_VARCHAR);
ut_a(type->mtype <= DATA_MYSQL);
if (type->mtype == DATA_SYS) {
ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS);
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libdict.a
libdict_a_SOURCES = dict0boot.c dict0crea.c dict0dict.c dict0load.c\
dict0mem.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -1195,7 +1195,8 @@ dict_create_or_check_foreign_constraint_tables(void)
fprintf(stderr, "InnoDB: error %lu in creation\n",
(ulong) error);
ut_a(error == DB_OUT_OF_FILE_SPACE);
ut_a(error == DB_OUT_OF_FILE_SPACE
|| error == DB_TOO_MANY_CONCURRENT_TRXS);
fprintf(stderr,
"InnoDB: creation failed\n"
......
......@@ -30,6 +30,8 @@ Created 1/8/1996 Heikki Tuuri
# include "m_ctype.h" /* my_isspace() */
#endif /* !UNIV_HOTBACKUP */
#include <ctype.h>
dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
......@@ -1529,6 +1531,12 @@ dict_index_add_col(
if (field->fixed_len > DICT_MAX_INDEX_COL_LEN) {
field->fixed_len = 0;
}
#if DICT_MAX_INDEX_COL_LEN != 768
/* The comparison limit above must be constant. If it were
changed, the disk format of some fixed-length columns would
change, which would be a disaster. */
# error "DICT_MAX_INDEX_COL_LEN != 768"
#endif
if (!(col->prtype & DATA_NOT_NULL)) {
index->n_nullable++;
......@@ -1585,9 +1593,6 @@ dict_index_copy_types(
ifield = dict_index_get_nth_field(index, i);
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dict_col_copy_type(dict_field_get_col(ifield), dfield_type);
if (UNIV_UNLIKELY(ifield->prefix_len)) {
dfield_type->len = ifield->prefix_len;
}
}
}
......@@ -3361,7 +3366,8 @@ dict_create_foreign_constraints(
ulint err;
mem_heap_t* heap;
ut_a(trx && trx->mysql_thd);
ut_a(trx);
ut_a(trx->mysql_thd);
str = dict_strip_comments(sql_string);
heap = mem_heap_create(10000);
......@@ -3403,7 +3409,8 @@ dict_foreign_parse_drop_constraints(
FILE* ef = dict_foreign_err_file;
struct charset_info_st* cs;
ut_a(trx && trx->mysql_thd);
ut_a(trx);
ut_a(trx->mysql_thd);
cs = innobase_get_charset(trx->mysql_thd);
......@@ -3712,7 +3719,7 @@ dict_index_calc_min_rec_len(
}
/* round the NULL flags up to full bytes */
sum += (nullable + 7) / 8;
sum += UT_BITS_IN_BYTES(nullable);
return(sum);
}
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libdyn.a
libdyn_a_SOURCES = dyn0dyn.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libeval.a
libeval_a_SOURCES = eval0eval.c eval0proc.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libfil.a
libfil_a_SOURCES = fil0fil.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libfsp.a
libfsp_a_SOURCES = fsp0fsp.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -205,10 +205,9 @@ the extent are free and which contain old tuple version to clean. */
space */
#define XDES_FSEG 4 /* extent belongs to a segment */
/* File extent data structure size in bytes. The "+ 7 ) / 8" part in the
definition rounds the number of bytes upward. */
/* File extent data structure size in bytes. */
#define XDES_SIZE \
(XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8)
(XDES_BITMAP + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE))
/* Offset of the descriptor array on a descriptor page */
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
......@@ -3649,7 +3648,11 @@ fsp_validate(
n_full_frag_pages = FSP_EXTENT_SIZE
* flst_get_len(header + FSP_FULL_FRAG, &mtr);
ut_a(free_limit <= size || (space != 0 && size < FSP_EXTENT_SIZE));
if (UNIV_UNLIKELY(free_limit > size)) {
ut_a(space != 0);
ut_a(size < FSP_EXTENT_SIZE);
}
flst_validate(header + FSP_FREE, &mtr);
flst_validate(header + FSP_FREE_FRAG, &mtr);
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libfut.a
libfut_a_SOURCES = fut0fut.c fut0lst.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libha.a
libha_a_SOURCES = ha0ha.c hash0hash.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
DEFS = -DMYSQL_SERVER @DEFS@
noinst_LIBRARIES = libhandler.a
libhandler_a_SOURCES = ha_innodb.cc
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
This diff is collapsed.
......@@ -190,27 +190,50 @@ class ha_innobase: public handler
uint table_changes);
};
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
extern long long innobase_buffer_pool_size, innobase_log_file_size;
extern long innobase_log_buffer_size;
extern long innobase_additional_mem_pool_size;
extern long innobase_buffer_pool_awe_mem_mb;
extern long innobase_file_io_threads, innobase_lock_wait_timeout;
extern long innobase_force_recovery;
extern long innobase_open_files;
extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
/* Some accessor functions which the InnoDB plugin needs, but which
can not be added to mysql/plugin.h as part of the public interface;
the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
#ifndef INNODB_COMPATIBILITY_HOOKS
#error InnoDB needs MySQL to be built with #define INNODB_COMPATIBILITY_HOOKS
#endif
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_auto_extend_increment;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay;
extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
extern ulong srv_flush_log_at_trx_commit;
struct charset_info_st *thd_charset(MYSQL_THD thd);
char **thd_query(MYSQL_THD thd);
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
*/
const char* mysql_bin_log_file_name(void);
/** Get the current position of the MySQL binlog.
* @return byte offset from the beginning of the binlog
*/
ulonglong mysql_bin_log_file_pos(void);
/**
Check if a user thread is a replication slave thread
@param thd user thread
@retval 0 the user thread is not a replication slave thread
@retval 1 the user thread is a replication slave thread
*/
int thd_slave_thread(const MYSQL_THD thd);
/**
Check if a user thread is running a non-transactional update
@param thd user thread
@retval 0 the user thread is not running a non-transactional update
@retval 1 the user thread is running a non-transactional update
*/
int thd_non_transactional_update(const MYSQL_THD thd);
/**
Get the user thread's binary logging format
@param thd user thread
@return Value to be used as index into the binlog_format_names array
*/
int thd_binlog_format(const MYSQL_THD thd);
}
/*
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libibuf.a
libibuf_a_SOURCES = ibuf0ibuf.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -150,9 +150,30 @@ ulint ibuf_flush_count = 0;
#define IBUF_COUNT_N_PAGES 2000
/* Buffered entry counts for file pages, used in debugging */
static ulint* ibuf_counts[IBUF_COUNT_N_SPACES];
static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES];
static ibool ibuf_counts_inited = FALSE;
/**********************************************************************
Checks that the indexes to ibuf_counts[][] are within limits. */
UNIV_INLINE
void
ibuf_count_check(
/*=============*/
ulint space_id, /* in: space identifier */
ulint page_no) /* in: page number */
{
if (space_id < IBUF_COUNT_N_SPACES && page_no < IBUF_COUNT_N_PAGES) {
return;
}
fprintf(stderr,
"InnoDB: UNIV_IBUF_DEBUG limits space_id and page_no\n"
"InnoDB: and breaks crash recovery.\n"
"InnoDB: space_id=%lu, should be 0<=space_id<%lu\n"
"InnoDB: page_no=%lu, should be 0<=page_no<%lu\n",
(ulint) space_id, (ulint) IBUF_COUNT_N_SPACES,
(ulint) page_no, (ulint) IBUF_COUNT_N_PAGES);
ut_error;
}
#endif
/* The start address for an insert buffer bitmap page bitmap */
......@@ -328,15 +349,9 @@ ibuf_count_get(
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
ut_ad(space < IBUF_COUNT_N_SPACES);
ut_ad(page_no < IBUF_COUNT_N_PAGES);
if (!ibuf_counts_inited) {
return(0);
}
ibuf_count_check(space, page_no);
return(*(ibuf_counts[space] + page_no));
return(ibuf_counts[space][page_no]);
}
/**********************************************************************
......@@ -349,11 +364,10 @@ ibuf_count_set(
ulint page_no,/* in: page number */
ulint val) /* in: value to set */
{
ut_a(space < IBUF_COUNT_N_SPACES);
ut_a(page_no < IBUF_COUNT_N_PAGES);
ibuf_count_check(space, page_no);
ut_a(val < UNIV_PAGE_SIZE);
*(ibuf_counts[space] + page_no) = val;
ibuf_counts[space][page_no] = val;
}
#endif
......@@ -378,22 +392,6 @@ ibuf_init_at_db_start(void)
ibuf->size = 0;
#ifdef UNIV_IBUF_DEBUG
{
ulint i, j;
for (i = 0; i < IBUF_COUNT_N_SPACES; i++) {
ibuf_counts[i] = mem_alloc(sizeof(ulint)
* IBUF_COUNT_N_PAGES);
for (j = 0; j < IBUF_COUNT_N_PAGES; j++) {
ibuf_count_set(i, j, 0);
}
}
ibuf_counts_inited = TRUE;
}
#endif
mutex_create(&ibuf_pessimistic_insert_mutex,
SYNC_IBUF_PESS_INSERT_MUTEX);
......@@ -567,7 +565,8 @@ ibuf_bitmap_page_init(
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
byte_offset = bit_offset / 8 + 1; /* better: (bit_offset + 7) / 8 */
byte_offset = bit_offset / 8 + 1;
/* better: byte_offset = UT_BITS_IN_BYTES(bit_offset); */
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
......@@ -1441,6 +1440,9 @@ ibuf_entry_build(
*buf2++ = 0; /* write the compact format indicator */
}
for (i = 0; i < n_fields; i++) {
ulint fixed_len;
const dict_field_t* ifield;
/* We add 4 below because we have the 4 extra fields at the
start of an ibuf record */
......@@ -1448,10 +1450,30 @@ ibuf_entry_build(
entry_field = dtuple_get_nth_field(entry, i);
dfield_copy(field, entry_field);
ifield = dict_index_get_nth_field(index, i);
/* Prefix index columns of fixed-length columns are of
fixed length. However, in the function call below,
dfield_get_type(entry_field) contains the fixed length
of the column in the clustered index. Replace it with
the fixed length of the secondary index column. */
fixed_len = ifield->fixed_len;
#ifdef UNIV_DEBUG
if (fixed_len) {
/* dict_index_add_col() should guarantee these */
ut_ad(fixed_len <= (ulint) entry_field->type.len);
if (ifield->prefix_len) {
ut_ad(ifield->prefix_len == fixed_len);
} else {
ut_ad(fixed_len
== (ulint) entry_field->type.len);
}
}
#endif /* UNIV_DEBUG */
dtype_new_store_for_order_and_null_size(
buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
dfield_get_type(entry_field),
dict_index_get_nth_field(index, i)->prefix_len);
dfield_get_type(entry_field), fixed_len);
}
/* Store the type info in buf2 to field 3 of tuple */
......
# Makefile included in Makefile.am in every subdirectory
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/storage/innobase/include \
-I$(top_srcdir)/sql \
-I$(srcdir)
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -62,6 +62,11 @@ Created 5/24/1996 Heikki Tuuri
lead to a duplicate key in some
table */
#define DB_TOO_MANY_CONCURRENT_TRXS 47 /* when InnoDB runs out of the
preconfigured undo slots, this can
only happen when there are too many
concurrent transactions */
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_OVERFLOW 1001
......
......@@ -92,6 +92,17 @@ dict_col_copy_type_noninline(
/*=========================*/
const dict_col_t* col, /* in: column */
dtype_t* type); /* out: data type */
#ifdef UNIV_DEBUG
/*************************************************************************
Assert that a column and a data type match. */
UNIV_INLINE
ibool
dict_col_type_assert_equal(
/*=======================*/
/* out: TRUE */
const dict_col_t* col, /* in: column */
const dtype_t* type); /* in: data type */
#endif /* UNIV_DEBUG */
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE
......
......@@ -30,6 +30,30 @@ dict_col_copy_type(
type->mbmaxlen = col->mbmaxlen;
}
#ifdef UNIV_DEBUG
/*************************************************************************
Assert that a column and a data type match. */
UNIV_INLINE
ibool
dict_col_type_assert_equal(
/*=======================*/
/* out: TRUE */
const dict_col_t* col, /* in: column */
const dtype_t* type) /* in: data type */
{
ut_ad(col);
ut_ad(type);
ut_ad(col->mtype == type->mtype);
ut_ad(col->prtype == type->prtype);
ut_ad(col->len == type->len);
ut_ad(col->mbminlen == type->mbminlen);
ut_ad(col->mbmaxlen == type->mbmaxlen);
return(TRUE);
}
#endif /* UNIV_DEBUG */
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE
......
......@@ -158,10 +158,13 @@ struct dict_col_struct{
of an index */
};
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can
create a column prefix index on 255 characters of a TEXT field also in the
UTF-8 charset. In that charset, a character may take at most 3 bytes. */
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
indexed column length (or indexed prefix length). It is set to 3*256,
so that one can create a column prefix index on 256 characters of a
TEXT or VARCHAR column also in the UTF-8 charset. In that charset,
a character may take at most 3 bytes.
This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
files would be at risk! */
#define DICT_MAX_INDEX_COL_LEN 768
......
#ifndef HA_INNODB_PROTOTYPES_H
#define HA_INNODB_PROTOTYPES_H
#include "univ.i" /* ulint, uint */
#include "m_ctype.h" /* CHARSET_INFO */
/* Prototypes for global functions in ha_innodb.cc that are called by
InnoDB's C-code. */
......@@ -19,4 +22,30 @@ innobase_convert_string(
CHARSET_INFO* from_cs,
uint* errors);
/**********************************************************************
Returns true if the thread is the replication thread on the slave
server. Used in srv_conc_enter_innodb() to determine if the thread
should be allowed to enter InnoDB - the replication thread is treated
differently than other threads. Also used in
srv_conc_force_exit_innodb(). */
ibool
thd_is_replication_slave_thread(
/*============================*/
/* out: true if thd is the replication thread */
void* thd); /* in: thread handle (THD*) */
/**********************************************************************
Returns true if the transaction this thread is processing has edited
non-transactional tables. Used by the deadlock detector when deciding
which transaction to rollback in case of a deadlock - we try to avoid
rolling back transactions that have edited non-transactional tables. */
ibool
thd_has_edited_nontrans_tables(
/*===========================*/
/* out: true if non-transactional tables have
been edited */
void* thd); /* in: thread handle (THD*) */
#endif
......@@ -94,7 +94,8 @@ log. */
#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 76
#define OS_FILE_SHARING_VIOLATION 76
#define OS_FILE_ERROR_NOT_SPECIFIED 77
/* Types for aio operations */
#define OS_FILE_READ 10
......
......@@ -795,7 +795,8 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
ulint* offsets, /* in: array for rec_get_offsets() */
ulint* offsets, /* out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /* in: number of elements */
{
ut_ad(offsets);
......@@ -1282,7 +1283,8 @@ UNIV_INLINE
void
rec_offs_set_n_fields(
/*==================*/
ulint* offsets, /* in: array returned by rec_get_offsets() */
ulint* offsets, /* in/out: array returned by
rec_get_offsets() */
ulint n_fields) /* in: number of fields */
{
ut_ad(offsets);
......
......@@ -460,6 +460,19 @@ row_check_table_for_mysql(
/* out: DB_ERROR or DB_SUCCESS */
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
handle */
/*************************************************************************
Get the min of the maximum possible row sizes. */
ulint
page_get_free_space_of_empty_noninline(
/*===================================*/
/* out: The (approx) maximum size
of a row, this is a conservative
estimate, since the size can be
slightly larger depending upon
the ROW_FORMAT setting.*/
dict_table_t* table); /* in: table for which max record
size required.*/
/* A struct describing a place for an individual column in the MySQL
row format which is presented to the table handler in ha_innobase.
......
......@@ -371,6 +371,18 @@ trx_is_interrupted(
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
/***********************************************************************
Compares the "weight" (or size) of two transactions. The weight of one
transaction is estimated as the number of altered rows + the number of
locked rows. Transactions that have edited non-transactional tables are
considered heavier than ones that have not. */
int
trx_weight_cmp(
/*===========*/
/* out: <0, 0 or >0; similar to strcmp(3) */
trx_t* a, /* in: the first transaction to be compared */
trx_t* b); /* in: the second transaction to be compared */
/* Signal to a transaction */
struct trx_sig_struct{
......@@ -453,7 +465,8 @@ struct trx_struct{
dulint table_id; /* table id if the preceding field is
TRUE */
/*------------------------------*/
int active_trans; /* 1 - if a transaction in MySQL
unsigned duplicates:2; /* TRX_DUP_IGNORE | TRX_DUP_REPLACE */
unsigned active_trans:2; /* 1 - if a transaction in MySQL
is active. 2 - if prepare_commit_mutex
was taken */
void* mysql_thd; /* MySQL thread handle corresponding
......@@ -610,7 +623,7 @@ struct trx_struct{
NULL */
ibool was_chosen_as_deadlock_victim;
/* when the transaction decides to wait
for a lock, this it sets this to FALSE;
for a lock, it sets this to FALSE;
if another transaction chooses this
transaction as a victim in deadlock
resolution, it sets this to TRUE */
......@@ -651,7 +664,12 @@ struct trx_struct{
cannot be any activity in the undo
logs! */
dulint undo_no; /* next undo log record number to
assign */
assign; since the undo log is
private for a transaction, this
is a simple ascending sequence
with no gaps; thus it represents
the number of modified/inserted
rows in a transaction */
trx_savept_t last_sql_stat_start;
/* undo_no when the last sql statement
was started: in case of an error, trx
......@@ -681,19 +699,19 @@ struct trx_struct{
single operation of a
transaction, e.g., a parallel
query */
/* Transaction concurrency states */
/* Transaction concurrency states (trx->conc_state) */
#define TRX_NOT_STARTED 1
#define TRX_ACTIVE 2
#define TRX_COMMITTED_IN_MEMORY 3
#define TRX_PREPARED 4 /* Support for 2PC/XA */
/* Transaction execution states when trx state is TRX_ACTIVE */
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
#define TRX_QUE_RUNNING 1 /* transaction is running */
#define TRX_QUE_LOCK_WAIT 2 /* transaction is waiting for a lock */
#define TRX_QUE_ROLLING_BACK 3 /* transaction is rolling back */
#define TRX_QUE_COMMITTING 4 /* transaction is committing */
/* Transaction isolation levels */
/* Transaction isolation levels (trx->isolation_level) */
#define TRX_ISO_READ_UNCOMMITTED 1 /* dirty read: non-locking
SELECTs are performed so that
we do not look at a possible
......@@ -728,6 +746,12 @@ struct trx_struct{
converted to LOCK IN SHARE
MODE reads */
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
Multiple flags can be combined with bitwise OR. */
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
/* Types of a trx signal */
#define TRX_SIG_NO_SIGNAL 100
#define TRX_SIG_TOTAL_ROLLBACK 1
......
......@@ -222,13 +222,16 @@ trx_undo_lists_init(
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused. */
trx_undo_t*
ulint
trx_undo_assign_undo(
/*=================*/
/* out: the undo log, NULL if did not succeed: out of
space */
trx_t* trx, /* in: transaction */
ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/* out: DB_SUCCESS if undo log assign
* successful, possible error codes are:
* ER_TOO_MANY_CONCURRENT_TRXS
* DB_OUT_OF_FILE_SPAC
* DB_OUT_OF_MEMORY */
trx_t* trx, /* in: transaction */
ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/**********************************************************************
Sets the state of the undo log segment at a transaction finish. */
......
......@@ -121,6 +121,11 @@ ut_2_power_up(
/* out: first power of 2 which is >= n */
ulint n) /* in: number != 0 */
__attribute__((const));
/* Determine how many bytes (groups of 8 bits) are needed to
store the given number of bits. */
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
/****************************************************************
Sort function for ulint arrays. */
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = liblock.a
liblock_a_SOURCES = lock0lock.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -3174,7 +3174,8 @@ lock_deadlock_occurs(
ulint ret;
ulint cost = 0;
ut_ad(trx && lock);
ut_ad(trx);
ut_ad(lock);
ut_ad(mutex_own(&kernel_mutex));
retry:
/* We check that adding this trx to the waits-for graph
......@@ -3246,7 +3247,9 @@ lock_deadlock_recursive(
trx_t* lock_trx;
ulint ret;
ut_a(trx && start && wait_lock);
ut_a(trx);
ut_a(start);
ut_a(wait_lock);
ut_ad(mutex_own(&kernel_mutex));
if (trx->deadlock_mark == 1) {
......@@ -3357,8 +3360,8 @@ lock_deadlock_recursive(
return(LOCK_VICTIM_IS_START);
}
if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) {
if (trx_weight_cmp(wait_lock->trx,
start) >= 0) {
/* Our recursion starting point
transaction is 'smaller', let us
choose 'start' as the victim and roll
......@@ -4423,12 +4426,9 @@ lock_table_queue_validate(
dict_table_t* table) /* in: table */
{
lock_t* lock;
ibool is_waiting;
ut_ad(mutex_own(&kernel_mutex));
is_waiting = FALSE;
lock = UT_LIST_GET_FIRST(table->locks);
while (lock) {
......@@ -4438,13 +4438,10 @@ lock_table_queue_validate(
if (!lock_get_wait(lock)) {
ut_a(!is_waiting);
ut_a(!lock_table_other_has_incompatible(
lock->trx, 0, table,
lock_get_mode(lock)));
} else {
is_waiting = TRUE;
ut_a(lock_table_has_to_wait_in_queue(lock));
}
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = liblog.a
liblog_a_SOURCES = log0log.c log0recv.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -3039,10 +3039,22 @@ logs_empty_and_mark_files_at_shutdown(void)
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. */
/* We need the monitor threads to stop before we proceed with a
normal shutdown. In case of very fast shutdown, however, we can
proceed without waiting for monitor threads. */
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
|| srv_lock_timeout_and_monitor_active)) {
mutex_exit(&kernel_mutex);
goto loop;
}
/* 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) {
......@@ -3163,22 +3175,8 @@ logs_empty_and_mark_files_at_shutdown(void)
goto loop;
}
/* The lock timeout thread should now have exited */
if (srv_lock_timeout_and_monitor_active) {
goto loop;
}
/* We now let also the InnoDB error monitor thread to exit */
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
if (srv_error_monitor_active) {
goto loop;
}
/* Make some checks that the server really is quiet */
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
ut_a(buf_all_freed());
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libmach.a
libmach_a_SOURCES = mach0data.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libmem.a
libmem_a_SOURCES = mem0mem.c mem0pool.c
EXTRA_DIST = mem0dbg.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libmtr.a
libmtr_a_SOURCES = mtr0mtr.c mtr0log.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libos.a
libos_a_SOURCES = os0proc.c os0sync.c os0thread.c os0file.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -250,6 +250,15 @@ os_file_get_last_error(
"InnoDB: the directory. It may also be"
" you have created a subdirectory\n"
"InnoDB: of the same name as a data file.\n");
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
fprintf(stderr,
"InnoDB: The error means that another program"
" is using InnoDB's files.\n"
"InnoDB: This might be a backup or antivirus"
" software or another instance\n"
"InnoDB: of MySQL."
" Please close it to get rid of this error.\n");
} else {
fprintf(stderr,
"InnoDB: Some operating system error numbers"
......@@ -268,6 +277,9 @@ os_file_get_last_error(
return(OS_FILE_DISK_FULL);
} else if (err == ERROR_FILE_EXISTS) {
return(OS_FILE_ALREADY_EXISTS);
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
return(OS_FILE_SHARING_VIOLATION);
} else {
return(100 + err);
}
......@@ -388,6 +400,10 @@ os_file_handle_error_cond_exit(
|| err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else if (err == OS_FILE_SHARING_VIOLATION) {
os_thread_sleep(10000000); /* 10 sec */
return(TRUE);
} else {
if (name) {
fprintf(stderr, "InnoDB: File name %s\n", name);
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libpage.a
libpage_a_SOURCES = page0page.c page0cur.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libpars.a
noinst_HEADERS = pars0grm.h
libpars_a_SOURCES = pars0grm.c lexyy.c pars0opt.c pars0pars.c pars0sym.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -2,6 +2,7 @@ MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine],
[Transactional Tables using InnoDB], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a])
MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la])
MYSQL_PLUGIN_ACTIONS(innobase, [
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
AC_SUBST(innodb_system_libs)
......@@ -38,37 +39,5 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac
AC_CONFIG_FILES(
storage/innobase/ut/Makefile
storage/innobase/btr/Makefile
storage/innobase/buf/Makefile
storage/innobase/data/Makefile
storage/innobase/dict/Makefile
storage/innobase/dyn/Makefile
storage/innobase/eval/Makefile
storage/innobase/fil/Makefile
storage/innobase/fsp/Makefile
storage/innobase/fut/Makefile
storage/innobase/ha/Makefile
storage/innobase/ibuf/Makefile
storage/innobase/lock/Makefile
storage/innobase/log/Makefile
storage/innobase/mach/Makefile
storage/innobase/mem/Makefile
storage/innobase/mtr/Makefile
storage/innobase/os/Makefile
storage/innobase/page/Makefile
storage/innobase/pars/Makefile
storage/innobase/que/Makefile
storage/innobase/read/Makefile
storage/innobase/rem/Makefile
storage/innobase/row/Makefile
storage/innobase/srv/Makefile
storage/innobase/sync/Makefile
storage/innobase/thr/Makefile
storage/innobase/trx/Makefile
storage/innobase/handler/Makefile
storage/innobase/usr/Makefile)
])
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(innobase, [handler/ha_innodb.cc])
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libque.a
libque_a_SOURCES = que0que.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libread.a
libread_a_SOURCES = read0read.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = librem.a
librem_a_SOURCES = rem0rec.c rem0cmp.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -153,7 +153,6 @@ static
void
rec_init_offsets(
/*=============*/
/* out: the offsets */
rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */
ulint* offsets)/* in/out: array of offsets;
......@@ -189,7 +188,7 @@ rec_init_offsets(
}
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
offs = 0;
null_mask = 1;
......@@ -304,7 +303,7 @@ rec_get_offsets_func(
/* out: the new offsets */
rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in: array consisting of offsets[0]
ulint* offsets,/* in/out: array consisting of offsets[0]
allocated elements, or an array from
rec_get_offsets(), or NULL */
ulint n_fields,/* in: maximum number of initialized fields
......@@ -440,7 +439,7 @@ rec_get_converted_size_new(
dtuple_t* dtuple) /* in: data tuple */
{
ulint size = REC_N_NEW_EXTRA_BYTES
+ (index->n_nullable + 7) / 8;
+ UT_BITS_IN_BYTES(index->n_nullable);
ulint i;
ulint n_fields;
ut_ad(index && dtuple);
......@@ -459,10 +458,10 @@ rec_get_converted_size_new(
break;
case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM:
/* infimum or supremum record, 8 bytes */
return(size + 8); /* no extra data needed */
/* infimum or supremum record, 8 data bytes */
return(REC_N_NEW_EXTRA_BYTES + 8);
default:
ut_a(0);
ut_error;
return(ULINT_UNDEFINED);
}
......@@ -476,21 +475,31 @@ rec_get_converted_size_new(
len = dtuple_get_nth_field(dtuple, i)->len;
col = dict_field_get_col(field);
ut_ad(len != UNIV_SQL_NULL || !(col->prtype & DATA_NOT_NULL));
ut_ad(dict_col_type_assert_equal(
col, dfield_get_type(dtuple_get_nth_field(
dtuple, i))));
if (len == UNIV_SQL_NULL) {
/* No length is stored for NULL fields. */
ut_ad(!(col->prtype & DATA_NOT_NULL));
continue;
}
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
ut_ad(!field->fixed_len || len == field->fixed_len);
if (field->fixed_len) {
ut_ad(len == field->fixed_len);
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len);
} else if (len < 128
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
size++;
} else {
/* For variable-length columns, we look up the
maximum length from the column itself. If this
is a prefix index column shorter than 256 bytes,
this will waste one byte. */
size += 2;
}
size += len;
......@@ -586,7 +595,7 @@ rec_set_nth_field_extern_bit_new(
we do not write to log about the change */
{
byte* nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
byte* lens = nulls - (index->n_nullable + 7) / 8;
byte* lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
ulint i;
ulint n_fields;
ulint null_mask = 1;
......@@ -875,7 +884,7 @@ rec_convert_dtuple_to_rec_new(
/* Calculate the offset of the origin in the physical record.
We must loop over all fields to do this. */
rec += (index->n_nullable + 7) / 8;
rec += UT_BITS_IN_BYTES(index->n_nullable);
for (i = 0; i < n_fields; i++) {
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
......@@ -892,6 +901,11 @@ rec_convert_dtuple_to_rec_new(
len = dfield_get_len(field);
fixed_len = dict_index_get_nth_field(index, i)->fixed_len;
ut_ad(dict_col_type_assert_equal(
dict_field_get_col(dict_index_get_nth_field(
index, i)),
dfield_get_type(field)));
if (!(dtype_get_prtype(type) & DATA_NOT_NULL)) {
if (len == UNIV_SQL_NULL)
continue;
......@@ -915,7 +929,7 @@ rec_convert_dtuple_to_rec_new(
init:
end = rec;
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
/* clear the SQL-null flags */
memset (lens + 1, 0, nulls - lens);
......@@ -1172,7 +1186,7 @@ rec_copy_prefix_to_buf(
}
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
UNIV_PREFETCH_R(lens);
prefix_len = 0;
null_mask = 1;
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = librow.a
librow_a_SOURCES = row0ins.c row0mysql.c row0purge.c row0row.c row0sel.c\
row0uins.c row0umod.c row0undo.c row0upd.c row0vers.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -51,21 +51,6 @@ innobase_invalidate_query_cache(
ulint full_name_len); /* in: full name length where also the null
chars count */
/**********************************************************************
This function returns true if
1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
2) SQL-query in the current thread
is INSERT ON DUPLICATE KEY UPDATE.
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
innobase_query_is_update(void);
/*************************************************************************
Creates an insert node struct. */
......@@ -448,7 +433,11 @@ row_ins_cascade_calc_update_vec(
ulint i;
ulint j;
ut_a(node && foreign && cascade && table && index);
ut_a(node);
ut_a(foreign);
ut_a(cascade);
ut_a(table);
ut_a(index);
/* Calculate the appropriate update vector which will set the fields
in the child index record to the same value (possibly padded with
......@@ -791,7 +780,10 @@ row_ins_foreign_check_on_constraint(
trx_t* trx;
mem_heap_t* tmp_heap = NULL;
ut_a(thr && foreign && pcur && mtr);
ut_a(thr);
ut_a(foreign);
ut_a(pcur);
ut_a(mtr);
trx = thr_get_trx(thr);
......@@ -1308,7 +1300,8 @@ row_ins_check_foreign_constraint(
goto exit_func;
}
ut_a(check_table && check_index);
ut_a(check_table);
ut_a(check_index);
if (check_table != table) {
/* We already have a LOCK_IX on table, but not necessarily
......@@ -1336,11 +1329,9 @@ row_ins_check_foreign_constraint(
/* Scan index records and check if there is a matching record */
for (;;) {
page_t* page;
rec = btr_pcur_get_rec(&pcur);
page = buf_frame_align(rec);
if (rec == page_get_infimum_rec(page)) {
if (page_rec_is_infimum(rec)) {
goto next_rec;
}
......@@ -1348,7 +1339,7 @@ row_ins_check_foreign_constraint(
offsets = rec_get_offsets(rec, check_index,
offsets, ULINT_UNDEFINED, &heap);
if (rec == page_get_supremum_rec(page)) {
if (page_rec_is_supremum(rec)) {
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index, offsets, thr);
......@@ -1654,6 +1645,7 @@ row_ins_scan_sec_index_for_duplicate(
btr_pcur_t pcur;
ulint err = DB_SUCCESS;
ibool moved;
unsigned allow_duplicates;
mtr_t mtr;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
......@@ -1684,12 +1676,14 @@ row_ins_scan_sec_index_for_duplicate(
btr_pcur_open(index, entry, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr);
allow_duplicates = thr_get_trx(thr)->duplicates & TRX_DUP_IGNORE;
/* Scan index records and check if there is a duplicate */
for (;;) {
rec = btr_pcur_get_rec(&pcur);
if (rec == page_get_infimum_rec(buf_frame_align(rec))) {
if (page_rec_is_infimum(rec)) {
goto next_rec;
}
......@@ -1697,7 +1691,7 @@ row_ins_scan_sec_index_for_duplicate(
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
if (allow_duplicates) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
......@@ -1826,7 +1820,7 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
if (innobase_query_is_update()) {
if (trx->duplicates & TRX_DUP_IGNORE) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
......@@ -1864,7 +1858,7 @@ row_ins_duplicate_error_in_clust(
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
if (trx->duplicates & TRX_DUP_IGNORE) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
......
......@@ -476,7 +476,8 @@ row_mysql_handle_errors(
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_ROW_IS_REFERENCED
|| err == DB_NO_REFERENCED_ROW
|| err == DB_CANNOT_ADD_CONSTRAINT) {
|| err == DB_CANNOT_ADD_CONSTRAINT
|| err == DB_TOO_MANY_CONCURRENT_TRXS) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
......@@ -4058,3 +4059,25 @@ row_check_table_for_mysql(
return(ret);
}
/*************************************************************************
Get the maximum row size. */
ulint
page_get_free_space_of_empty_noninline(
/*===================================*/
/* out: The (approx) maximum size
of a row, this is a conservative
estimate, since the size can be
slightly larger depending upon
the ROW_FORMAT setting.*/
dict_table_t* table) /* in: table for which max record
size is required.*/
{
ibool compact;
compact = dict_table_is_comp(table);
return(page_get_free_space_of_empty(compact) / 2);
}
......@@ -142,20 +142,15 @@ row_build_index_entry(
dfield_copy(dfield, dfield2);
/* If a column prefix index, take only the prefix */
if (ind_field->prefix_len) {
if (dfield_get_len(dfield2) != UNIV_SQL_NULL) {
if (ind_field->prefix_len > 0
&& dfield_get_len(dfield2) != UNIV_SQL_NULL) {
storage_len = dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen, col->mbmaxlen,
ind_field->prefix_len,
dfield_get_len(dfield2),
dfield2->data);
dfield_set_len(dfield, storage_len);
}
storage_len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminlen, col->mbmaxlen,
ind_field->prefix_len,
dfield_get_len(dfield2), dfield2->data);
dfield_get_type(dfield)->len = ind_field->prefix_len;
dfield_set_len(dfield, storage_len);
}
}
......@@ -478,7 +473,9 @@ row_build_row_ref_in_tuple(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_a(ref && index && rec);
ut_a(ref);
ut_a(index);
ut_a(rec);
if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr);
......
......@@ -3619,6 +3619,32 @@ row_search_for_mysql(
pcur, 0, &mtr);
pcur->trx_if_known = trx;
rec = btr_pcur_get_rec(pcur);
if (!moves_up
&& !page_rec_is_supremum(rec)
&& set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record
to prevent phantoms in ORDER BY ... DESC queries */
offsets = rec_get_offsets(page_rec_get_next(rec),
index, offsets,
ULINT_UNDEFINED, &heap);
err = sel_set_rec_lock(page_rec_get_next(rec),
index, offsets,
prebuilt->select_lock_type,
LOCK_GAP, thr);
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
}
} else {
if (mode == PAGE_CUR_G) {
btr_pcur_open_at_index_side(
......
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libsrv.a
libsrv_a_SOURCES = srv0srv.c srv0que.c srv0start.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -47,6 +47,7 @@ Created 10/8/1995 Heikki Tuuri
#include "dict0boot.h"
#include "srv0start.h"
#include "row0mysql.h"
#include "ha_prototypes.h"
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */
......@@ -180,6 +181,16 @@ dulint srv_archive_recovery_limit_lsn;
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
/* This parameter is used to throttle the number of insert buffers that are
merged in a batch. By increasing this parameter on a faster disk you can
possibly reduce the number of I/O operations performed to complete the
merge operation. The value of this parameter is used as is by the
background loop when the system is idle (low load), on a busy system
the parameter is scaled down by a factor of 4, this is to avoid putting
a heavier load on the I/O sub system. */
ulong srv_insert_buffer_batch_size = 20;
char* srv_file_flush_method_str = NULL;
ulint srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
ulint srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
......@@ -977,6 +988,17 @@ srv_conc_enter_innodb(
srv_conc_slot_t* slot = NULL;
ulint i;
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
/* TODO Do something more interesting (based on a config
parameter). Some users what to give the replication
thread very low priority, see http://bugs.mysql.com/25078
This can be done by introducing
innodb_replication_delay(ms) config parameter */
return;
}
/* If trx has 'free tickets' to enter the engine left, then use one
such ticket */
......@@ -1017,7 +1039,7 @@ srv_conc_enter_innodb(
if (!has_slept && !trx->has_search_latch
&& NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
has_slept = TRUE; /* We let is sleep only once to avoid
has_slept = TRUE; /* We let it sleep only once to avoid
starvation */
srv_conc_n_waiting_threads++;
......@@ -1130,7 +1152,7 @@ srv_conc_force_enter_innodb(
srv_conc_n_threads++;
trx->declared_to_be_inside_innodb = TRUE;
trx->n_tickets_to_enter_innodb = 0;
trx->n_tickets_to_enter_innodb = 1;
os_fast_mutex_unlock(&srv_conc_mutex);
}
......@@ -1152,6 +1174,12 @@ srv_conc_force_exit_innodb(
return;
}
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
return;
}
if (trx->declared_to_be_inside_innodb == FALSE) {
return;
......@@ -1853,6 +1881,7 @@ srv_lock_timeout_and_monitor_thread(
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
time_t last_tablespace_monitor_time;
time_t last_monitor_time;
ibool some_waits;
double wait_time;
......@@ -1865,6 +1894,7 @@ srv_lock_timeout_and_monitor_thread(
UT_NOT_USED(arg);
srv_last_monitor_time = time(NULL);
last_table_monitor_time = time(NULL);
last_tablespace_monitor_time = time(NULL);
last_monitor_time = time(NULL);
loop:
srv_lock_timeout_and_monitor_active = TRUE;
......@@ -1901,9 +1931,9 @@ srv_lock_timeout_and_monitor_thread(
}
if (srv_print_innodb_tablespace_monitor
&& difftime(current_time, last_table_monitor_time) > 60) {
last_table_monitor_time = time(NULL);
&& difftime(current_time,
last_tablespace_monitor_time) > 60) {
last_tablespace_monitor_time = time(NULL);
fputs("========================"
"========================\n",
......@@ -2100,7 +2130,7 @@ srv_error_monitor_thread(
os_thread_sleep(2000000);
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
goto loop;
}
......@@ -2270,7 +2300,8 @@ srv_master_thread(
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
ibuf_contract_for_n_pages(
TRUE, srv_insert_buffer_batch_size / 4);
srv_main_thread_op_info = "flushing log";
......@@ -2331,7 +2362,7 @@ srv_master_thread(
even if the server were active */
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
ibuf_contract_for_n_pages(TRUE, srv_insert_buffer_batch_size / 4);
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
......@@ -2469,7 +2500,8 @@ srv_master_thread(
if (srv_fast_shutdown && srv_shutdown_state > 0) {
n_bytes_merged = 0;
} else {
n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
n_bytes_merged = ibuf_contract_for_n_pages(
TRUE, srv_insert_buffer_batch_size);
}
srv_main_thread_op_info = "reserving kernel mutex";
......
......@@ -1025,6 +1025,12 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_IBUF_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
"InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n");
#endif
#ifdef UNIV_SYNC_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
......
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libsync.a
libsync_a_SOURCES = sync0arr.c sync0rw.c sync0sync.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -670,7 +670,9 @@ sync_array_detect_deadlock(
ibool ret;
rw_lock_debug_t*debug;
ut_a(arr && start && cell);
ut_a(arr);
ut_a(start);
ut_a(cell);
ut_ad(cell->wait_object);
ut_ad(os_thread_get_curr_id() == start->thread);
ut_ad(depth < 100);
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libthr.a
libthr_a_SOURCES = thr0loc.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libtrx.a
libtrx_a_SOURCES = trx0purge.c trx0rec.c trx0roll.c trx0rseg.c\
trx0sys.c trx0trx.c trx0undo.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -1024,6 +1024,7 @@ trx_undo_report_row_operation(
ibool is_insert;
trx_rseg_t* rseg;
mtr_t mtr;
ulint err = DB_SUCCESS;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
......@@ -1035,7 +1036,7 @@ trx_undo_report_row_operation(
*roll_ptr = ut_dulint_zero;
return(DB_SUCCESS);
return(err);
}
ut_ad(thr);
......@@ -1053,7 +1054,7 @@ trx_undo_report_row_operation(
if (trx->insert_undo == NULL) {
trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
err = trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
}
undo = trx->insert_undo;
......@@ -1063,7 +1064,7 @@ trx_undo_report_row_operation(
if (trx->update_undo == NULL) {
trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
err = trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
}
......@@ -1071,11 +1072,11 @@ trx_undo_report_row_operation(
is_insert = FALSE;
}
if (undo == NULL) {
/* Did not succeed: out of space */
if (err != DB_SUCCESS) {
/* Did not succeed: return the error encountered */
mutex_exit(&(trx->undo_mutex));
return(DB_OUT_OF_FILE_SPACE);
return(err);
}
page_no = undo->last_page_no;
......@@ -1107,7 +1108,9 @@ trx_undo_report_row_operation(
if (offset == 0) {
/* The record did not fit on the page. We erase the
end segment of the undo log page and write a log
record of it to to ensure deterministic contents. */
record of it: this is to ensure that in the debug
version the replicate page constructed using the log
records stays identical to the original page */
trx_undo_erase_page_end(undo_page, &mtr);
}
......@@ -1163,7 +1166,7 @@ trx_undo_report_row_operation(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return(DB_SUCCESS);
return(err);
}
/*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/
......
......@@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri
#include "btr0sea.h"
#include "os0proc.h"
#include "trx0xa.h"
#include "ha_prototypes.h"
/* Copy of the prototype for innobase_mysql_print_thd: this
copy MUST be equal to the one in mysql/sql/ha_innodb.cc ! */
......@@ -130,6 +131,8 @@ trx_create(
trx->mysql_thd = NULL;
trx->mysql_query_str = NULL;
trx->active_trans = 0;
trx->duplicates = 0;
trx->n_mysql_tables_in_use = 0;
trx->mysql_n_tables_locked = 0;
......@@ -1771,6 +1774,61 @@ trx_print(
}
}
/***********************************************************************
Compares the "weight" (or size) of two transactions. The weight of one
transaction is estimated as the number of altered rows + the number of
locked rows. Transactions that have edited non-transactional tables are
considered heavier than ones that have not. */
int
trx_weight_cmp(
/*===========*/
/* out: <0, 0 or >0; similar to strcmp(3) */
trx_t* a, /* in: the first transaction to be compared */
trx_t* b) /* in: the second transaction to be compared */
{
ibool a_notrans_edit;
ibool b_notrans_edit;
/* If mysql_thd is NULL for a transaction we assume that it has
not edited non-transactional tables. */
a_notrans_edit = a->mysql_thd != NULL
&& thd_has_edited_nontrans_tables(a->mysql_thd);
b_notrans_edit = b->mysql_thd != NULL
&& thd_has_edited_nontrans_tables(b->mysql_thd);
if (a_notrans_edit && !b_notrans_edit) {
return(1);
}
if (!a_notrans_edit && b_notrans_edit) {
return(-1);
}
/* Either both had edited non-transactional tables or both had
not, we fall back to comparing the number of altered/locked
rows. */
#if 0
fprintf(stderr,
"%s TRX_WEIGHT(a): %lld+%lu, TRX_WEIGHT(b): %lld+%lu\n",
__func__,
ut_conv_dulint_to_longlong(a->undo_no),
UT_LIST_GET_LEN(a->trx_locks),
ut_conv_dulint_to_longlong(b->undo_no),
UT_LIST_GET_LEN(b->trx_locks));
#endif
#define TRX_WEIGHT(t) \
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
return(ut_dulint_cmp(TRX_WEIGHT(a), TRX_WEIGHT(b)));
}
/********************************************************************
Prepares a transaction. */
......@@ -1889,7 +1947,7 @@ Does the transaction prepare for MySQL. */
ulint
trx_prepare_for_mysql(
/*====-=============*/
/*==================*/
/* out: 0 or error number */
trx_t* trx) /* in: trx handle */
{
......
......@@ -373,26 +373,31 @@ trx_undo_page_init(
/*******************************************************************
Creates a new undo log segment in file. */
static
page_t*
ulint
trx_undo_seg_create(
/*================*/
/* out: segment header page x-latched, NULL
if no space left */
/* out: DB_SUCCESS if page creation OK
possible error codes are:
DB_TOO_MANY_CONCURRENT_TRXS
DB_OUT_OF_FILE_SPACE */
trx_rseg_t* rseg __attribute__((unused)),/* in: rollback segment */
trx_rsegf_t* rseg_hdr,/* in: rollback segment header, page
x-latched */
ulint type, /* in: type of the segment: TRX_UNDO_INSERT or
TRX_UNDO_UPDATE */
ulint* id, /* out: slot index within rseg header */
page_t** undo_page,
/* out: segment header page x-latched, NULL
if there was an error */
mtr_t* mtr) /* in: mtr */
{
ulint slot_no;
ulint space;
page_t* undo_page;
trx_upagef_t* page_hdr;
trx_usegf_t* seg_hdr;
ulint n_reserved;
ibool success;
ulint err = DB_SUCCESS;
ut_ad(mtr && id && rseg_hdr);
ut_ad(mutex_own(&(rseg->mutex)));
......@@ -410,7 +415,7 @@ trx_undo_seg_create(
"InnoDB: many active transactions"
" running concurrently?\n");
return(NULL);
return(DB_TOO_MANY_CONCURRENT_TRXS);
}
space = buf_frame_get_space_id(rseg_hdr);
......@@ -419,30 +424,30 @@ trx_undo_seg_create(
mtr);
if (!success) {
return(NULL);
return(DB_OUT_OF_FILE_SPACE);
}
/* Allocate a new file segment for the undo log */
undo_page = fseg_create_general(space, 0,
*undo_page = fseg_create_general(space, 0,
TRX_UNDO_SEG_HDR
+ TRX_UNDO_FSEG_HEADER, TRUE, mtr);
fil_space_release_free_extents(space, n_reserved);
if (undo_page == NULL) {
if (*undo_page == NULL) {
/* No space left */
return(NULL);
return(DB_OUT_OF_FILE_SPACE);
}
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
buf_page_dbg_add_level(*undo_page, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
page_hdr = *undo_page + TRX_UNDO_PAGE_HDR;
seg_hdr = *undo_page + TRX_UNDO_SEG_HDR;
trx_undo_page_init(undo_page, type, mtr);
trx_undo_page_init(*undo_page, type, mtr);
mlog_write_ulint(page_hdr + TRX_UNDO_PAGE_FREE,
TRX_UNDO_SEG_HDR + TRX_UNDO_SEG_HDR_SIZE,
......@@ -456,10 +461,11 @@ trx_undo_seg_create(
page_hdr + TRX_UNDO_PAGE_NODE, mtr);
trx_rsegf_set_nth_undo(rseg_hdr, slot_no,
buf_frame_get_page_no(undo_page), mtr);
buf_frame_get_page_no(*undo_page), mtr);
*id = slot_no;
return(undo_page);
return(err);
}
/**************************************************************************
......@@ -1387,6 +1393,11 @@ trx_undo_mem_create(
undo = mem_alloc(sizeof(trx_undo_t));
if (undo == NULL) {
return NULL;
}
undo->id = id;
undo->type = type;
undo->state = TRX_UNDO_ACTIVE;
......@@ -1464,11 +1475,15 @@ trx_undo_mem_free(
/**************************************************************************
Creates a new undo log. */
static
trx_undo_t*
ulint
trx_undo_create(
/*============*/
/* out: undo log object, NULL if did not
succeed: out of space */
/* out: DB_SUCCESS if successful in creating
the new undo lob object, possible error
codes are:
DB_TOO_MANY_CONCURRENT_TRXS
DB_OUT_OF_FILE_SPACE
DB_OUT_OF_MEMORY*/
trx_t* trx, /* in: transaction */
trx_rseg_t* rseg, /* in: rollback segment memory copy */
ulint type, /* in: type of the log: TRX_UNDO_INSERT or
......@@ -1476,34 +1491,37 @@ trx_undo_create(
dulint trx_id, /* in: id of the trx for which the undo log
is created */
XID* xid, /* in: X/Open transaction identification*/
trx_undo_t** undo, /* out: the new undo log object, undefined
* if did not succeed */
mtr_t* mtr) /* in: mtr */
{
trx_rsegf_t* rseg_header;
ulint page_no;
ulint offset;
ulint id;
trx_undo_t* undo;
page_t* undo_page;
ulint err;
ut_ad(mutex_own(&(rseg->mutex)));
if (rseg->curr_size == rseg->max_size) {
return(NULL);
return(DB_OUT_OF_FILE_SPACE);
}
rseg->curr_size++;
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
undo_page = trx_undo_seg_create(rseg, rseg_header, type, &id, mtr);
err = trx_undo_seg_create(rseg, rseg_header, type, &id,
&undo_page, mtr);
if (undo_page == NULL) {
if (err != DB_SUCCESS) {
/* Did not succeed */
rseg->curr_size--;
return(NULL);
return(err);
}
page_no = buf_frame_get_page_no(undo_page);
......@@ -1515,9 +1533,14 @@ trx_undo_create(
undo_page + offset, mtr);
}
undo = trx_undo_mem_create(rseg, id, type, trx_id, xid,
*undo = trx_undo_mem_create(rseg, id, type, trx_id, xid,
page_no, offset);
return(undo);
if (*undo == NULL) {
err = DB_OUT_OF_MEMORY;
}
return(err);
}
/*================ UNDO LOG ASSIGNMENT AND CLEANUP =====================*/
......@@ -1634,17 +1657,20 @@ trx_undo_mark_as_dict_operation(
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused. */
trx_undo_t*
ulint
trx_undo_assign_undo(
/*=================*/
/* out: the undo log, NULL if did not succeed: out of
space */
trx_t* trx, /* in: transaction */
ulint type) /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/* out: DB_SUCCESS if undo log assign
successful, possible error codes are:
DD_TOO_MANY_CONCURRENT_TRXS
DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY*/
trx_t* trx, /* in: transaction */
ulint type) /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
{
trx_rseg_t* rseg;
trx_undo_t* undo;
mtr_t mtr;
ulint err = DB_SUCCESS;
ut_ad(trx);
ut_ad(trx->rseg);
......@@ -1662,15 +1688,11 @@ trx_undo_assign_undo(
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
&mtr);
if (undo == NULL) {
undo = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
&mtr);
if (undo == NULL) {
/* Did not succeed */
err = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
&undo, &mtr);
if (err != DB_SUCCESS) {
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
return(NULL);
goto func_exit;
}
}
......@@ -1688,10 +1710,11 @@ trx_undo_assign_undo(
trx_undo_mark_as_dict_operation(trx, undo, &mtr);
}
func_exit:
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
return(undo);
return err;
}
/**********************************************************************
......
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libusr.a
libusr_a_SOURCES = usr0sess.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# 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; version 2 of the License.
#
# 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
include ../include/Makefile.i
noinst_LIBRARIES = libut.a
libut_a_SOURCES = ut0byte.c ut0dbg.c ut0mem.c ut0rnd.c ut0ut.c ut0vec.c ut0list.c ut0wqueue.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -14,6 +14,7 @@ Created 5/11/1994 Heikki Tuuri
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "ut0sort.h"
#include "trx0trx.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment