mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
509e761f06
------------------------------------------------------------------------ r4670 | vasil | 2009-04-07 09:35:23 +0300 (Tue, 07 Apr 2009) | 11 lines branches/zip: Fix Bug#43660 SHOW INDEXES/ANALYZE does NOT update cardinality for indexes of InnoDB table by replacing the pseudo random number generator with a better one (LCG). This also fixes Mantis Issue#212. Approved by: Heikki (rb://110) ------------------------------------------------------------------------ r4671 | vasil | 2009-04-07 09:37:31 +0300 (Tue, 07 Apr 2009) | 4 lines branches/zip: Add ChangeLog entry for r4670. ------------------------------------------------------------------------ r4673 | marko | 2009-04-07 15:45:28 +0300 (Tue, 07 Apr 2009) | 4 lines branches/zip: Allow in-place updates of UTF-8 CHAR columns from or to NULL in ROW_FORMAT=REDUNDANT. (Bug #44032) rb://107 approved by Heikki Tuuri. ------------------------------------------------------------------------ r4677 | marko | 2009-04-07 16:19:31 +0300 (Tue, 07 Apr 2009) | 1 line branches/zip: Adjust r4673 as in the merge to branches/6.0 -r4676. ------------------------------------------------------------------------ r4678 | inaam | 2009-04-07 18:45:37 +0300 (Tue, 07 Apr 2009) | 12 lines branches/zip Enable atomics on solaris (using the libc functions as defined in atomic.h) if GCC atomic builtins are not present. There still remains some work to be done (by Vasil?). This patch makes changes to plug.in to check pthread_t size and presence of atomic functions when running on solaris. The same has to become a part of the generated Makefile.in when we bake our source. Reviewed by: Heikki rb://106 ------------------------------------------------------------------------ r4687 | vasil | 2009-04-08 13:08:59 +0300 (Wed, 08 Apr 2009) | 4 lines branches/zip: Whitespace fixup in the ChangeLog ------------------------------------------------------------------------ r4688 | vasil | 2009-04-08 13:11:15 +0300 (Wed, 08 Apr 2009) | 4 lines branches/zip: Add ChangeLog entry for r4678. ------------------------------------------------------------------------ r4689 | marko | 2009-04-08 14:24:49 +0300 (Wed, 08 Apr 2009) | 5 lines branches/zip: Hide unnecessarily visible globals. dict_ind_redundant, dict_ind_compact: Declare these UNIV_INTERN. innodb_hton_ptr: Declare static. We do not attempt to access the built-in InnoDB any more. trx_roll_savepoints_free(): Declare UNIV_INTERN. ------------------------------------------------------------------------ r4700 | calvin | 2009-04-11 00:37:10 +0300 (Sat, 11 Apr 2009) | 9 lines branches/zip: Rewrite CMakeLists.txt CMakeLists.txt is completely rewritten: - To replace the one written by mysql - Print out some useful information, such as system name, directory, generator used, win64, Microsoft compiler, etc. - Remove one workaround for mysqld.lib location. User does not need to specify a build type ------------------------------------------------------------------------ r4702 | calvin | 2009-04-13 18:16:44 +0300 (Mon, 13 Apr 2009) | 3 lines branches/zip: delete the original CMakeLists.txt A new version will be committed, suggested by Ken. ------------------------------------------------------------------------ r4703 | calvin | 2009-04-13 18:20:45 +0300 (Mon, 13 Apr 2009) | 9 lines branches/zip: new CMakeLists.txt CMakeLists.txt is completely rewritten with enhancements: - Print out useful information, such as system name, directory, generator used, win64, Microsoft compiler, etc. - Remove one workaround for mysqld.lib location. User does not need to specify a build type when invoking MSVC generator. ------------------------------------------------------------------------ r4706 | vasil | 2009-04-14 14:32:11 +0300 (Tue, 14 Apr 2009) | 5 lines branches/zip: When using the random function, first take the modulus by the number of pages and then typecast to ulint. ------------------------------------------------------------------------ r4707 | calvin | 2009-04-14 17:47:31 +0300 (Tue, 14 Apr 2009) | 13 lines branches/zip: remove statically linked libraries from mysql To make zlib and strings dynamically linked; mysqld will export additional functions required by InnoDB. Since the symbols will be resolved dynamically during runtime, wdl_load_mapfile() is no longer able to make any function calls to ones in mysqld. As the result, strtoull() (from strings.lib) is replaced with _strtoui64(). rb://111 Approved by: Marko ------------------------------------------------------------------------ r4712 | vasil | 2009-04-15 12:26:32 +0300 (Wed, 15 Apr 2009) | 157 lines branches/zip: Merge revisions 4481:4710 from branches/5.1: (resolving conflict in r4574, r4575 and skipping r4699 and r4705 because analogous changes to r4699 and r4705 were already made to branches/zip) ------------------------------------------------------------------------ r4573 | vasil | 2009-03-30 14:17:13 +0300 (Mon, 30 Mar 2009) | 4 lines Changed paths: M /branches/5.1/mysql-test/innodb.test branches/5.1: Fix email address from dev@innodb.com to innodb_dev_ww@oracle.com ------------------------------------------------------------------------ r4574 | vasil | 2009-03-30 14:27:08 +0300 (Mon, 30 Mar 2009) | 38 lines Changed paths: M /branches/5.1/Makefile.am M /branches/5.1/mysql-test/innodb.test branches/5.1: Restore the state of INNODB_THREAD_CONCURRENCY to silence this warning: TEST RESULT TIME (ms) ------------------------------------------------------------ worker[1] Using MTR_BUILD_THREAD 250, with reserved ports 12500..12509 main.innodb [ pass ] 8803 MTR's internal check of the test case 'main.innodb' failed. This means that the test case does not preserve the state that existed before the test case was executed. Most likely the test case did not do a proper clean-up. This is the diff of the states of the servers before and after the test case was executed: mysqltest: Logging to '/tmp/autotest.sh-20090330_033000-5.1.5Hg8CY/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.log'. mysqltest: Results saved in '/tmp/autotest.sh-20090330_033000-5.1.5Hg8CY/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.result'. mysqltest: Connecting to server localhost:12500 (socket /tmp/autotest.sh-20090330_033000-5.1.5Hg8CY/mysql-5.1/mysql-test/var/tmp/mysqld.1.sock) as 'root', connection 'default', attempt 0 ... mysqltest: ... Connected. mysqltest: Start processing test commands from './include/check-testcase.test' ... mysqltest: ... Done processing test commands. --- /tmp/autotest.sh-20090330_033000-5.1.5Hg8CY/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.result 2009-03-30 14:12:31.000000000 +0300 +++ /tmp/autotest.sh-20090330_033000-5.1.5Hg8CY/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.reject 2009-03-30 14:12:41.000000000 +0300 @@ -99,7 +99,7 @@ INNODB_SUPPORT_XA ON INNODB_SYNC_SPIN_LOOPS 20 INNODB_TABLE_LOCKS ON -INNODB_THREAD_CONCURRENCY 8 +INNODB_THREAD_CONCURRENCY 16 INNODB_THREAD_SLEEP_DELAY 10000 INSERT_ID 0 INTERACTIVE_TIMEOUT 28800 mysqltest: Result content mismatch not ok ------------------------------------------------------------------------ r4575 | vasil | 2009-03-30 15:55:31 +0300 (Mon, 30 Mar 2009) | 8 lines Changed paths: M /branches/5.1/mysql-test/innodb.result M /branches/5.1/mysql-test/innodb.test branches/5.1: Fix Bug#43309 Test main.innodb can't be run twice Make the innodb mysql-test more flexible by inspecting how much a variable of interest has changed since the start of the test. Do not assume the variables have zero values at the start of the test. ------------------------------------------------------------------------ r4576 | vasil | 2009-03-30 16:25:10 +0300 (Mon, 30 Mar 2009) | 4 lines Changed paths: M /branches/5.1/Makefile.am branches/5.1: Revert a change to Makefile.am that I committed accidentally in c4574. ------------------------------------------------------------------------ r4659 | vasil | 2009-04-06 15:34:51 +0300 (Mon, 06 Apr 2009) | 6 lines Changed paths: M /branches/5.1/mysql-test/innodb.test branches/5.1: Followup to r4575 and the fix of Bug#43309 Test main.innodb can't be run twice: Add an explanatory comment, as suggested by Patrick Crews in the bug report. ------------------------------------------------------------------------ r4699 | vasil | 2009-04-09 14:01:52 +0300 (Thu, 09 Apr 2009) | 15 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc M /branches/5.1/include/srv0srv.h M /branches/5.1/page/page0cur.c M /branches/5.1/srv/srv0srv.c branches/5.1: Fix Bug#43660 SHOW INDEXES/ANALYZE does NOT update cardinality for indexes of InnoDB table by replacing the PRNG that is used to pick random pages with a better one. This is based on r4670 but also adds a new configuration option and enables the fix only if this option is changed. Please skip the present revision when merging. Approved by: Heikki (via email) ------------------------------------------------------------------------ r4705 | vasil | 2009-04-14 14:30:13 +0300 (Tue, 14 Apr 2009) | 5 lines Changed paths: M /branches/5.1/page/page0cur.c branches/5.1: When using the random function, first take the modulus by the number of pages and then typecast to ulint. ------------------------------------------------------------------------ r4710 | vasil | 2009-04-15 11:55:18 +0300 (Wed, 15 Apr 2009) | 25 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc branches/5.1: Merge a change from MySQL (looks like this is against 5.0 but they later merged it to 5.1): ------------------------------------------------------------ revno: 1810.3846.1 committer: Alexey Botchkov <holyfoot@mysql.com> branch nick: 31435 timestamp: Tue 2008-11-11 14:42:32 +0400 message: Bug#31435 ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse I think we don't need to issue an error statement in the convert_search_mode_to_innobase(). Returning the PAGE_CUR_UNSUPP value is enough as allows to handle this case depending on the requirements. per-file comments: sql/ha_innodb.cc Bug#31435 ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse no error issued in convert_search_mode_to_innobase. ha_innobase::records_in_range() returns HA_POS_ERROR if search mode isn't supported. modified: sql/ha_innodb.cc ------------------------------------------------------------------------ ------------------------------------------------------------------------ r4713 | vasil | 2009-04-15 12:36:16 +0300 (Wed, 15 Apr 2009) | 4 lines branches/zip: Add missing ChangeLog entries ------------------------------------------------------------------------ r4714 | vasil | 2009-04-15 12:36:57 +0300 (Wed, 15 Apr 2009) | 4 lines branches/zip: Fix typo in the ChangeLog ------------------------------------------------------------------------ r4715 | vasil | 2009-04-15 12:39:04 +0300 (Wed, 15 Apr 2009) | 4 lines branches/zip: Whitespace cleanup in ChangeLog ------------------------------------------------------------------------ r4716 | vasil | 2009-04-15 21:36:06 +0300 (Wed, 15 Apr 2009) | 4 lines branches/zip: Add ChangeLog entry for r4543. ------------------------------------------------------------------------ r4717 | calvin | 2009-04-16 01:22:35 +0300 (Thu, 16 Apr 2009) | 18 lines branches/zip: Use the Windows Interlocked functions for atomic memory access Mapping the atomic operations to Windows Interlocked functions: os_compare_and_swap_* to InterlockedCompareExchange(64) os_atomic_increment_* to InterlockedExchangeAdd(64) os_atomic_test_and_set_byte to InterlockedExchange In this patch, the legacy code under UNIV_CAN_USE_X86_ASSEMBLER is removed all together, and add HAVE_WINDOWS_ATOMICS and INNODB_RW_LOCKS_USE_ATOMICS to CMakeLists.txt This is to address mantis issue#194. rb://113 Approved by: Marko ------------------------------------------------------------------------ r4720 | vasil | 2009-04-16 09:44:48 +0300 (Thu, 16 Apr 2009) | 4 lines branches/zip: Add ChangeLog entry for r4717. ------------------------------------------------------------------------ r4721 | marko | 2009-04-16 10:32:09 +0300 (Thu, 16 Apr 2009) | 2 lines branches/zip: row_scan_and_check_index(): Initialize prebuilt->index_usable. This should have been done in r4631. Spotted by Michael. ------------------------------------------------------------------------ r4728 | marko | 2009-04-16 16:02:27 +0300 (Thu, 16 Apr 2009) | 3 lines branches/zip: univ.i: Define REFMAN as the base URL of the MySQL Reference Manual and use it in every string. This fixes Issue #221. ------------------------------------------------------------------------ r4733 | calvin | 2009-04-17 08:13:20 +0300 (Fri, 17 Apr 2009) | 6 lines branches/zip: minor changes to CMakeLists.txt All are non-functional changes: - should check for long (not int), spotted by Sunny - comment out the project definition, avoiding to generate another .sln file. ------------------------------------------------------------------------ r4748 | vasil | 2009-04-18 00:50:09 +0300 (Sat, 18 Apr 2009) | 118 lines branches/zip: Merge revisions 4710:4746 from branches/5.1: ------------------------------------------------------------------------ r4746 | vasil | 2009-04-18 00:32:08 +0300 (Sat, 18 Apr 2009) | 110 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc M /branches/5.1/include/pars0pars.h branches/5.1: Merge a change from MySQL: ------------------------------------------------------------ revno: 2728.10.2 committer: Ignacio Galarza <iggy@mysql.com> branch nick: mysql-5.1-bugteam-bug29125 timestamp: Fri 2009-02-13 11:41:47 -0500 message: Bug#29125 Windows Server X64: so many compiler warnings - Remove bothersome warning messages. This change focuses on the warnings that are covered by the ignore file: support-files/compiler_warnings.supp. - Strings are guaranteed to be max uint in length modified: client/mysql_upgrade.c client/mysqladmin.cc client/mysqlbinlog.cc client/mysqlcheck.c client/mysqldump.c client/mysqlslap.c client/mysqltest.cc client/sql_string.cc extra/comp_err.c extra/yassl/src/buffer.cpp extra/yassl/taocrypt/include/block.hpp extra/yassl/taocrypt/src/algebra.cpp extra/yassl/taocrypt/src/asn.cpp include/config-win.h libmysql/libmysql.c mysys/array.c mysys/base64.c mysys/charset.c mysys/checksum.c mysys/default.c mysys/default_modify.c mysys/hash.c mysys/mf_keycache.c mysys/mf_tempdir.c mysys/my_append.c mysys/my_compress.c mysys/my_conio.c mysys/my_copy.c mysys/my_getwd.c mysys/my_pread.c mysys/my_quick.c mysys/my_read.c mysys/safemalloc.c mysys/string.c server-tools/instance-manager/buffer.cc server-tools/instance-manager/instance.cc server-tools/instance-manager/options.cc server-tools/instance-manager/parse.h sql-common/client.c sql-common/my_user.c sql/event_data_objects.cc sql/event_parse_data.cc sql/events.cc sql/gen_lex_hash.cc sql/item.h sql/item_func.cc sql/item_strfunc.cc sql/item_timefunc.cc sql/lock.cc sql/log_event.cc sql/log_event.h sql/log_event_old.cc sql/net_serv.cc sql/sp_head.h sql/spatial.h sql/sql_class.h sql/sql_connect.cc sql/sql_crypt.cc sql/sql_error.cc sql/sql_insert.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_load.cc sql/sql_prepare.cc sql/sql_profile.cc sql/sql_repl.cc sql/sql_servers.cc sql/sql_string.cc sql/sql_table.cc sql/sql_trigger.cc sql/sql_udf.cc sql/sql_view.cc sql/udf_example.c sql/uniques.cc storage/archive/azio.c storage/archive/azlib.h storage/csv/ha_tina.cc storage/csv/ha_tina.h storage/csv/transparent_file.h storage/federated/ha_federated.cc storage/federated/ha_federated.h storage/heap/hp_write.c storage/innobase/handler/ha_innodb.cc storage/innobase/include/pars0pars.h storage/myisam/ha_myisam.cc storage/myisam/mi_check.c storage/myisam/mi_packrec.c storage/myisam/mi_search.c storage/myisam/rt_index.c storage/myisammrg/ha_myisammrg.cc strings/ctype.c strings/my_vsnprintf.c tests/bug25714.c tests/mysql_client_test.c ------------------------------------------------------------------------ r4749 | vasil | 2009-04-18 00:58:08 +0300 (Sat, 18 Apr 2009) | 4 lines branches/zip: Add ChangeLog entry for t4748. ------------------------------------------------------------------------ r4751 | vasil | 2009-04-18 01:29:16 +0300 (Sat, 18 Apr 2009) | 4 lines branches/zip: Silence warning about unused variables. ------------------------------------------------------------------------ r4752 | vasil | 2009-04-18 01:30:37 +0300 (Sat, 18 Apr 2009) | 4 lines branches/zip: Include the needed header for memset(). ------------------------------------------------------------------------ r4753 | vasil | 2009-04-18 01:31:34 +0300 (Sat, 18 Apr 2009) | 4 lines branches/zip: Silence a compiler warning. ------------------------------------------------------------------------ r4756 | vasil | 2009-04-18 02:19:03 +0300 (Sat, 18 Apr 2009) | 5 lines branches/zip: Rename the aux config program and give it a more specific name because more are coming. ------------------------------------------------------------------------ r4757 | vasil | 2009-04-18 02:22:33 +0300 (Sat, 18 Apr 2009) | 4 lines branches/zip: Add comment and copyright notice to the aux config program. ------------------------------------------------------------------------ r4758 | vasil | 2009-04-18 02:40:47 +0300 (Sat, 18 Apr 2009) | 5 lines branches/zip: Add aux config programs to emulate the newly added checks in plug.in (from r4678). ------------------------------------------------------------------------ r4830 | marko | 2009-04-20 16:11:38 +0300 (Mon, 20 Apr 2009) | 6 lines branches/zip: Cosmetic fixes. row_unlock_for_mysql(): Add a const qualifier to read-only rec_t*. Use dict_index_is_clust(). CMakeLists.txt: svn propset svn:eol-style native. ------------------------------------------------------------------------ r4893 | marko | 2009-04-23 09:32:36 +0300 (Thu, 23 Apr 2009) | 11 lines branches/zip: Introduce the logical type names trx_id_t, roll_ptr_t, and undo_no_t. Each type is still defined as dulint. This is an initial step towards replacing dulint with a 64-bit data type. Because modern compilers have no trouble supporting 64-bit arithmetics even on 32-bit targets, the dulint struct is a relic that should go. The last remaining major use of dulint is dictionary IDs (table, index, and row ids). rb://114 approved by Sunny Bains ------------------------------------------------------------------------ r4894 | marko | 2009-04-23 10:21:07 +0300 (Thu, 23 Apr 2009) | 1 line branches/zip: ChangeLog: Document r4893. ------------------------------------------------------------------------ r4895 | marko | 2009-04-23 10:22:06 +0300 (Thu, 23 Apr 2009) | 1 line branches/zip: ChangeLog: Add the missing include/ to two files. ------------------------------------------------------------------------ r4896 | marko | 2009-04-23 10:37:40 +0300 (Thu, 23 Apr 2009) | 4 lines branches/zip: row_scan_and_check_index(): Improve the diagnostics, by reporting errors from row_search_for_mysql() in the error log. The errors will still be ignored by CHECK TABLE. This is somewhat related to Issue #211. ------------------------------------------------------------------------ r4897 | marko | 2009-04-23 10:40:34 +0300 (Thu, 23 Apr 2009) | 2 lines branches/zip: row_scan_and_check_index(): Check row_merge_is_index_usable() earlier, to make the logic clearer. ------------------------------------------------------------------------ r4898 | marko | 2009-04-23 15:15:07 +0300 (Thu, 23 Apr 2009) | 4 lines branches/zip: Correct a misleading comment. PAGE_MAX_TRX_ID will be updated in ibuf_insert_low() and updated from the insert buffer tree page to the secondary index tree page during the insert buffer merge. ------------------------------------------------------------------------ r4915 | marko | 2009-04-27 13:40:20 +0300 (Mon, 27 Apr 2009) | 2 lines branches/zip: row_scan_and_check_index(): Add some comments on prebuilt->index_usable, as suggested by Michael. ------------------------------------------------------------------------ r4921 | marko | 2009-04-29 11:51:25 +0300 (Wed, 29 Apr 2009) | 2 lines branches/zip: btr_cur_optimistic_insert(): Remove a redundant condition. The insert buffer tree is a clustered index. ------------------------------------------------------------------------ r4922 | marko | 2009-04-29 23:23:27 +0300 (Wed, 29 Apr 2009) | 22 lines branches/zip: Distinguish temporary tables in MLOG_FILE_CREATE. This addresses Mantis Issue #23 in InnoDB Hot Backup and some of MySQL Bug #41609. In MLOG_FILE_CREATE, we need to distinguish temporary tables, so that InnoDB Hot Backup can work correctly. It turns out that we can do this easily, by using a bit of the previously unused parameter for page number. (The page number parameter of MLOG_FILE_CREATE has been written as 0 ever since MySQL 4.1, which introduced MLOG_FILE_CREATE.) MLOG_FILE_FLAG_TEMP: A flag for indicating a temporary table in the page number parameter of MLOG_FILE_ operations. fil_op_write_log(): Add the parameter log_flags. fil_op_log_parse_or_replay(): Add the parameter log_flags. Do not replay MLOG_FILE_CREATE when MLOG_FILE_FLAG_TEMP is set in log_flags. This only affects ibbackup --apply-log. InnoDB itself never replays file operations. rb://117 approved by Heikki Tuuri ------------------------------------------------------------------------ r4977 | marko | 2009-05-13 15:49:38 +0300 (Wed, 13 May 2009) | 12 lines branches/zip: Merge revisions 4746:4976 from branches/5.1: ------------------------------------------------------------------------ r4976 | marko | 2009-05-13 15:44:54 +0300 (Wed, 13 May 2009) | 6 lines branches/5.1: Display DB_ROLL_PTR in the COLUMNS section of the innodb_table_monitor output. It was accidentally omitted due to an off-by-one loop condition. (Bug #44320) rb://116 approved by Heikki Tuuri ------------------------------------------------------------------------ ------------------------------------------------------------------------ r4978 | vasil | 2009-05-13 16:21:55 +0300 (Wed, 13 May 2009) | 4 lines branches/zip: Add ChangeLog entry for r4977. ------------------------------------------------------------------------ r4995 | marko | 2009-05-14 15:31:43 +0300 (Thu, 14 May 2009) | 24 lines branches/zip: Merge revisions 4976:4994 from branches/5.1: ------------------------------------------------------------------------ r4994 | marko | 2009-05-14 15:04:55 +0300 (Thu, 14 May 2009) | 18 lines branches/5.1: Prevent a race condition in innobase_commit() by ensuring that innodb_commit_concurrency>0 remains constant at run time. (Bug #42101) srv_commit_concurrency: Make this a static variable in ha_innodb.cc. innobase_commit_concurrency_validate(): Check that innodb_commit_concurrency is not changed from or to 0 at run time. This is needed, because innobase_commit() assumes that innodb_commit_concurrency>0 remains constant. Without this limitation, the checks for innodb_commit_concurrency>0 in innobase_commit() should be removed and that function would have to acquire and release commit_cond_m at least twice per invocation. Normally, innodb_commit_concurrency=0, and introducing the mutex operations would mean significant overhead. innodb_bug42101.test, innodb_bug42101-nonzero.test: Test cases. rb://123 approved by Heikki Tuuri ------------------------------------------------------------------------ ------------------------------------------------------------------------ r5000 | vasil | 2009-05-14 20:13:41 +0300 (Thu, 14 May 2009) | 4 lines branches/zip: Add ChangeLog entry for r4994. ------------------------------------------------------------------------ r5026 | marko | 2009-05-18 16:29:51 +0300 (Mon, 18 May 2009) | 1 line branches/zip: buf_validate(): Add missing out: comment. ------------------------------------------------------------------------ r5027 | marko | 2009-05-18 16:36:10 +0300 (Mon, 18 May 2009) | 1 line branches/zip: Add some missing out: comments to buf0buf.h, buf0buf.c. ------------------------------------------------------------------------ r5028 | marko | 2009-05-18 16:40:07 +0300 (Mon, 18 May 2009) | 11 lines branches/zip: When executing an optimistic update by delete-and-insert, correctly estimate the free space on the compressed page by page_zip_available(..., create=TRUE). This was reported as Issue #231. btr_cur_update_alloc_zip(): Add the parameter ibool create and pass it to page_zip_available(). The parameter was previously passed as 0. btr_cur_optimistic_update(): Pass create=TRUE to btr_cur_update_alloc_zip(). rb://120 approved by Heikki Tuuri ------------------------------------------------------------------------ r5030 | marko | 2009-05-19 10:04:04 +0300 (Tue, 19 May 2009) | 2 lines branches/zip: os_thread_get_curr_id(), os_thread_get_curr(): Add missing out: comments. ------------------------------------------------------------------------ r5031 | marko | 2009-05-19 10:30:02 +0300 (Tue, 19 May 2009) | 1 line branches/zip: Add missing out: comments to nullary functions. ------------------------------------------------------------------------ r5033 | marko | 2009-05-19 11:00:51 +0300 (Tue, 19 May 2009) | 1 line branches/zip: Remove bogus out: comments of functions returning void. ------------------------------------------------------------------------ r5034 | marko | 2009-05-19 12:41:32 +0300 (Tue, 19 May 2009) | 1 line branches/zip: row_update_prebuilt_trx(): Correct bogus comment. ------------------------------------------------------------------------ r5035 | marko | 2009-05-19 13:04:58 +0300 (Tue, 19 May 2009) | 3 lines branches/zip: ut0auxconf_have_solaris_atomics.c: Get the function declarations from <atomic.h>. Call the functions with proper arguments. ------------------------------------------------------------------------ r5036 | marko | 2009-05-19 13:05:50 +0300 (Tue, 19 May 2009) | 1 line branches/zip: Add proper comments to some file page accessors. ------------------------------------------------------------------------ r5037 | marko | 2009-05-19 13:08:16 +0300 (Tue, 19 May 2009) | 1 line branches/zip: Fix a typo that was introduced in r5036. ------------------------------------------------------------------------ r5038 | marko | 2009-05-19 22:59:07 +0300 (Tue, 19 May 2009) | 30 lines branches/zip: Write PAGE_MAX_TRX_ID to the redo log. Otherwise, transactions that are started before the rollback of incomplete transactions has finished may have an inconsistent view of the secondary indexes. dict_index_is_sec_or_ibuf(): Auxiliary function for controlling updates and checks of PAGE_MAX_TRX_ID: check whether an index is a secondary index or the insert buffer tree. page_set_max_trx_id(), page_update_max_trx_id(), lock_rec_insert_check_and_lock(), lock_sec_rec_modify_check_and_lock(), btr_cur_ins_lock_and_undo(), btr_cur_upd_lock_and_undo(): Add the parameter mtr. page_set_max_trx_id(): Allow mtr to be NULL. When mtr==NULL, do not attempt to write to the redo log. This only occurs when creating a page or reorganizing a compressed page. In these cases, the PAGE_MAX_TRX_ID will be set correctly during the application of redo log records, even though there is no explicit log record about it. btr_discard_only_page_on_level(): Preserve PAGE_MAX_TRX_ID. This function should be unreachable, though. btr_cur_pessimistic_update(): Update PAGE_MAX_TRX_ID. Add some assertions for checking that PAGE_MAX_TRX_ID is set on all secondary index leaf pages. rb://115 tested by Michael, fixes Issue #211 ------------------------------------------------------------------------ r5039 | marko | 2009-05-19 23:13:12 +0300 (Tue, 19 May 2009) | 1 line branches/zip: ib_wqueue_wait(): Add decorative comment. ------------------------------------------------------------------------ r5041 | marko | 2009-05-20 08:42:12 +0300 (Wed, 20 May 2009) | 1 line branches/zip: Add missing function comments. ------------------------------------------------------------------------ r5042 | marko | 2009-05-20 08:46:01 +0300 (Wed, 20 May 2009) | 1 line branches/zip: sync0rw.ic: Remove an extra ; that was added in r5041. ------------------------------------------------------------------------ r5044 | marko | 2009-05-20 11:11:58 +0300 (Wed, 20 May 2009) | 2 lines branches/zip: mlog_parse_index(): Correct a parameter comment and add a const qualifier that was missing. ------------------------------------------------------------------------ r5045 | marko | 2009-05-20 11:37:08 +0300 (Wed, 20 May 2009) | 1 line branches/zip: fil0fil.c: Correct some comments. ------------------------------------------------------------------------ r5046 | marko | 2009-05-20 12:19:40 +0300 (Wed, 20 May 2009) | 1 line branches/zip: Fix some function comments. ------------------------------------------------------------------------ r5047 | marko | 2009-05-20 12:26:49 +0300 (Wed, 20 May 2009) | 1 line branches/zip: ut_snprintf(): Fix the function comments. ------------------------------------------------------------------------ r5048 | marko | 2009-05-20 12:28:44 +0300 (Wed, 20 May 2009) | 3 lines branches/zip: inno_bcmp(): Remove this memcmp replacement. srv0start.c does not (any longer) call memcmp. srv_parse_megabytes(): Add a function comment. ------------------------------------------------------------------------ r5052 | marko | 2009-05-20 12:32:37 +0300 (Wed, 20 May 2009) | 1 line branches/zip: ib_vector_is_empty(): Fix the function comment. ------------------------------------------------------------------------ r5054 | marko | 2009-05-20 12:35:33 +0300 (Wed, 20 May 2009) | 1 line branches/zip: page_cur_lcg_prng(): Add missing parameter list. ------------------------------------------------------------------------ r5057 | marko | 2009-05-20 12:45:17 +0300 (Wed, 20 May 2009) | 1 line branches/zip: Remove bogus in: comments from struct members. ------------------------------------------------------------------------ r5058 | marko | 2009-05-20 13:06:03 +0300 (Wed, 20 May 2009) | 1 line branches/zip: Clean up some function comments. ------------------------------------------------------------------------ r5060 | marko | 2009-05-20 14:06:59 +0300 (Wed, 20 May 2009) | 1 line branches/zip: Clean up some comments. ------------------------------------------------------------------------ r5061 | marko | 2009-05-20 14:07:49 +0300 (Wed, 20 May 2009) | 2 lines branches/zip: innodb_export_status(): Remove the return(0), now that the function was declared void in r5060. ------------------------------------------------------------------------ r5062 | marko | 2009-05-20 14:45:03 +0300 (Wed, 20 May 2009) | 1 line branches/zip: ha_innodb.cc: Clean up some comments. ------------------------------------------------------------------------ r5063 | marko | 2009-05-20 16:10:17 +0300 (Wed, 20 May 2009) | 1 line branches/zip: ut_dulint_sort(): Write proper comments. ------------------------------------------------------------------------ r5064 | marko | 2009-05-20 16:17:26 +0300 (Wed, 20 May 2009) | 2 lines branches/zip: innobase_end(), innobase_flush_logs(): Document the function parameters. ------------------------------------------------------------------------ r5065 | marko | 2009-05-20 23:17:43 +0300 (Wed, 20 May 2009) | 1 line branches/zip: ha_innodb.cc: Add some missing function comments. ------------------------------------------------------------------------ r5066 | marko | 2009-05-21 00:51:23 +0300 (Thu, 21 May 2009) | 2 lines branches/zip: Fix some function comments. ------------------------------------------------------------------------ r5070 | vasil | 2009-05-21 08:27:00 +0300 (Thu, 21 May 2009) | 4 lines branches/zip: Whitespace fixup. ------------------------------------------------------------------------
539 lines
16 KiB
C
539 lines
16 KiB
C
/*****************************************************************************
|
|
|
|
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
|
|
|
|
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
|
|
|
|
*****************************************************************************/
|
|
|
|
/******************************************************
|
|
Cursor read
|
|
|
|
Created 2/16/1997 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#include "read0read.h"
|
|
|
|
#ifdef UNIV_NONINL
|
|
#include "read0read.ic"
|
|
#endif
|
|
|
|
#include "srv0srv.h"
|
|
#include "trx0sys.h"
|
|
|
|
/*
|
|
-------------------------------------------------------------------------------
|
|
FACT A: Cursor read view on a secondary index sees only committed versions
|
|
-------
|
|
of the records in the secondary index or those versions of rows created
|
|
by transaction which created a cursor before cursor was created even
|
|
if transaction which created the cursor has changed that clustered index page.
|
|
|
|
PROOF: We must show that read goes always to the clustered index record
|
|
to see that record is visible in the cursor read view. Consider e.g.
|
|
following table and SQL-clauses:
|
|
|
|
create table t1(a int not null, b int, primary key(a), index(b));
|
|
insert into t1 values (1,1),(2,2);
|
|
commit;
|
|
|
|
Now consider that we have a cursor for a query
|
|
|
|
select b from t1 where b >= 1;
|
|
|
|
This query will use secondary key on the table t1. Now after the first fetch
|
|
on this cursor if we do a update:
|
|
|
|
update t1 set b = 5 where b = 2;
|
|
|
|
Now second fetch of the cursor should not see record (2,5) instead it should
|
|
see record (2,2).
|
|
|
|
We also should show that if we have delete t1 where b = 5; we still
|
|
can see record (2,2).
|
|
|
|
When we access a secondary key record maximum transaction id is fetched
|
|
from this record and this trx_id is compared to up_limit_id in the view.
|
|
If trx_id in the record is greater or equal than up_limit_id in the view
|
|
cluster record is accessed. Because trx_id of the creating
|
|
transaction is stored when this view was created to the list of
|
|
trx_ids not seen by this read view previous version of the
|
|
record is requested to be built. This is build using clustered record.
|
|
If the secondary key record is delete marked it's corresponding
|
|
clustered record can be already be purged only if records
|
|
trx_id < low_limit_no. Purge can't remove any record deleted by a
|
|
transaction which was active when cursor was created. But, we still
|
|
may have a deleted secondary key record but no clustered record. But,
|
|
this is not a problem because this case is handled in
|
|
row_sel_get_clust_rec() function which is called
|
|
whenever we note that this read view does not see trx_id in the
|
|
record. Thus, we see correct version. Q. E. D.
|
|
|
|
-------------------------------------------------------------------------------
|
|
FACT B: Cursor read view on a clustered index sees only committed versions
|
|
-------
|
|
of the records in the clustered index or those versions of rows created
|
|
by transaction which created a cursor before cursor was created even
|
|
if transaction which created the cursor has changed that clustered index page.
|
|
|
|
PROOF: Consider e.g.following table and SQL-clauses:
|
|
|
|
create table t1(a int not null, b int, primary key(a));
|
|
insert into t1 values (1),(2);
|
|
commit;
|
|
|
|
Now consider that we have a cursor for a query
|
|
|
|
select a from t1 where a >= 1;
|
|
|
|
This query will use clustered key on the table t1. Now after the first fetch
|
|
on this cursor if we do a update:
|
|
|
|
update t1 set a = 5 where a = 2;
|
|
|
|
Now second fetch of the cursor should not see record (5) instead it should
|
|
see record (2).
|
|
|
|
We also should show that if we have execute delete t1 where a = 5; after
|
|
the cursor is opened we still can see record (2).
|
|
|
|
When accessing clustered record we always check if this read view sees
|
|
trx_id stored to clustered record. By default we don't see any changes
|
|
if record trx_id >= low_limit_id i.e. change was made transaction
|
|
which started after transaction which created the cursor. If row
|
|
was changed by the future transaction a previous version of the
|
|
clustered record is created. Thus we see only committed version in
|
|
this case. We see all changes made by committed transactions i.e.
|
|
record trx_id < up_limit_id. In this case we don't need to do anything,
|
|
we already see correct version of the record. We don't see any changes
|
|
made by active transaction except creating transaction. We have stored
|
|
trx_id of creating transaction to list of trx_ids when this view was
|
|
created. Thus we can easily see if this record was changed by the
|
|
creating transaction. Because we already have clustered record we can
|
|
access roll_ptr. Using this roll_ptr we can fetch undo record.
|
|
We can now check that undo_no of the undo record is less than undo_no of the
|
|
trancaction which created a view when cursor was created. We see this
|
|
clustered record only in case when record undo_no is less than undo_no
|
|
in the view. If this is not true we build based on undo_rec previous
|
|
version of the record. This record is found because purge can't remove
|
|
records accessed by active transaction. Thus we see correct version. Q. E. D.
|
|
-------------------------------------------------------------------------------
|
|
FACT C: Purge does not remove any delete marked row that is visible
|
|
-------
|
|
to cursor view.
|
|
|
|
TODO: proof this
|
|
|
|
*/
|
|
|
|
/*************************************************************************
|
|
Creates a read view object. */
|
|
UNIV_INLINE
|
|
read_view_t*
|
|
read_view_create_low(
|
|
/*=================*/
|
|
/* out, own: read view struct */
|
|
ulint n, /* in: number of cells in the trx_ids array */
|
|
mem_heap_t* heap) /* in: memory heap from which allocated */
|
|
{
|
|
read_view_t* view;
|
|
|
|
view = mem_heap_alloc(heap, sizeof(read_view_t));
|
|
|
|
view->n_trx_ids = n;
|
|
view->trx_ids = mem_heap_alloc(heap, n * sizeof *view->trx_ids);
|
|
|
|
return(view);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Makes a copy of the oldest existing read view, with the exception that also
|
|
the creating trx of the oldest view is set as not visible in the 'copied'
|
|
view. Opens a new view if no views currently exist. The view must be closed
|
|
with ..._close. This is used in purge. */
|
|
UNIV_INTERN
|
|
read_view_t*
|
|
read_view_oldest_copy_or_open_new(
|
|
/*==============================*/
|
|
/* out, own: read view struct */
|
|
trx_id_t cr_trx_id, /* in: trx_id of creating
|
|
transaction, or ut_dulint_zero
|
|
used in purge */
|
|
mem_heap_t* heap) /* in: memory heap from which
|
|
allocated */
|
|
{
|
|
read_view_t* old_view;
|
|
read_view_t* view_copy;
|
|
ibool needs_insert = TRUE;
|
|
ulint insert_done = 0;
|
|
ulint n;
|
|
ulint i;
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
old_view = UT_LIST_GET_LAST(trx_sys->view_list);
|
|
|
|
if (old_view == NULL) {
|
|
|
|
return(read_view_open_now(cr_trx_id, heap));
|
|
}
|
|
|
|
n = old_view->n_trx_ids;
|
|
|
|
if (!ut_dulint_is_zero(old_view->creator_trx_id)) {
|
|
n++;
|
|
} else {
|
|
needs_insert = FALSE;
|
|
}
|
|
|
|
view_copy = read_view_create_low(n, heap);
|
|
|
|
/* Insert the id of the creator in the right place of the descending
|
|
array of ids, if needs_insert is TRUE: */
|
|
|
|
i = 0;
|
|
while (i < n) {
|
|
if (needs_insert
|
|
&& (i >= old_view->n_trx_ids
|
|
|| ut_dulint_cmp(old_view->creator_trx_id,
|
|
read_view_get_nth_trx_id(old_view, i))
|
|
> 0)) {
|
|
|
|
read_view_set_nth_trx_id(view_copy, i,
|
|
old_view->creator_trx_id);
|
|
needs_insert = FALSE;
|
|
insert_done = 1;
|
|
} else {
|
|
read_view_set_nth_trx_id(view_copy, i,
|
|
read_view_get_nth_trx_id(
|
|
old_view,
|
|
i - insert_done));
|
|
}
|
|
|
|
i++;
|
|
}
|
|
|
|
view_copy->creator_trx_id = cr_trx_id;
|
|
|
|
view_copy->low_limit_no = old_view->low_limit_no;
|
|
view_copy->low_limit_id = old_view->low_limit_id;
|
|
|
|
|
|
if (n > 0) {
|
|
/* The last active transaction has the smallest id: */
|
|
view_copy->up_limit_id = read_view_get_nth_trx_id(
|
|
view_copy, n - 1);
|
|
} else {
|
|
view_copy->up_limit_id = old_view->up_limit_id;
|
|
}
|
|
|
|
UT_LIST_ADD_LAST(view_list, trx_sys->view_list, view_copy);
|
|
|
|
return(view_copy);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Opens a read view where exactly the transactions serialized before this
|
|
point in time are seen in the view. */
|
|
UNIV_INTERN
|
|
read_view_t*
|
|
read_view_open_now(
|
|
/*===============*/
|
|
/* out, own: read view struct */
|
|
trx_id_t cr_trx_id, /* in: trx_id of creating
|
|
transaction, or ut_dulint_zero
|
|
used in purge */
|
|
mem_heap_t* heap) /* in: memory heap from which
|
|
allocated */
|
|
{
|
|
read_view_t* view;
|
|
trx_t* trx;
|
|
ulint n;
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
|
|
|
|
view->creator_trx_id = cr_trx_id;
|
|
view->type = VIEW_NORMAL;
|
|
view->undo_no = ut_dulint_zero;
|
|
|
|
/* No future transactions should be visible in the view */
|
|
|
|
view->low_limit_no = trx_sys->max_trx_id;
|
|
view->low_limit_id = view->low_limit_no;
|
|
|
|
n = 0;
|
|
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
|
|
|
|
/* No active transaction should be visible, except cr_trx */
|
|
|
|
while (trx) {
|
|
if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
|
|
&& (trx->conc_state == TRX_ACTIVE
|
|
|| trx->conc_state == TRX_PREPARED)) {
|
|
|
|
read_view_set_nth_trx_id(view, n, trx->id);
|
|
|
|
n++;
|
|
|
|
/* NOTE that a transaction whose trx number is <
|
|
trx_sys->max_trx_id can still be active, if it is
|
|
in the middle of its commit! Note that when a
|
|
transaction starts, we initialize trx->no to
|
|
ut_dulint_max. */
|
|
|
|
if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
|
|
|
|
view->low_limit_no = trx->no;
|
|
}
|
|
}
|
|
|
|
trx = UT_LIST_GET_NEXT(trx_list, trx);
|
|
}
|
|
|
|
view->n_trx_ids = n;
|
|
|
|
if (n > 0) {
|
|
/* The last active transaction has the smallest id: */
|
|
view->up_limit_id = read_view_get_nth_trx_id(view, n - 1);
|
|
} else {
|
|
view->up_limit_id = view->low_limit_id;
|
|
}
|
|
|
|
|
|
UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view);
|
|
|
|
return(view);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Closes a read view. */
|
|
UNIV_INTERN
|
|
void
|
|
read_view_close(
|
|
/*============*/
|
|
read_view_t* view) /* in: read view */
|
|
{
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Closes a consistent read view for MySQL. This function is called at an SQL
|
|
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
|
|
UNIV_INTERN
|
|
void
|
|
read_view_close_for_mysql(
|
|
/*======================*/
|
|
trx_t* trx) /* in: trx which has a read view */
|
|
{
|
|
ut_a(trx->global_read_view);
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
read_view_close(trx->global_read_view);
|
|
|
|
mem_heap_empty(trx->global_read_view_heap);
|
|
|
|
trx->read_view = NULL;
|
|
trx->global_read_view = NULL;
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Prints a read view to stderr. */
|
|
UNIV_INTERN
|
|
void
|
|
read_view_print(
|
|
/*============*/
|
|
const read_view_t* view) /* in: read view */
|
|
{
|
|
ulint n_ids;
|
|
ulint i;
|
|
|
|
if (view->type == VIEW_HIGH_GRANULARITY) {
|
|
fprintf(stderr,
|
|
"High-granularity read view undo_n:o %lu %lu\n",
|
|
(ulong) ut_dulint_get_high(view->undo_no),
|
|
(ulong) ut_dulint_get_low(view->undo_no));
|
|
} else {
|
|
fprintf(stderr, "Normal read view\n");
|
|
}
|
|
|
|
fprintf(stderr, "Read view low limit trx n:o %lu %lu\n",
|
|
(ulong) ut_dulint_get_high(view->low_limit_no),
|
|
(ulong) ut_dulint_get_low(view->low_limit_no));
|
|
|
|
fprintf(stderr, "Read view up limit trx id " TRX_ID_FMT "\n",
|
|
TRX_ID_PREP_PRINTF(view->up_limit_id));
|
|
|
|
fprintf(stderr, "Read view low limit trx id " TRX_ID_FMT "\n",
|
|
TRX_ID_PREP_PRINTF(view->low_limit_id));
|
|
|
|
fprintf(stderr, "Read view individually stored trx ids:\n");
|
|
|
|
n_ids = view->n_trx_ids;
|
|
|
|
for (i = 0; i < n_ids; i++) {
|
|
fprintf(stderr, "Read view trx id " TRX_ID_FMT "\n",
|
|
TRX_ID_PREP_PRINTF(
|
|
read_view_get_nth_trx_id(view, i)));
|
|
}
|
|
}
|
|
|
|
/*************************************************************************
|
|
Create a high-granularity consistent cursor view for mysql to be used
|
|
in cursors. In this consistent read view modifications done by the
|
|
creating transaction after the cursor is created or future transactions
|
|
are not visible. */
|
|
UNIV_INTERN
|
|
cursor_view_t*
|
|
read_cursor_view_create_for_mysql(
|
|
/*==============================*/
|
|
trx_t* cr_trx) /* in: trx where cursor view is created */
|
|
{
|
|
cursor_view_t* curview;
|
|
read_view_t* view;
|
|
mem_heap_t* heap;
|
|
trx_t* trx;
|
|
ulint n;
|
|
|
|
ut_a(cr_trx);
|
|
|
|
/* Use larger heap than in trx_create when creating a read_view
|
|
because cursors are quite long. */
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
curview = (cursor_view_t*) mem_heap_alloc(heap, sizeof(cursor_view_t));
|
|
curview->heap = heap;
|
|
|
|
/* Drop cursor tables from consideration when evaluating the need of
|
|
auto-commit */
|
|
curview->n_mysql_tables_in_use = cr_trx->n_mysql_tables_in_use;
|
|
cr_trx->n_mysql_tables_in_use = 0;
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
curview->read_view = read_view_create_low(
|
|
UT_LIST_GET_LEN(trx_sys->trx_list), curview->heap);
|
|
|
|
view = curview->read_view;
|
|
view->creator_trx_id = cr_trx->id;
|
|
view->type = VIEW_HIGH_GRANULARITY;
|
|
view->undo_no = cr_trx->undo_no;
|
|
|
|
/* No future transactions should be visible in the view */
|
|
|
|
view->low_limit_no = trx_sys->max_trx_id;
|
|
view->low_limit_id = view->low_limit_no;
|
|
|
|
n = 0;
|
|
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
|
|
|
|
/* No active transaction should be visible */
|
|
|
|
while (trx) {
|
|
|
|
if (trx->conc_state == TRX_ACTIVE
|
|
|| trx->conc_state == TRX_PREPARED) {
|
|
|
|
read_view_set_nth_trx_id(view, n, trx->id);
|
|
|
|
n++;
|
|
|
|
/* NOTE that a transaction whose trx number is <
|
|
trx_sys->max_trx_id can still be active, if it is
|
|
in the middle of its commit! Note that when a
|
|
transaction starts, we initialize trx->no to
|
|
ut_dulint_max. */
|
|
|
|
if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
|
|
|
|
view->low_limit_no = trx->no;
|
|
}
|
|
}
|
|
|
|
trx = UT_LIST_GET_NEXT(trx_list, trx);
|
|
}
|
|
|
|
view->n_trx_ids = n;
|
|
|
|
if (n > 0) {
|
|
/* The last active transaction has the smallest id: */
|
|
view->up_limit_id = read_view_get_nth_trx_id(view, n - 1);
|
|
} else {
|
|
view->up_limit_id = view->low_limit_id;
|
|
}
|
|
|
|
UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view);
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
return(curview);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Close a given consistent cursor view for mysql and restore global read view
|
|
back to a transaction read view. */
|
|
UNIV_INTERN
|
|
void
|
|
read_cursor_view_close_for_mysql(
|
|
/*=============================*/
|
|
trx_t* trx, /* in: trx */
|
|
cursor_view_t* curview)/* in: cursor view to be closed */
|
|
{
|
|
ut_a(curview);
|
|
ut_a(curview->read_view);
|
|
ut_a(curview->heap);
|
|
|
|
/* Add cursor's tables to the global count of active tables that
|
|
belong to this transaction */
|
|
trx->n_mysql_tables_in_use += curview->n_mysql_tables_in_use;
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
read_view_close(curview->read_view);
|
|
trx->read_view = trx->global_read_view;
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
mem_heap_free(curview->heap);
|
|
}
|
|
|
|
/*************************************************************************
|
|
This function sets a given consistent cursor view to a transaction
|
|
read view if given consistent cursor view is not NULL. Otherwise, function
|
|
restores a global read view to a transaction read view. */
|
|
UNIV_INTERN
|
|
void
|
|
read_cursor_set_for_mysql(
|
|
/*======================*/
|
|
trx_t* trx, /* in: transaction where cursor is set */
|
|
cursor_view_t* curview)/* in: consistent cursor view to be set */
|
|
{
|
|
ut_a(trx);
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
if (UNIV_LIKELY(curview != NULL)) {
|
|
trx->read_view = curview->read_view;
|
|
} else {
|
|
trx->read_view = trx->global_read_view;
|
|
}
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
}
|