mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 23:34:34 +01:00
76de7d788c
innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Fixes: - Bug #21409: Incorrect result returned when in READ-COMMITTED with query_cache ON At low transaction isolation levels we let each consistent read set its own snapshot. - Bug #23666: strange Innodb_row_lock_time_% values in show status; also millisecs wrong On Windows ut_usectime returns secs and usecs relative to the UNIX epoch (which is Jan, 1 1970). - Bug #25494: LATEST DEADLOCK INFORMATION is not always cleared lock_deadlock_recursive(): When the search depth or length is exceeded, rewind lock_latest_err_file and display the two transactions at the point of aborting the search. - Bug #25927: Foreign key with ON DELETE SET NULL on NOT NULL can crash server Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns for which there is a foreign key constraint ON ... SET NULL. - Bug #26835: Repeatable corruption of utf8-enabled tables inside InnoDB The bug could be reproduced as follows: Define a table so that the first column of the clustered index is a VARCHAR or a UTF-8 CHAR in a collation where sequences of bytes of differing length are considered equivalent. Insert and delete a record. Before the delete-marked record is purged, insert another record whose first column is of different length but equivalent to the first record. Under certain conditions, the insertion can be incorrectly performed as update-in-place. Likewise, an operation that could be done as update-in-place can unnecessarily be performed as delete and insert, but that would not cause corruption but merely degraded performance. mysql-test/r/innodb.result: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1284: Merge changes from MySQL AB: ChangeSet 2007/01/24 14:49:36+04:00 holyfoot@mysql.com bug 22682 Test fails --without-geometry geometry dependent parts moved to proper .test files mysql-test/r/innodb.result 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +0 -2 result fixed mysql-test/r/innodb_gis.result 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +2 -0 result fixed mysql-test/t/innodb.test 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +0 -6 HAVE_GEOMETRY dependent part moved to innodb_gis.test mysql-test/t/innodb_gis.test 2007/01/24 14:49:35+04:00 holyfoot@mysql.com +6 -0 HAVE_GEOMETRY dependent part moved here from innodb.test Revision r1186: dict_load_foreign(): Use a local variable instead of the 10-bit field foreign->n_fields in order to preserve ON UPDATE CASCADE and ON DELETE CASCADE flags. For some reason, gcc does not warn about shifting a 10-bit field to right by 24 bits. (Bug 24741) This bug was introduced while reducing the memory footprint of the InnoDB data dictionary (Bug 20877). innodb.test, innodb.result: Add a test case. Revision r1318: Add a test case for r1316 (Bug #25927). Revision r1340: innodb.test, innodb.result: Add test case for Bug #26835. The bug could be reproduced as follows: Define a table so that the first column of the clustered index is a VARCHAR or a UTF-8 CHAR in a collation where sequences of bytes of differing length are considered equivalent. Insert and delete a record. Before the delete-marked record is purged, insert another record whose first column is of different length but equivalent to the first record. Under certain conditions, the insertion can be incorrectly performed as update-in-place. Likewise, an operation that could be done as update-in-place can unnecessarily be performed as delete and insert, but that would not cause corruption but merely degraded performance. mysql-test/t/innodb.test: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1284: Merge changes from MySQL AB: ChangeSet 2007/01/24 14:49:36+04:00 holyfoot@mysql.com bug 22682 Test fails --without-geometry geometry dependent parts moved to proper .test files mysql-test/r/innodb.result 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +0 -2 result fixed mysql-test/r/innodb_gis.result 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +2 -0 result fixed mysql-test/t/innodb.test 2007/01/24 14:49:34+04:00 holyfoot@mysql.com +0 -6 HAVE_GEOMETRY dependent part moved to innodb_gis.test mysql-test/t/innodb_gis.test 2007/01/24 14:49:35+04:00 holyfoot@mysql.com +6 -0 HAVE_GEOMETRY dependent part moved here from innodb.test Revision r1283: Merge changes from MySQL AB: ChangeSet 2007/01/22 18:42:52+02:00 monty@mysql.com Give warnings for unused objects Changed error message to be compatible with old error file Added new error message for new DUP_ENTRY syntax mysql-test/t/innodb.test 2007/01/22 18:42:49+02:00 monty@mysql.com +14 -14 Changed to use new error message Revision r1186: dict_load_foreign(): Use a local variable instead of the 10-bit field foreign->n_fields in order to preserve ON UPDATE CASCADE and ON DELETE CASCADE flags. For some reason, gcc does not warn about shifting a 10-bit field to right by 24 bits. (Bug 24741) This bug was introduced while reducing the memory footprint of the InnoDB data dictionary (Bug 20877). innodb.test, innodb.result: Add a test case. Revision r1318: Add a test case for r1316 (Bug #25927). Revision r1329: Merge changes from MySQL AB to mysql-test directives. The results are not affected. Revision r1340: innodb.test, innodb.result: Add test case for Bug #26835. The bug could be reproduced as follows: Define a table so that the first column of the clustered index is a VARCHAR or a UTF-8 CHAR in a collation where sequences of bytes of differing length are considered equivalent. Insert and delete a record. Before the delete-marked record is purged, insert another record whose first column is of different length but equivalent to the first record. Under certain conditions, the insertion can be incorrectly performed as update-in-place. Likewise, an operation that could be done as update-in-place can unnecessarily be performed as delete and insert, but that would not cause corruption but merely degraded performance. storage/innobase/buf/buf0buf.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/buf/buf0flu.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/buf/buf0lru.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/dict/dict0boot.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/dict/dict0crea.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/dict/dict0dict.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1316: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns for which there is a foreign key constraint ON ... SET NULL. (Bug #25927) dict_foreign_find_index(): Add paramettter check_null. dict_foreign_add_to_cache(): Do not allow ON DELETE SET NULL or ON UPDATE SET NULL if any of the referencing columns are declared NOT NULL. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/dict/dict0load.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1186: dict_load_foreign(): Use a local variable instead of the 10-bit field foreign->n_fields in order to preserve ON UPDATE CASCADE and ON DELETE CASCADE flags. For some reason, gcc does not warn about shifting a 10-bit field to right by 24 bits. (Bug 24741) This bug was introduced while reducing the memory footprint of the InnoDB data dictionary (Bug 20877). innodb.test, innodb.result: Add a test case. Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/fil/fil0fil.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/fsp/fsp0fsp.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/ha/ha0ha.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/handler/ha_innodb.cc: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1204: Change this in ha_innobase: void* innobase_prebuilt; to this: row_prebuilt_t* prebuilt; by introducing the typedef in ha_innodb.h, and remove all the now needless local variables and casts in ha_innodb.cc. Revision r1298: ha_innodb.cc: Remove all references to thd->ha_data[hton->slot]. thd_to_trx(thd, hton): Accessor for getting the InnoDB trx object of a MySQL thread object and an InnoDB handlerton. Revision r1292: Remove the declarations of some global functions in ha_innodb.h and declare them static in ha_innodb.cc. These functions are invoked via function pointers in handlerton. Revision r1300: ha_innodb.cc: Replace thd->tablespace_op with thd_tablespace_op(thd). Plugins must treat class THD as an opaque type. Revision r1198: Merge a change from MySQL AB: ChangeSet@1.2372, 2006-12-31 02:29:11+01:00, kent@mysql.com +79 -0 Many files: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header Added GPL copyright text Revision r1271: Merge changes from MySQL AB: Rename some FIELD_TYPE_ constants to MYSQL_TYPE_. Change the scope of a type cast of two dividends. Revision r1299: ha_innodb.cc: Replace thd->in_lock_tables with thd_in_lock_tables(thd). Plugins must treat class THD as an opaque type. Revision r1201: Apply patch from MySQL: ChangeSet@1.2353, 2006-12-19 16:57:51-07:00, tsmith@siva.hindu.god +13 -0 Added innodb_rollback_on_timeout option to restore the 4.1 InnoDB timeout behavior (Bug 24200) Revision r1322: ha_innodb.cc: Remove the unused innobase_repl_ variables. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 Revision r1334: Fix for Bug# 21409. At low transaction isolation levels we let each consistent read set its own snapshot storage/innobase/handler/ha_innodb.h: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1204: Change this in ha_innobase: void* innobase_prebuilt; to this: row_prebuilt_t* prebuilt; by introducing the typedef in ha_innodb.h, and remove all the now needless local variables and casts in ha_innodb.cc. Revision r1292: Remove the declarations of some global functions in ha_innodb.h and declare them static in ha_innodb.cc. These functions are invoked via function pointers in handlerton. Revision r1198: Merge a change from MySQL AB: ChangeSet@1.2372, 2006-12-31 02:29:11+01:00, kent@mysql.com +79 -0 Many files: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header Added GPL copyright text Revision r1201: Apply patch from MySQL: ChangeSet@1.2353, 2006-12-19 16:57:51-07:00, tsmith@siva.hindu.god +13 -0 Added innodb_rollback_on_timeout option to restore the 4.1 InnoDB timeout behavior (Bug 24200) storage/innobase/ibuf/ibuf0ibuf.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/buf0buf.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/buf0flu.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/dict0dict.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/ha0ha.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/lock0lock.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/log0log.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/mem0mem.h: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1241: Remove the unused function mem_strdupq(). storage/innobase/include/mem0mem.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1241: Remove the unused function mem_strdupq(). storage/innobase/include/rem0rec.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1338: rec_offs_nth_size(): Treat n==0 as a special case. (Bug #26835) storage/innobase/include/sync0rw.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/sync0sync.h: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1247: Rename mutex_enter_nowait to mutex_enter_nowait_func and add macro mutex_enter_nowait that supplies the default __FILE__ and __LINE__ arguments. Adjust callers. storage/innobase/include/sync0sync.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1294: Fixed inline asm code, it didn't work with GCC > ver 3.x. Revision r1244: Add ut_ad() debug assertions. UT_LIST_ADD_FIRST(), UT_LIST_ADD_LAST(), UT_LIST_INSERT_AFTER(): Assert against some trivial cases of cyclic lists. mutex_enter_func(): Assert that the current thread is not holding the mutex. Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/trx0sys.ic: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/include/univ.i: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1285: Merge a change from MySQL AB: ChangeSet 2006/10/26 15:41:47-04:00 iggy@amd64. Post Merge Cleanup storage/innobase/include/univ.i 2006/10/26 15:38:50-04:00 iggy@amd64. +9 -0 Post Merge Cleanup storage/innobase/include/ut0lst.h: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1244: Add ut_ad() debug assertions. UT_LIST_ADD_FIRST(), UT_LIST_ADD_LAST(), UT_LIST_INSERT_AFTER(): Assert against some trivial cases of cyclic lists. mutex_enter_func(): Assert that the current thread is not holding the mutex. storage/innobase/lock/lock0lock.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1330: lock_deadlock_recursive(): When the search depth or length is exceeded, rewind lock_latest_err_file and display the two transactions at the point of aborting the search. (Bug #25494) Revision r1332: lock_deadlock_recursive(): When aborting the search, display a note regardless of start->undo_no. Otherwise, aborted searches may show up as genuine deadlocks. This mistake was made in r1330. storage/innobase/log/log0log.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1247: Rename mutex_enter_nowait to mutex_enter_nowait_func and add macro mutex_enter_nowait that supplies the default __FILE__ and __LINE__ arguments. Adjust callers. storage/innobase/log/log0recv.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/mem/mem0pool.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/pars/pars0pars.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/que/que0que.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/read/read0read.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/row/row0mysql.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1201: Apply patch from MySQL: ChangeSet@1.2353, 2006-12-19 16:57:51-07:00, tsmith@siva.hindu.god +13 -0 Added innodb_rollback_on_timeout option to restore the 4.1 InnoDB timeout behavior (Bug 24200) Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/row/row0vers.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/srv/srv0que.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/srv/srv0srv.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1262: Fix for Bug# 23666. On Windows ut_usectime returns secs and usecs relative to the UNIX epoch (which is Jan, 1 1970). Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/sync/sync0rw.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1247: Rename mutex_enter_nowait to mutex_enter_nowait_func and add macro mutex_enter_nowait that supplies the default __FILE__ and __LINE__ arguments. Adjust callers. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/sync/sync0sync.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1247: Rename mutex_enter_nowait to mutex_enter_nowait_func and add macro mutex_enter_nowait that supplies the default __FILE__ and __LINE__ arguments. Adjust callers. storage/innobase/thr/thr0loc.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/trx/trx0purge.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/trx/trx0roll.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/trx/trx0rseg.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/trx/trx0sys.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/trx/trx0trx.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. Revision r1324: Merge changes from MySQL AB: ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0 Fixed compiler warnings ... Fixed compiler warnings detected on windows64 storage/innobase/trx/trx0undo.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/usr/usr0sess.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1242: Merge r1239 from branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. storage/innobase/ut/ut0ut.c: Apply the following InnoDB snapshots: innodb-5.1-ss1318 innodb-5.1-ss1330 innodb-5.1-ss1332 innodb-5.1-ss1340 Revision r1262: Fix for Bug# 23666. On Windows ut_usectime returns secs and usecs relative to the UNIX epoch (which is Jan, 1 1970).
551 lines
18 KiB
C
551 lines
18 KiB
C
/******************************************************
|
|
Mutex, the basic synchronization primitive
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 9/5/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef sync0sync_h
|
|
#define sync0sync_h
|
|
|
|
#include "univ.i"
|
|
#include "sync0types.h"
|
|
#include "ut0lst.h"
|
|
#include "ut0mem.h"
|
|
#include "os0thread.h"
|
|
#include "os0sync.h"
|
|
#include "sync0arr.h"
|
|
|
|
#ifndef UNIV_HOTBACKUP
|
|
extern my_bool timed_mutexes;
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
/**********************************************************************
|
|
Initializes the synchronization data structures. */
|
|
|
|
void
|
|
sync_init(void);
|
|
/*===========*/
|
|
/**********************************************************************
|
|
Frees the resources in synchronization data structures. */
|
|
|
|
void
|
|
sync_close(void);
|
|
/*===========*/
|
|
/**********************************************************************
|
|
Creates, or rather, initializes a mutex object to a specified memory
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
necessary only if the memory block containing it is freed. */
|
|
|
|
#ifdef UNIV_DEBUG
|
|
# ifdef UNIV_SYNC_DEBUG
|
|
# define mutex_create(M, level) \
|
|
mutex_create_func((M), #M, (level), __FILE__, __LINE__)
|
|
# else
|
|
# define mutex_create(M, level) \
|
|
mutex_create_func((M), #M, __FILE__, __LINE__)
|
|
# endif
|
|
#else
|
|
# define mutex_create(M, level) \
|
|
mutex_create_func((M), __FILE__, __LINE__)
|
|
#endif
|
|
|
|
/**********************************************************************
|
|
Creates, or rather, initializes a mutex object in a specified memory
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
necessary only if the memory block containing it is freed. */
|
|
|
|
void
|
|
mutex_create_func(
|
|
/*==============*/
|
|
mutex_t* mutex, /* in: pointer to memory */
|
|
#ifdef UNIV_DEBUG
|
|
const char* cmutex_name, /* in: mutex name */
|
|
# ifdef UNIV_SYNC_DEBUG
|
|
ulint level, /* in: level */
|
|
# endif /* UNIV_SYNC_DEBUG */
|
|
#endif /* UNIV_DEBUG */
|
|
const char* cfile_name, /* in: file name where created */
|
|
ulint cline); /* in: file line where created */
|
|
/**********************************************************************
|
|
Calling this function is obligatory only if the memory buffer containing
|
|
the mutex is freed. Removes a mutex object from the mutex list. The mutex
|
|
is checked to be in the reset state. */
|
|
|
|
#undef mutex_free /* Fix for MacOS X */
|
|
void
|
|
mutex_free(
|
|
/*=======*/
|
|
mutex_t* mutex); /* in: mutex */
|
|
/******************************************************************
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
corresponding function. */
|
|
|
|
#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
|
|
/**********************************************************************
|
|
A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
|
|
inlining of InnoDB functions, and no inlined functions should be called from
|
|
there. That is why we need to duplicate the inlined function here. */
|
|
|
|
void
|
|
mutex_enter_noninline(
|
|
/*==================*/
|
|
mutex_t* mutex); /* in: mutex */
|
|
/******************************************************************
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
corresponding function. */
|
|
|
|
/* NOTE! currently same as mutex_enter! */
|
|
|
|
#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
|
|
#define mutex_enter_fast_func mutex_enter_func;
|
|
/**********************************************************************
|
|
NOTE! Use the corresponding macro in the header file, not this function
|
|
directly. Locks a mutex for the current thread. If the mutex is reserved
|
|
the function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting
|
|
for the mutex before suspending the thread. */
|
|
UNIV_INLINE
|
|
void
|
|
mutex_enter_func(
|
|
/*=============*/
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
|
const char* file_name, /* in: file name where locked */
|
|
ulint line); /* in: line where locked */
|
|
/******************************************************************
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
corresponding function. */
|
|
|
|
#define mutex_enter_nowait(M) \
|
|
mutex_enter_nowait_func((M), __FILE__, __LINE__)
|
|
/************************************************************************
|
|
NOTE! Use the corresponding macro in the header file, not this function
|
|
directly. Tries to lock the mutex for the current thread. If the lock is not
|
|
acquired immediately, returns with return value 1. */
|
|
|
|
ulint
|
|
mutex_enter_nowait_func(
|
|
/*====================*/
|
|
/* out: 0 if succeed, 1 if not */
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
|
const char* file_name, /* in: file name where mutex
|
|
requested */
|
|
ulint line); /* in: line where requested */
|
|
/**********************************************************************
|
|
Unlocks a mutex owned by the current thread. */
|
|
UNIV_INLINE
|
|
void
|
|
mutex_exit(
|
|
/*=======*/
|
|
mutex_t* mutex); /* in: pointer to mutex */
|
|
/**********************************************************************
|
|
Releases a mutex. */
|
|
|
|
void
|
|
mutex_exit_noninline(
|
|
/*=================*/
|
|
mutex_t* mutex); /* in: mutex */
|
|
/**********************************************************************
|
|
Returns TRUE if no mutex or rw-lock is currently locked.
|
|
Works only in the debug version. */
|
|
|
|
ibool
|
|
sync_all_freed(void);
|
|
/*================*/
|
|
/*#####################################################################
|
|
FUNCTION PROTOTYPES FOR DEBUGGING */
|
|
/***********************************************************************
|
|
Prints wait info of the sync system. */
|
|
|
|
void
|
|
sync_print_wait_info(
|
|
/*=================*/
|
|
FILE* file); /* in: file where to print */
|
|
/***********************************************************************
|
|
Prints info of the sync system. */
|
|
|
|
void
|
|
sync_print(
|
|
/*=======*/
|
|
FILE* file); /* in: file where to print */
|
|
#ifdef UNIV_DEBUG
|
|
/**********************************************************************
|
|
Checks that the mutex has been initialized. */
|
|
|
|
ibool
|
|
mutex_validate(
|
|
/*===========*/
|
|
const mutex_t* mutex);
|
|
/**********************************************************************
|
|
Checks that the current thread owns the mutex. Works only
|
|
in the debug version. */
|
|
|
|
ibool
|
|
mutex_own(
|
|
/*======*/
|
|
/* out: TRUE if owns */
|
|
const mutex_t* mutex); /* in: mutex */
|
|
#endif /* UNIV_DEBUG */
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
/**********************************************************************
|
|
Adds a latch and its level in the thread level array. Allocates the memory
|
|
for the array if called first time for this OS thread. Makes the checks
|
|
against other latch levels stored in the array for this thread. */
|
|
|
|
void
|
|
sync_thread_add_level(
|
|
/*==================*/
|
|
void* latch, /* in: pointer to a mutex or an rw-lock */
|
|
ulint level); /* in: level in the latching order; if
|
|
SYNC_LEVEL_VARYING, nothing is done */
|
|
/**********************************************************************
|
|
Removes a latch from the thread level array if it is found there. */
|
|
|
|
ibool
|
|
sync_thread_reset_level(
|
|
/*====================*/
|
|
/* out: TRUE if found from the array; it is no error
|
|
if the latch is not found, as we presently are not
|
|
able to determine the level for every latch
|
|
reservation the program does */
|
|
void* latch); /* in: pointer to a mutex or an rw-lock */
|
|
/**********************************************************************
|
|
Checks that the level array for the current thread is empty. */
|
|
|
|
ibool
|
|
sync_thread_levels_empty(void);
|
|
/*==========================*/
|
|
/* out: TRUE if empty */
|
|
/**********************************************************************
|
|
Checks that the level array for the current thread is empty. */
|
|
|
|
ibool
|
|
sync_thread_levels_empty_gen(
|
|
/*=========================*/
|
|
/* out: TRUE if empty except the
|
|
exceptions specified below */
|
|
ibool dict_mutex_allowed); /* in: TRUE if dictionary mutex is
|
|
allowed to be owned by the thread,
|
|
also purge_is_running mutex is
|
|
allowed */
|
|
/**********************************************************************
|
|
Gets the debug information for a reserved mutex. */
|
|
|
|
void
|
|
mutex_get_debug_info(
|
|
/*=================*/
|
|
mutex_t* mutex, /* in: mutex */
|
|
const char** file_name, /* out: file where requested */
|
|
ulint* line, /* out: line where requested */
|
|
os_thread_id_t* thread_id); /* out: id of the thread which owns
|
|
the mutex */
|
|
/**********************************************************************
|
|
Counts currently reserved mutexes. Works only in the debug version. */
|
|
|
|
ulint
|
|
mutex_n_reserved(void);
|
|
/*==================*/
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
/**********************************************************************
|
|
NOT to be used outside this module except in debugging! Gets the value
|
|
of the lock word. */
|
|
UNIV_INLINE
|
|
ulint
|
|
mutex_get_lock_word(
|
|
/*================*/
|
|
const mutex_t* mutex); /* in: mutex */
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
/**********************************************************************
|
|
NOT to be used outside this module except in debugging! Gets the waiters
|
|
field in a mutex. */
|
|
UNIV_INLINE
|
|
ulint
|
|
mutex_get_waiters(
|
|
/*==============*/
|
|
/* out: value to set */
|
|
const mutex_t* mutex); /* in: mutex */
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
/*
|
|
LATCHING ORDER WITHIN THE DATABASE
|
|
==================================
|
|
|
|
The mutex or latch in the central memory object, for instance, a rollback
|
|
segment object, must be acquired before acquiring the latch or latches to
|
|
the corresponding file data structure. In the latching order below, these
|
|
file page object latches are placed immediately below the corresponding
|
|
central memory object latch or mutex.
|
|
|
|
Synchronization object Notes
|
|
---------------------- -----
|
|
|
|
Dictionary mutex If we have a pointer to a dictionary
|
|
| object, e.g., a table, it can be
|
|
| accessed without reserving the
|
|
| dictionary mutex. We must have a
|
|
| reservation, a memoryfix, to the
|
|
| appropriate table object in this case,
|
|
| and the table must be explicitly
|
|
| released later.
|
|
V
|
|
Dictionary header
|
|
|
|
|
V
|
|
Secondary index tree latch The tree latch protects also all
|
|
| the B-tree non-leaf pages. These
|
|
V can be read with the page only
|
|
Secondary index non-leaf bufferfixed to save CPU time,
|
|
| no s-latch is needed on the page.
|
|
| Modification of a page requires an
|
|
| x-latch on the page, however. If a
|
|
| thread owns an x-latch to the tree,
|
|
| it is allowed to latch non-leaf pages
|
|
| even after it has acquired the fsp
|
|
| latch.
|
|
V
|
|
Secondary index leaf The latch on the secondary index leaf
|
|
| can be kept while accessing the
|
|
| clustered index, to save CPU time.
|
|
V
|
|
Clustered index tree latch To increase concurrency, the tree
|
|
| latch is usually released when the
|
|
| leaf page latch has been acquired.
|
|
V
|
|
Clustered index non-leaf
|
|
|
|
|
V
|
|
Clustered index leaf
|
|
|
|
|
V
|
|
Transaction system header
|
|
|
|
|
V
|
|
Transaction undo mutex The undo log entry must be written
|
|
| before any index page is modified.
|
|
| Transaction undo mutex is for the undo
|
|
| logs the analogue of the tree latch
|
|
| for a B-tree. If a thread has the
|
|
| trx undo mutex reserved, it is allowed
|
|
| to latch the undo log pages in any
|
|
| order, and also after it has acquired
|
|
| the fsp latch.
|
|
V
|
|
Rollback segment mutex The rollback segment mutex must be
|
|
| reserved, if, e.g., a new page must
|
|
| be added to an undo log. The rollback
|
|
| segment and the undo logs in its
|
|
| history list can be seen as an
|
|
| analogue of a B-tree, and the latches
|
|
| reserved similarly, using a version of
|
|
| lock-coupling. If an undo log must be
|
|
| extended by a page when inserting an
|
|
| undo log record, this corresponds to
|
|
| a pessimistic insert in a B-tree.
|
|
V
|
|
Rollback segment header
|
|
|
|
|
V
|
|
Purge system latch
|
|
|
|
|
V
|
|
Undo log pages If a thread owns the trx undo mutex,
|
|
| or for a log in the history list, the
|
|
| rseg mutex, it is allowed to latch
|
|
| undo log pages in any order, and even
|
|
| after it has acquired the fsp latch.
|
|
| If a thread does not have the
|
|
| appropriate mutex, it is allowed to
|
|
| latch only a single undo log page in
|
|
| a mini-transaction.
|
|
V
|
|
File space management latch If a mini-transaction must allocate
|
|
| several file pages, it can do that,
|
|
| because it keeps the x-latch to the
|
|
| file space management in its memo.
|
|
V
|
|
File system pages
|
|
|
|
|
V
|
|
Kernel mutex If a kernel operation needs a file
|
|
| page allocation, it must reserve the
|
|
| fsp x-latch before acquiring the kernel
|
|
| mutex.
|
|
V
|
|
Search system mutex
|
|
|
|
|
V
|
|
Buffer pool mutex
|
|
|
|
|
V
|
|
Log mutex
|
|
|
|
|
Any other latch
|
|
|
|
|
V
|
|
Memory pool mutex */
|
|
|
|
/* Latching order levels */
|
|
|
|
/* User transaction locks are higher than any of the latch levels below:
|
|
no latches are allowed when a thread goes to wait for a normal table
|
|
or row lock! */
|
|
#define SYNC_USER_TRX_LOCK 9999
|
|
#define SYNC_NO_ORDER_CHECK 3000 /* this can be used to suppress
|
|
latching order checking */
|
|
#define SYNC_LEVEL_VARYING 2000 /* Level is varying. Only used with
|
|
buffer pool page locks, which do not
|
|
have a fixed level, but instead have
|
|
their level set after the page is
|
|
locked; see e.g.
|
|
ibuf_bitmap_get_map_page(). */
|
|
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
|
|
this in X-mode, implicit or backround
|
|
operations purge, rollback, foreign
|
|
key checks reserve this in S-mode */
|
|
#define SYNC_DICT 1000
|
|
#define SYNC_DICT_AUTOINC_MUTEX 999
|
|
#define SYNC_DICT_HEADER 995
|
|
#define SYNC_IBUF_HEADER 914
|
|
#define SYNC_IBUF_PESS_INSERT_MUTEX 912
|
|
#define SYNC_IBUF_MUTEX 910 /* ibuf mutex is really below
|
|
SYNC_FSP_PAGE: we assign a value this
|
|
high only to make the program to pass
|
|
the debug checks */
|
|
/*-------------------------------*/
|
|
#define SYNC_INDEX_TREE 900
|
|
#define SYNC_TREE_NODE_NEW 892
|
|
#define SYNC_TREE_NODE_FROM_HASH 891
|
|
#define SYNC_TREE_NODE 890
|
|
#define SYNC_PURGE_SYS 810
|
|
#define SYNC_PURGE_LATCH 800
|
|
#define SYNC_TRX_UNDO 700
|
|
#define SYNC_RSEG 600
|
|
#define SYNC_RSEG_HEADER_NEW 591
|
|
#define SYNC_RSEG_HEADER 590
|
|
#define SYNC_TRX_UNDO_PAGE 570
|
|
#define SYNC_EXTERN_STORAGE 500
|
|
#define SYNC_FSP 400
|
|
#define SYNC_FSP_PAGE 395
|
|
/*------------------------------------- Insert buffer headers */
|
|
/*------------------------------------- ibuf_mutex */
|
|
/*------------------------------------- Insert buffer tree */
|
|
#define SYNC_IBUF_BITMAP_MUTEX 351
|
|
#define SYNC_IBUF_BITMAP 350
|
|
/*------------------------------------- MySQL query cache mutex */
|
|
/*------------------------------------- MySQL binlog mutex */
|
|
/*-------------------------------*/
|
|
#define SYNC_KERNEL 300
|
|
#define SYNC_REC_LOCK 299
|
|
#define SYNC_TRX_LOCK_HEAP 298
|
|
#define SYNC_TRX_SYS_HEADER 290
|
|
#define SYNC_LOG 170
|
|
#define SYNC_RECV 168
|
|
#define SYNC_WORK_QUEUE 161
|
|
#define SYNC_SEARCH_SYS 160 /* NOTE that if we have a memory
|
|
heap that can be extended to the
|
|
buffer pool, its logical level is
|
|
SYNC_SEARCH_SYS, as memory allocation
|
|
can call routines there! Otherwise
|
|
the level is SYNC_MEM_HASH. */
|
|
#define SYNC_BUF_POOL 150
|
|
#define SYNC_BUF_BLOCK 149
|
|
#define SYNC_DOUBLEWRITE 140
|
|
#define SYNC_ANY_LATCH 135
|
|
#define SYNC_THR_LOCAL 133
|
|
#define SYNC_MEM_HASH 131
|
|
#define SYNC_MEM_POOL 130
|
|
|
|
/* Codes used to designate lock operations */
|
|
#define RW_LOCK_NOT_LOCKED 350
|
|
#define RW_LOCK_EX 351
|
|
#define RW_LOCK_EXCLUSIVE 351
|
|
#define RW_LOCK_SHARED 352
|
|
#define RW_LOCK_WAIT_EX 353
|
|
#define SYNC_MUTEX 354
|
|
|
|
/* NOTE! The structure appears here only for the compiler to know its size.
|
|
Do not use its fields directly! The structure used in the spin lock
|
|
implementation of a mutual exclusion semaphore. */
|
|
|
|
struct mutex_struct {
|
|
ulint lock_word; /* This ulint is the target of the atomic
|
|
test-and-set instruction in Win32 */
|
|
#if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER)
|
|
os_fast_mutex_t
|
|
os_fast_mutex; /* In other systems we use this OS mutex
|
|
in place of lock_word */
|
|
#endif
|
|
ulint waiters; /* This ulint is set to 1 if there are (or
|
|
may be) threads waiting in the global wait
|
|
array for this mutex to be released.
|
|
Otherwise, this is 0. */
|
|
UT_LIST_NODE_T(mutex_t) list; /* All allocated mutexes are put into
|
|
a list. Pointers to the next and prev. */
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
const char* file_name; /* File where the mutex was locked */
|
|
ulint line; /* Line where the mutex was locked */
|
|
ulint level; /* Level in the global latching order */
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
const char* cfile_name;/* File name where mutex created */
|
|
ulint cline; /* Line where created */
|
|
#ifdef UNIV_DEBUG
|
|
os_thread_id_t thread_id; /* The thread id of the thread
|
|
which locked the mutex. */
|
|
ulint magic_n;
|
|
# define MUTEX_MAGIC_N (ulint)979585
|
|
#endif /* UNIV_DEBUG */
|
|
#ifndef UNIV_HOTBACKUP
|
|
ulong count_os_wait; /* count of os_wait */
|
|
# ifdef UNIV_DEBUG
|
|
ulong count_using; /* count of times mutex used */
|
|
ulong count_spin_loop; /* count of spin loops */
|
|
ulong count_spin_rounds; /* count of spin rounds */
|
|
ulong count_os_yield; /* count of os_wait */
|
|
ulonglong lspent_time; /* mutex os_wait timer msec */
|
|
ulonglong lmax_spent_time; /* mutex os_wait timer msec */
|
|
const char* cmutex_name;/* mutex name */
|
|
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
|
|
# endif /* UNIV_DEBUG */
|
|
#endif /* !UNIV_HOTBACKUP */
|
|
};
|
|
|
|
/* The global array of wait cells for implementation of the databases own
|
|
mutexes and read-write locks. Appears here for debugging purposes only! */
|
|
|
|
extern sync_array_t* sync_primary_wait_array;
|
|
|
|
/* Constant determining how long spin wait is continued before suspending
|
|
the thread. A value 600 rounds on a 1995 100 MHz Pentium seems to correspond
|
|
to 20 microseconds. */
|
|
|
|
#define SYNC_SPIN_ROUNDS srv_n_spin_wait_rounds
|
|
|
|
/* The number of system calls made in this module. Intended for performance
|
|
monitoring. */
|
|
|
|
extern ulint mutex_system_call_count;
|
|
extern ulint mutex_exit_count;
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
/* Latching order checks start when this is set TRUE */
|
|
extern ibool sync_order_checks_on;
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
/* This variable is set to TRUE when sync_init is called */
|
|
extern ibool sync_initialized;
|
|
|
|
/* Global list of database mutexes (not OS mutexes) created. */
|
|
typedef UT_LIST_BASE_NODE_T(mutex_t) ut_list_base_node_t;
|
|
extern ut_list_base_node_t mutex_list;
|
|
|
|
/* Mutex protecting the mutex_list variable */
|
|
extern mutex_t mutex_list_mutex;
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "sync0sync.ic"
|
|
#endif
|
|
|
|
#endif
|