Commit graph

66 commits

Author SHA1 Message Date
Marko Mäkelä
1df1a63924 Merge 10.2 into 10.3 2020-07-02 06:17:51 +03:00
Marko Mäkelä
c36834c832 MDEV-20377: Make WITH_MSAN more usable
MemorySanitizer (clang -fsanitize=memory) requires that all code
be compiled with instrumentation enabled. The only exception is the
C runtime library. Failure to use instrumented libraries will cause
bogus messages about memory being uninitialized.

In WITH_MSAN builds, we must avoid calling getservbyname(),
because even though it is a standard library function, it is
not instrumented, not even in clang 10.

Note: Before MariaDB Server 10.5, ./mtr will typically fail
due to the old PCRE library, which was updated in MDEV-14024.

The following cmake options were tested on 10.5
in commit 94d0bb4dbe:

cmake \
-DCMAKE_C_FLAGS='-march=native -O2' \
-DCMAKE_CXX_FLAGS='-stdlib=libc++ -march=native -O2' \
-DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug \
-DWITH_INNODB_{BZIP2,LZ4,LZMA,LZO,SNAPPY}=OFF \
-DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,SPIDER}=NO \
-DWITH_SAFEMALLOC=OFF \
-DWITH_{ZLIB,SSL,PCRE}=bundled \
-DHAVE_LIBAIO_H=0 \
-DWITH_MSAN=ON

MEM_MAKE_DEFINED(): An alias for VALGRIND_MAKE_MEM_DEFINED()
and __msan_unpoison().

MEM_GET_VBITS(), MEM_SET_VBITS(): Aliases for
VALGRIND_GET_VBITS(), VALGRIND_SET_VBITS(), __msan_copy_shadow().

InnoDB: Replace the UNIV_MEM_ macros with corresponding MEM_ macros.

ut_crc32_8_hw(), ut_crc32_64_low_hw(): Use the compiler built-in
functions instead of inline assembler when building WITH_MSAN.
This will require at least -msse4.2 when building for IA-32 or AMD64.
The inline assembler would not be instrumented, and would thus cause
bogus failures.
2020-07-01 17:23:00 +03:00
Oleksandr Byelkin
58b70dc136 Merge branch '10.2' into 10.3 2020-02-10 20:34:16 +01:00
Marko Mäkelä
a9d1324867 Cleanup: Remove mem_block_t::magic_n and mem_block_validate()
Use of freed memory is better caught by AddressSanitizer,
especially with ASAN_POISON_MEMORY_REGION that is aliased
by MEM_NOACCESS and UNIV_MEM_FREE.
2020-02-03 12:34:08 +02:00
Oleksandr Byelkin
55b2281a5d Merge branch '10.2' into 10.3 2019-10-31 10:58:06 +01:00
Marko Mäkelä
44b0c86971 Clean up ut_strlcpy(), ut_strlcpy_rev()
ut_strlcpy(): Replace with the standard function strncpy().

ut_strlcpy_rev(): Define in the same compilation unit where
the only caller resides. Avoid unnecessary definition
in non-debug builds.
2019-10-30 06:42:51 +02:00
Marko Mäkelä
bef843b97f MDEV-20917 InnoDB is passing NULL to nonnull function parameters
mem_heap_dup(): Avoid mem_heap_alloc() and memcpy() of data=NULL, len=0.

trx_undo_report_insert_virtual(), trx_undo_page_report_insert(),
trx_undo_page_report_modify(): Avoid memcpy(ptr, NULL, 0).

dfield_data_is_binary_equal(): Correctly handle data=NULL, len=0.

rec_init_offsets_temp(): Do allow def_val=NULL in the interface.

This clean-up was motivated by WITH_UBSAN, and no bug related to this
was observed in the wild. It should be noted that undefined behaviour
such as memcpy(ptr, NULL, 0) could allow compilers to perform unsafe
optimizations, like it was the case in
commit fc168c3a5e (MDEV-15587).
2019-10-29 18:20:32 +02:00
Marko Mäkelä
814534745b MDEV-20917 InnoDB is passing NULL to nonnull function parameters
mem_heap_dup(): Avoid mem_heap_alloc() and memcpy() of data=NULL, len=0.

trx_undo_report_insert_virtual(), trx_undo_page_report_insert(),
trx_undo_page_report_modify(): Avoid memcpy(ptr, NULL, 0).

dfield_data_is_binary_equal(): Correctly handle data=NULL, len=0.

This clean-up was motivated by WITH_UBSAN, and no bug related to this
was observed in the wild. It should be noted that undefined behaviour
such as memcpy(ptr, NULL, 0) could allow compilers to perform unsafe
optimizations, like it was the case in
commit fc168c3a5e (MDEV-15587).
2019-10-29 17:26:28 +02:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
c0ac0b8860 Update FSF address 2019-05-11 19:25:02 +03:00
Marko Mäkelä
fd58bb71e2 Merge 10.2 into 10.3 2018-11-19 18:45:53 +02:00
Marko Mäkelä
ff88e4bb8a Remove many redundant #include from InnoDB 2018-11-19 11:42:14 +02:00
Marko Mäkelä
a90100d756 Replace univ_page_size and UNIV_PAGE_SIZE
Try to use one variable (srv_page_size) for innodb_page_size.

Also, replace UNIV_PAGE_SIZE_SHIFT with srv_page_size_shift.
2018-04-28 20:45:45 +03:00
Marko Mäkelä
ba19764209 Fix most -Wsign-conversion in InnoDB
Change innodb_buffer_pool_size, innodb_fill_factor to unsigned.
2018-04-28 20:45:45 +03:00
Sergei Golubchik
b1818dccf7 Merge branch '10.2' into 10.3 2018-03-28 17:31:57 +02:00
Marko Mäkelä
3d7915f000 Merge 10.1 into 10.2 2018-03-21 22:58:52 +02:00
Marko Mäkelä
0492100059 Merge 5.5 into 10.0 2018-03-20 18:36:03 +02:00
Eugene Kosov
5a8f8f89d6 honor alignment rules and xtradb too 2018-03-20 10:46:57 +03:00
Eugene Kosov
75c76dbb06 MDEV-15030 Add ASAN instrumentation
Learn both valgrind and asan to catch this bug:

  mem_heap_t* heap = mem_heap_create(1024);
  byte* p = reinterpret_cast<byte*>(heap) + sizeof(mem_heap_t);
  *p = 123;

Overflows of the last allocation in a block will be catched too.

mem_heap_create_block(): poison newly allocated memory
2018-03-19 16:18:53 +03:00
Marko Mäkelä
b006d2ead4 Merge bb-10.2-ext into 10.3 2018-02-15 10:22:03 +02:00
Sergei Golubchik
4771ae4b22 Merge branch 'github/10.1' into 10.2 2018-02-06 14:50:50 +01:00
Vicențiu Ciorbaru
d833bb65d5 Merge remote-tracking branch '5.5' into 10.0 2018-01-24 12:29:31 +02:00
Marko Mäkelä
8637931f11 Add ASAN instrumentation (and more strict Valgrind) to InnoDB
mem_heap_free_heap_top(): Remove UNIV_MEM_ASSERT_W() and unpoison
the memory region first, because part of it may have been poisoned
by an earlier mem_heap_free_top() call.
Poison the address range at the end.

mem_heap_block_free(): Poison the address range at the end.

UNIV_MEM_ASSERT_AND_ALLOC(): Replace with UNIV_MEM_ALLOC().
We want to keep the address ranges poisoned (unaccessible) as
long as possible.

UNIV_MEM_ASSERT_AND_FREE(): Replace with UNIV_MEM_FREE().
2018-01-23 20:34:05 +02:00
Marko Mäkelä
fe47aee3bd Inline definition of mem_heap_dup(), mem_heap_strdup(), mem_heap_strdupl() 2017-09-05 08:54:36 +03:00
Marko Mäkelä
4e1116b2c6 MDEV-12271 Port MySQL 8.0 Bug#23150562 REMOVE UNIV_MUST_NOT_INLINE AND UNIV_NONINL
Also, remove empty .ic files that were not removed by my MySQL commit.

Problem:
InnoDB used to support a compilation mode that allowed to choose
whether the function definitions in .ic files are to be inlined or not.
This stopped making sense when InnoDB moved to C++ in MySQL 5.6
(and ha_innodb.cc started to #include .ic files), and more so in
MySQL 5.7 when inline methods and functions were introduced
in .h files.

Solution:
Remove all references to UNIV_NONINL and UNIV_MUST_NOT_INLINE from
all files, assuming that the symbols are never defined.
Remove the files fut0fut.cc and ut0byte.cc which only mattered when
UNIV_NONINL was defined.
2017-03-17 12:42:07 +02:00
Marko Mäkelä
89d80c1b0b Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with
ulonglong.  Change some parameters to this type.

Use size_t in a few more places.

Declare many flag constants as unsigned to avoid sign mismatch
when shifting bits or applying the unary ~ operator.

When applying the unary ~ operator to enum constants, explictly
cast the result to an unsigned type, because enum constants can
be treated as signed.

In InnoDB, change the source code line number parameters from
ulint to unsigned type. Also, make some InnoDB functions return
a narrower type (unsigned or uint32_t instead of ulint;
bool instead of ibool).
2017-03-07 19:07:27 +02:00
Marko Mäkelä
63574f1275 MDEV-11690 Remove UNIV_HOTBACKUP
The InnoDB source code contains quite a few references to a closed-source
hot backup tool which was originally called InnoDB Hot Backup (ibbackup)
and later incorporated in MySQL Enterprise Backup.

The open source backup tool XtraBackup uses the full database for recovery.
So, the references to UNIV_HOTBACKUP are only cluttering the source code.
2016-12-30 16:05:42 +02:00
Jan Lindström
2e814d4702 Merge InnoDB 5.7 from mysql-5.7.9.
Contains also

MDEV-10547: Test multi_update_innodb fails with InnoDB 5.7

	The failure happened because 5.7 has changed the signature of
	the bool handler::primary_key_is_clustered() const
	virtual function ("const" was added). InnoDB was using the old
	signature which caused the function not to be used.

MDEV-10550: Parallel replication lock waits/deadlock handling does not work with InnoDB 5.7

	Fixed mutexing problem on lock_trx_handle_wait. Note that
	rpl_parallel and rpl_optimistic_parallel tests still
	fail.

MDEV-10156 : Group commit tests fail on 10.2 InnoDB (branch bb-10.2-jan)
  Reason: incorrect merge

MDEV-10550: Parallel replication can't sync with master in InnoDB 5.7 (branch bb-10.2-jan)
  Reason: incorrect merge
2016-09-02 13:22:28 +03:00
Sergei Golubchik
720e04ff67 5.6.31 2016-06-21 14:21:03 +02:00
Sergei Golubchik
6d06fbbd1d move to storage/innobase 2015-05-04 19:17:21 +02:00
Murthy Narkedimilli
b292b5d2e3 Fixing the bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-10 22:29:41 +02:00
Aditya A
b6b3d6e243 BUG#16069598 - SERVER CRASH BY NULL POINTER DEREFERENCING IN
MEM_HEAP_CREATE_BLOCK() 

PROBLEM
-------

If we give start mysqld with the option --innodb_log_buffer_size=50GB
,then  mem_area_alloc() function fails to allocate memory and returns
NULL.In debug version we assert at this point,but there is no check in
release version and we get a segmentation fault.

FIX
---
Added a log message saying that we are unable to allocate memory.
After this message we assert.

[Approved by Kevin http://rb.no.oracle.com/rb/r/2065 ]
2013-03-07 14:44:35 +05:30
Narayanan Venkateswaran
164080e4a8 WL#6161 Integrating with InnoDB codebase in MySQL 5.5
Changes in the InnoDB codebase required to compile and
integrate the MEB codebase with MySQL 5.5.

@ storage/innobase/btr/btr0btr.c
  Excluded buffer pool usage from MEB build.
 
  buf_pool_from_bpage calls are in buf0buf.ic, and
  the buffer pool functions from that file are
  disabled in MEB.
@ storage/innobase/buf/buf0buf.c
  Disabling more buffer pool functions unused in MEB.
@ storage/innobase/dict/dict0dict.c
  Disabling dict_ind_free that is unused in MEB.
@ storage/innobase/dict/dict0mem.c
  The include

  #include "ha_prototypes.h"

  Was causing conflicts with definitions in my_global.h

  Linking C executable mysqlbackup
  libinnodb.a(dict0mem.c.o): In function `dict_mem_foreign_table_name_lookup_set':
  dict0mem.c:(.text+0x91c): undefined reference to `innobase_get_lower_case_table_names'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_referenced_table_name_lookup_set':
  dict0mem.c:(.text+0x9fc): undefined reference to `innobase_get_lower_case_table_names'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_foreign_table_name_lookup_set':
  dict0mem.c:(.text+0x96e): undefined reference to `innobase_casedn_str'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_referenced_table_name_lookup_set':
  dict0mem.c:(.text+0xa4e): undefined reference to `innobase_casedn_str'
  collect2: ld returned 1 exit status
  make[2]: *** [mysqlbackup] Error 1

  innobase_get_lower_case_table_names
  innobase_casedn_str
  are functions that are part of ha_innodb.cc that is not part of the build
        
  dict_mem_foreign_table_name_lookup_set
  function is not there in the current codebase, meaning we do not use it in MEB.
@ storage/innobase/fil/fil0fil.c
  The srv_fast_shutdown variable is declared in
  srv0srv.c that is not compiled in the
  mysqlbackup codebase.

  This throws an undeclared error.

  From the Manual
  ---------------

  innodb_fast_shutdown
  --------------------

  The InnoDB shutdown mode. The default value is 1
  as of MySQL 3.23.50, which causes a “fast� shutdown
  (the normal type of shutdown). If the value is 0,
  InnoDB does a full purge and an insert buffer merge
  before a shutdown. These operations can take minutes,
  or even hours in extreme cases. If the value is 1,
  InnoDB skips these operations at shutdown.

  This ideally does not matter from mysqlbackup
  @ storage/innobase/ha/ha0ha.c
  In file included from /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/ha/ha0ha.c:34:0:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/btr0sea.h:286:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  make[2]: *** [CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/ha/ha0ha.c.o] Error 1
  make[1]: *** [CMakeFiles/innodb.dir/all] Error 2
  make: *** [all] Error 2

  # include "sync0rw.h" is excluded from hotbackup compilation in dict0dict.h

  This causes extern rw_lock_t*	btr_search_latch_temp; to throw a failure because
  the definition of rw_lock_t is not found.
@ storage/innobase/include/buf0buf.h
  Excluding buffer pool functions that are unused from the
  MEB codebase.
@ storage/innobase/include/buf0buf.ic
  replicated the exclusion of

  #include "buf0flu.h"
  #include "buf0lru.h"
  #include "buf0rea.h"

  by looking at the current codebase in <meb-trunk>/src/innodb
  @ storage/innobase/include/dict0dict.h
  dict_table_x_lock_indexes, dict_table_x_unlock_indexes, dict_table_is_corrupted,
  dict_index_is_corrupted, buf_block_buf_fix_inc_func are unused in MEB and was
  leading to compilation errors and hence excluded.
@ storage/innobase/include/dict0dict.ic
  dict_table_x_lock_indexes, dict_table_x_unlock_indexes, dict_table_is_corrupted,
  dict_index_is_corrupted, buf_block_buf_fix_inc_func are unused in MEB and was
  leading to compilation errors and hence excluded.
@ storage/innobase/include/log0log.h
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/log0log.h: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/log0log.h:767:2: error: expected specifier-qualifier-list before Ã¢â  ‚¬Ëœmutex_t’

  mutex_t definitions were excluded as seen from ambient code
  hence excluding definition for log_flush_order_mutex also.
@ storage/innobase/include/os0file.h
  Bug in InnoDB code, create_mode should have been create.
@ storage/innobase/include/srv0srv.h
  In file included from /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/buf/buf0buf.c:50:0:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/srv0srv.h: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/srv0srv.h:120:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘srv_use_native_aio’

  srv_use_native_aio - we do not use native aio of the OS anyway from MEB. MEB does not compile
  InnoDB with this option. Hence disabling it.
@ storage/innobase/include/trx0sys.h
  [ 56%] Building C object CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c.o
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c: In function ‘trx_sys_read_file_format_id’:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c:1499:20: error: ‘TRX_SYS_FILE_FORMAT_TAG_MAGIC_N’   undeclared (first use in this function)
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c:1499:20: note: each undeclared identifier is reported only once for  each function it appears in
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/buf0buf.h:607:1: warning: ‘buf_block_buf_fix_inc_func’ declared ‘static’ but never defined
  make[2]: *** [CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c.o] Error 1

  unused calls excluded to enable compilation
@ storage/innobase/mem/mem0dbg.c
    excluding #include "ha_prototypes.h" that lead to definitions in ha_innodb.cc
@ storage/innobase/os/os0file.c
    InnoDB not compiled with aio support from MEB anyway. Hence excluding this from
    the compilation.
@ storage/innobase/page/page0zip.c
  page0zip.c:(.text+0x4e9e): undefined reference to `buf_pool_from_block'
  collect2: ld returned 1 exit status

  buf_pool_from_block defined in buf0buf.ic, most of the file is excluded for compilation of MEB
@ storage/innobase/ut/ut0dbg.c
  excluding #include "ha_prototypes.h" since it leads to definitions in ha_innodb.cc
  innobase_basename(file) is defined in ha_innodb.cc. Hence excluding that also.
@ storage/innobase/ut/ut0ut.c
  cal_tm unused from MEB, was leading to earnings, hence disabling for MEB.
2012-06-07 19:14:26 +05:30
Marko Mäkelä
1b6cb0128a Merge mysql-5.1 to mysql-5.5. 2011-12-28 12:31:18 +02:00
Marko Mäkelä
e498a1bf65 Bug#13418934 REMOVE HAVE_PURIFY DEPENDENCES FROM INNODB
InnoDB: Remove HAVE_purify, UNIV_INIT_MEM_TO_ZERO, UNIV_SET_MEM_TO_ZERO.

The compile-time setting HAVE_purify can mask potential bugs.
It is being set in PB2 Valgrind runs. We should simply get rid of it,
and replace it with UNIV_MEM_INVALID() to declare uninitialized memory
as such in Valgrind-instrumented binaries.

os_mem_alloc_large(), ut_malloc_low(): Remove the parameter set_to_zero.

ut_malloc(): Define as a macro that invokes ut_malloc_low().

buf_pool_init(): Never initialize the buffer pool frames. All pages
must be initialized before flushing them to disk.

mem_heap_alloc(): Never initialize the allocated memory block.

os_mem_alloc_nocache(), ut_test_malloc(): Unused function, remove.

rb:813 approved by Jimmy Yang
2011-12-28 12:19:30 +02:00
Jimmy Yang
618f4796f0 Include "ha_prototypes.h" to sync/sync0rw.c for innobase_basename(). 2011-02-25 03:21:02 -08:00
Jimmy Yang
56845ed3b4 Fix Bug #11765975 __FILE__ macros expanded to full path instead of relative
in CMake builds

rb://600 approved by Sunny Bains
2011-02-25 00:33:13 -08:00
Marko Mäkelä
41375b0fa4 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-01-25 10:51:13 +02:00
Jimmy Yang
d754b57199 Fix bug #52546, crash on shutdown of plugin with innodb_use_sys_malloc=0.
rb://339, approved by Sunny Bains.
2010-05-17 01:57:42 -07:00
Vasil Dimov
c7525a0130 Merge from innodb-branches-innodb+ (2) 2010-04-19 20:53:16 +03:00
Vasil Dimov
c877ff39bc Import branches/innodb+ from SVN on top of storage/innobase. 2010-04-12 18:20:41 +03:00
Satya B
c6c12db965 Merge Innodb Plugin 1.0.6 from mysql-5.1-bugteam storage/innodb_plugin to mysql-trunk-merge.
Merging revisions 3221 to 3230 from mysql-5.1-bugteam
2009-12-02 19:30:50 +05:30
Satya B
d63eb541f5 Merging Innodb plugin 1.0.5 revisions from 5.1-main from revisions 3149 to 3163
also merged missing Innodb plugin revisions r5636,r5635 manually
2009-10-16 17:28:02 +05:30
Guilhem Bichot
7ceb29ff17 Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same
layout as we always had in trees containing only the builtin
2) win\configure.js WITH_INNOBASE_STORAGE_ENGINE still works.

storage/innobase/CMakeLists.txt:
  fix to new directory name (and like 5.1)
storage/innobase/Makefile.am:
  fix to new directory name (and like 5.1)
storage/innobase/handler/ha_innodb.cc:
  fix to new directory name (and like 5.1)
storage/innobase/plug.in:
  fix to new directory name (and like 5.1)
2009-08-07 12:16:00 +02:00
Guilhem Bichot
b57e4dbd88 Creation of mysql-trunk = {summit + "Innodb plugin replacing the builtin"}:
bzr branch mysql-5.1-performance-version mysql-trunk # Summit
cd mysql-trunk
bzr merge mysql-5.1-innodb_plugin # which is 5.1 + Innodb plugin 
bzr rm innobase # remove the builtin
Next step: build, test fixes.
2009-08-04 13:25:19 +02:00
Mikael Ronstrom
5773302ed8 Remove compiler warnings 2008-10-16 20:07:50 +02:00
Mikael Ronstrom
1732095b7d Google SMP patch 2008-10-15 20:54:18 +02:00
unknown
e2513bf07f Apply snapshot innodb-5.1-ss1989
Fixes the following bugs:

Bug #30706: SQL thread on slave is allowed to block client queries when slave load is high
  Add (innodb|innobase|srv)_replication_delay MySQL config parameter.

Bug #30888: Innodb table + stored procedure + row deletion = server crash
  While adding code for the low level read of the AUTOINC value from the index,
  the case for MEDIUM ints which are 3 bytes was missed triggering an
  assertion.

Bug #30907: Regression: "--innodb_autoinc_lock_mode=0" (off) not same as older releases
  We don't rely on *first_value to be 0 when checking whether
  get_auto_increment() has been invoked for the first time in a multi-row
  INSERT. We instead use trx_t::n_autoinc_rows. Initialize trx::n_autoinc_rows
  inside ha_innobase::start_stmt() too.

Bug #31444: "InnoDB: Error: MySQL is freeing a thd" in innodb_mysql.test
  ha_innobase::external_lock(): Update prebuilt->mysql_has_locked and
  trx->n_mysql_tables_in_use only after row_lock_table_for_mysql() returns
  DB_SUCCESS.  A timeout on LOCK TABLES would lead to an inconsistent state,
  which would cause trx_free() to print a warning.

Bug #31494: innodb + 5.1 + read committed crash, assertion
  Set an error code when a deadlock occurs in semi-consistent read.


mysql-test/r/innodb.result:
  Apply snapshot innodb-5.1-ss1989
  
  Also, a test is moved into the new innodb_autoinc_lock_mode_zero
  test, because it depends on a non-default setting for a read-only
  variable.
  
  Revision r1821:
  Merge a change from MySQL AB:
  
  ChangeSet@1.2536.50.1  2007-08-02 12:45:56-07:00  igor@mysql.com
  
  Fixed bug#28404.
  This patch adds cost estimation for the queries with ORDER BY / GROUP BY
  and LIMIT.
  If there was a ref/range access to the table whose rows were required
  to be ordered in the result set the optimizer always employed this access
  though a scan by a different index that was compatible with the required
  order could be cheaper to produce the first L rows of the result set.
  Now for such queries the optimizer makes a choice between the cheapest
  ref/range accesses not compatible with the given order and index scans
  compatible with it.
  
  innodb.result: Adjusted results for test cases affected fy the fix for
  bug #28404.
  
  
  Revision r1781:
  Fix a test case that was broken after Bug#16979 fix. See r1645 and r1735.
  The variable used in the tests below was introduced in r1735.
  
  
  Revision r1792:
  innodb.result: Revert r1655, which should have been reverted as part of r1781.
  
  
  Revision r1843:
  Add test for Bug# 21409, the actual bug was fixed in r1334.
mysql-test/t/innodb.test:
  Apply snapshot innodb-5.1-ss1989
  
  Also, a test is moved into the new innodb_autoinc_lock_mode_zero
  test, because it depends on a non-default setting for a read-only
  variable.
  
  Revision r1781:
  Fix a test case that was broken after Bug#16979 fix. See r1645 and r1735.
  The variable used in the tests below was introduced in r1735.
  
  
  Revision r1843:
  Add test for Bug# 21409, the actual bug was fixed in r1334.
storage/innobase/buf/buf0lru.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1819:
  Merge r1815:1817 from branches/zip: Improve Valgrind instrumentation.
  
  UNIV_MEM_ASSERT_RW(): New macro, to check that the contents of a memory
  area is defined.
  
  UNIV_MEM_ASSERT_W(): New macro, to check that a memory area is writable.
  
  UNIV_MEM_ASSERT_AND_FREE(): New macro, to check that the memory is
  writable before declaring it free (unwritable).  This replaces UNIV_MEM_FREE()
  in many places.
  
  mem_init_buf(): Check that the memory is writable, and declare it undefined.
  
  mem_erase_buf(): Check that the memory is writable, and declare it freed.
storage/innobase/dict/dict0dict.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1894:
  Add debug lock checks to autoinc functions. Add lock guards around an
  invocation of dict_table_autoinc_initialize().
storage/innobase/dict/dict0load.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1974:
  Prevent loading of tables that have unsupported features most notably
  FTS indexes.
storage/innobase/handler/ha_innodb.cc:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1850:
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
  
  Approved by:	Heikki
  
  
  
  Revision r1887:
  Merge changes from MySQL AB:
  
  ChangeSet@1.2528.115.25  2007-08-27 18:18:14-06:00  tsmith@hindu.god
  
  Fix some Windows compiler warnings.
  
  dict0mem.c: Fix compiler warning with a cast.
  
  ha_innodb.cc: Change type to fix a compiler warning.
  
  
  Revision r1809:
  ha_innobase::external_lock(): Update prebuilt->mysql_has_locked and
  trx->n_mysql_tables_in_use only after row_lock_table_for_mysql()
  returns DB_SUCCESS.  A timeout on LOCK TABLES would lead to an
  inconsistent state, which would cause trx_free() to print a warning.
  
  This was later reported as Bug #31444.
  
  
  Revision r1833:
  Add /*== ... === */ decoration that was missing around some auto-inc functions.
  Add a missing comment, fix the length of a decoration.  Initialize the *value
  out parameter in ha_innobase::innobase_get_auto_increment().
  
  
  Revision r1866:
  Revert r1850 as MySQL did not approve the addition.
  
  log for r1850:
  
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
  
  
  Revision r1846:
  Add config option innodb_use_adaptive_hash_indexes to enable/disable
  adaptive hash indexes. It is enabled by default (no change in default
  behavior).
  
  Approved by:	Marko
  
  
  Revision r1974:
  Prevent loading of tables that have unsupported features most notably
  FTS indexes.
  
  
  Revision r1829:
  Add assertion to enforce check of an implicit invariant and add comment about
  retry of autoinc read semantics. We always reread the table's autoinc counter
  after attempting to initialize it i.e., we want to guarantee that a read of
  autoinc valus that is returned to the caller is always covered by the
  AUTOINC locking mechanism.
  
  
  Revision r1787:
  Move the prototype of innobase_print_identifier() from ut0ut.c to
  ha_prototypes.h.  Enclose the definitions in ha_prototypes.h in
  #ifndef UNIV_HOTBACKUP.
  
  
  Revision r1888:
  Merge a change from MySQL AB:
  
  ChangeSet@1.2528.115.30  2007-08-28 10:17:15-06:00  tsmith@hindu.god
  
  Fix another compiler warning on Windows in InnoDB.
  
  ha_innodb.cc:
  
  Fix compiler warning: ::get_auto_increment takes a ulonglong
  for nb_desired_values, but InnoDB's trx struct stores it as
  a ulint (unsigned long).  Probably harmless, as a single
  statement won't be asking for more than 2^32 rows.
  
  
  Revision r1987:
  Bug fix: The problem was that when write_row() attempted to update the max
  autoinc value, and if it was rolled back because of a deadlock, the 
  deadlock error (transaction rollback) was not being propagated back to MySQL.
  
  
  Revision r1889:
  Merge a change from MySQL AB:
  
  ChangeSet@1.2560  2007-09-21 10:15:16+02:00  gkodinov@local
  
  ha_innodb.cc: fixed type conversion warnings revealed by bug 30639 
  
  
  Revision r1989:
  Suppress printing of deadlock errors while reading the autoinc value.
  DB_DEADLOCK errors are part of normal processing and excessive printing
  of these error messages could be disconcerting for users. 
  
  
  Revision r1828:
  Fix two bugs:
  
  Bug# 30907: We don't rely on *first_value to be 0 when checking whether
  get_auto_increment() has been invoked for the first time in a multi-row
  INSERT. We instead use trx_t::n_autoinc_rows. Initialize trx::n_autoinc_rows
  inside ha_innobase::start_stmt() too.
  
  Bug# 30888: While adding code for the low level read of the AUTOINC value
  from the index, the case for MEDIUM ints which are 3 bytes was missed
  triggering an assertion.
storage/innobase/handler/ha_innodb.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1844:
  Remove the prototypes of some functions inside #if 0.
  The function definitions were removed in r1746.
storage/innobase/ibuf/ibuf0ibuf.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1965:
  ibuf_insert_to_index_page(): Fix typos in diagnostic output.
storage/innobase/include/db0err.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1974:
  Prevent loading of tables that have unsupported features most notably
  FTS indexes.
storage/innobase/include/ha_prototypes.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1787:
  Move the prototype of innobase_print_identifier() from ut0ut.c to
  ha_prototypes.h.  Enclose the definitions in ha_prototypes.h in
  #ifndef UNIV_HOTBACKUP.
storage/innobase/include/mach0data.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1779:
  Fix a bug that handles the case where the host specific byte order matches
  the InnoDB storage byte order, which is big-endian.
storage/innobase/include/mach0data.ic:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1779:
  Fix a bug that handles the case where the host specific byte order matches
  the InnoDB storage byte order, which is big-endian.
storage/innobase/include/mem0dbg.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1830:
  Improve memory debugging.  This is follow-up to r1819.
  
  mem_heap_validate(): Compile this function also if UNIV_MEM_DEBUG is
  defined.  Previously, this function was only compiled with UNIV_DEBUG.
  
  mem_heap_free_heap_top(): Flag the memory allocated, not freed, for
  Valgrind.  Otherwise, Valgrind would complain on the second call of
  mem_heap_empty().
  
  UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Display additional diagnostics
  for failed Valgrind checks.
storage/innobase/include/mem0mem.ic:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1830:
  Improve memory debugging.  This is follow-up to r1819.
  
  mem_heap_validate(): Compile this function also if UNIV_MEM_DEBUG is
  defined.  Previously, this function was only compiled with UNIV_DEBUG.
  
  mem_heap_free_heap_top(): Flag the memory allocated, not freed, for
  Valgrind.  Otherwise, Valgrind would complain on the second call of
  mem_heap_empty().
  
  UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Display additional diagnostics
  for failed Valgrind checks.
  
  
  Revision r1937:
  mem_heap_free_top(): Remove a bogus Valgrind warning.
  
  
  Revision r1819:
  Merge r1815:1817 from branches/zip: Improve Valgrind instrumentation.
  
  UNIV_MEM_ASSERT_RW(): New macro, to check that the contents of a memory
  area is defined.
  
  UNIV_MEM_ASSERT_W(): New macro, to check that a memory area is writable.
  
  UNIV_MEM_ASSERT_AND_FREE(): New macro, to check that the memory is
  writable before declaring it free (unwritable).  This replaces UNIV_MEM_FREE()
  in many places.
  
  mem_init_buf(): Check that the memory is writable, and declare it undefined.
  
  mem_erase_buf(): Check that the memory is writable, and declare it freed.
storage/innobase/include/rem0rec.ic:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1918:
  Improve Valgrind instrumentation.
  
  rec_offs_set_n_alloc(): Use UNIV_MEM_ASSERT_AND_ALLOC().
  
  UNIV_MEM_ASSERT_AND_ALLOC(): New directive, similar to
  UNIV_MEM_ASSERT_AND_FREE().
storage/innobase/include/row0mysql.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1783:
  Correct the function comments of row_create_table_for_mysql() and
  row_drop_table_for_mysql().
storage/innobase/include/sync0rw.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1757:
  Enclose rw_lock_validate() in #ifdef UNIV_DEBUG.  It is only called by
  debug assertions.
storage/innobase/include/univ.i:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1827:
  Merge r1826 from branches/zip: UNIV_MEM_ASSERT_AND_FREE():
  Use UNIV_MEM_ASSERT_W() instead of UNIV_MEM_ASSERT_RW().
  The memory area need not be initialized.
  This mistake was made in r1815.
  
  
  Revision r1918:
  Improve Valgrind instrumentation.
  
  rec_offs_set_n_alloc(): Use UNIV_MEM_ASSERT_AND_ALLOC().
  
  UNIV_MEM_ASSERT_AND_ALLOC(): New directive, similar to
  UNIV_MEM_ASSERT_AND_FREE().
  
  
  Revision r1830:
  Improve memory debugging.  This is follow-up to r1819.
  
  mem_heap_validate(): Compile this function also if UNIV_MEM_DEBUG is
  defined.  Previously, this function was only compiled with UNIV_DEBUG.
  
  mem_heap_free_heap_top(): Flag the memory allocated, not freed, for
  Valgrind.  Otherwise, Valgrind would complain on the second call of
  mem_heap_empty().
  
  UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Display additional diagnostics
  for failed Valgrind checks.
  
  
  Revision r1819:
  Merge r1815:1817 from branches/zip: Improve Valgrind instrumentation.
  
  UNIV_MEM_ASSERT_RW(): New macro, to check that the contents of a memory
  area is defined.
  
  UNIV_MEM_ASSERT_W(): New macro, to check that a memory area is writable.
  
  UNIV_MEM_ASSERT_AND_FREE(): New macro, to check that the memory is
  writable before declaring it free (unwritable).  This replaces UNIV_MEM_FREE()
  in many places.
  
  mem_init_buf(): Check that the memory is writable, and declare it undefined.
  
  mem_erase_buf(): Check that the memory is writable, and declare it freed.
  
  
  Revision r1948:
  UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Display also __FILE__ and __LINE__
  when these Valgrind checks fail.
storage/innobase/include/ut0ut.h:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1850:
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
  
  Approved by:	Heikki
  
  
  
  Revision r1862:
  Add ut_snprintf() function. On Windows this needs to be implemented
  using auxiliary functions because there is no snprintf-variant on
  Windows that behaves exactly as specified in the standard:
  
  * Always return the number of characters that would have been printed
    if the size were unlimited (not including the final `\0').
  * Always '\0'-terminate the result
  * Do not touch the buffer if size=0, only return the number of characters
    that would have been printed. Can be used to estimate the size needed
    and to allocate it dynamically.
  
  See http://www.freebsd.org/cgi/query-pr.cgi?pr=87260 for the reason why
  2 ap variables are used.
  
  Approved by:	Heikki
  
  
  Revision r1866:
  Revert r1850 as MySQL did not approve the addition.
  
  log for r1850:
  
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
storage/innobase/mem/mem0dbg.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1830:
  Improve memory debugging.  This is follow-up to r1819.
  
  mem_heap_validate(): Compile this function also if UNIV_MEM_DEBUG is
  defined.  Previously, this function was only compiled with UNIV_DEBUG.
  
  mem_heap_free_heap_top(): Flag the memory allocated, not freed, for
  Valgrind.  Otherwise, Valgrind would complain on the second call of
  mem_heap_empty().
  
  UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Display additional diagnostics
  for failed Valgrind checks.
  
  
  Revision r1819:
  Merge r1815:1817 from branches/zip: Improve Valgrind instrumentation.
  
  UNIV_MEM_ASSERT_RW(): New macro, to check that the contents of a memory
  area is defined.
  
  UNIV_MEM_ASSERT_W(): New macro, to check that a memory area is writable.
  
  UNIV_MEM_ASSERT_AND_FREE(): New macro, to check that the memory is
  writable before declaring it free (unwritable).  This replaces UNIV_MEM_FREE()
  in many places.
  
  mem_init_buf(): Check that the memory is writable, and declare it undefined.
  
  mem_erase_buf(): Check that the memory is writable, and declare it freed.
storage/innobase/mem/mem0mem.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1819:
  Merge r1815:1817 from branches/zip: Improve Valgrind instrumentation.
  
  UNIV_MEM_ASSERT_RW(): New macro, to check that the contents of a memory
  area is defined.
  
  UNIV_MEM_ASSERT_W(): New macro, to check that a memory area is writable.
  
  UNIV_MEM_ASSERT_AND_FREE(): New macro, to check that the memory is
  writable before declaring it free (unwritable).  This replaces UNIV_MEM_FREE()
  in many places.
  
  mem_init_buf(): Check that the memory is writable, and declare it undefined.
  
  mem_erase_buf(): Check that the memory is writable, and declare it freed.
storage/innobase/row/row0mysql.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1786:
  row_create_table_for_mysql(), row_truncate_table_for_mysql(),
  row_drop_table_for_mysql(): Do not mention innodb_force_recovery
  when newraw is set.
  
  
  Revision r1790:
  row_drop_table_for_mysql(): Before calling
  dict_table_remove_from_cache(table) and thus freeing the memory
  allocated for the table, copy the table name.  This avoids reading
  freed memory when name == table->name.
  
  Approved by Sunny.
  
  
  Revision r1783:
  Correct the function comments of row_create_table_for_mysql() and
  row_drop_table_for_mysql().
  
  
  Revision r1894:
  Add debug lock checks to autoinc functions. Add lock guards around an
  invocation of dict_table_autoinc_initialize().
storage/innobase/row/row0sel.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1782:
  Add comment that the variable dest should be word aligned. After discussion
  on IM with Heikki.
  
  
  Revision r1988:
  Set an error code when a deadlock occurs in semi-consistent read.  (Bug #31494)
  
  innodb-semi-consistent: New tests for InnoDB semi-consistent reads.
  Unfortunately, these will not trigger Bug #31494, because there merely
  occur lock wait timeouts, not deadlocks.
  
  
  Revision r1820:
  Use the clustered index and not the one selected by the optimizer in the plan,
  when building a previous version of the row. This bug is triggered when
  running queries via InnoDB's internal SQL parser; when InnoDB's optimizer
  selects a secondary index for the plan.
  
  
  Revision r1828:
  Fix two bugs:
  
  Bug# 30907: We don't rely on *first_value to be 0 when checking whether
  get_auto_increment() has been invoked for the first time in a multi-row
  INSERT. We instead use trx_t::n_autoinc_rows. Initialize trx::n_autoinc_rows
  inside ha_innobase::start_stmt() too.
  
  Bug# 30888: While adding code for the low level read of the AUTOINC value
  from the index, the case for MEDIUM ints which are 3 bytes was missed
  triggering an assertion.
  
  
  Revision r1779:
  Fix a bug that handles the case where the host specific byte order matches
  the InnoDB storage byte order, which is big-endian.
storage/innobase/sync/sync0rw.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1757:
  Enclose rw_lock_validate() in #ifdef UNIV_DEBUG.  It is only called by
  debug assertions.
storage/innobase/ut/ut0ut.c:
  Apply snapshot innodb-5.1-ss1989
  
  Revision r1850:
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
  
  Approved by:	Heikki
  
  
  
  Revision r1873:
  snprintf() should always return non-negative result. According to
  Microsoft documentation about _vscprintf():
  
    If format is a null pointer, the invalid parameter handler is invoked,
    as described in Parameter Validation. If execution is allowed to
    continue, the functions return -1 and set errno to EINVAL.
  
  The UNIX variant of snprintf() segfaults if format is a NULL pointer
  (similar to strlen(NULL) for example), so it is better to conform to
  this behavior and crash our custom Windows version instead of
  returning -1. Noone would expect -1 to be returned from snprintf().
  
  Cosmetic: Add a space after typecast.
  
  Approved by:	Marko
  
  
  Revision r1862:
  Add ut_snprintf() function. On Windows this needs to be implemented
  using auxiliary functions because there is no snprintf-variant on
  Windows that behaves exactly as specified in the standard:
  
  * Always return the number of characters that would have been printed
    if the size were unlimited (not including the final `\0').
  * Always '\0'-terminate the result
  * Do not touch the buffer if size=0, only return the number of characters
    that would have been printed. Can be used to estimate the size needed
    and to allocate it dynamically.
  
  See http://www.freebsd.org/cgi/query-pr.cgi?pr=87260 for the reason why
  2 ap variables are used.
  
  Approved by:	Heikki
  
  
  Revision r1866:
  Revert r1850 as MySQL did not approve the addition.
  
  log for r1850:
  
  Implement this feature request:
  http://bugs.mysql.com/30706
  
  * Add a function that returns the number of microseconds since
    epoch - ut_time_us().
  
  * Add (innodb|innobase|srv)_replication_delay MySQL config parameter.
  
  * Add UT_WAIT_FOR() macro that waits for a specified condition to occur
    until a timeout elapses.
  
  * Using all of the above, handle the replication thread specially in
    srv_conc_enter_innodb().
  
  
  Revision r1787:
  Move the prototype of innobase_print_identifier() from ut0ut.c to
  ha_prototypes.h.  Enclose the definitions in ha_prototypes.h in
  #ifndef UNIV_HOTBACKUP.
  
  
  Revision r1789:
  ut_print_namel(): Do not assume that all '/' are separators between
  database and table names.
  
  Approved by Heikki.
  
  
  Revision r1936:
  ut_print_buf(): Add a Valgrind check that the buffer is wholly defined.
mysql-test/r/innodb-semi-consistent.result:
  Apply snapshot innodb-5.1-ss1989
  
  
  Revision r1988:
  Set an error code when a deadlock occurs in semi-consistent read.  (Bug #31494)
  
  innodb-semi-consistent: New tests for InnoDB semi-consistent reads.
  Unfortunately, these will not trigger Bug #31494, because there merely
  occur lock wait timeouts, not deadlocks.
mysql-test/r/innodb_autoinc_lock_mode_zero.result:
  New test, using read-only setting --innodb-autoinc-lock-mode=0
mysql-test/t/innodb-semi-consistent-master.opt:
  Apply snapshot innodb-5.1-ss1989
  
  
  Revision r1988:
  Set an error code when a deadlock occurs in semi-consistent read.  (Bug #31494)
  
  innodb-semi-consistent: New tests for InnoDB semi-consistent reads.
  Unfortunately, these will not trigger Bug #31494, because there merely
  occur lock wait timeouts, not deadlocks.
mysql-test/t/innodb-semi-consistent.test:
  Apply snapshot innodb-5.1-ss1989
  
  
  Revision r1988:
  Set an error code when a deadlock occurs in semi-consistent read.  (Bug #31494)
  
  innodb-semi-consistent: New tests for InnoDB semi-consistent reads.
  Unfortunately, these will not trigger Bug #31494, because there merely
  occur lock wait timeouts, not deadlocks.
mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt:
  New test, using read-only setting --innodb-autoinc-lock-mode=0
mysql-test/t/innodb_autoinc_lock_mode_zero.test:
  New test, using read-only setting --innodb-autoinc-lock-mode=0
2007-11-06 15:42:58 -07:00
unknown
c2f0c211cd Apply snapshot innodb-51-ss1644
Fixes:
- Bug #23710: crash_commit_before fails if innodb_file_per_table=1
- Bug #28254: innodb crash if shutdown during innodb_table_monitor is running
- Bug #28604: innodb_force_recovery restricts data dump
- Bug #29097: fsp_get_available_space_in_free_extents() is capped at 4TB
- Bug #29155: Innodb "Parallel recovery" is not prevented


storage/innobase/Makefile.am:
  Apply snapshot innodb-51-ss1644
  
  Revision r1632:
  Add include/lock0priv.h to noinst_HEADERS in Makefile.am.
  
  
  
  Revision r1636:
  Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic:
  * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic
  * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype
  * Makefile.am: add lock0priv.ic to noinst_HEADERS
  * lock0priv.ic: introduce this new file containing the body of
    lock_get_type()
  
  This move is necessary in order to use lock_get_type() from other lock/
  source files (it's going to be used in lock/lock0iter.c).
  
  Approved by:	Heikki
  
  
  Revision r1638:
  Introduce a lock queue iterator for easy (and opaque) traversing of lock
  queues. Supports table and record lock queues via the same interface.
  
  There is only "get previous" method because currently there is no need
  for "get next" - it would be unused. Feel free to add one if needed.
  
  Approved by:	Heikki
storage/innobase/buf/buf0buf.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1624:
  Fix change missed as part of Bug 15815. Use a function to check if a block
  needs to be made younger.
  
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/buf/buf0lru.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/fsp/fsp0fsp.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1605:
  Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB"
  by typecasting the variables before multiplying them, so that the result of
  the multiplication is of type "unsigned long long".
  
  I verified this fix by creating a sparse file of 6TB and forcing InnoDB to
  use it without overwriting it with zeroes (by commenting the code that
  overwrites :newraw files).
  
  New type ullint is introduced with the sole purpose of shortening
  "unsigned long long", please do not define it to something else than
  "unsigned long long".
  
  Approved by:	Heikki
storage/innobase/handler/ha_innodb.cc:
  Apply snapshot innodb-51-ss1644
  
  Revision r1605:
  Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB"
  by typecasting the variables before multiplying them, so that the result of
  the multiplication is of type "unsigned long long".
  
  I verified this fix by creating a sparse file of 6TB and forcing InnoDB to
  use it without overwriting it with zeroes (by commenting the code that
  overwrites :newraw files).
  
  New type ullint is introduced with the sole purpose of shortening
  "unsigned long long", please do not define it to something else than
  "unsigned long long".
  
  Approved by:	Heikki
  
  
  Revision r1573:
  create_table_def(): Eliminate the inline function call to dict_table_is_comp()
  that was introduced in r1571.  Inlining is disabled in ha_innodb.cc.
  
  
  Revision r1574:
  innodb_check_for_record_too_big_error(): Divide the return value of
  page_get_free_space_of_empty_noninline() by 2.  Until r1571, that function
  did not return the same value as page_get_free_space_of_empty().
  
  
  Revision r1571:
  Fix a severe bug that was introduced in r1422 when fixing Bug 21101.
  When creating an index containing a too long record, InnoDB would
  dereference a NULL pointer when trying to determine the maximum row length.
  
  innodb_check_for_record_too_big_error(): Replace the dict_table_t*
  parameter with a Boolean flag.  There is not always a dict_table_t object
  when this function is called.
  
  page_get_free_space_of_empty_noninline(): Move the definition and
  declaration from row0mysql (!) to page0page.  Make the signature
  identical with page_get_free_space_of_empty().
  
  create_clustered_index_when_no_primary(): Add the parameter "comp".
  Remove unnecessary casts.
storage/innobase/include/buf0buf.ic:
  Apply snapshot innodb-51-ss1644
  
  Revision r1624:
  Fix change missed as part of Bug 15815. Use a function to check if a block
  needs to be made younger.
storage/innobase/include/fsp0fsp.h:
  Apply snapshot innodb-51-ss1644
  
  Revision r1605:
  Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB"
  by typecasting the variables before multiplying them, so that the result of
  the multiplication is of type "unsigned long long".
  
  I verified this fix by creating a sparse file of 6TB and forcing InnoDB to
  use it without overwriting it with zeroes (by commenting the code that
  overwrites :newraw files).
  
  New type ullint is introduced with the sole purpose of shortening
  "unsigned long long", please do not define it to something else than
  "unsigned long long".
  
  Approved by:	Heikki
storage/innobase/include/lock0lock.h:
  Apply snapshot innodb-51-ss1644
  
  Revision r1623:
  Fix typo in comment.
  
  
  Revision r1628:
  lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation
  in order to determine which lock is blocking which. Make it non-static
  and put its definition in include/lock0lock.h.
  
  Approved by:	Heikki (via IM)
storage/innobase/include/mem0mem.ic:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/include/page0page.h:
  Apply snapshot innodb-51-ss1644
  
  Revision r1571:
  Fix a severe bug that was introduced in r1422 when fixing Bug 21101.
  When creating an index containing a too long record, InnoDB would
  dereference a NULL pointer when trying to determine the maximum row length.
  
  innodb_check_for_record_too_big_error(): Replace the dict_table_t*
  parameter with a Boolean flag.  There is not always a dict_table_t object
  when this function is called.
  
  page_get_free_space_of_empty_noninline(): Move the definition and
  declaration from row0mysql (!) to page0page.  Make the signature
  identical with page_get_free_space_of_empty().
  
  create_clustered_index_when_no_primary(): Add the parameter "comp".
  Remove unnecessary casts.
storage/innobase/include/row0mysql.h:
  Apply snapshot innodb-51-ss1644
  
  Revision r1571:
  Fix a severe bug that was introduced in r1422 when fixing Bug 21101.
  When creating an index containing a too long record, InnoDB would
  dereference a NULL pointer when trying to determine the maximum row length.
  
  innodb_check_for_record_too_big_error(): Replace the dict_table_t*
  parameter with a Boolean flag.  There is not always a dict_table_t object
  when this function is called.
  
  page_get_free_space_of_empty_noninline(): Move the definition and
  declaration from row0mysql (!) to page0page.  Make the signature
  identical with page_get_free_space_of_empty().
  
  create_clustered_index_when_no_primary(): Add the parameter "comp".
  Remove unnecessary casts.
storage/innobase/include/univ.i:
  Apply snapshot innodb-51-ss1644
  
  Revision r1605:
  Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB"
  by typecasting the variables before multiplying them, so that the result of
  the multiplication is of type "unsigned long long".
  
  I verified this fix by creating a sparse file of 6TB and forcing InnoDB to
  use it without overwriting it with zeroes (by commenting the code that
  overwrites :newraw files).
  
  New type ullint is introduced with the sole purpose of shortening
  "unsigned long long", please do not define it to something else than
  "unsigned long long".
  
  Approved by:	Heikki
  
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/lock/lock0lock.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1631:
  Move lock_rec_find_set_bit() and lock_rec_get_prev() from
  lock/lock0lock.c to include/lock0priv.h and make them non-static.
  They will be used in lock/lock0iter.c.
  
  Approved by:	Heikki
  
  
  Revision r1636:
  Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic:
  * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic
  * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype
  * Makefile.am: add lock0priv.ic to noinst_HEADERS
  * lock0priv.ic: introduce this new file containing the body of
    lock_get_type()
  
  This move is necessary in order to use lock_get_type() from other lock/
  source files (it's going to be used in lock/lock0iter.c).
  
  Approved by:	Heikki
  
  
  Revision r1628:
  lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation
  in order to determine which lock is blocking which. Make it non-static
  and put its definition in include/lock0lock.h.
  
  Approved by:	Heikki (via IM)
  
  
  Revision r1629:
  Add "const" qualifiers to lock_get_type() and lock_get_mode().
  
  Approved by:	Sunny
  
  
  Revision r1626:
  Move lock_*struct structures from lock/lock0lock.c to include/lock0priv.h.
  
  This is needed in order to add more code to lock/ that uses members of
  these structures (internal to the lock module) but in a separate file,
  rather than lock0lock.c. lock0lock.c is a way too big already.
  
  Approved by:	Sunny
storage/innobase/log/log0recv.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1607:
  Bug#23710
  
  At InnoDB startup consider the case where log scan went beyond checkpoint_lsn as a crash and initiate crash recovery code path.
  
  reviewed by: Heikki
storage/innobase/mem/mem0mem.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/mem/mem0pool.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/os/os0file.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1613:
  Fix Bug#29155 by enabling file locking on FreeBSD.
  It has been disabled because InnoDB has refused to start on
  FreeBSD & LinuxThreads, but now it starts just fine.
  
  Approved by:	Heikki
storage/innobase/page/page0page.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1571:
  Fix a severe bug that was introduced in r1422 when fixing Bug 21101.
  When creating an index containing a too long record, InnoDB would
  dereference a NULL pointer when trying to determine the maximum row length.
  
  innodb_check_for_record_too_big_error(): Replace the dict_table_t*
  parameter with a Boolean flag.  There is not always a dict_table_t object
  when this function is called.
  
  page_get_free_space_of_empty_noninline(): Move the definition and
  declaration from row0mysql (!) to page0page.  Make the signature
  identical with page_get_free_space_of_empty().
  
  create_clustered_index_when_no_primary(): Add the parameter "comp".
  Remove unnecessary casts.
storage/innobase/rem/rem0rec.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/row/row0mysql.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1571:
  Fix a severe bug that was introduced in r1422 when fixing Bug 21101.
  When creating an index containing a too long record, InnoDB would
  dereference a NULL pointer when trying to determine the maximum row length.
  
  innodb_check_for_record_too_big_error(): Replace the dict_table_t*
  parameter with a Boolean flag.  There is not always a dict_table_t object
  when this function is called.
  
  page_get_free_space_of_empty_noninline(): Move the definition and
  declaration from row0mysql (!) to page0page.  Make the signature
  identical with page_get_free_space_of_empty().
  
  create_clustered_index_when_no_primary(): Add the parameter "comp".
  Remove unnecessary casts.
storage/innobase/sync/sync0rw.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1598:
  Add some comments.
  
  Approved by:	Heikki (via IM)
storage/innobase/sync/sync0sync.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1598:
  Add some comments.
  
  Approved by:	Heikki (via IM)
storage/innobase/trx/trx0sys.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
storage/innobase/trx/trx0trx.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1595:
  trx_commit_for_mysql(): Avoid acquiring and releasing kernel_mutex when
  trx->sess or trx_dummy_sess is non-NULL.
storage/innobase/ut/ut0mem.c:
  Apply snapshot innodb-51-ss1644
  
  Revision r1581:
  Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
2007-07-24 19:34:31 -06:00