branches/innodb+: Merge revisions 4150:4528 from branches/zip:
------------------------------------------------------------------------
r4152 | marko | 2009-02-10 12:52:27 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: When innodb_use_sys_malloc is set, ignore
innodb_additional_mem_pool_size, because nothing will
be allocated from mem_comm_pool.
mem_pool_create(): Remove the assertion about size. The function will
work with any size. However, an assertion would fail in ut_malloc_low()
when size==0.
mem_init(): When srv_use_sys_malloc is set, pass size=1 to mem_pool_create().
mem0mem.c: Add #include "srv0srv.h" that is needed by mem0dbg.c.
------------------------------------------------------------------------
r4153 | vasil | 2009-02-10 22:58:17 +0200 (Tue, 10 Feb 2009) | 14 lines
branches/zip:
(followup to r4145) Non-functional change:
Change the os_atomic_increment() and os_compare_and_swap() functions
to macros to avoid artificial limitations on the types of those
functions' arguments. As a consequence typecasts from the source
code can be removed.
Also remove Google's copyright from os0sync.ic because that file no longer
contains code from Google.
Approved by: Marko (rb://88), also ok from Inaam via IM
------------------------------------------------------------------------
r4163 | marko | 2009-02-12 00:14:19 +0200 (Thu, 12 Feb 2009) | 4 lines
branches/zip: Make innodb_thread_concurrency=0 the default.
The old default was 8.
------------------------------------------------------------------------
r4169 | calvin | 2009-02-12 10:37:10 +0200 (Thu, 12 Feb 2009) | 3 lines
branches/zip: Adjust the result file of innodb_thread_concurrency_basic
test. The default value of innodb_thread_concurrency is changed to 0
(from 8) via r4163.
------------------------------------------------------------------------
r4174 | vasil | 2009-02-12 17:38:27 +0200 (Thu, 12 Feb 2009) | 4 lines
branches/zip:
Fix pathname of the file to patch.
------------------------------------------------------------------------
r4176 | vasil | 2009-02-13 10:06:31 +0200 (Fri, 13 Feb 2009) | 7 lines
branches/zip:
Fix the failing mysql-test partition_innodb, which failed only if run after
innodb_trx_weight (or other test that would leave LATEST DEADLOCK ERROR into
the output of SHOW ENGINE INNODB STATUS). Find further explanation for the
failure at the top of the added patch partition_innodb.diff.
------------------------------------------------------------------------
r4198 | vasil | 2009-02-17 09:06:07 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
Add the full text of the GPLv2 license into the root directory of the
plugin. In previous releases this file was copied from an external source
(https://svn.innodb.com/svn/plugin/trunk/support/COPYING) "manually" when
creating the source and binary archives. It is less confusing to have this
present in the root directory of the SVN branch.
------------------------------------------------------------------------
r4199 | vasil | 2009-02-17 09:11:58 +0200 (Tue, 17 Feb 2009) | 4 lines
branches/zip:
Add Google's license into COPYING.Google.
------------------------------------------------------------------------
r4200 | vasil | 2009-02-17 09:56:33 +0200 (Tue, 17 Feb 2009) | 11 lines
branches/zip:
To the files touched by the Google patch from c4144 (excluding
include/os0sync.ic because later we removed Google code from that file):
* Remove the Google license
* Remove old Innobase copyright lines
* Add a reference to the Google license and to the GPLv2 license at the top,
as recommended by the lawyers at Oracle Legal.
------------------------------------------------------------------------
r4201 | vasil | 2009-02-17 10:12:02 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 1/28]
------------------------------------------------------------------------
r4202 | vasil | 2009-02-17 10:15:06 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 2/28]
------------------------------------------------------------------------
r4203 | vasil | 2009-02-17 10:25:45 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 3/28]
------------------------------------------------------------------------
r4204 | vasil | 2009-02-17 10:55:41 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 4/28]
------------------------------------------------------------------------
r4205 | vasil | 2009-02-17 10:59:22 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 5/28]
------------------------------------------------------------------------
r4206 | vasil | 2009-02-17 11:02:27 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 6/28]
------------------------------------------------------------------------
r4207 | vasil | 2009-02-17 11:04:28 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 7/28]
------------------------------------------------------------------------
r4208 | vasil | 2009-02-17 11:06:49 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 8/28]
------------------------------------------------------------------------
r4209 | vasil | 2009-02-17 11:10:18 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 9/28]
------------------------------------------------------------------------
r4210 | vasil | 2009-02-17 11:12:41 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 10/28]
------------------------------------------------------------------------
r4211 | vasil | 2009-02-17 11:14:40 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 11/28]
------------------------------------------------------------------------
r4212 | vasil | 2009-02-17 11:18:35 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 12/28]
------------------------------------------------------------------------
r4213 | vasil | 2009-02-17 11:24:40 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 13/28]
------------------------------------------------------------------------
r4214 | vasil | 2009-02-17 11:27:31 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 13/28]
------------------------------------------------------------------------
r4215 | vasil | 2009-02-17 11:29:55 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 15/28]
------------------------------------------------------------------------
r4216 | vasil | 2009-02-17 11:33:38 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 16/28]
------------------------------------------------------------------------
r4217 | vasil | 2009-02-17 11:36:44 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 17/28]
------------------------------------------------------------------------
r4218 | vasil | 2009-02-17 11:39:11 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 18/28]
------------------------------------------------------------------------
r4219 | vasil | 2009-02-17 11:41:24 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 19/28]
------------------------------------------------------------------------
r4220 | vasil | 2009-02-17 11:43:50 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 20/28]
------------------------------------------------------------------------
r4221 | vasil | 2009-02-17 11:46:52 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 21/28]
------------------------------------------------------------------------
r4222 | vasil | 2009-02-17 11:50:12 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 22/28]
------------------------------------------------------------------------
r4223 | vasil | 2009-02-17 11:53:58 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 23/28]
------------------------------------------------------------------------
r4224 | vasil | 2009-02-17 12:01:41 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 24/28]
------------------------------------------------------------------------
r4225 | vasil | 2009-02-17 12:05:45 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 25/28]
------------------------------------------------------------------------
r4226 | vasil | 2009-02-17 12:09:16 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 26/28]
------------------------------------------------------------------------
r4227 | vasil | 2009-02-17 12:12:56 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 27/28]
------------------------------------------------------------------------
r4228 | vasil | 2009-02-17 12:14:04 +0200 (Tue, 17 Feb 2009) | 8 lines
branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 28/28]
------------------------------------------------------------------------
r4229 | vasil | 2009-02-17 12:30:55 +0200 (Tue, 17 Feb 2009) | 4 lines
branches/zip:
Add the copyright notice to the non C files.
------------------------------------------------------------------------
r4231 | marko | 2009-02-17 14:26:53 +0200 (Tue, 17 Feb 2009) | 12 lines
Minor cleanup of the Google SMP patch.
sync_array_object_signalled(): Add a (void) cast to eliminate a gcc warning
about the return value of os_atomic_increment() being ignored.
rw_lock_create_func(): Properly indent the preprocessor directives.
rw_lock_x_lock_low(), rw_lock_x_lock_func_nowait(): Split lines correctly.
rw_lock_set_writer_id_and_recursion_flag(): Silence a Valgrind warning.
Do not mix statements and variable declarations.
------------------------------------------------------------------------
r4232 | marko | 2009-02-17 14:59:54 +0200 (Tue, 17 Feb 2009) | 3 lines
branches/zip: When assigning lock->recursive = FALSE, also flag
lock->writer_thread invalid, so that Valgrind will catch more errors.
This is related to Issue #175.
------------------------------------------------------------------------
r4242 | marko | 2009-02-18 17:01:09 +0200 (Wed, 18 Feb 2009) | 2 lines
branches/zip: UT_DBG_STOP: Use do{} while(0) to silence a g++-4.3.2 warning
about a while(0); statement. This should fix (part of) Issue #176.
------------------------------------------------------------------------
r4243 | marko | 2009-02-18 17:04:03 +0200 (Wed, 18 Feb 2009) | 3 lines
branches/zip: buf_buddy_get_slot(): Fix a gcc 4.3.2 warning
about an empty body of a "for" statement.
This fixes part of Issue #176.
------------------------------------------------------------------------
r4244 | marko | 2009-02-18 17:25:45 +0200 (Wed, 18 Feb 2009) | 11 lines
branches/zip: Protect ut_total_allocated_memory with ut_list_mutex.
Unprotected updates to ut_total_allocated_memory in
os_mem_alloc_large() and os_mem_free_large(), called during
fast index creation, may corrupt the variable and cause assertion failures.
Also, add UNIV_MEM_ALLOC() and UNIV_MEM_FREE() instrumentation around
os_mem_alloc_large() and os_mem_free_large(), so that Valgrind can
detect more errors.
rb://90 approved by Heikki Tuuri. This addresses Issue #177.
------------------------------------------------------------------------
r4248 | marko | 2009-02-19 11:52:39 +0200 (Thu, 19 Feb 2009) | 2 lines
branches/zip: page_zip_set_size(): Fix a g++ 4.3.2 warning
about an empty body in a "for" statement. This closes Issue #176.
------------------------------------------------------------------------
r4251 | inaam | 2009-02-19 15:46:27 +0200 (Thu, 19 Feb 2009) | 8 lines
branches/zip: Issue #178 rb://91
Change plug.in to have same CXXFLAGS as CFLAGS. This is to ensure that
both .c and .cc files get compiled with same flags. To fix the issue
where UNIV_LINUX was defined only in .c files.
Approved by: Marko
------------------------------------------------------------------------
r4258 | vasil | 2009-02-20 11:52:19 +0200 (Fri, 20 Feb 2009) | 7 lines
branches/zip:
Cleanup in ChangeLog:
* Wrap lines at 78 characters
* Changed files are listed alphabetically
* White-space cleanup
------------------------------------------------------------------------
r4259 | vasil | 2009-02-20 11:59:42 +0200 (Fri, 20 Feb 2009) | 6 lines
branches/zip:
ChangeLog: Remove include/os0sync.ic from the entry about the google patch,
this file was modified later to not include Google's code.
------------------------------------------------------------------------
r4262 | vasil | 2009-02-20 14:56:59 +0200 (Fri, 20 Feb 2009) | 373 lines
branches/zip:
Merge revisions 4035:4261 from branches/5.1:
------------------------------------------------------------------------
r4065 | sunny | 2009-01-29 16:01:36 +0200 (Thu, 29 Jan 2009) | 8 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/mysql-test/innodb-autoinc.result
M /branches/5.1/mysql-test/innodb-autoinc.test
branches/5.1: In the last round of AUTOINC cleanup we assumed that AUTOINC
is only defined for integer columns. This caused an assertion failure when
we checked for the maximum value of a column type. We now calculate the
max value for floating-point autoinc columns too.
Fix Bug#42400 - InnoDB autoinc code can't handle floating-point columns
rb://84 and Mantis issue://162
------------------------------------------------------------------------
r4111 | sunny | 2009-02-03 22:06:52 +0200 (Tue, 03 Feb 2009) | 2 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
branches/5.1: Add the ULL suffix otherwise there is an overflow.
------------------------------------------------------------------------
r4128 | vasil | 2009-02-08 21:36:45 +0200 (Sun, 08 Feb 2009) | 18 lines
Changed paths:
M /branches/5.1/mysql-test/innodb-autoinc.result
M /branches/5.1/mysql-test/innodb-autoinc.test
branches/5.1:
Merge a change from MySQL:
------------------------------------------------------------
revno: 2709.20.31
committer: Timothy Smith <timothy.smith@sun.com>
branch nick: 51
timestamp: Fri 2008-12-19 01:28:51 +0100
message:
Disable part of innodb-autoinc.test, because the MySQL server asserts when
compiled --with-debug, due to bug 39828, "autoinc wraps around when offset and
increment > 1". This change should be reverted when that bug is fixed (and a
a few other minor changes to the test as described in comments).
modified:
mysql-test/r/innodb-autoinc.result
mysql-test/t/innodb-autoinc.test
------------------------------------------------------------------------
r4129 | vasil | 2009-02-08 21:54:25 +0200 (Sun, 08 Feb 2009) | 310 lines
Changed paths:
M /branches/5.1/mysql-test/innodb-autoinc.test
branches/5.1:
Merge a change from MySQL:
[looks like the changes to innodb-autoinc.test were made as part of
the following huge merge, but we are merging only changes to that file]
------------------------------------------------------------
revno: 2546.47.1
committer: Luis Soares <luis.soares@sun.com>
branch nick: 5.1-rpl
timestamp: Fri 2009-01-23 13:22:05 +0100
message:
merge: 5.1 -> 5.1-rpl
conflicts:
Text conflict in client/mysqltest.cc
Text conflict in mysql-test/include/wait_until_connected_again.inc
Text conflict in mysql-test/lib/mtr_report.pm
Text conflict in mysql-test/mysql-test-run.pl
Text conflict in mysql-test/r/events_bugs.result
Text conflict in mysql-test/r/log_state.result
Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
Text conflict in mysql-test/r/mysqlcheck.result
Text conflict in mysql-test/r/query_cache.result
Text conflict in mysql-test/r/status.result
Text conflict in mysql-test/suite/binlog/r/binlog_index.result
Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
Text conflict in mysql-test/t/disabled.def
Text conflict in mysql-test/t/events_bugs.test
Text conflict in mysql-test/t/log_state.test
Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
Text conflict in mysql-test/t/mysqlcheck.test
Text conflict in mysql-test/t/query_cache.test
Text conflict in mysql-test/t/rpl_init_slave_func.test
Text conflict in mysql-test/t/status.test
removed:
mysql-test/suite/parts/r/partition_bit_ndb.result
mysql-test/suite/parts/t/partition_bit_ndb.test
mysql-test/suite/parts/t/partition_sessions.test
mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc
mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result
mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result
mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test
mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test
mysql-test/t/log_bin_trust_function_creators_func-master.opt
mysql-test/t/rpl_init_slave_func-slave.opt
added:
mysql-test/include/check_events_off.inc
mysql-test/include/cleanup_fake_relay_log.inc
mysql-test/include/have_simple_parser.inc
mysql-test/include/no_running_event_scheduler.inc
mysql-test/include/no_running_events.inc
mysql-test/include/running_event_scheduler.inc
mysql-test/include/setup_fake_relay_log.inc
mysql-test/include/wait_condition_sp.inc
mysql-test/r/fulltext_plugin.result
mysql-test/r/have_simple_parser.require
mysql-test/r/innodb_bug38231.result
mysql-test/r/innodb_bug39438.result
mysql-test/r/innodb_mysql_rbk.result
mysql-test/r/partition_innodb_semi_consistent.result
mysql-test/r/query_cache_28249.result
mysql-test/r/status2.result
mysql-test/std_data/bug40482-bin.000001
mysql-test/suite/binlog/r/binlog_innodb_row.result
mysql-test/suite/binlog/t/binlog_innodb_row.test
mysql-test/suite/rpl/r/rpl_binlog_corruption.result
mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt
mysql-test/suite/rpl/t/rpl_binlog_corruption.test
mysql-test/suite/sys_vars/r/tmp_table_size_basic.result
mysql-test/suite/sys_vars/t/tmp_table_size_basic.test
mysql-test/t/fulltext_plugin-master.opt
mysql-test/t/fulltext_plugin.test
mysql-test/t/innodb_bug38231.test
mysql-test/t/innodb_bug39438-master.opt
mysql-test/t/innodb_bug39438.test
mysql-test/t/innodb_mysql_rbk-master.opt
mysql-test/t/innodb_mysql_rbk.test
mysql-test/t/partition_innodb_semi_consistent-master.opt
mysql-test/t/partition_innodb_semi_consistent.test
mysql-test/t/query_cache_28249.test
mysql-test/t/status2.test
renamed:
mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result => mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result
mysql-test/suite/funcs_1/t/is_collation_character_set_applicability.test => mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test
modified:
.bzr-mysql/default.conf
CMakeLists.txt
client/mysql.cc
client/mysql_upgrade.c
client/mysqlcheck.c
client/mysqltest.cc
configure.in
extra/resolve_stack_dump.c
extra/yassl/include/openssl/ssl.h
include/config-win.h
include/m_ctype.h
include/my_global.h
mysql-test/extra/binlog_tests/database.test
mysql-test/extra/rpl_tests/rpl_auto_increment.test
mysql-test/include/commit.inc
mysql-test/include/have_32bit.inc
mysql-test/include/have_64bit.inc
mysql-test/include/index_merge1.inc
mysql-test/include/linux_sys_vars.inc
mysql-test/include/windows_sys_vars.inc
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/r/alter_table.result
mysql-test/r/commit_1innodb.result
mysql-test/r/create.result
mysql-test/r/csv.result
mysql-test/r/ctype_ucs.result
mysql-test/r/date_formats.result
mysql-test/r/events_bugs.result
mysql-test/r/events_scheduling.result
mysql-test/r/fulltext.result
mysql-test/r/func_if.result
mysql-test/r/func_in.result
mysql-test/r/func_str.result
mysql-test/r/func_time.result
mysql-test/r/grant.result
mysql-test/r/index_merge_myisam.result
mysql-test/r/information_schema.result
mysql-test/r/innodb-autoinc.result
mysql-test/r/innodb.result
mysql-test/r/innodb_mysql.result
mysql-test/r/log_bin_trust_function_creators_func.result
mysql-test/r/log_state.result
mysql-test/r/myisampack.result
mysql-test/r/mysql.result
mysql-test/r/mysqlcheck.result
mysql-test/r/partition_datatype.result
mysql-test/r/partition_mgm.result
mysql-test/r/partition_pruning.result
mysql-test/r/query_cache.result
mysql-test/r/read_buffer_size_basic.result
mysql-test/r/read_rnd_buffer_size_basic.result
mysql-test/r/rpl_init_slave_func.result
mysql-test/r/select.result
mysql-test/r/status.result
mysql-test/r/strict.result
mysql-test/r/temp_table.result
mysql-test/r/type_bit.result
mysql-test/r/type_date.result
mysql-test/r/type_float.result
mysql-test/r/warnings_engine_disabled.result
mysql-test/r/xml.result
mysql-test/suite/binlog/r/binlog_database.result
mysql-test/suite/binlog/r/binlog_index.result
mysql-test/suite/binlog/r/binlog_innodb.result
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
mysql-test/suite/binlog/t/binlog_innodb.test
mysql-test/suite/funcs_1/r/is_columns_is.result
mysql-test/suite/funcs_1/r/is_engines.result
mysql-test/suite/funcs_1/r/storedproc.result
mysql-test/suite/funcs_1/storedproc/param_check.inc
mysql-test/suite/funcs_2/t/disabled.def
mysql-test/suite/ndb/t/disabled.def
mysql-test/suite/parts/r/partition_bit_innodb.result
mysql-test/suite/parts/r/partition_bit_myisam.result
mysql-test/suite/parts/r/partition_special_innodb.result
mysql-test/suite/parts/t/disabled.def
mysql-test/suite/parts/t/partition_special_innodb.test
mysql-test/suite/parts/t/partition_value_innodb.test
mysql-test/suite/parts/t/partition_value_myisam.test
mysql-test/suite/parts/t/partition_value_ndb.test
mysql-test/suite/rpl/r/rpl_auto_increment.result
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/r/rpl_row_create_table.result
mysql-test/suite/rpl/r/rpl_slave_skip.result
mysql-test/suite/rpl/r/rpl_trigger.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_packet.test
mysql-test/suite/rpl/t/rpl_row_create_table.test
mysql-test/suite/rpl/t/rpl_slave_skip.test
mysql-test/suite/rpl/t/rpl_trigger.test
mysql-test/suite/rpl_ndb/t/disabled.def
mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc
mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc
mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result
mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result
mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result
mysql-test/t/alter_table.test
mysql-test/t/create.test
mysql-test/t/csv.test
mysql-test/t/ctype_ucs.test
mysql-test/t/date_formats.test
mysql-test/t/disabled.def
mysql-test/t/events_bugs.test
mysql-test/t/events_scheduling.test
mysql-test/t/fulltext.test
mysql-test/t/func_if.test
mysql-test/t/func_in.test
mysql-test/t/func_str.test
mysql-test/t/func_time.test
mysql-test/t/grant.test
mysql-test/t/information_schema.test
mysql-test/t/innodb-autoinc.test
mysql-test/t/innodb.test
mysql-test/t/innodb_mysql.test
mysql-test/t/log_bin_trust_function_creators_func.test
mysql-test/t/log_state.test
mysql-test/t/myisam_data_pointer_size_func.test
mysql-test/t/myisampack.test
mysql-test/t/mysql.test
mysql-test/t/mysqlcheck.test
mysql-test/t/partition_innodb_stmt.test
mysql-test/t/partition_mgm.test
mysql-test/t/partition_pruning.test
mysql-test/t/query_cache.test
mysql-test/t/rpl_init_slave_func.test
mysql-test/t/select.test
mysql-test/t/status.test
mysql-test/t/strict.test
mysql-test/t/temp_table.test
mysql-test/t/type_bit.test
mysql-test/t/type_date.test
mysql-test/t/type_float.test
mysql-test/t/warnings_engine_disabled.test
mysql-test/t/xml.test
mysys/my_getopt.c
mysys/my_init.c
scripts/mysql_install_db.sh
sql-common/my_time.c
sql/field.cc
sql/field.h
sql/filesort.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/item.cc
sql/item_cmpfunc.cc
sql/item_func.h
sql/item_strfunc.cc
sql/item_sum.cc
sql/item_timefunc.cc
sql/item_timefunc.h
sql/log.cc
sql/log.h
sql/log_event.cc
sql/log_event.h
sql/mysql_priv.h
sql/mysqld.cc
sql/opt_range.cc
sql/partition_info.cc
sql/repl_failsafe.cc
sql/rpl_constants.h
sql/set_var.cc
sql/slave.cc
sql/spatial.h
sql/sql_acl.cc
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_class.h
sql/sql_cursor.cc
sql/sql_delete.cc
sql/sql_lex.cc
sql/sql_lex.h
sql/sql_locale.cc
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_plugin.cc
sql/sql_plugin.h
sql/sql_profile.cc
sql/sql_repl.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_trigger.cc
sql/sql_trigger.h
sql/table.cc
sql/table.h
sql/unireg.cc
storage/csv/ha_tina.cc
storage/federated/ha_federated.cc
storage/heap/ha_heap.cc
storage/innobase/Makefile.am
storage/innobase/btr/btr0sea.c
storage/innobase/buf/buf0lru.c
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0mem.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/include/btr0sea.h
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0mem.h
storage/innobase/include/ha_prototypes.h
storage/innobase/include/lock0lock.h
storage/innobase/include/row0mysql.h
storage/innobase/include/sync0sync.ic
storage/innobase/include/ut0ut.h
storage/innobase/lock/lock0lock.c
storage/innobase/os/os0file.c
storage/innobase/plug.in
storage/innobase/row/row0mysql.c
storage/innobase/row/row0sel.c
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0start.c
storage/innobase/ut/ut0ut.c
storage/myisam/ft_boolean_search.c
strings/ctype.c
strings/xml.c
tests/mysql_client_test.c
win/configure.js
mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test
------------------------------------------------------------------------
r4165 | calvin | 2009-02-12 01:34:27 +0200 (Thu, 12 Feb 2009) | 1 line
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
branches/5.1: minor non-functional changes.
------------------------------------------------------------------------
------------------------------------------------------------------------
r4263 | vasil | 2009-02-20 15:00:46 +0200 (Fri, 20 Feb 2009) | 4 lines
branches/zip:
Add a ChangeLog entry for a change in r4262.
------------------------------------------------------------------------
r4265 | marko | 2009-02-20 22:31:03 +0200 (Fri, 20 Feb 2009) | 5 lines
branches/zip: Make innodb_use_sys_malloc=ON the default.
Replace srv_use_sys_malloc with UNIV_LIKELY(srv_use_sys_malloc)
to improve branch prediction in the default case.
Approved by Ken over the IM.
------------------------------------------------------------------------
r4266 | vasil | 2009-02-20 23:29:32 +0200 (Fri, 20 Feb 2009) | 7 lines
branches/zip:
Add a sentence at the top of COPYING.Google to clarify that this license
does not apply to the whole InnoDB.
Suggested by: Ken
------------------------------------------------------------------------
r4268 | marko | 2009-02-23 12:43:51 +0200 (Mon, 23 Feb 2009) | 9 lines
branches/zip: Initialize ut_list_mutex at startup. Without this fix,
ut_list_mutex would be used uninitialized when innodb_use_sys_malloc=1.
This fix addresses Issue #181.
ut_mem_block_list_init(): Rename to ut_mem_init() and make public.
ut_malloc_low(), ut_free_all_mem(): Add ut_a(ut_mem_block_list_inited).
mem_init(): Call ut_mem_init().
------------------------------------------------------------------------
r4269 | marko | 2009-02-23 15:09:49 +0200 (Mon, 23 Feb 2009) | 7 lines
branches/zip: When freeing an uncompressed BLOB page, tolerate garbage in
FIL_PAGE_TYPE. (Bug #43043, Issue #182)
btr_check_blob_fil_page_type(): New function.
btr_free_externally_stored_field(), btr_copy_blob_prefix():
Call btr_check_blob_fil_page_type() to check FIL_PAGE_TYPE.
------------------------------------------------------------------------
r4272 | marko | 2009-02-23 23:10:18 +0200 (Mon, 23 Feb 2009) | 8 lines
branches/zip: Adjust the fix of Issue #182 in r4269 per Inaam's suggestion.
btr_check_blob_fil_page_type(): Replace the parameter
const char* op
with
ibool read. Do not print anything about page type mismatch
when reading a BLOB page in Antelope format.
Print space id before page number.
------------------------------------------------------------------------
r4273 | marko | 2009-02-24 00:11:11 +0200 (Tue, 24 Feb 2009) | 1 line
branches/zip: ut_mem_init(): Add the assertion !ut_mem_block_list_inited.
------------------------------------------------------------------------
r4274 | marko | 2009-02-24 00:14:38 +0200 (Tue, 24 Feb 2009) | 12 lines
branches/zip: Fix bugs in the fix of Issue #181. Tested inside and
outside Valgrind, with innodb_use_sys_malloc set to 0 and 1.
mem_init(): Invoke ut_mem_init() before mem_pool_create(), because
the latter one will invoke ut_malloc().
srv_general_init(): Do not initialize the memory subsystem (mem_init()).
innobase_init(): Initialize the memory subsystem (mem_init()) before
calling srv_parse_data_file_paths_and_sizes(), which needs ut_malloc().
Call ut_free_all_mem() in error handling to clean up after the mem_init().
------------------------------------------------------------------------
r4280 | marko | 2009-02-24 15:14:59 +0200 (Tue, 24 Feb 2009) | 1 line
branches/zip: Remove unused function os_mem_alloc_nocache().
------------------------------------------------------------------------
r4281 | marko | 2009-02-24 16:02:48 +0200 (Tue, 24 Feb 2009) | 1 line
branches/zip: Remove the unused function dict_index_get_type().
------------------------------------------------------------------------
r4283 | marko | 2009-02-24 23:06:56 +0200 (Tue, 24 Feb 2009) | 1 line
branches/zip: srv0start.c: Remove unnecessary #include "mem0pool.h".
------------------------------------------------------------------------
r4284 | marko | 2009-02-24 23:26:38 +0200 (Tue, 24 Feb 2009) | 1 line
branches/zip: mem0mem.c: Remove unnecessary #include "mach0data.h".
------------------------------------------------------------------------
r4288 | vasil | 2009-02-25 10:48:07 +0200 (Wed, 25 Feb 2009) | 21 lines
branches/zip: Merge revisions 4261:4287 from branches/5.1:
------------------------------------------------------------------------
r4287 | sunny | 2009-02-25 05:32:01 +0200 (Wed, 25 Feb 2009) | 10 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/mysql-test/innodb-autoinc.result
M /branches/5.1/mysql-test/innodb-autoinc.test
branches/5.1: Fix Bug#42714 AUTO_INCREMENT errors in 5.1.31. There are two
changes to the autoinc handling.
1. To fix the immediate problem from the bug report, we must ensure that the
value written to the table is always less than the max value stored in
dict_table_t.
2. The second related change is that according to MySQL documentation when
the offset is greater than the increment, we should ignore the offset.
------------------------------------------------------------------------
------------------------------------------------------------------------
r4289 | vasil | 2009-02-25 10:53:51 +0200 (Wed, 25 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the fix in r4288.
------------------------------------------------------------------------
r4290 | vasil | 2009-02-25 11:05:44 +0200 (Wed, 25 Feb 2009) | 11 lines
branches/zip:
Make ChangeLog entries for bugs in bugs.mysql.com in the form:
Fix Bug#12345 bug title
(for bugs after 1.0.2 was released and the ChangeLog published)
There is no need to bloat the ChangeLog with information that is available
via bugs.mysql.com.
Discussed with: Marko
------------------------------------------------------------------------
r4291 | vasil | 2009-02-25 11:08:32 +0200 (Wed, 25 Feb 2009) | 4 lines
branches/zip:
Fix Bug synopsis and remove explanation
------------------------------------------------------------------------
r4292 | marko | 2009-02-25 12:09:15 +0200 (Wed, 25 Feb 2009) | 25 lines
branches/zip: Correct the initialization of the memory subsystem once
again, to finally put Issue #181 to rest.
Revert some parts of r4274. It is best not to call ut_malloc() before
srv_general_init().
mem_init(): Do not call ut_mem_init().
srv_general_init(): Initialize the memory subsystem in two phases:
first ut_mem_init(), then mem_init(). This is because os_sync_init()
and sync_init() depend on ut_mem_init() and mem_init() depends on
os_sync_init() or sync_init().
srv_parse_data_file_paths_and_sizes(),
srv_parse_log_group_home_dirs(): Remove the output parameters. Assign
to the global variables directly. Allocate memory with malloc()
instead of ut_malloc(), because these functions will be called before
srv_general_init().
srv_free_paths_and_sizes(): New function, for cleaning up after
srv_parse_data_file_paths_and_sizes() and
srv_parse_log_group_home_dirs().
rb://92 approved by Sunny Bains
------------------------------------------------------------------------
r4297 | vasil | 2009-02-25 17:19:19 +0200 (Wed, 25 Feb 2009) | 4 lines
branches/zip:
White-space cleanup in the ChangeLog
------------------------------------------------------------------------
r4301 | vasil | 2009-02-25 21:33:32 +0200 (Wed, 25 Feb 2009) | 5 lines
branches/zip:
Do not output the commands that restore the environment because they depend
on the state of the environment before the test starts executing.
------------------------------------------------------------------------
r4315 | vasil | 2009-02-26 09:21:20 +0200 (Thu, 26 Feb 2009) | 5 lines
branches/zip:
Apply any necessary patches to the mysql tree at the end of setup.sh
This step was previously done manually (and sometimes forgotten).
------------------------------------------------------------------------
r4319 | marko | 2009-02-26 23:27:51 +0200 (Thu, 26 Feb 2009) | 6 lines
branches/zip: btr_check_blob_fil_page_type(): Do not report
FIL_PAGE_TYPE mismatch even when purging a BLOB.
Heavy users may have large data files created with MySQL 5.0 or earlier,
and they don not want to have the error log flooded with such messages.
This fixes Issue #182.
------------------------------------------------------------------------
r4320 | inaam | 2009-02-27 02:13:19 +0200 (Fri, 27 Feb 2009) | 8 lines
branches/zip
This is to revert the changes made to the plug.in (r4251) as a fix for
issue# 178. Changes to plug.in will not propogate to a plugin
installation unless autotools are rerun which is unacceptable.
A fix for issue# 178 will be committed in a separate commit.
------------------------------------------------------------------------
r4321 | inaam | 2009-02-27 02:16:46 +0200 (Fri, 27 Feb 2009) | 6 lines
branches/zip
This is a fix for issue#178. Instead of using UNIV_LINUX which is
defined through CFLAGS we use compiler generated define __linux__
that is effective for both .c and .cc files.
------------------------------------------------------------------------
r4324 | vasil | 2009-02-27 13:27:18 +0200 (Fri, 27 Feb 2009) | 39 lines
branches/zip:
Add FreeBSD to the list of the operating systems that have
sizeof(pthread_t) == sizeof(void*) (i.e. word size).
On FreeBSD pthread_t is defined like:
/usr/include/sys/_pthreadtypes.h:
typedef struct pthread *pthread_t;
I did the following tests (per Inaam's recommendation):
a) appropriate version of GCC is available on that platform (4.1.2 or
higher for atomics to be available)
On FreeBSD 6.x the default compiler is 3.4.6, on FreeBSD 7.x the default
one is 4.2.1. One can always install the version of choice from the ports
collection. If gcc 3.x is used then HAVE_GCC_ATOMIC_BUILTINS will not be
defined and thus the change I am committing will make no difference.
b) find out if sizeof(pthread_t) == sizeof(long)
On 32 bit both are 4 bytes, on 64 bit both are 8 bytes.
c) find out the compiler generated platform define (e.g.: __aix, __sunos__
etc.)
The macro is __FreeBSD__.
d) patch univ.i with the appropriate platform define
e) build the mysql
f) ensure it is using atomic builtins (look at the err.log message at
system startup. It should say we are using atomics for both mutexes and
rw-locks)
g) do sanity testing (keeping in view the smp changes)
I ran the mysql-test suite. All tests pass.
------------------------------------------------------------------------
r4353 | vasil | 2009-03-05 09:27:29 +0200 (Thu, 05 Mar 2009) | 6 lines
branches/zip:
As suggested by Ken, print a message that says that the Google SMP patch
(GCC atomics) is disabled if it is. Also extend the message when the patch
is partially enabled to make it clear that it is partially enabled.
------------------------------------------------------------------------
r4356 | vasil | 2009-03-05 13:49:51 +0200 (Thu, 05 Mar 2009) | 4 lines
branches/zip:
Fix typo made in r4353.
------------------------------------------------------------------------
r4357 | vasil | 2009-03-05 16:38:59 +0200 (Thu, 05 Mar 2009) | 23 lines
branches/zip:
Implement a check whether pthread_t objects can be used by GCC atomic
builtin functions. This check is implemented in plug.in and defines the
macro HAVE_ATOMIC_PTHREAD_T. This macro is checked in univ.i and the
relevant part of the code enabled (the one that uses GCC atomics against
pthread_t objects).
In addition to this, the same program that is compiled as part of the
plug.in check is added in ut/ut0auxconf.c. In the InnoDB Plugin source
archives that are shipped to the users, a generated Makefile.in is added.
That Makefile.in will be modified to compile ut/ut0auxconf.c and define
the macro HAVE_ATOMIC_PTHREAD_T if the compilation succeeds. I.e.
Makefile.in will emulate the work that is done by plug.in. This is done in
order to make the check happen and HAVE_ATOMIC_PTHREAD_T eventually
defined without regenerating MySQL's ./configure from
./storage/innobase/plug.in. The point is not to ask users to install the
autotools and regenerate ./configure.
rb://95
Approved by: Marko
------------------------------------------------------------------------
r4360 | vasil | 2009-03-05 22:23:17 +0200 (Thu, 05 Mar 2009) | 21 lines
branches/zip: Merge revisions 4287:4357 from branches/5.1:
------------------------------------------------------------------------
r4325 | sunny | 2009-03-02 02:28:52 +0200 (Mon, 02 Mar 2009) | 10 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/mysql-test/innodb-autoinc.result
M /branches/5.1/mysql-test/innodb-autoinc.test
branches/5.1: Bug#43203: Overflow from auto incrementing causes server segv
It was not a SIGSEGV but an assertion failure. The assertion was checking
the invariant that *first_value passed in by MySQL doesn't contain a value
that is greater than the max value for that type. The assertion has been
changed to a check and if the value is greater than the max we report a
generic AUTOINC failure.
rb://93
Approved by Heikki
------------------------------------------------------------------------
------------------------------------------------------------------------
r4361 | vasil | 2009-03-05 22:27:54 +0200 (Thu, 05 Mar 2009) | 30 lines
branches/zip: Merge revision 4358 from branches/5.1 (resolving a conflict):
------------------------------------------------------------------------
r4358 | vasil | 2009-03-05 21:21:10 +0200 (Thu, 05 Mar 2009) | 21 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
branches/5.1:
Merge a change from MySQL:
------------------------------------------------------------
revno: 2728.19.1
committer: Alfranio Correia <alfranio.correia@sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Tue 2009-02-03 11:36:46 +0000
message:
BUG#42445 Warning messages in innobase/handler/ha_innodb.cc
There was a type casting problem in the storage/innobase/handler/ha_innodb.cc,
(int ha_innobase::write_row(...)). Innobase uses has an internal error variable
of type 'ulint' while mysql uses an 'int'.
To fix the problem the function manipulates an error variable of
type 'ulint' and only casts it into 'int' when needs to return the value.
modified:
storage/innobase/handler/ha_innodb.cc
------------------------------------------------------------------------
------------------------------------------------------------------------
r4362 | vasil | 2009-03-05 22:29:07 +0200 (Thu, 05 Mar 2009) | 23 lines
branches/zip: Merge revision 4359 from branches/5.1:
------------------------------------------------------------------------
r4359 | vasil | 2009-03-05 21:42:01 +0200 (Thu, 05 Mar 2009) | 14 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
branches/5.1:
Merge a change from MySQL:
------------------------------------------------------------
revno: 2747
committer: Timothy Smith <timothy.smith@sun.com>
branch nick: 51
timestamp: Fri 2009-01-16 17:49:07 +0100
message:
Add another cast to ignore int/ulong difference in error types, silence warning on Win64
modified:
storage/innobase/handler/ha_innodb.cc
------------------------------------------------------------------------
------------------------------------------------------------------------
r4363 | vasil | 2009-03-05 22:31:37 +0200 (Thu, 05 Mar 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the bugfix in c4360.
------------------------------------------------------------------------
r4378 | calvin | 2009-03-09 10:10:17 +0200 (Mon, 09 Mar 2009) | 7 lines
branches/zip: remove compile flag MYSQL_SERVER for dynamic plugin
The dynamic plugin on Windows used to be built with MYSQL_SERVER
compile flag, while it is not the case for other platforms.
r3797 assumed MYSQL_SERVER was not defined for dynamic plugin,
which introduced the engine crash during dropping a database.
------------------------------------------------------------------------
r4396 | marko | 2009-03-12 09:22:27 +0200 (Thu, 12 Mar 2009) | 3 lines
branches/zip: btr_store_big_rec_extern_fields(): Initialize FIL_PAGE_TYPE
in a separate redo log entry. This will make ibbackup --apply-log
debugging easier.
------------------------------------------------------------------------
r4397 | marko | 2009-03-12 09:26:11 +0200 (Thu, 12 Mar 2009) | 3 lines
branches/zip: trx_sys_create_doublewrite_buf(): As the dummy change,
initialize FIL_PAGE_TYPE. This will make it easier to write the debug
assertions for ibbackup --apply-log.
------------------------------------------------------------------------
r4401 | marko | 2009-03-12 10:26:40 +0200 (Thu, 12 Mar 2009) | 19 lines
branches/zip: Merge revisions 4359:4400 from branches/5.1:
------------------------------------------------------------------------
r4399 | marko | 2009-03-12 09:38:05 +0200 (Thu, 12 Mar 2009) | 2 lines
branches/5.1: row_sel_get_clust_rec_for_mysql(): Store the cursor position
also for unlock_row(). (Bug #39320)
------------------------------------------------------------------------
r4400 | marko | 2009-03-12 10:06:44 +0200 (Thu, 12 Mar 2009) | 5 lines
branches/5.1: Fix a bug in multi-table semi-consistent reads.
Remember the acquired record locks per table handle (row_prebuilt_t)
rather than per transaction (trx_t), so that unlock_row should successfully
unlock all non-matching rows in multi-table operations.
This deficiency was found while investigating Bug #39320.
------------------------------------------------------------------------
These were submitted as rb://94 and rb://96 and approved by Heikki Tuuri.
------------------------------------------------------------------------
r4455 | marko | 2009-03-16 11:43:34 +0200 (Mon, 16 Mar 2009) | 2 lines
branches/zip: UT_LIST_VALIDATE(): Add the parameter ASSERTION and
adjust all callers.
------------------------------------------------------------------------
r4456 | marko | 2009-03-16 12:59:25 +0200 (Mon, 16 Mar 2009) | 6 lines
branches/zip: UT_LIST_VALIDATE(): Assert that the link is non-NULL
before dereferencing it. In this way, ut_list_node_313 will be
pointing to the last non-NULL list item at the time of the assertion
failure. (gcc-4.3.2 -O3 seems to optimize the common subexpressions
and make the variable NULL, though.)
------------------------------------------------------------------------
r4457 | marko | 2009-03-16 14:12:02 +0200 (Mon, 16 Mar 2009) | 2 lines
branches/zip: sync_thread_add_level(): Make the assertions about
level == SYNC_BUF_BLOCK more readable.
------------------------------------------------------------------------
r4461 | vasil | 2009-03-17 09:38:19 +0200 (Tue, 17 Mar 2009) | 6 lines
branches/zip:
Remove mysql-test/patches/bug32625.diff because that bug was fixed in
the mysql repository (1 year and 4 months after sending them the simple
patch!). See http://bugs.mysql.com/32625
------------------------------------------------------------------------
r4465 | marko | 2009-03-17 12:34:19 +0200 (Tue, 17 Mar 2009) | 1 line
branches/zip: buf0buddy.c: Add and adjust some debug assertions.
------------------------------------------------------------------------
r4473 | vasil | 2009-03-17 15:50:30 +0200 (Tue, 17 Mar 2009) | 5 lines
branches/zip:
Increment the InnoDB Plugin version from 1.0.3 to 1.0.4 now that
1.0.3 has been released.
------------------------------------------------------------------------
r4478 | vasil | 2009-03-18 11:53:53 +0200 (Wed, 18 Mar 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug41893.diff because that bug has been fixed
in the MySQL repository, see http://bugs.mysql.com/41893.
------------------------------------------------------------------------
r4479 | marko | 2009-03-18 12:43:54 +0200 (Wed, 18 Mar 2009) | 2 lines
branches/zip: buf_LRU_block_remove_hashed_page(): Add some debug assertions.
------------------------------------------------------------------------
r4480 | marko | 2009-03-18 14:32:13 +0200 (Wed, 18 Mar 2009) | 1 line
branches/zip: buf_buddy_free_low(): Correct the function comment.
------------------------------------------------------------------------
r4482 | marko | 2009-03-19 15:23:32 +0200 (Thu, 19 Mar 2009) | 12 lines
branches/zip: Merge revisions 4400:4481 from branches/5.1:
------------------------------------------------------------------------
r4481 | marko | 2009-03-19 15:01:48 +0200 (Thu, 19 Mar 2009) | 6 lines
branches/5.1: row_unlock_for_mysql(): Do not unlock records that were
modified by the current transaction. This bug was introduced or unmasked
in r4400.
rb://97 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r4490 | marko | 2009-03-20 12:33:33 +0200 (Fri, 20 Mar 2009) | 4 lines
branches/zip: Non-functional change for reducing dependencies in InnoDB Hot Backup:
Replace srv_sys->dummy_ind1 and srv_sys->dummy_ind2 with
dict_ind_redundant and dict_ind_compact, initialized in dict_init().
------------------------------------------------------------------------
r4491 | marko | 2009-03-20 12:45:18 +0200 (Fri, 20 Mar 2009) | 2 lines
branches/zip: Add const qualifiers or in/out comments to some function
parameters in log0log.
------------------------------------------------------------------------
r4492 | marko | 2009-03-20 12:52:14 +0200 (Fri, 20 Mar 2009) | 5 lines
branches/zip: page_validate(): Always report the space id and the
name of the index.
In Hot Backup, do not invoke comparison functions, as MySQL collations
will be unavailable.
------------------------------------------------------------------------
r4493 | marko | 2009-03-20 13:24:06 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: Replace fil_get_space_for_id_low() with fil_space_get_by_id().
------------------------------------------------------------------------
r4494 | marko | 2009-03-20 13:51:35 +0200 (Fri, 20 Mar 2009) | 3 lines
branches/zip: fil0fil.c: Refer to fil_system directly, not via local vars.
This eliminates some "unused variable" warnings when building
InnoDB Hot Backup in such a way that all mutex operations are no-ops.
------------------------------------------------------------------------
r4495 | marko | 2009-03-20 14:15:52 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: innobase_get_at_most_n_mbchars(): Declare in ha_prototypes.h.
------------------------------------------------------------------------
r4496 | marko | 2009-03-20 14:48:26 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: recv_recover_page(): Remove compile-time constant parameters.
------------------------------------------------------------------------
r4497 | marko | 2009-03-20 14:56:19 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: recv_sys_init(): Remove a compile-time constant parameter.
------------------------------------------------------------------------
r4498 | marko | 2009-03-20 15:08:05 +0200 (Fri, 20 Mar 2009) | 4 lines
branches/zip: Non-functional change: Add const qualifiers.
log_block_checksum_is_ok_or_old_format(), recv_sys_add_to_parsing_buf():
The log block is read-only. Make it const.
------------------------------------------------------------------------
r4499 | marko | 2009-03-20 15:10:25 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: recv_scan_log_recs(): Remove a compile-time constant parameter.
------------------------------------------------------------------------
r4500 | marko | 2009-03-20 15:47:17 +0200 (Fri, 20 Mar 2009) | 1 line
branches/zip: fil_init(): Add the parameter hash_size.
------------------------------------------------------------------------
r4501 | vasil | 2009-03-20 16:50:41 +0200 (Fri, 20 Mar 2009) | 4 lines
branches/zip:
Add any entry about the release of 1.0.3 in the ChangeLog.
------------------------------------------------------------------------
r4515 | marko | 2009-03-23 10:49:53 +0200 (Mon, 23 Mar 2009) | 1 line
branches/zip: hash_table_t: adaptive: Remove from UNIV_HOTBACKUP builds.
------------------------------------------------------------------------
r4516 | marko | 2009-03-23 10:57:16 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Define and use ASSERT_HASH_MUTEX_OWN.
Make it a no-op in UNIV_HOTBACKUP builds.
------------------------------------------------------------------------
r4517 | marko | 2009-03-23 11:07:20 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Define and use PAGE_ZIP_MATCH.
In UNIV_HOTBACKUP builds, assume fixed allocation.
------------------------------------------------------------------------
r4521 | marko | 2009-03-23 12:05:47 +0200 (Mon, 23 Mar 2009) | 1 line
branches/zip: buf_page_print(): Clean up the code #ifdef UNIV_HOTBACKUP.
------------------------------------------------------------------------
r4522 | marko | 2009-03-23 12:20:50 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Exclude some operating system interface code
from UNIV_HOTBACKUP builds.
------------------------------------------------------------------------
r4523 | marko | 2009-03-23 13:00:43 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Remove the remaining references to hash_table_t::adapive
from UNIV_HOTBACKUP builds. This should have been done in r4515.
------------------------------------------------------------------------
r4524 | marko | 2009-03-23 14:05:18 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Enclose recv_recovery_from_backup_on and
recv_recovery_from_backup_is_on() in #ifdef UNIV_LOG_ARCHIVE.
------------------------------------------------------------------------
r4525 | marko | 2009-03-23 14:57:45 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: recv_parse_or_apply_log_rec_body(): Add debug assertions
ensuring that FIL_PAGE_TYPE makes sense when applying log records.
------------------------------------------------------------------------
r4526 | marko | 2009-03-23 16:21:34 +0200 (Mon, 23 Mar 2009) | 2 lines
branches/zip: Remove unneeded definitions and dependencies
from UNIV_HOTBACKUP builds.
------------------------------------------------------------------------
r4527 | calvin | 2009-03-23 23:15:33 +0200 (Mon, 23 Mar 2009) | 5 lines
branches/zip: adjust build files on Windows
Adjust the patch positions based on the latest MySQL source.
Also add the patches to the .bat files for vs9.
------------------------------------------------------------------------
2009-03-24 09:32:21 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 2005, 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
|
|
|
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/******************************************************
|
|
|
|
New index creation routines using a merge sort
|
|
|
|
|
|
|
|
Created 12/4/2005 Jan Lindstrom
|
2007-06-08 09:37:07 +02:00
|
|
|
Completed by Sunny Bains and Marko Makela
|
2007-04-04 13:05:33 +02:00
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "row0merge.h"
|
|
|
|
#include "row0ext.h"
|
|
|
|
#include "row0row.h"
|
|
|
|
#include "row0upd.h"
|
|
|
|
#include "row0ins.h"
|
|
|
|
#include "row0sel.h"
|
|
|
|
#include "dict0dict.h"
|
|
|
|
#include "dict0mem.h"
|
|
|
|
#include "dict0boot.h"
|
|
|
|
#include "dict0crea.h"
|
|
|
|
#include "dict0load.h"
|
|
|
|
#include "btr0btr.h"
|
|
|
|
#include "mach0data.h"
|
|
|
|
#include "trx0rseg.h"
|
|
|
|
#include "trx0trx.h"
|
|
|
|
#include "trx0roll.h"
|
|
|
|
#include "trx0undo.h"
|
|
|
|
#include "trx0purge.h"
|
|
|
|
#include "trx0rec.h"
|
|
|
|
#include "que0que.h"
|
|
|
|
#include "rem0cmp.h"
|
|
|
|
#include "read0read.h"
|
|
|
|
#include "os0file.h"
|
|
|
|
#include "lock0lock.h"
|
|
|
|
#include "data0data.h"
|
|
|
|
#include "data0type.h"
|
|
|
|
#include "que0que.h"
|
|
|
|
#include "pars0pars.h"
|
|
|
|
#include "mem0mem.h"
|
|
|
|
#include "log0log.h"
|
2007-06-08 09:37:07 +02:00
|
|
|
#include "ut0sort.h"
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
#include "handler0alter.h"
|
2007-04-11 10:16:14 +02:00
|
|
|
|
2008-03-03 11:27:57 +01:00
|
|
|
/* Ignore posix_fadvise() on those platforms where it does not exist */
|
|
|
|
#if defined __WIN__
|
|
|
|
# define posix_fadvise(fd, offset, len, advice) /* nothing */
|
|
|
|
#endif /* __WIN__ */
|
|
|
|
|
2007-09-21 10:07:58 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
/* Set these in order ot enable debug printout. */
|
|
|
|
static ibool row_merge_print_cmp;
|
|
|
|
static ibool row_merge_print_read;
|
|
|
|
static ibool row_merge_print_write;
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2007-09-26 15:52:08 +02:00
|
|
|
/* Block size for I/O operations in merge sort. The minimum is
|
|
|
|
UNIV_PAGE_SIZE, or page_get_free_space_of_empty() rounded to a power of 2.
|
|
|
|
|
|
|
|
When not creating a PRIMARY KEY that contains column prefixes, this
|
|
|
|
can be set as small as UNIV_PAGE_SIZE / 2. See the comment above
|
|
|
|
ut_ad(data_size < sizeof(row_merge_block_t)). */
|
2007-04-11 14:17:55 +02:00
|
|
|
|
2007-09-24 10:52:15 +02:00
|
|
|
typedef byte row_merge_block_t[1048576];
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-09-27 08:13:33 +02:00
|
|
|
/* Secondary buffer for I/O operations of merge records. This buffer
|
|
|
|
is used for writing or reading a record that spans two row_merge_block_t.
|
|
|
|
Thus, it must be able to hold one merge record, whose maximum size is
|
|
|
|
the same as the minimum size of row_merge_block_t. */
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-09-27 08:13:33 +02:00
|
|
|
typedef byte mrec_buf_t[UNIV_PAGE_SIZE];
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
/* Merge record in row_merge_block_t. The format is the same as a
|
|
|
|
record in ROW_FORMAT=COMPACT with the exception that the
|
|
|
|
REC_N_NEW_EXTRA_BYTES are omitted. */
|
|
|
|
typedef byte mrec_t;
|
|
|
|
|
|
|
|
/* Buffer for sorting in main memory. */
|
|
|
|
struct row_merge_buf_struct {
|
|
|
|
mem_heap_t* heap; /* memory heap where allocated */
|
|
|
|
dict_index_t* index; /* the index the tuples belong to */
|
|
|
|
ulint total_size; /* total amount of data bytes */
|
|
|
|
ulint n_tuples; /* number of data tuples */
|
|
|
|
ulint max_tuples; /* maximum number of data tuples */
|
|
|
|
const dfield_t**tuples; /* array of pointers to
|
|
|
|
arrays of fields that form
|
|
|
|
the data tuples */
|
|
|
|
const dfield_t**tmp_tuples; /* temporary copy of tuples,
|
|
|
|
for sorting */
|
2007-04-11 14:17:55 +02:00
|
|
|
};
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
typedef struct row_merge_buf_struct row_merge_buf_t;
|
2007-04-11 14:17:55 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Information about temporary files used in merge sort are stored
|
|
|
|
to this structure */
|
2007-04-11 14:17:55 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
struct merge_file_struct {
|
|
|
|
int fd; /* File descriptor */
|
|
|
|
ulint offset; /* File offset */
|
2007-04-11 14:17:55 +02:00
|
|
|
};
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
typedef struct merge_file_struct merge_file_t;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 10:07:58 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
/**********************************************************
|
|
|
|
Display a merge tuple. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
row_merge_tuple_print(
|
|
|
|
/*==================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
FILE* f, /*!< in: output stream */
|
|
|
|
const dfield_t* entry, /*!< in: tuple to print */
|
|
|
|
ulint n_fields)/*!< in: number of fields in the tuple */
|
2007-09-21 10:07:58 +02:00
|
|
|
{
|
|
|
|
ulint j;
|
|
|
|
|
|
|
|
for (j = 0; j < n_fields; j++) {
|
|
|
|
const dfield_t* field = &entry[j];
|
|
|
|
|
|
|
|
if (dfield_is_null(field)) {
|
|
|
|
fputs("\n NULL;", f);
|
|
|
|
} else {
|
2007-10-23 08:46:12 +02:00
|
|
|
ulint field_len = dfield_get_len(field);
|
|
|
|
ulint len = ut_min(field_len, 20);
|
2007-09-21 10:07:58 +02:00
|
|
|
if (dfield_is_ext(field)) {
|
|
|
|
fputs("\nE", f);
|
|
|
|
} else {
|
|
|
|
fputs("\n ", f);
|
|
|
|
}
|
2007-10-23 08:46:12 +02:00
|
|
|
ut_print_buf(f, dfield_get_data(field), len);
|
|
|
|
if (len != field_len) {
|
|
|
|
fprintf(f, " (total %lu bytes)", field_len);
|
2007-09-21 10:07:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
putc('\n', f);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Allocate a sort buffer.
|
|
|
|
@return own: sort buffer */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_t*
|
|
|
|
row_merge_buf_create_low(
|
|
|
|
/*=====================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
mem_heap_t* heap, /*!< in: heap where allocated */
|
|
|
|
dict_index_t* index, /*!< in: secondary index */
|
|
|
|
ulint max_tuples, /*!< in: maximum number of data tuples */
|
|
|
|
ulint buf_size) /*!< in: size of the buffer, in bytes */
|
2007-04-12 12:32:16 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_t* buf;
|
|
|
|
|
2007-08-03 13:49:51 +02:00
|
|
|
ut_ad(max_tuples > 0);
|
|
|
|
ut_ad(max_tuples <= sizeof(row_merge_block_t));
|
|
|
|
ut_ad(max_tuples < buf_size);
|
|
|
|
|
2007-08-16 15:25:56 +02:00
|
|
|
buf = mem_heap_zalloc(heap, buf_size);
|
2007-06-08 09:37:07 +02:00
|
|
|
buf->heap = heap;
|
|
|
|
buf->index = index;
|
|
|
|
buf->max_tuples = max_tuples;
|
|
|
|
buf->tuples = mem_heap_alloc(heap,
|
|
|
|
2 * max_tuples * sizeof *buf->tuples);
|
|
|
|
buf->tmp_tuples = buf->tuples + max_tuples;
|
|
|
|
|
|
|
|
return(buf);
|
2007-04-12 12:32:16 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Allocate a sort buffer.
|
|
|
|
@return own: sort buffer */
|
2007-04-12 12:32:16 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_t*
|
|
|
|
row_merge_buf_create(
|
2007-04-04 13:05:33 +02:00
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_index_t* index) /*!< in: secondary index */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_t* buf;
|
|
|
|
ulint max_tuples;
|
|
|
|
ulint buf_size;
|
|
|
|
mem_heap_t* heap;
|
2007-04-12 12:32:16 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
max_tuples = sizeof(row_merge_block_t)
|
|
|
|
/ ut_max(1, dict_index_get_min_size(index));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
buf_size = (sizeof *buf) + (max_tuples - 1) * sizeof *buf->tuples;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
heap = mem_heap_create(buf_size + sizeof(row_merge_block_t));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
buf = row_merge_buf_create_low(heap, index, max_tuples, buf_size);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(buf);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Empty a sort buffer.
|
|
|
|
@return sort buffer */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-08-03 13:49:51 +02:00
|
|
|
row_merge_buf_t*
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_empty(
|
|
|
|
/*================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_buf_t* buf) /*!< in,own: sort buffer */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint buf_size;
|
|
|
|
ulint max_tuples = buf->max_tuples;
|
|
|
|
mem_heap_t* heap = buf->heap;
|
|
|
|
dict_index_t* index = buf->index;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
buf_size = (sizeof *buf) + (max_tuples - 1) * sizeof *buf->tuples;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_empty(heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-08-03 13:49:51 +02:00
|
|
|
return(row_merge_buf_create_low(heap, index, max_tuples, buf_size));
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
|
|
|
Deallocate a sort buffer. */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
void
|
|
|
|
row_merge_buf_free(
|
|
|
|
/*===============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_buf_t* buf) /*!< in,own: sort buffer, to be freed */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_free(buf->heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Insert a data tuple into a sort buffer.
|
|
|
|
@return TRUE if added, FALSE if out of space */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
ibool
|
|
|
|
row_merge_buf_add(
|
|
|
|
/*==============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_buf_t* buf, /*!< in/out: sort buffer */
|
|
|
|
const dtuple_t* row, /*!< in: row in clustered index */
|
|
|
|
const row_ext_t* ext) /*!< in: cache of externally stored
|
2007-06-08 09:37:07 +02:00
|
|
|
column prefixes, or NULL */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
ulint i;
|
|
|
|
ulint n_fields;
|
|
|
|
ulint data_size;
|
|
|
|
ulint extra_size;
|
|
|
|
const dict_index_t* index;
|
|
|
|
dfield_t* entry;
|
|
|
|
dfield_t* field;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (buf->n_tuples >= buf->max_tuples) {
|
|
|
|
return(FALSE);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-08-15 13:54:15 +02:00
|
|
|
UNIV_PREFETCH_R(row->fields);
|
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
index = buf->index;
|
|
|
|
|
|
|
|
n_fields = dict_index_get_n_fields(index);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
entry = mem_heap_alloc(buf->heap, n_fields * sizeof *entry);
|
|
|
|
buf->tuples[buf->n_tuples] = entry;
|
|
|
|
field = entry;
|
|
|
|
|
|
|
|
data_size = 0;
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
extra_size = UT_BITS_IN_BYTES(index->n_nullable);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-09-19 09:14:36 +02:00
|
|
|
for (i = 0; i < n_fields; i++, field++) {
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
const dict_field_t* ifield;
|
2007-06-08 09:37:07 +02:00
|
|
|
const dict_col_t* col;
|
|
|
|
ulint col_no;
|
|
|
|
const dfield_t* row_field;
|
2007-09-19 09:14:36 +02:00
|
|
|
ulint len;
|
2007-06-08 09:37:07 +02:00
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
ifield = dict_index_get_nth_field(index, i);
|
2007-06-08 09:37:07 +02:00
|
|
|
col = ifield->col;
|
|
|
|
col_no = dict_col_get_no(col);
|
|
|
|
row_field = dtuple_get_nth_field(row, col_no);
|
|
|
|
dfield_copy(field, row_field);
|
2007-10-23 08:46:12 +02:00
|
|
|
len = dfield_get_len(field);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
if (dfield_is_null(field)) {
|
|
|
|
ut_ad(!(col->prtype & DATA_NOT_NULL));
|
|
|
|
continue;
|
|
|
|
} else if (UNIV_LIKELY(!ext)) {
|
|
|
|
} else if (dict_index_is_clust(index)) {
|
|
|
|
/* Flag externally stored fields. */
|
2007-11-29 13:47:18 +01:00
|
|
|
const byte* buf = row_ext_lookup(ext, col_no,
|
|
|
|
&len);
|
2007-09-19 09:14:36 +02:00
|
|
|
if (UNIV_LIKELY_NULL(buf)) {
|
2007-11-27 10:11:45 +01:00
|
|
|
ut_a(buf != field_ref_zero);
|
2007-09-19 09:14:36 +02:00
|
|
|
if (i < dict_index_get_n_unique(index)) {
|
|
|
|
dfield_set_data(field, buf, len);
|
|
|
|
} else {
|
|
|
|
dfield_set_ext(field);
|
2007-10-23 08:46:12 +02:00
|
|
|
len = dfield_get_len(field);
|
2007-09-19 09:14:36 +02:00
|
|
|
}
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
}
|
|
|
|
} else {
|
2007-11-29 13:47:18 +01:00
|
|
|
const byte* buf = row_ext_lookup(ext, col_no,
|
|
|
|
&len);
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_LIKELY_NULL(buf)) {
|
2007-11-27 10:11:45 +01:00
|
|
|
ut_a(buf != field_ref_zero);
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
dfield_set_data(field, buf, len);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* If a column prefix index, take only the prefix */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (ifield->prefix_len) {
|
2007-10-23 08:46:12 +02:00
|
|
|
len = dtype_get_at_most_n_mbchars(
|
2007-06-08 09:37:07 +02:00
|
|
|
col->prtype,
|
|
|
|
col->mbminlen, col->mbmaxlen,
|
|
|
|
ifield->prefix_len,
|
2007-10-23 08:46:12 +02:00
|
|
|
len, dfield_get_data(field));
|
|
|
|
dfield_set_len(field, len);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-19 09:14:36 +02:00
|
|
|
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (ifield->fixed_len) {
|
2007-09-19 09:14:36 +02:00
|
|
|
ut_ad(len == ifield->fixed_len);
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
ut_ad(!dfield_is_ext(field));
|
|
|
|
} else if (dfield_is_ext(field)) {
|
|
|
|
extra_size += 2;
|
2007-09-19 09:14:36 +02:00
|
|
|
} else if (len < 128
|
2007-06-08 09:37:07 +02:00
|
|
|
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
|
|
|
|
extra_size++;
|
|
|
|
} else {
|
2007-09-19 09:14:36 +02:00
|
|
|
/* For variable-length columns, we look up the
|
|
|
|
maximum length from the column itself. If this
|
|
|
|
is a prefix index column shorter than 256 bytes,
|
|
|
|
this will waste one byte. */
|
2007-06-08 09:37:07 +02:00
|
|
|
extra_size += 2;
|
|
|
|
}
|
2007-09-19 09:14:36 +02:00
|
|
|
data_size += len;
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
{
|
|
|
|
ulint size;
|
|
|
|
ulint extra;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
size = rec_get_converted_size_comp(index,
|
2007-06-08 09:37:07 +02:00
|
|
|
REC_STATUS_ORDINARY,
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
entry, n_fields, &extra);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(data_size + extra_size + REC_N_NEW_EXTRA_BYTES == size);
|
|
|
|
ut_ad(extra_size + REC_N_NEW_EXTRA_BYTES == extra);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
#endif /* UNIV_DEBUG */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Add to the total size of the record in row_merge_block_t
|
|
|
|
the encoded length of extra_size and the extra bytes (extra_size).
|
|
|
|
See row_merge_buf_write() for the variable-length encoding
|
|
|
|
of extra_size. */
|
2007-06-08 22:30:26 +02:00
|
|
|
data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-26 15:52:08 +02:00
|
|
|
/* The following assertion may fail if row_merge_block_t is
|
|
|
|
declared very small and a PRIMARY KEY is being created with
|
|
|
|
many prefix columns. In that case, the record may exceed the
|
|
|
|
page_zip_rec_needs_ext() limit. However, no further columns
|
|
|
|
will be moved to external storage until the record is inserted
|
|
|
|
to the clustered index B-tree. */
|
|
|
|
ut_ad(data_size < sizeof(row_merge_block_t));
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Reserve one byte for the end marker of row_merge_block_t. */
|
|
|
|
if (buf->total_size + data_size >= sizeof(row_merge_block_t) - 1) {
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
buf->total_size += data_size;
|
|
|
|
buf->n_tuples++;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
field = entry;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the data fields. */
|
2007-08-15 13:54:15 +02:00
|
|
|
|
|
|
|
do {
|
2007-10-23 08:46:12 +02:00
|
|
|
dfield_dup(field++, buf->heap);
|
2007-08-15 13:54:15 +02:00
|
|
|
} while (--n_fields);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(TRUE);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
/* Structure for reporting duplicate records. */
|
|
|
|
struct row_merge_dup_struct {
|
|
|
|
const dict_index_t* index; /* index being sorted */
|
|
|
|
TABLE* table; /* MySQL table object */
|
|
|
|
ulint n_dup; /* number of duplicates */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct row_merge_dup_struct row_merge_dup_t;
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
Report a duplicate key. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
row_merge_dup_report(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */
|
|
|
|
const dfield_t* entry) /*!< in: duplicate index entry */
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
{
|
2007-09-27 10:28:25 +02:00
|
|
|
mrec_buf_t buf;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
const dtuple_t* tuple;
|
|
|
|
dtuple_t tuple_store;
|
2007-09-27 10:28:25 +02:00
|
|
|
const rec_t* rec;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
const dict_index_t* index = dup->index;
|
|
|
|
ulint n_fields= dict_index_get_n_fields(index);
|
|
|
|
mem_heap_t* heap = NULL;
|
|
|
|
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
|
|
|
ulint* offsets;
|
2007-09-27 10:28:25 +02:00
|
|
|
ulint n_ext;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
|
|
|
if (dup->n_dup++) {
|
|
|
|
/* Only report the first duplicate record,
|
|
|
|
but count all duplicate records. */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-09-28 09:05:57 +02:00
|
|
|
rec_offs_init(offsets_);
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
2007-09-27 10:28:25 +02:00
|
|
|
/* Convert the tuple to a record and then to MySQL format. */
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
2007-09-27 10:28:25 +02:00
|
|
|
tuple = dtuple_from_fields(&tuple_store, entry, n_fields);
|
|
|
|
n_ext = dict_index_is_clust(index) ? dtuple_get_n_ext(tuple) : 0;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
2007-09-27 10:28:25 +02:00
|
|
|
rec = rec_convert_dtuple_to_rec(buf, index, tuple, n_ext);
|
|
|
|
offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED,
|
|
|
|
&heap);
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
2007-09-27 10:28:25 +02:00
|
|
|
innobase_rec_to_mysql(dup->table, rec, index, offsets);
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
|
|
|
if (UNIV_LIKELY_NULL(heap)) {
|
|
|
|
mem_heap_free(heap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/*****************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Compare two tuples.
|
|
|
|
@return 1, 0, -1 if a is greater, equal, less, respectively, than b */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-04-16 11:13:44 +02:00
|
|
|
int
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_tuple_cmp(
|
|
|
|
/*================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint n_field,/*!< in: number of fields */
|
|
|
|
const dfield_t* a, /*!< in: first tuple to be compared */
|
|
|
|
const dfield_t* b, /*!< in: second tuple to be compared */
|
|
|
|
row_merge_dup_t* dup) /*!< in/out: for reporting duplicates */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
int cmp;
|
|
|
|
const dfield_t* field = a;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
/* Compare the fields of the tuples until a difference is
|
|
|
|
found or we run out of fields to compare. If !cmp at the
|
|
|
|
end, the tuples are equal. */
|
2007-06-08 09:37:07 +02:00
|
|
|
do {
|
|
|
|
cmp = cmp_dfield_dfield(a++, b++);
|
|
|
|
} while (!cmp && --n_field);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
if (UNIV_UNLIKELY(!cmp) && UNIV_LIKELY_NULL(dup)) {
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
/* Report a duplicate value error if the tuples are
|
|
|
|
logically equal. NULL columns are logically inequal,
|
|
|
|
although they are equal in the sorting order. Find
|
|
|
|
out if any of the fields are NULL. */
|
|
|
|
for (b = field; b != a; b++) {
|
|
|
|
if (dfield_is_null(b)) {
|
|
|
|
|
|
|
|
goto func_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
row_merge_dup_report(dup, field);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-04-16 11:13:44 +02:00
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
func_exit:
|
2007-06-08 09:37:07 +02:00
|
|
|
return(cmp);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**************************************************************************
|
|
|
|
Merge sort the tuple buffer in main memory. */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
void
|
|
|
|
row_merge_tuple_sort(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint n_field,/*!< in: number of fields */
|
|
|
|
row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */
|
|
|
|
const dfield_t** tuples, /*!< in/out: tuples */
|
|
|
|
const dfield_t** aux, /*!< in/out: work area */
|
|
|
|
ulint low, /*!< in: lower bound of the
|
2007-06-08 09:37:07 +02:00
|
|
|
sorting area, inclusive */
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint high) /*!< in: upper bound of the
|
2007-06-08 09:37:07 +02:00
|
|
|
sorting area, exclusive */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
#define row_merge_tuple_sort_ctx(a,b,c,d) \
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
row_merge_tuple_sort(n_field, dup, a, b, c, d)
|
|
|
|
#define row_merge_tuple_cmp_ctx(a,b) row_merge_tuple_cmp(n_field, a, b, dup)
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
UT_SORT_FUNCTION_BODY(row_merge_tuple_sort_ctx,
|
|
|
|
tuples, aux, low, high, row_merge_tuple_cmp_ctx);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
|
|
|
Sort a buffer. */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
void
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_sort(
|
2007-04-04 13:05:33 +02:00
|
|
|
/*===============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_buf_t* buf, /*!< in/out: sort buffer */
|
|
|
|
row_merge_dup_t* dup) /*!< in/out: for reporting duplicates */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
row_merge_tuple_sort(dict_index_get_n_unique(buf->index), dup,
|
2007-06-08 09:37:07 +02:00
|
|
|
buf->tuples, buf->tmp_tuples, 0, buf->n_tuples);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
|
|
|
Write a buffer to a block. */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
void
|
|
|
|
row_merge_buf_write(
|
|
|
|
/*================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const row_merge_buf_t* buf, /*!< in: sorted buffer */
|
2007-09-21 13:44:57 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
2009-05-25 08:46:10 +02:00
|
|
|
const merge_file_t* of, /*!< in: output file */
|
2007-09-21 13:44:57 +02:00
|
|
|
#endif /* UNIV_DEBUG */
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block) /*!< out: buffer for writing to file */
|
2007-09-21 13:44:57 +02:00
|
|
|
#ifndef UNIV_DEBUG
|
|
|
|
# define row_merge_buf_write(buf, of, block) row_merge_buf_write(buf, block)
|
|
|
|
#endif /* !UNIV_DEBUG */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
const dict_index_t* index = buf->index;
|
|
|
|
ulint n_fields= dict_index_get_n_fields(index);
|
|
|
|
byte* b = &(*block)[0];
|
2007-06-08 09:37:07 +02:00
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
ulint i;
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
for (i = 0; i < buf->n_tuples; i++) {
|
|
|
|
ulint size;
|
|
|
|
ulint extra_size;
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
const dfield_t* entry = buf->tuples[i];
|
2007-06-08 09:37:07 +02:00
|
|
|
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
size = rec_get_converted_size_comp(index,
|
2007-06-08 09:37:07 +02:00
|
|
|
REC_STATUS_ORDINARY,
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
entry, n_fields,
|
2007-06-08 09:37:07 +02:00
|
|
|
&extra_size);
|
|
|
|
ut_ad(size > extra_size);
|
|
|
|
ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES);
|
|
|
|
extra_size -= REC_N_NEW_EXTRA_BYTES;
|
|
|
|
size -= REC_N_NEW_EXTRA_BYTES;
|
|
|
|
|
|
|
|
/* Encode extra_size + 1 */
|
|
|
|
if (extra_size + 1 < 0x80) {
|
2008-05-14 17:43:19 +02:00
|
|
|
*b++ = (byte) (extra_size + 1);
|
2007-06-08 09:37:07 +02:00
|
|
|
} else {
|
2007-06-08 22:30:26 +02:00
|
|
|
ut_ad((extra_size + 1) < 0x8000);
|
2008-05-14 17:43:19 +02:00
|
|
|
*b++ = (byte) (0x80 | ((extra_size + 1) >> 8));
|
2007-06-08 09:37:07 +02:00
|
|
|
*b++ = (byte) (extra_size + 1);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(b + size < block[1]);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
rec_convert_dtuple_to_rec_comp(b + extra_size, 0, index,
|
|
|
|
REC_STATUS_ORDINARY,
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
entry, n_fields);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
b += size;
|
2007-09-21 13:44:57 +02:00
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_write) {
|
|
|
|
fprintf(stderr, "row_merge_buf_write %p,%d,%lu %lu",
|
|
|
|
(void*) b, of->fd, (ulong) of->offset,
|
|
|
|
(ulong) i);
|
|
|
|
row_merge_tuple_print(stderr, entry, n_fields);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Write an "end-of-chunk" marker. */
|
|
|
|
ut_a(b < block[1]);
|
2007-06-08 22:30:26 +02:00
|
|
|
ut_a(b == block[0] + buf->total_size);
|
2007-06-08 09:37:07 +02:00
|
|
|
*b++ = 0;
|
|
|
|
#ifdef UNIV_DEBUG_VALGRIND
|
|
|
|
/* The rest of the block is uninitialized. Initialize it
|
|
|
|
to avoid bogus warnings. */
|
2007-09-20 14:20:17 +02:00
|
|
|
memset(b, 0xff, block[1] - b);
|
2007-06-08 09:37:07 +02:00
|
|
|
#endif /* UNIV_DEBUG_VALGRIND */
|
2007-09-21 10:07:58 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_write) {
|
2007-09-21 13:44:57 +02:00
|
|
|
fprintf(stderr, "row_merge_buf_write %p,%d,%lu EOF\n",
|
|
|
|
(void*) b, of->fd, (ulong) of->offset);
|
2007-09-21 10:07:58 +02:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**********************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Create a memory heap and allocate space for row_merge_rec_offsets().
|
|
|
|
@return memory heap */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_t*
|
|
|
|
row_merge_heap_create(
|
|
|
|
/*==================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_index_t* index, /*!< in: record descriptor */
|
|
|
|
ulint** offsets1, /*!< out: offsets */
|
|
|
|
ulint** offsets2) /*!< out: offsets */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 22:30:26 +02:00
|
|
|
ulint i = 1 + REC_OFFS_HEADER_SIZE
|
2007-06-08 09:37:07 +02:00
|
|
|
+ dict_index_get_n_fields(index);
|
|
|
|
mem_heap_t* heap = mem_heap_create(2 * i * sizeof *offsets1);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
*offsets1 = mem_heap_alloc(heap, i * sizeof *offsets1);
|
|
|
|
*offsets2 = mem_heap_alloc(heap, i * sizeof *offsets2);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
(*offsets1)[0] = (*offsets2)[0] = i;
|
|
|
|
(*offsets1)[1] = (*offsets2)[1] = dict_index_get_n_fields(index);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/**************************************************************************
|
|
|
|
Search an index object by name and column names. If several indexes match,
|
2009-05-25 08:46:10 +02:00
|
|
|
return the index with the max id.
|
|
|
|
@return matching index, NULL if not found */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
dict_index_t*
|
|
|
|
row_merge_dict_table_get_index(
|
|
|
|
/*===========================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_table_t* table, /*!< in: table */
|
|
|
|
const merge_index_def_t*index_def) /*!< in: index definition */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint i;
|
|
|
|
dict_index_t* index;
|
|
|
|
const char** column_names;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
column_names = mem_alloc(index_def->n_fields * sizeof *column_names);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
for (i = 0; i < index_def->n_fields; ++i) {
|
|
|
|
column_names[i] = index_def->fields[i].field_name;
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
index = dict_table_get_index_by_max_id(
|
|
|
|
table, index_def->name, column_names, index_def->n_fields);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2008-05-14 17:43:19 +02:00
|
|
|
mem_free((void*) column_names);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(index);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Read a merge block from the file system.
|
|
|
|
@return TRUE if request was successful, FALSE if fail */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
ibool
|
|
|
|
row_merge_read(
|
|
|
|
/*===========*/
|
2009-05-25 08:46:10 +02:00
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint offset, /*!< in: offset where to read */
|
|
|
|
row_merge_block_t* buf) /*!< out: data */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
|
2007-08-20 14:33:27 +02:00
|
|
|
ibool success;
|
|
|
|
|
|
|
|
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
|
|
|
|
(ulint) (ofs & 0xFFFFFFFF),
|
|
|
|
(ulint) (ofs >> 32),
|
|
|
|
sizeof *buf);
|
2008-03-03 11:27:57 +01:00
|
|
|
/* Each block is read exactly once. Free up the file cache. */
|
|
|
|
posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
|
|
|
|
|
2007-08-20 14:33:27 +02:00
|
|
|
if (UNIV_UNLIKELY(!success)) {
|
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
|
|
|
" InnoDB: failed to read merge block at %llu\n", ofs);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-08-20 14:33:27 +02:00
|
|
|
return(UNIV_LIKELY(success));
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Read a merge block from the file system.
|
|
|
|
@return TRUE if request was successful, FALSE if fail */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
ibool
|
|
|
|
row_merge_write(
|
|
|
|
/*============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint offset, /*!< in: offset where to write */
|
|
|
|
const void* buf) /*!< in: data */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
ib_uint64_t ofs = ((ib_uint64_t) offset)
|
|
|
|
* sizeof(row_merge_block_t);
|
2008-03-03 11:27:57 +01:00
|
|
|
ibool success;
|
|
|
|
|
|
|
|
success = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
|
|
|
|
(ulint) (ofs & 0xFFFFFFFF),
|
|
|
|
(ulint) (ofs >> 32),
|
|
|
|
sizeof(row_merge_block_t));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2008-03-03 11:27:57 +01:00
|
|
|
/* The block will be needed on the next merge pass,
|
|
|
|
but it can be evicted from the file cache meanwhile. */
|
|
|
|
posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
|
|
|
|
|
|
|
|
return(UNIV_LIKELY(success));
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Read a merge record.
|
|
|
|
@return pointer to next record, or NULL on I/O error or end of list */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
const byte*
|
|
|
|
row_merge_read_rec(
|
|
|
|
/*===============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block, /*!< in/out: file buffer */
|
|
|
|
mrec_buf_t* buf, /*!< in/out: secondary buffer */
|
|
|
|
const byte* b, /*!< in: pointer to record */
|
|
|
|
const dict_index_t* index, /*!< in: index of the record */
|
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint* foffs, /*!< in/out: file offset */
|
|
|
|
const mrec_t** mrec, /*!< out: pointer to merge record,
|
2007-06-08 09:37:07 +02:00
|
|
|
or NULL on end of list
|
|
|
|
(non-NULL on I/O error) */
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint* offsets)/*!< out: offsets of mrec */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
ulint extra_size;
|
|
|
|
ulint data_size;
|
|
|
|
ulint avail_size;
|
|
|
|
|
|
|
|
ut_ad(block);
|
|
|
|
ut_ad(buf);
|
|
|
|
ut_ad(b >= block[0]);
|
|
|
|
ut_ad(b < block[1]);
|
|
|
|
ut_ad(index);
|
|
|
|
ut_ad(foffs);
|
|
|
|
ut_ad(mrec);
|
|
|
|
ut_ad(offsets);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 22:30:26 +02:00
|
|
|
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
|
2007-06-08 09:37:07 +02:00
|
|
|
+ dict_index_get_n_fields(index));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
extra_size = *b++;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_UNLIKELY(!extra_size)) {
|
|
|
|
/* End of list */
|
|
|
|
*mrec = NULL;
|
2007-09-21 10:07:58 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_read) {
|
2007-09-21 13:44:57 +02:00
|
|
|
fprintf(stderr, "row_merge_read %p,%p,%d,%lu EOF\n",
|
|
|
|
(const void*) b, (const void*) block,
|
|
|
|
fd, (ulong) *foffs);
|
2007-09-21 10:07:58 +02:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
2007-06-08 09:37:07 +02:00
|
|
|
return(NULL);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (extra_size >= 0x80) {
|
|
|
|
/* Read another byte of extra_size. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_UNLIKELY(b >= block[1])) {
|
|
|
|
if (!row_merge_read(fd, ++(*foffs), block)) {
|
|
|
|
err_exit:
|
|
|
|
/* Signal I/O error. */
|
|
|
|
*mrec = b;
|
|
|
|
return(NULL);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Wrap around to the beginning of the buffer. */
|
|
|
|
b = block[0];
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
extra_size = (extra_size & 0x7f) << 8;
|
|
|
|
extra_size |= *b++;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-19 13:40:51 +02:00
|
|
|
/* Normalize extra_size. Above, value 0 signals "end of list". */
|
2007-06-08 09:37:07 +02:00
|
|
|
extra_size--;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Read the extra bytes. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_UNLIKELY(b + extra_size >= block[1])) {
|
|
|
|
/* The record spans two blocks. Copy the entire record
|
|
|
|
to the auxiliary buffer and handle this as a special
|
|
|
|
case. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
avail_size = block[1] - b;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
memcpy(*buf, b, avail_size);
|
2007-04-12 12:32:16 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (!row_merge_read(fd, ++(*foffs), block)) {
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-13 14:11:43 +02:00
|
|
|
goto err_exit;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Wrap around to the beginning of the buffer. */
|
|
|
|
b = block[0];
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the record. */
|
|
|
|
memcpy(*buf + avail_size, b, extra_size - avail_size);
|
|
|
|
b += extra_size - avail_size;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
*mrec = *buf + extra_size;
|
2007-04-12 14:58:09 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
data_size = rec_offs_data_size(offsets);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* These overflows should be impossible given that
|
|
|
|
records are much smaller than either buffer, and
|
|
|
|
the record starts near the beginning of each buffer. */
|
|
|
|
ut_a(extra_size + data_size < sizeof *buf);
|
|
|
|
ut_a(b + data_size < block[1]);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the data bytes. */
|
|
|
|
memcpy(*buf + extra_size, b, data_size);
|
|
|
|
b += data_size;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 10:07:58 +02:00
|
|
|
goto func_exit;
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
*mrec = b + extra_size;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
data_size = rec_offs_data_size(offsets);
|
|
|
|
ut_ad(extra_size + data_size < sizeof *buf);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
b += extra_size + data_size;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_LIKELY(b < block[1])) {
|
|
|
|
/* The record fits entirely in the block.
|
|
|
|
This is the normal case. */
|
2007-09-21 10:07:58 +02:00
|
|
|
goto func_exit;
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* The record spans two blocks. Copy it to buf. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-19 13:40:51 +02:00
|
|
|
b -= extra_size + data_size;
|
2007-06-08 09:37:07 +02:00
|
|
|
avail_size = block[1] - b;
|
|
|
|
memcpy(*buf, b, avail_size);
|
|
|
|
*mrec = *buf + extra_size;
|
|
|
|
rec_offs_make_valid(*mrec, index, offsets);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (!row_merge_read(fd, ++(*foffs), block)) {
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
goto err_exit;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Wrap around to the beginning of the buffer. */
|
|
|
|
b = block[0];
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the rest of the record. */
|
|
|
|
memcpy(*buf + avail_size, b, extra_size + data_size - avail_size);
|
|
|
|
b += extra_size + data_size - avail_size;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 10:07:58 +02:00
|
|
|
func_exit:
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_read) {
|
2007-09-21 13:44:57 +02:00
|
|
|
fprintf(stderr, "row_merge_read %p,%p,%d,%lu ",
|
|
|
|
(const void*) b, (const void*) block,
|
|
|
|
fd, (ulong) *foffs);
|
2007-09-21 10:07:58 +02:00
|
|
|
rec_print_comp(stderr, *mrec, offsets);
|
|
|
|
putc('\n', stderr);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(b);
|
|
|
|
}
|
2007-04-11 11:42:50 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/************************************************************************
|
|
|
|
Write a merge record. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
row_merge_write_rec_low(
|
|
|
|
/*====================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
byte* b, /*!< out: buffer */
|
|
|
|
ulint e, /*!< in: encoded extra_size */
|
2007-09-19 13:40:51 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint size, /*!< in: total size to write */
|
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint foffs, /*!< in: file offset */
|
2007-09-19 13:40:51 +02:00
|
|
|
#endif /* UNIV_DEBUG */
|
2009-05-25 08:46:10 +02:00
|
|
|
const mrec_t* mrec, /*!< in: record to write */
|
|
|
|
const ulint* offsets)/*!< in: offsets of mrec */
|
2007-09-21 13:44:57 +02:00
|
|
|
#ifndef UNIV_DEBUG
|
|
|
|
# define row_merge_write_rec_low(b, e, size, fd, foffs, mrec, offsets) \
|
|
|
|
row_merge_write_rec_low(b, e, mrec, offsets)
|
|
|
|
#endif /* !UNIV_DEBUG */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
2007-09-19 13:40:51 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
const byte* const end = b + size;
|
|
|
|
ut_ad(e == rec_offs_extra_size(offsets) + 1);
|
|
|
|
|
2007-09-21 10:07:58 +02:00
|
|
|
if (row_merge_print_write) {
|
2007-09-21 13:44:57 +02:00
|
|
|
fprintf(stderr, "row_merge_write %p,%d,%lu ",
|
|
|
|
(void*) b, fd, (ulong) foffs);
|
2007-09-21 10:07:58 +02:00
|
|
|
rec_print_comp(stderr, mrec, offsets);
|
|
|
|
putc('\n', stderr);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (e < 0x80) {
|
2008-05-14 17:43:19 +02:00
|
|
|
*b++ = (byte) e;
|
2007-06-08 09:37:07 +02:00
|
|
|
} else {
|
2008-05-14 17:43:19 +02:00
|
|
|
*b++ = (byte) (0x80 | (e >> 8));
|
2007-06-08 09:37:07 +02:00
|
|
|
*b++ = (byte) e;
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
memcpy(b, mrec - rec_offs_extra_size(offsets), rec_offs_size(offsets));
|
2007-09-19 13:40:51 +02:00
|
|
|
ut_ad(b + rec_offs_size(offsets) == end);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Write a merge record.
|
|
|
|
@return pointer to end of block, or NULL on error */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
byte*
|
|
|
|
row_merge_write_rec(
|
|
|
|
/*================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block, /*!< in/out: file buffer */
|
|
|
|
mrec_buf_t* buf, /*!< in/out: secondary buffer */
|
|
|
|
byte* b, /*!< in: pointer to end of block */
|
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint* foffs, /*!< in/out: file offset */
|
|
|
|
const mrec_t* mrec, /*!< in: record to write */
|
|
|
|
const ulint* offsets)/*!< in: offsets of mrec */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint extra_size;
|
|
|
|
ulint size;
|
|
|
|
ulint avail_size;
|
|
|
|
|
|
|
|
ut_ad(block);
|
|
|
|
ut_ad(buf);
|
|
|
|
ut_ad(b >= block[0]);
|
|
|
|
ut_ad(b < block[1]);
|
|
|
|
ut_ad(mrec);
|
|
|
|
ut_ad(foffs);
|
|
|
|
ut_ad(mrec < block[0] || mrec > block[1]);
|
|
|
|
ut_ad(mrec < buf[0] || mrec > buf[1]);
|
|
|
|
|
|
|
|
/* Normalize extra_size. Value 0 signals "end of list". */
|
|
|
|
extra_size = rec_offs_extra_size(offsets) + 1;
|
|
|
|
|
|
|
|
size = extra_size + (extra_size >= 0x80)
|
|
|
|
+ rec_offs_data_size(offsets);
|
|
|
|
|
|
|
|
if (UNIV_UNLIKELY(b + size >= block[1])) {
|
|
|
|
/* The record spans two blocks.
|
|
|
|
Copy it to the temporary buffer first. */
|
|
|
|
avail_size = block[1] - b;
|
|
|
|
|
2007-09-19 13:40:51 +02:00
|
|
|
row_merge_write_rec_low(buf[0],
|
2007-09-21 13:44:57 +02:00
|
|
|
extra_size, size, fd, *foffs,
|
|
|
|
mrec, offsets);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
/* Copy the head of the temporary buffer, write
|
|
|
|
the completed block, and copy the tail of the
|
|
|
|
record to the head of the new block. */
|
|
|
|
memcpy(b, buf[0], avail_size);
|
|
|
|
|
|
|
|
if (!row_merge_write(fd, (*foffs)++, block)) {
|
|
|
|
return(NULL);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-20 14:20:17 +02:00
|
|
|
UNIV_MEM_INVALID(block[0], sizeof block[0]);
|
2007-09-19 15:52:43 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the rest. */
|
|
|
|
b = block[0];
|
|
|
|
memcpy(b, buf[0] + avail_size, size - avail_size);
|
|
|
|
b += size - avail_size;
|
|
|
|
} else {
|
2007-09-21 13:44:57 +02:00
|
|
|
row_merge_write_rec_low(b, extra_size, size, fd, *foffs,
|
|
|
|
mrec, offsets);
|
2007-09-19 13:40:51 +02:00
|
|
|
b += size;
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(b);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Write an end-of-list marker.
|
|
|
|
@return pointer to end of block, or NULL on error */
|
2007-04-04 13:05:33 +02:00
|
|
|
static
|
2007-06-08 09:37:07 +02:00
|
|
|
byte*
|
|
|
|
row_merge_write_eof(
|
|
|
|
/*================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block, /*!< in/out: file buffer */
|
|
|
|
byte* b, /*!< in: pointer to end of block */
|
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
ulint* foffs) /*!< in/out: file offset */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(block);
|
|
|
|
ut_ad(b >= block[0]);
|
|
|
|
ut_ad(b < block[1]);
|
|
|
|
ut_ad(foffs);
|
2007-09-21 10:07:58 +02:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_write) {
|
2007-09-21 13:44:57 +02:00
|
|
|
fprintf(stderr, "row_merge_write %p,%p,%d,%lu EOF\n",
|
|
|
|
(void*) b, (void*) block, fd, (ulong) *foffs);
|
2007-09-21 10:07:58 +02:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
*b++ = 0;
|
2007-09-19 15:52:43 +02:00
|
|
|
UNIV_MEM_ASSERT_RW(block[0], b - block[0]);
|
|
|
|
UNIV_MEM_ASSERT_W(block[0], sizeof block[0]);
|
2007-09-20 14:20:17 +02:00
|
|
|
#ifdef UNIV_DEBUG_VALGRIND
|
|
|
|
/* The rest of the block is uninitialized. Initialize it
|
|
|
|
to avoid bogus warnings. */
|
|
|
|
memset(b, 0xff, block[1] - b);
|
|
|
|
#endif /* UNIV_DEBUG_VALGRIND */
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
if (!row_merge_write(fd, (*foffs)++, block)) {
|
|
|
|
return(NULL);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-09-20 14:20:17 +02:00
|
|
|
UNIV_MEM_INVALID(block[0], sizeof block[0]);
|
2007-06-08 09:37:07 +02:00
|
|
|
return(block[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Compare two merge records.
|
|
|
|
@return 1, 0, -1 if mrec1 is greater, equal, less, respectively, than mrec2 */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
int
|
|
|
|
row_merge_cmp(
|
|
|
|
/*==========*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const mrec_t* mrec1, /*!< in: first merge
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
record to be compared */
|
2009-05-25 08:46:10 +02:00
|
|
|
const mrec_t* mrec2, /*!< in: second merge
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
record to be compared */
|
2009-05-25 08:46:10 +02:00
|
|
|
const ulint* offsets1, /*!< in: first record offsets */
|
|
|
|
const ulint* offsets2, /*!< in: second record offsets */
|
|
|
|
const dict_index_t* index) /*!< in: index */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
2007-09-21 10:07:58 +02:00
|
|
|
int cmp;
|
|
|
|
|
|
|
|
cmp = cmp_rec_rec_simple(mrec1, mrec2, offsets1, offsets2, index);
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (row_merge_print_cmp) {
|
|
|
|
fputs("row_merge_cmp1 ", stderr);
|
|
|
|
rec_print_comp(stderr, mrec1, offsets1);
|
|
|
|
fputs("\nrow_merge_cmp2 ", stderr);
|
|
|
|
rec_print_comp(stderr, mrec2, offsets2);
|
|
|
|
fprintf(stderr, "\nrow_merge_cmp=%d\n", cmp);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
return(cmp);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Reads clustered index of the table and create temporary files
|
2009-05-25 08:46:10 +02:00
|
|
|
containing the index entries for the indexes to be built.
|
|
|
|
@return DB_SUCCESS or error */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
2007-04-04 13:05:33 +02:00
|
|
|
ulint
|
|
|
|
row_merge_read_clustered_index(
|
|
|
|
/*===========================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: transaction */
|
|
|
|
TABLE* table, /*!< in/out: MySQL table object,
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
for reporting erroneous records */
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_table_t* old_table,/*!< in: table where rows are
|
2007-08-10 17:52:09 +02:00
|
|
|
read from */
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_table_t* new_table,/*!< in: table where indexes are
|
2007-08-10 17:52:09 +02:00
|
|
|
created; identical to old_table
|
|
|
|
unless creating a PRIMARY KEY */
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_index_t** index, /*!< in: indexes to be created */
|
|
|
|
merge_file_t* files, /*!< in: temporary files */
|
|
|
|
ulint n_index,/*!< in: number of indexes to create */
|
|
|
|
row_merge_block_t* block) /*!< in/out: file buffer */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
dict_index_t* clust_index; /* Clustered index */
|
|
|
|
mem_heap_t* row_heap; /* Heap memory to create
|
2007-04-04 13:05:33 +02:00
|
|
|
clustered index records */
|
2007-06-08 09:37:07 +02:00
|
|
|
row_merge_buf_t** merge_buf; /* Temporary list for records*/
|
|
|
|
btr_pcur_t pcur; /* Persistent cursor on the
|
2007-05-22 08:48:53 +02:00
|
|
|
clustered index */
|
2007-06-08 09:37:07 +02:00
|
|
|
mtr_t mtr; /* Mini transaction */
|
|
|
|
ulint err = DB_SUCCESS;/* Return code */
|
|
|
|
ulint i;
|
2007-08-10 17:52:09 +02:00
|
|
|
ulint n_nonnull = 0; /* number of columns
|
|
|
|
changed to NOT NULL */
|
|
|
|
ulint* nonnull = NULL; /* NOT NULL columns */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
trx->op_info = "reading clustered index";
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-05-22 08:48:53 +02:00
|
|
|
ut_ad(trx);
|
2007-08-10 17:52:09 +02:00
|
|
|
ut_ad(old_table);
|
|
|
|
ut_ad(new_table);
|
2007-05-22 08:48:53 +02:00
|
|
|
ut_ad(index);
|
|
|
|
ut_ad(files);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Create and initialize memory for record buffers */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
merge_buf = mem_alloc(n_index * sizeof *merge_buf);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
for (i = 0; i < n_index; i++) {
|
|
|
|
merge_buf[i] = row_merge_buf_create(index[i]);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
/* Find the clustered index and create a persistent cursor
|
|
|
|
based on that. */
|
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
clust_index = dict_table_get_first_index(old_table);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
btr_pcur_open_at_index_side(
|
|
|
|
TRUE, clust_index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
|
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
if (UNIV_UNLIKELY(old_table != new_table)) {
|
|
|
|
ulint n_cols = dict_table_get_n_cols(old_table);
|
|
|
|
|
|
|
|
/* A primary key will be created. Identify the
|
|
|
|
columns that were flagged NOT NULL in the new table,
|
|
|
|
so that we can quickly check that the records in the
|
|
|
|
(old) clustered index do not violate the added NOT
|
|
|
|
NULL constraints. */
|
|
|
|
|
|
|
|
ut_a(n_cols == dict_table_get_n_cols(new_table));
|
|
|
|
|
|
|
|
nonnull = mem_alloc(n_cols * sizeof *nonnull);
|
|
|
|
|
|
|
|
for (i = 0; i < n_cols; i++) {
|
|
|
|
if (dict_table_get_nth_col(old_table, i)->prtype
|
|
|
|
& DATA_NOT_NULL) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dict_table_get_nth_col(new_table, i)->prtype
|
|
|
|
& DATA_NOT_NULL) {
|
|
|
|
|
|
|
|
nonnull[n_nonnull++] = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!n_nonnull) {
|
|
|
|
mem_free(nonnull);
|
|
|
|
nonnull = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-27 10:28:25 +02:00
|
|
|
row_heap = mem_heap_create(sizeof(mrec_buf_t));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Scan the clustered index. */
|
2007-05-22 08:48:53 +02:00
|
|
|
for (;;) {
|
|
|
|
const rec_t* rec;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
ulint* offsets;
|
2007-08-01 09:52:05 +02:00
|
|
|
dtuple_t* row = NULL;
|
2007-04-04 13:05:33 +02:00
|
|
|
row_ext_t* ext;
|
2007-08-01 09:52:05 +02:00
|
|
|
ibool has_next = TRUE;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-10-22 10:16:35 +02:00
|
|
|
btr_pcur_move_to_next_on_page(&pcur);
|
2007-06-07 10:14:42 +02:00
|
|
|
|
2007-05-22 08:48:53 +02:00
|
|
|
/* When switching pages, commit the mini-transaction
|
|
|
|
in order to release the latch on the old page. */
|
|
|
|
|
2007-10-22 10:16:35 +02:00
|
|
|
if (btr_pcur_is_after_last_on_page(&pcur)) {
|
2007-05-22 08:48:53 +02:00
|
|
|
btr_pcur_store_position(&pcur, &mtr);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mtr_start(&mtr);
|
|
|
|
btr_pcur_restore_position(BTR_SEARCH_LEAF,
|
|
|
|
&pcur, &mtr);
|
2007-06-08 09:37:07 +02:00
|
|
|
has_next = btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
2007-05-22 08:48:53 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_LIKELY(has_next)) {
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
offsets = rec_get_offsets(rec, clust_index, NULL,
|
|
|
|
ULINT_UNDEFINED, &row_heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Skip delete marked records. */
|
2007-08-10 17:52:09 +02:00
|
|
|
if (rec_get_deleted_flag(
|
|
|
|
rec, dict_table_is_comp(old_table))) {
|
2007-06-08 09:37:07 +02:00
|
|
|
continue;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
srv_n_rows_inserted++;
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
/* Build a row based on the clustered index. */
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
row = row_build(ROW_COPY_POINTERS, clust_index,
|
2007-12-03 13:16:07 +01:00
|
|
|
rec, offsets,
|
|
|
|
new_table, &ext, row_heap);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
if (UNIV_LIKELY_NULL(nonnull)) {
|
|
|
|
for (i = 0; i < n_nonnull; i++) {
|
|
|
|
dfield_t* field
|
|
|
|
= &row->fields[nonnull[i]];
|
2007-10-23 08:46:12 +02:00
|
|
|
dtype_t* field_type
|
|
|
|
= dfield_get_type(field);
|
2007-08-10 17:52:09 +02:00
|
|
|
|
2007-10-23 08:46:12 +02:00
|
|
|
ut_a(!(field_type->prtype
|
2007-08-10 17:52:09 +02:00
|
|
|
& DATA_NOT_NULL));
|
|
|
|
|
|
|
|
if (dfield_is_null(field)) {
|
|
|
|
err = DB_PRIMARY_KEY_IS_NULL;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
i = 0;
|
|
|
|
goto err_exit;
|
2007-08-10 17:52:09 +02:00
|
|
|
}
|
|
|
|
|
2007-10-23 08:46:12 +02:00
|
|
|
field_type->prtype |= DATA_NOT_NULL;
|
2007-08-10 17:52:09 +02:00
|
|
|
}
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
/* Build all entries for all the indexes to be created
|
|
|
|
in a single scan of the clustered index. */
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
for (i = 0; i < n_index; i++) {
|
|
|
|
row_merge_buf_t* buf = merge_buf[i];
|
|
|
|
merge_file_t* file = &files[i];
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
const dict_index_t* index = buf->index;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_LIKELY
|
2007-08-01 09:52:05 +02:00
|
|
|
(row && row_merge_buf_add(buf, row, ext))) {
|
2007-06-08 09:37:07 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-09-21 16:33:49 +02:00
|
|
|
/* The buffer must be sufficiently large
|
|
|
|
to hold at least one record. */
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(buf->n_tuples || !has_next);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* We have enough data tuples to form a block.
|
|
|
|
Sort them and write to disk. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
if (buf->n_tuples) {
|
|
|
|
if (dict_index_is_unique(index)) {
|
2007-11-01 12:44:49 +01:00
|
|
|
row_merge_dup_t dup;
|
|
|
|
dup.index = buf->index;
|
|
|
|
dup.table = table;
|
|
|
|
dup.n_dup = 0;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
|
|
|
|
row_merge_buf_sort(buf, &dup);
|
|
|
|
|
|
|
|
if (dup.n_dup) {
|
|
|
|
err = DB_DUPLICATE_KEY;
|
|
|
|
err_exit:
|
|
|
|
trx->error_key_num = i;
|
|
|
|
goto func_exit;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
row_merge_buf_sort(buf, NULL);
|
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 13:44:57 +02:00
|
|
|
row_merge_buf_write(buf, file, block);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (!row_merge_write(file->fd, file->offset++,
|
|
|
|
block)) {
|
|
|
|
err = DB_OUT_OF_FILE_SPACE;
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
goto err_exit;
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-20 14:20:17 +02:00
|
|
|
UNIV_MEM_INVALID(block[0], sizeof block[0]);
|
2007-08-03 13:49:51 +02:00
|
|
|
merge_buf[i] = row_merge_buf_empty(buf);
|
2007-09-21 16:33:49 +02:00
|
|
|
|
|
|
|
/* Try writing the record again, now that
|
|
|
|
the buffer has been written out and emptied. */
|
|
|
|
|
|
|
|
if (UNIV_UNLIKELY
|
|
|
|
(row && !row_merge_buf_add(buf, row, ext))) {
|
|
|
|
/* An empty buffer should have enough
|
|
|
|
room for at least one record. */
|
|
|
|
ut_error;
|
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_empty(row_heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_UNLIKELY(!has_next)) {
|
|
|
|
goto func_exit;
|
|
|
|
}
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
func_exit:
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(row_heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-08-10 17:52:09 +02:00
|
|
|
if (UNIV_LIKELY_NULL(nonnull)) {
|
|
|
|
mem_free(nonnull);
|
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
for (i = 0; i < n_index; i++) {
|
|
|
|
row_merge_buf_free(merge_buf[i]);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_free(merge_buf);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
trx->op_info = "";
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(err);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/*****************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Merge two blocks of linked lists on disk and write a bigger block.
|
|
|
|
@return DB_SUCCESS or error code */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
ulint
|
|
|
|
row_merge_blocks(
|
|
|
|
/*=============*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_index_t* index, /*!< in: index being created */
|
|
|
|
merge_file_t* file, /*!< in/out: file containing
|
2007-06-08 09:37:07 +02:00
|
|
|
index entries */
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block, /*!< in/out: 3 buffers */
|
|
|
|
ulint* foffs0, /*!< in/out: offset of first
|
2007-06-08 09:37:07 +02:00
|
|
|
source list in the file */
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint* foffs1, /*!< in/out: offset of second
|
2007-06-08 09:37:07 +02:00
|
|
|
source list in the file */
|
2009-05-25 08:46:10 +02:00
|
|
|
merge_file_t* of, /*!< in/out: output file */
|
|
|
|
TABLE* table) /*!< in/out: MySQL table, for
|
2007-09-27 10:28:25 +02:00
|
|
|
reporting erroneous key value
|
|
|
|
if applicable */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
mem_heap_t* heap; /* memory heap for offsets0, offsets1 */
|
|
|
|
|
|
|
|
mrec_buf_t buf[3]; /* buffer for handling split mrec in block[] */
|
|
|
|
const byte* b0; /* pointer to block[0] */
|
|
|
|
const byte* b1; /* pointer to block[1] */
|
|
|
|
byte* b2; /* pointer to block[2] */
|
|
|
|
const mrec_t* mrec0; /* merge rec, points to block[0] or buf[0] */
|
|
|
|
const mrec_t* mrec1; /* merge rec, points to block[1] or buf[1] */
|
|
|
|
ulint* offsets0;/* offsets of mrec0 */
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint* offsets1;/* offsets of mrec1 */
|
|
|
|
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
heap = row_merge_heap_create(index, &offsets0, &offsets1);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
/* Write a record and read the next record. Split the output
|
|
|
|
file in two halves, which can be merged on the following pass. */
|
|
|
|
#define ROW_MERGE_WRITE_GET_NEXT(N, AT_END) \
|
|
|
|
do { \
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
b2 = row_merge_write_rec(&block[2], &buf[2], b2, \
|
2007-06-08 09:37:07 +02:00
|
|
|
of->fd, &of->offset, \
|
|
|
|
mrec##N, offsets##N); \
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
if (UNIV_UNLIKELY(!b2)) { \
|
2007-06-08 09:37:07 +02:00
|
|
|
goto corrupt; \
|
|
|
|
} \
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
b##N = row_merge_read_rec(&block[N], &buf[N], \
|
2007-06-08 09:37:07 +02:00
|
|
|
b##N, index, \
|
|
|
|
file->fd, foffs##N, \
|
|
|
|
&mrec##N, offsets##N); \
|
|
|
|
if (UNIV_UNLIKELY(!b##N)) { \
|
|
|
|
if (mrec##N) { \
|
|
|
|
goto corrupt; \
|
|
|
|
} \
|
|
|
|
AT_END; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
if (!row_merge_read(file->fd, *foffs0, &block[0])
|
|
|
|
|| !row_merge_read(file->fd, *foffs1, &block[1])) {
|
2007-06-08 09:37:07 +02:00
|
|
|
corrupt:
|
|
|
|
mem_heap_free(heap);
|
|
|
|
return(DB_CORRUPTION);
|
|
|
|
}
|
|
|
|
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
b0 = block[0];
|
|
|
|
b1 = block[1];
|
|
|
|
b2 = block[2];
|
2007-06-08 09:37:07 +02:00
|
|
|
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, file->fd,
|
|
|
|
foffs0, &mrec0, offsets0);
|
|
|
|
b1 = row_merge_read_rec(&block[1], &buf[1], b1, index, file->fd,
|
2007-06-08 09:37:07 +02:00
|
|
|
foffs1, &mrec1, offsets1);
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
if (UNIV_UNLIKELY(!b0 && mrec0)
|
|
|
|
|| UNIV_UNLIKELY(!b1 && mrec1)) {
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
goto corrupt;
|
|
|
|
}
|
|
|
|
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
while (mrec0 && mrec1) {
|
|
|
|
switch (row_merge_cmp(mrec0, mrec1,
|
|
|
|
offsets0, offsets1, index)) {
|
2007-06-08 09:37:07 +02:00
|
|
|
case 0:
|
|
|
|
if (UNIV_UNLIKELY
|
|
|
|
(dict_index_is_unique(index))) {
|
2007-09-27 10:28:25 +02:00
|
|
|
innobase_rec_to_mysql(table, mrec0,
|
|
|
|
index, offsets0);
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_free(heap);
|
|
|
|
return(DB_DUPLICATE_KEY);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
/* fall through */
|
|
|
|
case -1:
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
ROW_MERGE_WRITE_GET_NEXT(0, goto merged);
|
2007-06-08 09:37:07 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
ROW_MERGE_WRITE_GET_NEXT(1, goto merged);
|
2007-06-08 09:37:07 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ut_error;
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
merged:
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
if (mrec0) {
|
|
|
|
/* append all mrec0 to output */
|
2007-06-08 09:37:07 +02:00
|
|
|
for (;;) {
|
2007-06-08 22:30:26 +02:00
|
|
|
ROW_MERGE_WRITE_GET_NEXT(0, goto done0);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
|
|
|
}
|
2007-06-08 22:30:26 +02:00
|
|
|
done0:
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
if (mrec1) {
|
|
|
|
/* append all mrec1 to output */
|
2007-06-08 09:37:07 +02:00
|
|
|
for (;;) {
|
2007-06-08 22:30:26 +02:00
|
|
|
ROW_MERGE_WRITE_GET_NEXT(1, goto done1);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
|
|
|
}
|
2007-06-08 22:30:26 +02:00
|
|
|
done1:
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_free(heap);
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
b2 = row_merge_write_eof(&block[2], b2, of->fd, &of->offset);
|
|
|
|
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/*****************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Merge disk files.
|
|
|
|
@return DB_SUCCESS or error code */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
ulint
|
|
|
|
row_merge(
|
|
|
|
/*======*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_index_t* index, /*!< in: index being created */
|
|
|
|
merge_file_t* file, /*!< in/out: file containing
|
2007-09-27 10:28:25 +02:00
|
|
|
index entries */
|
2009-05-25 08:46:10 +02:00
|
|
|
ulint half, /*!< in: half the file */
|
|
|
|
row_merge_block_t* block, /*!< in/out: 3 buffers */
|
|
|
|
int* tmpfd, /*!< in/out: temporary file handle */
|
|
|
|
TABLE* table) /*!< in/out: MySQL table, for
|
2007-09-27 10:28:25 +02:00
|
|
|
reporting erroneous key value
|
|
|
|
if applicable */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
ulint foffs0; /* first input offset */
|
|
|
|
ulint foffs1; /* second input offset */
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint error; /* error code */
|
|
|
|
merge_file_t of; /* output file */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 15:05:51 +02:00
|
|
|
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
|
2007-09-24 10:46:13 +02:00
|
|
|
ut_ad(half > 0);
|
2007-09-21 15:05:51 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
of.fd = *tmpfd;
|
|
|
|
of.offset = 0;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2008-03-03 11:27:57 +01:00
|
|
|
/* The input file will be read sequentially, starting from the
|
|
|
|
beginning and the middle. In Linux, the POSIX_FADV_SEQUENTIAL
|
|
|
|
affects the entire file. Each block will be read exactly once. */
|
|
|
|
posix_fadvise(file->fd, 0, 0,
|
|
|
|
POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Merge blocks to the output file. */
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
foffs0 = 0;
|
|
|
|
foffs1 = half;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 15:05:51 +02:00
|
|
|
for (; foffs0 < half && foffs1 < file->offset; foffs0++, foffs1++) {
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
error = row_merge_blocks(index, file, block,
|
2007-09-27 10:28:25 +02:00
|
|
|
&foffs0, &foffs1, &of, table);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
return(error);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Copy the last block, if there is one. */
|
2007-09-21 15:05:51 +02:00
|
|
|
while (foffs0 < half) {
|
|
|
|
if (!row_merge_read(file->fd, foffs0++, block)
|
|
|
|
|| !row_merge_write(of.fd, of.offset++, block)) {
|
|
|
|
return(DB_CORRUPTION);
|
|
|
|
}
|
|
|
|
}
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
while (foffs1 < file->offset) {
|
|
|
|
if (!row_merge_read(file->fd, foffs1++, block)
|
|
|
|
|| !row_merge_write(of.fd, of.offset++, block)) {
|
2007-06-08 09:37:07 +02:00
|
|
|
return(DB_CORRUPTION);
|
2007-04-13 14:11:43 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Swap file descriptors for the next pass. */
|
|
|
|
*tmpfd = file->fd;
|
|
|
|
*file = of;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 15:05:51 +02:00
|
|
|
UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/*****************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Merge disk files.
|
|
|
|
@return DB_SUCCESS or error code */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
|
|
|
ulint
|
|
|
|
row_merge_sort(
|
|
|
|
/*===========*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_index_t* index, /*!< in: index being created */
|
|
|
|
merge_file_t* file, /*!< in/out: file containing
|
2007-09-27 10:28:25 +02:00
|
|
|
index entries */
|
2009-05-25 08:46:10 +02:00
|
|
|
row_merge_block_t* block, /*!< in/out: 3 buffers */
|
|
|
|
int* tmpfd, /*!< in/out: temporary file handle */
|
|
|
|
TABLE* table) /*!< in/out: MySQL table, for
|
2007-09-27 10:28:25 +02:00
|
|
|
reporting erroneous key value
|
|
|
|
if applicable */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
ulint blksz; /* block size */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-21 15:05:51 +02:00
|
|
|
for (blksz = 1; blksz < file->offset; blksz *= 2) {
|
2007-09-24 10:46:13 +02:00
|
|
|
ulint half;
|
|
|
|
ulint error;
|
|
|
|
|
2008-05-14 17:43:19 +02:00
|
|
|
ut_ad(ut_is_2pow(blksz));
|
|
|
|
half = ut_2pow_round((file->offset + (blksz - 1)) / 2, blksz);
|
2007-09-27 10:28:25 +02:00
|
|
|
error = row_merge(index, file, half, block, tmpfd, table);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
return(DB_SUCCESS);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
/*****************************************************************
|
|
|
|
Copy externally stored columns to the data tuple. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
row_merge_copy_blobs(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const mrec_t* mrec, /*!< in: merge record */
|
|
|
|
const ulint* offsets,/*!< in: offsets of mrec */
|
|
|
|
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
|
|
|
|
dtuple_t* tuple, /*!< in/out: data tuple */
|
|
|
|
mem_heap_t* heap) /*!< in/out: memory heap */
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
{
|
|
|
|
ulint i;
|
|
|
|
ulint n_fields = dtuple_get_n_fields(tuple);
|
|
|
|
|
|
|
|
for (i = 0; i < n_fields; i++) {
|
|
|
|
ulint len;
|
|
|
|
const void* data;
|
|
|
|
dfield_t* field = dtuple_get_nth_field(tuple, i);
|
|
|
|
|
|
|
|
if (!dfield_is_ext(field)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(!dfield_is_null(field));
|
|
|
|
|
2008-01-11 20:59:47 +01:00
|
|
|
/* The table is locked during index creation.
|
|
|
|
Therefore, externally stored columns cannot possibly
|
|
|
|
be freed between the time the BLOB pointers are read
|
|
|
|
(row_merge_read_clustered_index()) and dereferenced
|
|
|
|
(below). */
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
data = btr_rec_copy_externally_stored_field(
|
|
|
|
mrec, offsets, zip_size, i, &len, heap);
|
|
|
|
|
|
|
|
dfield_set_data(field, data, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/************************************************************************
|
|
|
|
Read sorted file containing index data tuples and insert these data
|
2009-05-25 08:46:10 +02:00
|
|
|
tuples to the index
|
|
|
|
@return DB_SUCCESS or error number */
|
2007-06-08 09:37:07 +02:00
|
|
|
static
|
2007-04-04 13:05:33 +02:00
|
|
|
ulint
|
|
|
|
row_merge_insert_index_tuples(
|
|
|
|
/*==========================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: transaction */
|
|
|
|
dict_index_t* index, /*!< in: index */
|
|
|
|
dict_table_t* table, /*!< in: new table */
|
|
|
|
ulint zip_size,/*!< in: compressed page size of
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
the old table, or 0 if uncompressed */
|
2009-05-25 08:46:10 +02:00
|
|
|
int fd, /*!< in: file descriptor */
|
|
|
|
row_merge_block_t* block) /*!< in/out: file buffer */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
mrec_buf_t buf;
|
|
|
|
const byte* b;
|
|
|
|
que_thr_t* thr;
|
|
|
|
ins_node_t* node;
|
|
|
|
mem_heap_t* tuple_heap;
|
|
|
|
mem_heap_t* graph_heap;
|
|
|
|
ulint error = DB_SUCCESS;
|
|
|
|
ulint foffs = 0;
|
|
|
|
ulint* offsets;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(trx);
|
|
|
|
ut_ad(index);
|
|
|
|
ut_ad(table);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
/* We use the insert query graph as the dummy graph
|
|
|
|
needed in the row module call */
|
|
|
|
|
|
|
|
trx->op_info = "inserting index entries";
|
|
|
|
|
2007-04-13 14:11:43 +02:00
|
|
|
graph_heap = mem_heap_create(500);
|
2007-04-04 13:05:33 +02:00
|
|
|
node = ins_node_create(INS_DIRECT, table, graph_heap);
|
|
|
|
|
|
|
|
thr = pars_complete_graph_for_exec(node, trx, graph_heap);
|
|
|
|
|
|
|
|
que_thr_move_to_run_state_for_mysql(thr, trx);
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
tuple_heap = mem_heap_create(1000);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
2007-06-08 22:30:26 +02:00
|
|
|
ulint i = 1 + REC_OFFS_HEADER_SIZE
|
2007-06-08 09:37:07 +02:00
|
|
|
+ dict_index_get_n_fields(index);
|
|
|
|
offsets = mem_heap_alloc(graph_heap, i * sizeof *offsets);
|
|
|
|
offsets[0] = i;
|
|
|
|
offsets[1] = dict_index_get_n_fields(index);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
b = *block;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (!row_merge_read(fd, foffs, block)) {
|
|
|
|
error = DB_CORRUPTION;
|
|
|
|
} else {
|
|
|
|
for (;;) {
|
|
|
|
const mrec_t* mrec;
|
|
|
|
dtuple_t* dtuple;
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
ulint n_ext;
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
b = row_merge_read_rec(block, &buf, b, index,
|
|
|
|
fd, &foffs, &mrec, offsets);
|
|
|
|
if (UNIV_UNLIKELY(!b)) {
|
|
|
|
/* End of list, or I/O error */
|
|
|
|
if (mrec) {
|
|
|
|
error = DB_CORRUPTION;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
dtuple = row_rec_to_index_entry_low(
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
mrec, index, offsets, &n_ext, tuple_heap);
|
|
|
|
|
|
|
|
if (UNIV_UNLIKELY(n_ext)) {
|
|
|
|
row_merge_copy_blobs(mrec, offsets, zip_size,
|
|
|
|
dtuple, tuple_heap);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
node->row = dtuple;
|
|
|
|
node->table = table;
|
|
|
|
node->trx_id = trx->id;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
ut_ad(dtuple_validate(dtuple));
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
do {
|
|
|
|
thr->run_node = thr;
|
|
|
|
thr->prev_node = thr->common.parent;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
error = row_ins_index_entry(index, dtuple,
|
|
|
|
0, FALSE, thr);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
if (UNIV_LIKELY(error == DB_SUCCESS)) {
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
goto next_rec;
|
|
|
|
}
|
2007-04-13 14:11:43 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
thr->lock_state = QUE_THR_LOCK_ROW;
|
|
|
|
trx->error_state = error;
|
|
|
|
que_thr_stop_for_mysql(thr);
|
|
|
|
thr->lock_state = QUE_THR_LOCK_NOLOCK;
|
|
|
|
} while (row_mysql_handle_errors(&error, trx,
|
|
|
|
thr, NULL));
|
2007-04-13 14:11:43 +02:00
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
goto err_exit;
|
2007-04-13 14:11:43 +02:00
|
|
|
next_rec:
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_empty(tuple_heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
que_thr_stop_for_mysql_no_error(thr, trx);
|
2007-04-13 14:11:43 +02:00
|
|
|
err_exit:
|
2007-04-04 13:05:33 +02:00
|
|
|
que_graph_free(thr->graph);
|
|
|
|
|
|
|
|
trx->op_info = "";
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
mem_heap_free(tuple_heap);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
2007-08-21 14:10:14 +02:00
|
|
|
/*************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Sets an exclusive lock on a table, for the duration of creating indexes.
|
|
|
|
@return error code or DB_SUCCESS */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-08-21 14:10:14 +02:00
|
|
|
ulint
|
|
|
|
row_merge_lock_table(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in/out: transaction */
|
|
|
|
dict_table_t* table, /*!< in: table to lock */
|
|
|
|
enum lock_mode mode) /*!< in: LOCK_X or LOCK_S */
|
2007-08-21 14:10:14 +02:00
|
|
|
{
|
|
|
|
mem_heap_t* heap;
|
|
|
|
que_thr_t* thr;
|
|
|
|
ulint err;
|
|
|
|
sel_node_t* node;
|
|
|
|
|
|
|
|
ut_ad(trx);
|
|
|
|
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
branches/zip: Fast index creation: Remove the ROW_PREBUILT_OBSOLETE nonsense.
Active transactions must not switch table or index definitions on the fly,
for several reasons, including the following:
* copied indexes do not carry any history or locking information;
that is, rollbacks, read views, and record locking would be broken
* huge potential for race conditions, inconsistent reads and writes,
loss of data, and corruption
Instead of trying to track down if the table was changed during a transaction,
acquire appropriate locks that protect the creation and dropping of indexes.
innodb-index.test: Test the locking of CREATE INDEX and DROP INDEX. Test
that consistent reads work across dropped indexes.
lock_rec_insert_check_and_lock(): Relax the lock_table_has() assertion.
When inserting a record into an index, the table must be at least IX-locked.
However, when an index is being created, an IS-lock on the table is
sufficient.
row_merge_lock_table(): Add the parameter enum lock_mode mode, which must
be LOCK_X or LOCK_S.
row_merge_drop_table(): Assert that n_mysql_handles_opened == 0.
Unconditionally drop the table.
ha_innobase::add_index(): Acquire an X or S lock on the table, as appropriate.
After acquiring an X lock, assert that n_mysql_handles_opened == 1.
Remove the comments about dropping tables in the background.
ha_innobase::final_drop_index(): Acquire an X lock on the table.
dict_table_t: Remove version_number, to_be_dropped, and prebuilts.
ins_node_t: Remove table_version_number.
enum lock_mode: Move the definition from lock0lock.h to lock0types.h.
ROW_PREBUILT_OBSOLETE, row_update_prebuilt(), row_prebuilt_table_obsolete():
Remove.
row_prebuilt_t: Remove the declaration from row0types.h.
row_drop_table_for_mysql_no_commit(): Always print a warning if a table
was added to the background drop queue.
2007-12-17 16:49:59 +01:00
|
|
|
ut_ad(mode == LOCK_X || mode == LOCK_S);
|
2007-08-21 14:10:14 +02:00
|
|
|
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
|
2007-12-17 21:51:34 +01:00
|
|
|
trx->op_info = "setting table lock for creating or dropping index";
|
2007-08-21 14:10:14 +02:00
|
|
|
|
|
|
|
node = sel_node_create(heap);
|
|
|
|
thr = pars_complete_graph_for_exec(node, trx, heap);
|
|
|
|
thr->graph->state = QUE_FORK_ACTIVE;
|
|
|
|
|
|
|
|
/* We use the select query graph as the dummy graph needed
|
|
|
|
in the lock module call */
|
|
|
|
|
|
|
|
thr = que_fork_get_first_thr(que_node_get_parent(thr));
|
|
|
|
que_thr_move_to_run_state_for_mysql(thr, trx);
|
|
|
|
|
|
|
|
run_again:
|
|
|
|
thr->run_node = thr;
|
|
|
|
thr->prev_node = thr->common.parent;
|
|
|
|
|
branches/zip: Fast index creation: Remove the ROW_PREBUILT_OBSOLETE nonsense.
Active transactions must not switch table or index definitions on the fly,
for several reasons, including the following:
* copied indexes do not carry any history or locking information;
that is, rollbacks, read views, and record locking would be broken
* huge potential for race conditions, inconsistent reads and writes,
loss of data, and corruption
Instead of trying to track down if the table was changed during a transaction,
acquire appropriate locks that protect the creation and dropping of indexes.
innodb-index.test: Test the locking of CREATE INDEX and DROP INDEX. Test
that consistent reads work across dropped indexes.
lock_rec_insert_check_and_lock(): Relax the lock_table_has() assertion.
When inserting a record into an index, the table must be at least IX-locked.
However, when an index is being created, an IS-lock on the table is
sufficient.
row_merge_lock_table(): Add the parameter enum lock_mode mode, which must
be LOCK_X or LOCK_S.
row_merge_drop_table(): Assert that n_mysql_handles_opened == 0.
Unconditionally drop the table.
ha_innobase::add_index(): Acquire an X or S lock on the table, as appropriate.
After acquiring an X lock, assert that n_mysql_handles_opened == 1.
Remove the comments about dropping tables in the background.
ha_innobase::final_drop_index(): Acquire an X lock on the table.
dict_table_t: Remove version_number, to_be_dropped, and prebuilts.
ins_node_t: Remove table_version_number.
enum lock_mode: Move the definition from lock0lock.h to lock0types.h.
ROW_PREBUILT_OBSOLETE, row_update_prebuilt(), row_prebuilt_table_obsolete():
Remove.
row_prebuilt_t: Remove the declaration from row0types.h.
row_drop_table_for_mysql_no_commit(): Always print a warning if a table
was added to the background drop queue.
2007-12-17 16:49:59 +01:00
|
|
|
err = lock_table(0, table, mode, thr);
|
2007-08-21 14:10:14 +02:00
|
|
|
|
|
|
|
trx->error_state = err;
|
|
|
|
|
|
|
|
if (UNIV_LIKELY(err == DB_SUCCESS)) {
|
|
|
|
que_thr_stop_for_mysql_no_error(thr, trx);
|
|
|
|
} else {
|
|
|
|
que_thr_stop_for_mysql(thr);
|
|
|
|
|
|
|
|
if (err != DB_QUE_THR_SUSPENDED) {
|
|
|
|
ibool was_lock_wait;
|
|
|
|
|
|
|
|
was_lock_wait = row_mysql_handle_errors(
|
|
|
|
&err, trx, thr, NULL);
|
|
|
|
|
|
|
|
if (was_lock_wait) {
|
|
|
|
goto run_again;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
que_thr_t* run_thr;
|
|
|
|
que_node_t* parent;
|
|
|
|
|
|
|
|
parent = que_node_get_parent(thr);
|
|
|
|
run_thr = que_fork_start_command(parent);
|
|
|
|
|
|
|
|
ut_a(run_thr == thr);
|
|
|
|
|
|
|
|
/* There was a lock wait but the thread was not
|
|
|
|
in a ready to run or running state. */
|
|
|
|
trx->error_state = DB_LOCK_WAIT;
|
|
|
|
|
|
|
|
goto run_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
que_graph_free(thr->graph);
|
|
|
|
trx->op_info = "";
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/*************************************************************************
|
2008-10-11 21:37:21 +02:00
|
|
|
Drop an index from the InnoDB system tables. The data dictionary must
|
|
|
|
have been locked exclusively by the caller, because the transaction
|
|
|
|
will not be committed. */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-06-04 09:49:31 +02:00
|
|
|
void
|
|
|
|
row_merge_drop_index(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_index_t* index, /*!< in: index to be removed */
|
|
|
|
dict_table_t* table, /*!< in: table */
|
|
|
|
trx_t* trx) /*!< in: transaction handle */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
|
|
|
ulint err;
|
2007-04-11 14:42:54 +02:00
|
|
|
pars_info_t* info = pars_info_create();
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
/* We use the private SQL parser of Innobase to generate the
|
|
|
|
query graphs needed in deleting the dictionary data from system
|
|
|
|
tables in Innobase. Deleting a row from SYS_INDEXES table also
|
|
|
|
frees the file segments of the B-tree associated with the index. */
|
|
|
|
|
|
|
|
static const char str1[] =
|
|
|
|
"PROCEDURE DROP_INDEX_PROC () IS\n"
|
|
|
|
"BEGIN\n"
|
2007-04-11 14:42:54 +02:00
|
|
|
"DELETE FROM SYS_FIELDS WHERE INDEX_ID = :indexid;\n"
|
|
|
|
"DELETE FROM SYS_INDEXES WHERE ID = :indexid\n"
|
|
|
|
" AND TABLE_ID = :tableid;\n"
|
2007-04-04 13:05:33 +02:00
|
|
|
"END;\n";
|
|
|
|
|
|
|
|
ut_ad(index && table && trx);
|
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
pars_info_add_dulint_literal(info, "indexid", index->id);
|
|
|
|
pars_info_add_dulint_literal(info, "tableid", table->id);
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
trx_start_if_not_started(trx);
|
|
|
|
trx->op_info = "dropping index";
|
|
|
|
|
2008-10-11 21:37:21 +02:00
|
|
|
ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
err = que_eval_sql(info, str1, FALSE, trx);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
ut_a(err == DB_SUCCESS);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
/* Replace this index with another equivalent index for all
|
|
|
|
foreign key constraints on this table where this index is used */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
dict_table_replace_index_in_foreign_list(table, index);
|
|
|
|
dict_index_remove_from_cache(table, index);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
trx->op_info = "";
|
2007-06-04 09:49:31 +02:00
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-04 09:49:31 +02:00
|
|
|
/*************************************************************************
|
2008-10-11 21:37:21 +02:00
|
|
|
Drop those indexes which were created before an error occurred when
|
|
|
|
building an index. The data dictionary must have been locked
|
|
|
|
exclusively by the caller, because the transaction will not be
|
|
|
|
committed. */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-06-04 09:49:31 +02:00
|
|
|
void
|
|
|
|
row_merge_drop_indexes(
|
|
|
|
/*===================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: transaction */
|
|
|
|
dict_table_t* table, /*!< in: table containing the indexes */
|
|
|
|
dict_index_t** index, /*!< in: indexes to drop */
|
|
|
|
ulint num_created) /*!< in: number of elements in index[] */
|
2007-06-04 09:49:31 +02:00
|
|
|
{
|
|
|
|
ulint key_num;
|
|
|
|
|
|
|
|
for (key_num = 0; key_num < num_created; key_num++) {
|
|
|
|
row_merge_drop_index(index[key_num], table, trx);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
/*************************************************************************
|
|
|
|
Drop all partially created indexes during crash recovery. */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-09-05 12:18:03 +02:00
|
|
|
void
|
|
|
|
row_merge_drop_temp_indexes(void)
|
|
|
|
/*=============================*/
|
|
|
|
{
|
|
|
|
trx_t* trx;
|
|
|
|
ulint err;
|
|
|
|
|
|
|
|
/* We use the private SQL parser of Innobase to generate the
|
|
|
|
query graphs needed in deleting the dictionary data from system
|
|
|
|
tables in Innobase. Deleting a row from SYS_INDEXES table also
|
|
|
|
frees the file segments of the B-tree associated with the index. */
|
|
|
|
#if TEMP_INDEX_PREFIX != '\377'
|
|
|
|
# error "TEMP_INDEX_PREFIX != '\377'"
|
|
|
|
#endif
|
|
|
|
static const char drop_temp_indexes[] =
|
|
|
|
"PROCEDURE DROP_TEMP_INDEXES_PROC () IS\n"
|
|
|
|
"indexid CHAR;\n"
|
|
|
|
"DECLARE CURSOR c IS SELECT ID FROM SYS_INDEXES\n"
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
"WHERE SUBSTR(NAME,0,1)='\377';\n"
|
2007-09-05 12:18:03 +02:00
|
|
|
"BEGIN\n"
|
|
|
|
"\tOPEN c;\n"
|
branches/innodb+: Merge revisions 3180:3312 from branches/zip:
------------------------------------------------------------------------
r3254 | marko | 2008-11-24 18:01:42 +0200 (Mon, 24 Nov 2008) | 4 lines
branches/zip: Note that it is legitimate for a secondary index record not
to be found during purge. This tries to address Issue #129. The comments
were supplied by Heikki.
------------------------------------------------------------------------
r3286 | marko | 2008-11-26 10:00:28 +0200 (Wed, 26 Nov 2008) | 18 lines
branches/zip: row_merge_drop_temp_indexes(): Replace the WHILE 1 with
WHILE 1=1 in the SQL procedure, so that the loop will actually be
entered and temporary indexes be dropped during crash recovery.
Thanks to Sunny Bains for pointing this out.
Tested as follows:
Set a breakpoint in row_merge_rename_indexes.
CREATE TABLE t(a INT)ENGINE=InnoDB;
CREATE INDEX a ON t(a);
-- The breakpoint will be reached. Kill and restart mysqld.
SHOW CREATE TABLE t;
-- This shows the MySQL .frm file, without and index.
CREATE TABLE innodb_table_monitor(a INT)ENGINE=InnoDB;
-- This will dump the InnoDB dictionary to the error log, without the index.
------------------------------------------------------------------------
r3302 | vasil | 2008-11-27 23:26:39 +0200 (Thu, 27 Nov 2008) | 12 lines
branches/zip:
Fix Mantis issue#130 wdl: does not handle 64-bit address
- Change the call from strtoul() to strtoull()
- Change "%16X" to "%16llx" when scanning preferred load address
rb://58
Submitted by: Calvin
Approved by: Marko
------------------------------------------------------------------------
r3303 | vasil | 2008-11-27 23:31:18 +0200 (Thu, 27 Nov 2008) | 10 lines
branches/zip:
* Remove a change from win-plugin/win-plugin.diff about time_t because
MySQL has used VS2005 for building 5.1.30.
* Adjust the line numbers so the patch applies cleanly without fuzz and
offset messages.
Submitted by: Calvin
------------------------------------------------------------------------
r3304 | vasil | 2008-11-27 23:33:48 +0200 (Thu, 27 Nov 2008) | 6 lines
branches/zip:
Non-functional change in win-plugin/win-plugin.diff: fix the file name
before the diff, this is irrelevant but it is nice to be the same as
the file name on the following line.
------------------------------------------------------------------------
r3312 | marko | 2008-11-28 16:18:43 +0200 (Fri, 28 Nov 2008) | 5 lines
branches/zip: row_undo_mod_del_mark_or_remove_sec_low(): Complain if
the secondary index entry cannot be found, and this is not an incomplete
transaction that is being rolled back in crash recovery. The source code
comments were suggested by Heikki.
------------------------------------------------------------------------
2008-11-28 15:58:51 +01:00
|
|
|
"\tWHILE 1=1 LOOP\n"
|
2007-09-05 12:18:03 +02:00
|
|
|
"\t\tFETCH c INTO indexid;\n"
|
|
|
|
"\t\tIF (SQL % NOTFOUND) THEN\n"
|
|
|
|
"\t\t\tEXIT;\n"
|
|
|
|
"\t\tEND IF;\n"
|
|
|
|
"\t\tDELETE FROM SYS_FIELDS WHERE INDEX_ID = indexid;\n"
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
"\t\tDELETE FROM SYS_INDEXES WHERE ID = indexid;\n"
|
2007-09-05 12:18:03 +02:00
|
|
|
"\tEND LOOP;\n"
|
|
|
|
"\tCLOSE c;\n"
|
2007-10-29 16:25:46 +01:00
|
|
|
"\tCOMMIT WORK;\n"
|
2007-09-05 12:18:03 +02:00
|
|
|
"END;\n";
|
|
|
|
|
|
|
|
trx = trx_allocate_for_background();
|
|
|
|
trx->op_info = "dropping partially created indexes";
|
|
|
|
row_mysql_lock_data_dictionary(trx);
|
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 15:25:45 +01:00
|
|
|
/* Incomplete transactions may be holding some locks on the
|
|
|
|
data dictionary tables. However, they should never have been
|
|
|
|
able to lock the records corresponding to the partially
|
|
|
|
created indexes that we are attempting to delete, because the
|
|
|
|
table was locked when the indexes were being created. We will
|
|
|
|
drop the partially created indexes before the rollback of
|
|
|
|
incomplete transactions is initiated. Thus, this should not
|
|
|
|
interfere with the incomplete transactions. */
|
|
|
|
trx->isolation_level = TRX_ISO_READ_UNCOMMITTED;
|
2007-09-05 12:18:03 +02:00
|
|
|
err = que_eval_sql(NULL, drop_temp_indexes, FALSE, trx);
|
|
|
|
ut_a(err == DB_SUCCESS);
|
|
|
|
|
|
|
|
row_mysql_unlock_data_dictionary(trx);
|
|
|
|
trx_free_for_background(trx);
|
|
|
|
}
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/*************************************************************************
|
2007-06-08 09:37:07 +02:00
|
|
|
Create a merge file. */
|
|
|
|
static
|
2007-04-11 10:16:14 +02:00
|
|
|
void
|
|
|
|
row_merge_file_create(
|
|
|
|
/*==================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
merge_file_t* merge_file) /*!< out: merge file structure */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-08 09:37:07 +02:00
|
|
|
merge_file->fd = innobase_mysql_tmpfile();
|
2007-04-12 12:32:16 +02:00
|
|
|
merge_file->offset = 0;
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Destroy a merge file. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
row_merge_file_destroy(
|
|
|
|
/*===================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
merge_file_t* merge_file) /*!< out: merge file structure */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
if (merge_file->fd != -1) {
|
|
|
|
close(merge_file->fd);
|
|
|
|
merge_file->fd = -1;
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2007-08-10 17:52:09 +02:00
|
|
|
Determine the precise type of a column that is added to a tem
|
2009-05-25 08:46:10 +02:00
|
|
|
if a column must be constrained NOT NULL.
|
|
|
|
@return col->prtype, possibly ORed with DATA_NOT_NULL */
|
2007-08-10 17:52:09 +02:00
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
row_merge_col_prtype(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_col_t* col, /*!< in: column */
|
|
|
|
const char* col_name, /*!< in: name of the column */
|
|
|
|
const merge_index_def_t*index_def) /*!< in: the index definition
|
2007-08-10 17:52:09 +02:00
|
|
|
of the primary key */
|
|
|
|
{
|
|
|
|
ulint prtype = col->prtype;
|
|
|
|
ulint i;
|
|
|
|
|
|
|
|
ut_ad(index_def->ind_type & DICT_CLUSTERED);
|
|
|
|
|
|
|
|
if (prtype & DATA_NOT_NULL) {
|
|
|
|
|
|
|
|
return(prtype);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All columns that are included
|
|
|
|
in the PRIMARY KEY must be NOT NULL. */
|
|
|
|
|
|
|
|
for (i = 0; i < index_def->n_fields; i++) {
|
|
|
|
if (!strcmp(col_name, index_def->fields[i].field_name)) {
|
|
|
|
return(prtype | DATA_NOT_NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return(prtype);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Create a temporary table for creating a primary key, using the definition
|
2009-05-25 08:46:10 +02:00
|
|
|
of an existing table.
|
|
|
|
@return table, or NULL on error */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-04-04 13:05:33 +02:00
|
|
|
dict_table_t*
|
|
|
|
row_merge_create_temporary_table(
|
|
|
|
/*=============================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const char* table_name, /*!< in: new table name */
|
|
|
|
const merge_index_def_t*index_def, /*!< in: the index definition
|
2007-08-10 17:52:09 +02:00
|
|
|
of the primary key */
|
2009-05-25 08:46:10 +02:00
|
|
|
const dict_table_t* table, /*!< in: old table definition */
|
|
|
|
trx_t* trx) /*!< in/out: transaction
|
2007-08-10 17:52:09 +02:00
|
|
|
(sets error_state) */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
|
|
|
ulint i;
|
|
|
|
dict_table_t* new_table = NULL;
|
|
|
|
ulint n_cols = dict_table_get_n_user_cols(table);
|
2007-06-06 22:25:35 +02:00
|
|
|
ulint error;
|
2007-09-05 12:18:03 +02:00
|
|
|
mem_heap_t* heap = mem_heap_create(1000);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-08-02 11:46:28 +02:00
|
|
|
ut_ad(table_name);
|
2007-08-10 17:52:09 +02:00
|
|
|
ut_ad(index_def);
|
2007-08-02 11:46:28 +02:00
|
|
|
ut_ad(table);
|
2007-04-04 13:05:33 +02:00
|
|
|
ut_ad(mutex_own(&dict_sys->mutex));
|
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
new_table = dict_mem_table_create(table_name, 0, n_cols, table->flags);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
for (i = 0; i < n_cols; i++) {
|
|
|
|
const dict_col_t* col;
|
|
|
|
const char* col_name;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
col = dict_table_get_nth_col(table, i);
|
|
|
|
col_name = dict_table_get_col_name(table, i);
|
2007-06-06 22:25:35 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
dict_mem_table_add_col(new_table, heap, col_name, col->mtype,
|
|
|
|
row_merge_col_prtype(col, col_name,
|
|
|
|
index_def),
|
|
|
|
col->len);
|
2007-06-06 22:25:35 +02:00
|
|
|
}
|
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
error = row_create_table_for_mysql(new_table, trx);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
2007-06-06 22:25:35 +02:00
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
trx->error_state = error;
|
2007-09-05 12:18:03 +02:00
|
|
|
new_table = NULL;
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return(new_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2008-10-11 21:37:21 +02:00
|
|
|
Rename the temporary indexes in the dictionary to permanent ones. The
|
|
|
|
data dictionary must have been locked exclusively by the caller,
|
2009-05-25 08:46:10 +02:00
|
|
|
because the transaction will not be committed.
|
|
|
|
@return DB_SUCCESS if all OK */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-04-04 13:05:33 +02:00
|
|
|
ulint
|
2007-09-05 12:18:03 +02:00
|
|
|
row_merge_rename_indexes(
|
|
|
|
/*=====================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in/out: transaction */
|
|
|
|
dict_table_t* table) /*!< in/out: table with new indexes */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
|
|
|
ulint err = DB_SUCCESS;
|
2007-04-11 14:42:54 +02:00
|
|
|
pars_info_t* info = pars_info_create();
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
/* We use the private SQL parser of Innobase to generate the
|
2007-09-05 12:18:03 +02:00
|
|
|
query graphs needed in renaming indexes. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
#if TEMP_INDEX_PREFIX != '\377'
|
|
|
|
# error "TEMP_INDEX_PREFIX != '\377'"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const char rename_indexes[] =
|
|
|
|
"PROCEDURE RENAME_INDEXES_PROC () IS\n"
|
2007-04-04 13:05:33 +02:00
|
|
|
"BEGIN\n"
|
2007-09-05 12:18:03 +02:00
|
|
|
"UPDATE SYS_INDEXES SET NAME=SUBSTR(NAME,1,LENGTH(NAME)-1)\n"
|
|
|
|
"WHERE TABLE_ID = :tableid AND SUBSTR(NAME,0,1)='\377';\n"
|
2007-04-04 13:05:33 +02:00
|
|
|
"END;\n";
|
|
|
|
|
2008-10-11 21:37:21 +02:00
|
|
|
ut_ad(table);
|
|
|
|
ut_ad(trx);
|
|
|
|
ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
trx->op_info = "renaming indexes";
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-04-11 14:42:54 +02:00
|
|
|
pars_info_add_dulint_literal(info, "tableid", table->id);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
err = que_eval_sql(info, rename_indexes, FALSE, trx);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
if (err == DB_SUCCESS) {
|
2007-09-05 12:18:03 +02:00
|
|
|
dict_index_t* index = dict_table_get_first_index(table);
|
|
|
|
do {
|
|
|
|
if (*index->name == TEMP_INDEX_PREFIX) {
|
|
|
|
index->name++;
|
|
|
|
}
|
|
|
|
index = dict_table_get_next_index(index);
|
|
|
|
} while (index);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
trx->op_info = "";
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
2007-08-20 13:40:00 +02:00
|
|
|
/*************************************************************************
|
2008-10-11 21:37:21 +02:00
|
|
|
Rename the tables in the data dictionary. The data dictionary must
|
|
|
|
have been locked exclusively by the caller, because the transaction
|
2009-05-25 08:46:10 +02:00
|
|
|
will not be committed.
|
|
|
|
@return error code or DB_SUCCESS */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-08-20 13:40:00 +02:00
|
|
|
ulint
|
|
|
|
row_merge_rename_tables(
|
|
|
|
/*====================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_table_t* old_table, /*!< in/out: old table, renamed to
|
2007-08-20 13:40:00 +02:00
|
|
|
tmp_name */
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_table_t* new_table, /*!< in/out: new table, renamed to
|
2007-08-20 13:40:00 +02:00
|
|
|
old_table->name */
|
2009-05-25 08:46:10 +02:00
|
|
|
const char* tmp_name, /*!< in: new name for old_table */
|
|
|
|
trx_t* trx) /*!< in: transaction handle */
|
2007-08-20 13:40:00 +02:00
|
|
|
{
|
|
|
|
ulint err = DB_ERROR;
|
|
|
|
pars_info_t* info;
|
|
|
|
const char* old_name= old_table->name;
|
|
|
|
|
|
|
|
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
|
|
ut_ad(old_table != new_table);
|
2007-08-29 10:45:34 +02:00
|
|
|
ut_ad(mutex_own(&dict_sys->mutex));
|
2007-08-20 13:40:00 +02:00
|
|
|
|
2008-10-11 21:37:21 +02:00
|
|
|
ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
|
|
|
|
|
2007-08-20 13:40:00 +02:00
|
|
|
trx->op_info = "renaming tables";
|
|
|
|
|
|
|
|
/* We use the private SQL parser of Innobase to generate the query
|
|
|
|
graphs needed in updating the dictionary data in system tables. */
|
|
|
|
|
|
|
|
info = pars_info_create();
|
|
|
|
|
|
|
|
pars_info_add_str_literal(info, "new_name", new_table->name);
|
|
|
|
pars_info_add_str_literal(info, "old_name", old_name);
|
|
|
|
pars_info_add_str_literal(info, "tmp_name", tmp_name);
|
|
|
|
|
|
|
|
err = que_eval_sql(info,
|
|
|
|
"PROCEDURE RENAME_TABLES () IS\n"
|
|
|
|
"BEGIN\n"
|
|
|
|
"UPDATE SYS_TABLES SET NAME = :tmp_name\n"
|
|
|
|
" WHERE NAME = :old_name;\n"
|
|
|
|
"UPDATE SYS_TABLES SET NAME = :old_name\n"
|
|
|
|
" WHERE NAME = :new_name;\n"
|
|
|
|
"END;\n", FALSE, trx);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto err_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The following calls will also rename the .ibd data files if
|
|
|
|
the tables are stored in a single-table tablespace */
|
|
|
|
|
|
|
|
if (!dict_table_rename_in_cache(old_table, tmp_name, FALSE)
|
|
|
|
|| !dict_table_rename_in_cache(new_table, old_name, FALSE)) {
|
|
|
|
|
|
|
|
err = DB_ERROR;
|
|
|
|
goto err_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = dict_load_foreigns(old_name, TRUE);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
err_exit:
|
|
|
|
trx->error_state = DB_SUCCESS;
|
|
|
|
trx_general_rollback_for_mysql(trx, FALSE, NULL);
|
|
|
|
trx->error_state = DB_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->op_info = "";
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
2007-12-19 16:05:13 +01:00
|
|
|
/*************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Create and execute a query graph for creating an index.
|
|
|
|
@return DB_SUCCESS or error code */
|
2007-12-19 16:05:13 +01:00
|
|
|
static
|
|
|
|
ulint
|
|
|
|
row_merge_create_index_graph(
|
|
|
|
/*=========================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: trx */
|
|
|
|
dict_table_t* table, /*!< in: table */
|
|
|
|
dict_index_t* index) /*!< in: index */
|
2007-12-19 16:05:13 +01:00
|
|
|
{
|
|
|
|
ind_node_t* node; /* Index creation node */
|
|
|
|
mem_heap_t* heap; /* Memory heap */
|
|
|
|
que_thr_t* thr; /* Query thread */
|
|
|
|
ulint err;
|
|
|
|
|
|
|
|
ut_ad(trx);
|
|
|
|
ut_ad(table);
|
|
|
|
ut_ad(index);
|
|
|
|
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
|
|
|
|
index->table = table;
|
|
|
|
node = ind_create_graph_create(index, heap);
|
|
|
|
thr = pars_complete_graph_for_exec(node, trx, heap);
|
|
|
|
|
|
|
|
ut_a(thr == que_fork_start_command(que_node_get_parent(thr)));
|
|
|
|
|
|
|
|
que_run_threads(thr);
|
|
|
|
|
|
|
|
err = trx->error_state;
|
|
|
|
|
|
|
|
que_graph_free((que_t*) que_node_get_parent(thr));
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
2007-04-04 13:05:33 +02:00
|
|
|
/*************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Create the index and load in to the dictionary.
|
|
|
|
@return index, or NULL on error */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-06-06 22:25:35 +02:00
|
|
|
dict_index_t*
|
2007-04-04 13:05:33 +02:00
|
|
|
row_merge_create_index(
|
|
|
|
/*===================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in/out: trx (sets error_state) */
|
|
|
|
dict_table_t* table, /*!< in: the index is on this table */
|
branches/innodb+: Merge revisions 4660:5090 from branches/zip:
------------------------------------------------------------------------
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.
------------------------------------------------------------------------
2009-05-25 08:20:53 +02:00
|
|
|
const merge_index_def_t*index_def)
|
2009-05-25 08:46:10 +02:00
|
|
|
/*!< in: the index definition */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
2007-06-06 22:25:35 +02:00
|
|
|
dict_index_t* index;
|
2007-09-05 12:18:03 +02:00
|
|
|
ulint err;
|
2007-04-04 13:05:33 +02:00
|
|
|
ulint n_fields = index_def->n_fields;
|
2007-09-05 12:18:03 +02:00
|
|
|
ulint i;
|
2007-04-04 13:05:33 +02:00
|
|
|
|
|
|
|
/* Create the index prototype, using the passed in def, this is not
|
|
|
|
a persistent operation. We pass 0 as the space id, and determine at
|
2007-06-08 09:37:07 +02:00
|
|
|
a lower level the space id where to store the table. */
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-06 22:25:35 +02:00
|
|
|
index = dict_mem_index_create(table->name, index_def->name,
|
|
|
|
0, index_def->ind_type, n_fields);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-06-06 22:25:35 +02:00
|
|
|
ut_a(index);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
for (i = 0; i < n_fields; i++) {
|
|
|
|
merge_index_field_t* ifield = &index_def->fields[i];
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
dict_mem_index_add_field(index, ifield->field_name,
|
|
|
|
ifield->prefix_len);
|
|
|
|
}
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2008-09-17 21:52:30 +02:00
|
|
|
/* Add the index to SYS_INDEXES, using the index prototype. */
|
2007-12-19 16:05:13 +01:00
|
|
|
err = row_merge_create_index_graph(trx, table, index);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
if (err == DB_SUCCESS) {
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
index = row_merge_dict_table_get_index(
|
|
|
|
table, index_def);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
ut_a(index);
|
2007-04-04 13:05:33 +02:00
|
|
|
|
2007-09-05 12:18:03 +02:00
|
|
|
/* Note the id of the transaction that created this
|
|
|
|
index, we use it to restrict readers from accessing
|
|
|
|
this index, to ensure read consistency. */
|
branches/innodb+: Merge revisions 4528:4657 from branches/zip:
------------------------------------------------------------------------
r4530 | marko | 2009-03-24 14:02:29 +0200 (Tue, 24 Mar 2009) | 3 lines
branches/zip: Remove references to UNIV_HOTBACKUP from files that are
not used when building InnoDB Hot Backup. Declare
innobase_invalidate_query_cache() in ha_prototypes.h.
------------------------------------------------------------------------
r4531 | marko | 2009-03-24 15:46:12 +0200 (Tue, 24 Mar 2009) | 7 lines
branches/zip: Note that buf_page_t::list and buf_page_t::in_flush_list
are only protected by buf_pool_mutex, not by the block mutex.
buf_page_release(): Remove the assertion on in_flush_list.
The function is only holding block->mutex, not buf_pool_mutex.
This was reported by Sunny. This was the only piece of code
that accessed in_flush_list while not holding buf_pool_mutex.
------------------------------------------------------------------------
r4532 | calvin | 2009-03-24 17:59:45 +0200 (Tue, 24 Mar 2009) | 13 lines
branches/zip: Mantis issue #201 - remove innodb_plugin_init() due to
new option --ignore_builtin_innodb
Starting 5.1.33, MySQL has a new option --ignore_builtin_innodb
for using the dynamic plugin. It is required to remove
innodb_plugin_init() in the plugin.
This patch removes innodb_plugin_init() as well as functions,
variables used by innodb_plugin_init().
rb://98
Approved by: Marko
------------------------------------------------------------------------
r4543 | inaam | 2009-03-25 19:18:33 +0200 (Wed, 25 Mar 2009) | 17 lines
branches/zip
SHOW ENGINE INNODB MUTEX shows all mutexes and rw_locks. This can
be overwhelming particularly when the buffer pool is very large
(note that each block in buffer pool has at least one mutex, one
rw_lock and an additional mutex if rw_lock does not use atomics).
With this patch status of following mutexes and rw-locks is not shown:
1) block->mutex
2) block->lock
3) block->lock->mutex (if applicable)
4) All other mutexes and rw-locks for which number of os-waits are zero
Addresses issue# 179 rb://99
Approved by: Marko
------------------------------------------------------------------------
r4579 | marko | 2009-03-31 10:40:58 +0300 (Tue, 31 Mar 2009) | 3 lines
branches/zip: struct read_view_struct: Add clarifying comments about
low_limit_id and up_limit_id.
------------------------------------------------------------------------
r4630 | calvin | 2009-04-02 15:46:47 +0300 (Thu, 02 Apr 2009) | 6 lines
branches/zip: Mantis issue #197 - Make srv_spin_wait_delay configurable
New parameter innodb_spin_wait_delay to set the maximum delay between
polling for a spin lock. 5 is the default.
Approved by: Marko (on IM)
------------------------------------------------------------------------
r4631 | marko | 2009-04-02 16:23:12 +0300 (Thu, 02 Apr 2009) | 24 lines
branches/zip: Refuse to use newly created indexes that may lack
history. This addresses Mantis issue #116.
dict_index_t: Enable the storage of trx_id.
row_prebuilt_t: Make many fields bit-fields to reduce the memory
footprint. Add index_usable.
ha_innobase::change_active_index(): Check if the index is usable and
set prebuilt->index_usable accordingly. Unfortunately, the return
status of this function is ignored by MySQL, and the actual refusal to
use the index must be made in row_search_for_mysql().
row_search_for_mysql(): Return DB_MISSING_HISTORY if
!prebuilt->index_usable.
convert_error_code_to_mysql(): Map DB_MISSING_HISTORY to
HA_ERR_TABLE_DEF_CHANGED.
innodb-index.test: Add a test case where access to a newly created
secondary index must be blocked for old transactions.
rb://100 approved by Heikki Tuuri
------------------------------------------------------------------------
r4647 | vasil | 2009-04-06 10:05:25 +0300 (Mon, 06 Apr 2009) | 4 lines
branches/zip:
Add changelog entry for c4630.
------------------------------------------------------------------------
r4648 | vasil | 2009-04-06 10:07:26 +0300 (Mon, 06 Apr 2009) | 4 lines
branches/zip:
Fix formatting in ChangeLog to be consistent.
------------------------------------------------------------------------
r4657 | marko | 2009-04-06 15:13:45 +0300 (Mon, 06 Apr 2009) | 1 line
branches/zip: Remove the bogus failure reported in Issue #219.
------------------------------------------------------------------------
2009-04-06 13:18:22 +02:00
|
|
|
index->trx_id = (ib_uint64_t)
|
|
|
|
ut_conv_dulint_to_longlong(trx->id);
|
2007-09-05 12:18:03 +02:00
|
|
|
} else {
|
|
|
|
index = NULL;
|
2007-06-06 22:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return(index);
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2007-06-08 09:37:07 +02:00
|
|
|
Check if a transaction can use an index. */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-04-04 13:05:33 +02:00
|
|
|
ibool
|
|
|
|
row_merge_is_index_usable(
|
|
|
|
/*======================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
const trx_t* trx, /*!< in: transaction */
|
|
|
|
const dict_index_t* index) /*!< in: index to check */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/innodb+: Merge revisions 4528:4657 from branches/zip:
------------------------------------------------------------------------
r4530 | marko | 2009-03-24 14:02:29 +0200 (Tue, 24 Mar 2009) | 3 lines
branches/zip: Remove references to UNIV_HOTBACKUP from files that are
not used when building InnoDB Hot Backup. Declare
innobase_invalidate_query_cache() in ha_prototypes.h.
------------------------------------------------------------------------
r4531 | marko | 2009-03-24 15:46:12 +0200 (Tue, 24 Mar 2009) | 7 lines
branches/zip: Note that buf_page_t::list and buf_page_t::in_flush_list
are only protected by buf_pool_mutex, not by the block mutex.
buf_page_release(): Remove the assertion on in_flush_list.
The function is only holding block->mutex, not buf_pool_mutex.
This was reported by Sunny. This was the only piece of code
that accessed in_flush_list while not holding buf_pool_mutex.
------------------------------------------------------------------------
r4532 | calvin | 2009-03-24 17:59:45 +0200 (Tue, 24 Mar 2009) | 13 lines
branches/zip: Mantis issue #201 - remove innodb_plugin_init() due to
new option --ignore_builtin_innodb
Starting 5.1.33, MySQL has a new option --ignore_builtin_innodb
for using the dynamic plugin. It is required to remove
innodb_plugin_init() in the plugin.
This patch removes innodb_plugin_init() as well as functions,
variables used by innodb_plugin_init().
rb://98
Approved by: Marko
------------------------------------------------------------------------
r4543 | inaam | 2009-03-25 19:18:33 +0200 (Wed, 25 Mar 2009) | 17 lines
branches/zip
SHOW ENGINE INNODB MUTEX shows all mutexes and rw_locks. This can
be overwhelming particularly when the buffer pool is very large
(note that each block in buffer pool has at least one mutex, one
rw_lock and an additional mutex if rw_lock does not use atomics).
With this patch status of following mutexes and rw-locks is not shown:
1) block->mutex
2) block->lock
3) block->lock->mutex (if applicable)
4) All other mutexes and rw-locks for which number of os-waits are zero
Addresses issue# 179 rb://99
Approved by: Marko
------------------------------------------------------------------------
r4579 | marko | 2009-03-31 10:40:58 +0300 (Tue, 31 Mar 2009) | 3 lines
branches/zip: struct read_view_struct: Add clarifying comments about
low_limit_id and up_limit_id.
------------------------------------------------------------------------
r4630 | calvin | 2009-04-02 15:46:47 +0300 (Thu, 02 Apr 2009) | 6 lines
branches/zip: Mantis issue #197 - Make srv_spin_wait_delay configurable
New parameter innodb_spin_wait_delay to set the maximum delay between
polling for a spin lock. 5 is the default.
Approved by: Marko (on IM)
------------------------------------------------------------------------
r4631 | marko | 2009-04-02 16:23:12 +0300 (Thu, 02 Apr 2009) | 24 lines
branches/zip: Refuse to use newly created indexes that may lack
history. This addresses Mantis issue #116.
dict_index_t: Enable the storage of trx_id.
row_prebuilt_t: Make many fields bit-fields to reduce the memory
footprint. Add index_usable.
ha_innobase::change_active_index(): Check if the index is usable and
set prebuilt->index_usable accordingly. Unfortunately, the return
status of this function is ignored by MySQL, and the actual refusal to
use the index must be made in row_search_for_mysql().
row_search_for_mysql(): Return DB_MISSING_HISTORY if
!prebuilt->index_usable.
convert_error_code_to_mysql(): Map DB_MISSING_HISTORY to
HA_ERR_TABLE_DEF_CHANGED.
innodb-index.test: Add a test case where access to a newly created
secondary index must be blocked for old transactions.
rb://100 approved by Heikki Tuuri
------------------------------------------------------------------------
r4647 | vasil | 2009-04-06 10:05:25 +0300 (Mon, 06 Apr 2009) | 4 lines
branches/zip:
Add changelog entry for c4630.
------------------------------------------------------------------------
r4648 | vasil | 2009-04-06 10:07:26 +0300 (Mon, 06 Apr 2009) | 4 lines
branches/zip:
Fix formatting in ChangeLog to be consistent.
------------------------------------------------------------------------
r4657 | marko | 2009-04-06 15:13:45 +0300 (Mon, 06 Apr 2009) | 1 line
branches/zip: Remove the bogus failure reported in Issue #219.
------------------------------------------------------------------------
2009-04-06 13:18:22 +02:00
|
|
|
return(!trx->read_view || read_view_sees_trx_id(
|
|
|
|
trx->read_view,
|
|
|
|
ut_dulint_create((ulint) (index->trx_id >> 32),
|
|
|
|
(ulint) index->trx_id & 0xFFFFFFFF)));
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2009-05-25 08:46:10 +02:00
|
|
|
Drop the old table.
|
|
|
|
@return DB_SUCCESS or error code */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-04-04 13:05:33 +02:00
|
|
|
ulint
|
|
|
|
row_merge_drop_table(
|
|
|
|
/*=================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: transaction */
|
|
|
|
dict_table_t* table) /*!< in: table to drop */
|
2007-04-04 13:05:33 +02:00
|
|
|
{
|
branches/zip: Fast index creation: Remove the ROW_PREBUILT_OBSOLETE nonsense.
Active transactions must not switch table or index definitions on the fly,
for several reasons, including the following:
* copied indexes do not carry any history or locking information;
that is, rollbacks, read views, and record locking would be broken
* huge potential for race conditions, inconsistent reads and writes,
loss of data, and corruption
Instead of trying to track down if the table was changed during a transaction,
acquire appropriate locks that protect the creation and dropping of indexes.
innodb-index.test: Test the locking of CREATE INDEX and DROP INDEX. Test
that consistent reads work across dropped indexes.
lock_rec_insert_check_and_lock(): Relax the lock_table_has() assertion.
When inserting a record into an index, the table must be at least IX-locked.
However, when an index is being created, an IS-lock on the table is
sufficient.
row_merge_lock_table(): Add the parameter enum lock_mode mode, which must
be LOCK_X or LOCK_S.
row_merge_drop_table(): Assert that n_mysql_handles_opened == 0.
Unconditionally drop the table.
ha_innobase::add_index(): Acquire an X or S lock on the table, as appropriate.
After acquiring an X lock, assert that n_mysql_handles_opened == 1.
Remove the comments about dropping tables in the background.
ha_innobase::final_drop_index(): Acquire an X lock on the table.
dict_table_t: Remove version_number, to_be_dropped, and prebuilts.
ins_node_t: Remove table_version_number.
enum lock_mode: Move the definition from lock0lock.h to lock0types.h.
ROW_PREBUILT_OBSOLETE, row_update_prebuilt(), row_prebuilt_table_obsolete():
Remove.
row_prebuilt_t: Remove the declaration from row0types.h.
row_drop_table_for_mysql_no_commit(): Always print a warning if a table
was added to the background drop queue.
2007-12-17 16:49:59 +01:00
|
|
|
/* There must be no open transactions on the table. */
|
|
|
|
ut_a(table->n_mysql_handles_opened == 0);
|
|
|
|
|
2008-10-11 21:37:21 +02:00
|
|
|
return(row_drop_table_for_mysql(table->name, trx, FALSE));
|
2007-04-04 13:05:33 +02:00
|
|
|
}
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Build indexes on a table by reading a clustered index,
|
|
|
|
creating a temporary file containing index entries, merge sorting
|
2009-05-25 08:46:10 +02:00
|
|
|
these index entries and inserting sorted index entries to indexes.
|
|
|
|
@return DB_SUCCESS or error code */
|
2008-02-06 15:17:36 +01:00
|
|
|
UNIV_INTERN
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint
|
|
|
|
row_merge_build_indexes(
|
|
|
|
/*====================*/
|
2009-05-25 08:46:10 +02:00
|
|
|
trx_t* trx, /*!< in: transaction */
|
|
|
|
dict_table_t* old_table, /*!< in: table where rows are
|
2007-06-08 09:37:07 +02:00
|
|
|
read from */
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_table_t* new_table, /*!< in: table where indexes are
|
2007-08-10 17:22:47 +02:00
|
|
|
created; identical to old_table
|
|
|
|
unless creating a PRIMARY KEY */
|
2009-05-25 08:46:10 +02:00
|
|
|
dict_index_t** indexes, /*!< in: indexes to be created */
|
|
|
|
ulint n_indexes, /*!< in: size of indexes[] */
|
|
|
|
TABLE* table) /*!< in/out: MySQL table, for
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
reporting erroneous key value
|
|
|
|
if applicable */
|
2007-06-08 09:37:07 +02:00
|
|
|
{
|
|
|
|
merge_file_t* merge_files;
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
row_merge_block_t* block;
|
|
|
|
ulint block_size;
|
2007-06-08 09:37:07 +02:00
|
|
|
ulint i;
|
|
|
|
ulint error;
|
|
|
|
int tmpfd;
|
|
|
|
|
|
|
|
ut_ad(trx);
|
|
|
|
ut_ad(old_table);
|
|
|
|
ut_ad(new_table);
|
|
|
|
ut_ad(indexes);
|
|
|
|
ut_ad(n_indexes);
|
|
|
|
|
|
|
|
trx_start_if_not_started(trx);
|
|
|
|
|
|
|
|
/* Allocate memory for merge file data structure and initialize
|
|
|
|
fields */
|
|
|
|
|
|
|
|
merge_files = mem_alloc(n_indexes * sizeof *merge_files);
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
block_size = 3 * sizeof *block;
|
|
|
|
block = os_mem_alloc_large(&block_size);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
for (i = 0; i < n_indexes; i++) {
|
|
|
|
|
|
|
|
row_merge_file_create(&merge_files[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpfd = innobase_mysql_tmpfile();
|
|
|
|
|
2007-09-26 15:47:32 +02:00
|
|
|
/* Reset the MySQL row buffer that is used when reporting
|
|
|
|
duplicate keys. */
|
|
|
|
innobase_rec_reset(table);
|
|
|
|
|
2007-06-08 09:37:07 +02:00
|
|
|
/* Read clustered index of the table and create files for
|
|
|
|
secondary index entries for merge sort */
|
|
|
|
|
|
|
|
error = row_merge_read_clustered_index(
|
branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0]. TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.
innobase_rec_reset(): New function, for resetting table->record[0].
row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.
dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.
dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.
row_merge_dup_t: Structure for counting and reporting duplicate records.
row_merge_dup_report(): Function for counting and reporting duplicate records.
row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.
row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.
row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.
row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.
row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 13:56:26 +02:00
|
|
|
trx, table, old_table, new_table, indexes,
|
2007-08-10 17:52:09 +02:00
|
|
|
merge_files, n_indexes, block);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto func_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we have files containing index entries ready for
|
|
|
|
sorting and inserting. */
|
|
|
|
|
|
|
|
for (i = 0; i < n_indexes; i++) {
|
|
|
|
error = row_merge_sort(indexes[i], &merge_files[i],
|
2007-09-27 10:28:25 +02:00
|
|
|
block, &tmpfd, table);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
if (error == DB_SUCCESS) {
|
|
|
|
error = row_merge_insert_index_tuples(
|
|
|
|
trx, indexes[i], new_table,
|
branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 11:43:15 +02:00
|
|
|
dict_table_zip_size(old_table),
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
merge_files[i].fd, block);
|
2007-06-08 09:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the temporary file to free up space. */
|
|
|
|
row_merge_file_destroy(&merge_files[i]);
|
|
|
|
|
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
trx->error_key_num = i;
|
|
|
|
goto func_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func_exit:
|
|
|
|
close(tmpfd);
|
|
|
|
|
|
|
|
for (i = 0; i < n_indexes; i++) {
|
|
|
|
row_merge_file_destroy(&merge_files[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
mem_free(merge_files);
|
branches/zip: row_merge_build_indexes(): Allocate all buffers with a
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
2007-06-08 11:49:50 +02:00
|
|
|
os_mem_free_large(block, block_size);
|
2007-06-08 09:37:07 +02:00
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|