2005-10-27 09:29:40 +02:00
|
|
|
/***************************************************************************
|
|
|
|
Version control for database, common definitions, and include files
|
|
|
|
|
|
|
|
(c) 1994 - 2000 Innobase Oy
|
|
|
|
|
|
|
|
Created 1/20/1994 Heikki Tuuri
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef univ_i
|
|
|
|
#define univ_i
|
|
|
|
|
2008-05-14 17:43:19 +02:00
|
|
|
#define INNODB_VERSION_MAJOR 1
|
|
|
|
#define INNODB_VERSION_MINOR 0
|
branches/innodb+: Merge revisions 3312:3459 from branches/zip:
------------------------------------------------------------------------
r3328 | marko | 2008-12-02 10:16:05 +0200 (Tue, 02 Dec 2008) | 7 lines
branches/zip: page_cur_insert_rec_zip(): When allocating insert_buf
from the free list, zero out the DB_TRX_ID and DB_ROLL_PTR of the
deleted record if the new record would not overwrite these
fields. This fixes a harmless content mismatch reported by
page_zip_validate() that was reported as Issue #111.
rb://55 approved by Sunny Bains.
------------------------------------------------------------------------
r3329 | vasil | 2008-12-02 12:03:17 +0200 (Tue, 02 Dec 2008) | 4 lines
branches/zip:
Add entry in the ChangeLog for the release of 1.0.2.
------------------------------------------------------------------------
r3331 | vasil | 2008-12-02 12:09:20 +0200 (Tue, 02 Dec 2008) | 5 lines
branches/zip:
Remove an entry from the ChnageLog for a change that was made before
the release of 1.0.2 but was not included in that release.
------------------------------------------------------------------------
r3333 | vasil | 2008-12-02 12:11:54 +0200 (Tue, 02 Dec 2008) | 4 lines
branches/zip:
Now that 1.0.2 is out, the current tree is version 1.0.3.
------------------------------------------------------------------------
r3336 | vasil | 2008-12-02 13:34:36 +0200 (Tue, 02 Dec 2008) | 5 lines
branches/zip:
Resurrect a ChangeLog entry that I removed in c3331 with a fake date
so it does not appear that it has been included in 1.0.2.
------------------------------------------------------------------------
r3361 | vasil | 2008-12-04 18:10:08 +0200 (Thu, 04 Dec 2008) | 9 lines
branches/zip:
Fix Mantis issue#103 mysql_addons.c depends on THD internals - please remove it
Use MySQL's thd_get_thread_id() instead of our own ib_thd_get_thread_id()
since MySQL implemented the former, see http://bugs.mysql.com/30930.
Approved by: Marko (https://svn.innodb.com/rb/r/40, rb://40)
------------------------------------------------------------------------
r3362 | vasil | 2008-12-04 18:49:24 +0200 (Thu, 04 Dec 2008) | 15 lines
branches/zip:
Revert our temporary fix for Bug#40360 Binlog related errors with binlog off
This bug was fixed in MySQL code.
Our fix went into r2944 and r2947, but this patch does not entirely revert
those revisions because we want to leave the test case that was introduced
and also r2944 itself reverted r2935 and r2936. So if we completely revert
r2944 and r2947 then we would loose the test and will restore r2935 and
r2936.
This resolves Issue#108 We should remove ib_bin_log_is_engaged() once mysql
add an equivallent, see Bug#40360
------------------------------------------------------------------------
r3404 | marko | 2008-12-05 10:02:54 +0200 (Fri, 05 Dec 2008) | 5 lines
branches/zip: row_undo_mod_del_mark_or_remove_sec_low(): Do not
complain if the record is not found. Explain that this is possible
when a deadlock occurs during an update. Heikki investigated this
in Issue #134.
------------------------------------------------------------------------
r3432 | marko | 2008-12-08 14:14:01 +0200 (Mon, 08 Dec 2008) | 4 lines
branches/zip: ibuf_merge_or_delete_for_page(): Remove the redundant
checks for ibuf_fixed_addr_page() || fsp_descr_page(). The one at
the beginning of the function is enough.
------------------------------------------------------------------------
r3456 | marko | 2008-12-09 10:31:26 +0200 (Tue, 09 Dec 2008) | 3 lines
branches/zip: row_purge_remove_sec_if_poss_low(): Allocate mtr_vers
from the stack, not with mem_alloc().
------------------------------------------------------------------------
r3459 | vasil | 2008-12-09 11:49:03 +0200 (Tue, 09 Dec 2008) | 152 lines
branches/zip:
Merge 2929:3458 from branches/5.1 (resolving conflict in c3257,
note also that r3363 reverted r2933 so there are not changes in
mysql-test/innodb-autoinc.result with the current merge):
------------------------------------------------------------------------
r2933 | calvin | 2008-10-30 02:57:31 +0200 (Thu, 30 Oct 2008) | 10 lines
Changed paths:
M /branches/5.1/mysql-test/innodb-autoinc.result
branches/5.1: correct the result file innodb-autoinc.result
Change the followings:
auto_increment_increment
auto_increment_offset
to
auto-increment-increment
auto-increment-offset
------------------------------------------------------------------------
r2981 | marko | 2008-11-07 14:54:10 +0200 (Fri, 07 Nov 2008) | 5 lines
Changed paths:
M /branches/5.1/row/row0mysql.c
branches/5.0: row_mysql_store_col_in_innobase_format(): Correct a misleading
comment. In the UTF-8 encoding, ASCII takes 1 byte per character, while
the "latin1" character set (normally ISO-8859-1, but in MySQL it actually
refers to the Windows Code Page 1252 a.k.a. CP1252, WinLatin1)
takes 1 to 3 bytes (1 to 2 bytes for the ISO-8859-1 subset).
------------------------------------------------------------------------
r3114 | calvin | 2008-11-14 20:31:48 +0200 (Fri, 14 Nov 2008) | 8 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
branches/5.1: fix bug#40386: Not flushing query cache after truncate
ha_statistics.records can not be 0 unless the table is empty, set to
1 instead. The original problem of bug#29507 is fixed in the server.
Additional test was done with the fix of bug#29507 in the server.
Approved by: Heikki (on IM)
------------------------------------------------------------------------
r3257 | inaam | 2008-11-24 22:06:50 +0200 (Mon, 24 Nov 2008) | 13 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/srv/srv0srv.c
M /branches/5.1/trx/trx0trx.c
branches/5.1 bug#40760
The config param innodb_thread_concurrency is dynamically set and is
read when a thread enters/exits innodb. If the value is changed between
the enter and exit time the behaviour becomes erratic.
The fix is not to use srv_thread_concurrency when exiting, instead use
the flag trx->declared_to_be_inside_innodb.
rb://57
Approved by: Marko
------------------------------------------------------------------------
r3363 | calvin | 2008-12-04 19:00:20 +0200 (Thu, 04 Dec 2008) | 13 lines
Changed paths:
M /branches/5.1/mysql-test/innodb-autoinc.result
branches/5.1: revert the changes in r2933
The changes in r2933 causes test failure on Linux.
More investigation is needed for Windows.
Change the followings in innodb-autoinc.result:
auto-increment-increment
auto-increment-offset
back to:
auto_increment_increment
auto_increment_offset
------------------------------------------------------------------------
r3412 | vasil | 2008-12-05 10:46:18 +0200 (Fri, 05 Dec 2008) | 7 lines
Changed paths:
M /branches/5.1/trx/trx0undo.c
branches/5.1:
Add the traditional 2 spaces after the timestamp so the message does
not look like:
070223 13:26:01InnoDB: Warning: canno....
------------------------------------------------------------------------
r3458 | vasil | 2008-12-09 11:21:08 +0200 (Tue, 09 Dec 2008) | 51 lines
Changed paths:
M /branches/5.1/mysql-test/innodb_bug34300.test
branches/5.1:
Merge a change from MySQL to fix the failing innodb_bug34300 mysql-test:
main.innodb_bug34300 [ fail ]
mysqltest: At line 11: query 'SET @@max_allowed_packet=16777216' failed: 1621: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Aborting: main.innodb_bug34300 failed in default mode.
The changeset is this:
------------------------------------------------------------
revno: 2709.1.10
committer: Staale Smedseng <staale.smedseng@sun.com>
branch nick: b22891-51-bugteam
timestamp: Thu 2008-11-20 08:51:48 +0100
message:
A fix for Bug#22891 "session level max_allowed_packet can be
set but is ignored".
This patch makes @@session.max_allowed_packed and
@@session.net_buffer_length read-only as suggested in the bug
report. The user will have to use SET GLOBAL (and reconnect)
to alter the session values of these variables.
The error string ER_VARIABLE_IS_READONLY is introduced.
Tests are modified accordingly.
modified:
mysql-test/r/func_compress.result
mysql-test/r/max_allowed_packet_basic.result
mysql-test/r/max_allowed_packet_func.result
mysql-test/r/net_buffer_length_basic.result
mysql-test/r/packet.result
mysql-test/r/union.result
mysql-test/r/variables.result
mysql-test/t/func_compress.test
mysql-test/t/innodb_bug34300.test
mysql-test/t/max_allowed_packet_basic.test
mysql-test/t/max_allowed_packet_func.test
mysql-test/t/net_buffer_length_basic.test
mysql-test/t/packet.test
mysql-test/t/union.test
mysql-test/t/variables.test
sql/set_var.cc
sql/set_var.h
sql/share/errmsg.txt
------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
2008-12-09 12:09:06 +01:00
|
|
|
#define INNODB_VERSION_BUGFIX 3
|
2008-05-14 17:43:19 +02:00
|
|
|
|
|
|
|
/* The following is the InnoDB version as shown in
|
|
|
|
SELECT plugin_version FROM information_schema.plugins;
|
|
|
|
calculated in in make_version_string() in sql/sql_show.cc like this:
|
|
|
|
"version >> 8" . "version & 0xff"
|
|
|
|
because the version is shown with only one dot, we skip the last
|
|
|
|
component, i.e. we show M.N.P as M.N */
|
|
|
|
#define INNODB_VERSION_SHORT \
|
|
|
|
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
|
|
|
|
|
|
|
|
/* auxiliary macros to help creating the version as string */
|
|
|
|
#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c)
|
|
|
|
#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c)
|
|
|
|
|
|
|
|
#define INNODB_VERSION_STR \
|
|
|
|
_INNODB_VERSION(INNODB_VERSION_MAJOR, \
|
|
|
|
INNODB_VERSION_MINOR, \
|
|
|
|
INNODB_VERSION_BUGFIX)
|
|
|
|
|
2007-11-01 16:00:44 +01:00
|
|
|
#ifdef MYSQL_DYNAMIC_PLUGIN
|
2008-02-08 13:23:17 +01:00
|
|
|
/* In the dynamic plugin, redefine some externally visible symbols
|
|
|
|
in order not to conflict with the symbols of a builtin InnoDB. */
|
|
|
|
|
|
|
|
/* Rename all C++ classes that contain virtual functions, because we
|
|
|
|
have not figured out how to apply the visibility=hidden attribute to
|
|
|
|
the virtual method table (vtable) in GCC 3. */
|
2007-11-01 16:00:44 +01:00
|
|
|
# define ha_innobase ha_innodb
|
|
|
|
#endif /* MYSQL_DYNAMIC_PLUGIN */
|
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
|
2006-10-25 13:19:12 +02:00
|
|
|
# undef __WIN__
|
|
|
|
# define __WIN__
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# include <windows.h>
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# if !defined(WIN64) && !defined(_WIN64)
|
|
|
|
# define UNIV_CAN_USE_X86_ASSEMBLER
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# ifdef _NT_
|
|
|
|
# define __NT__
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
#else
|
|
|
|
/* The defines used with MySQL */
|
|
|
|
|
|
|
|
/* Include two header files from MySQL to make the Unix flavor used
|
|
|
|
in compiling more Posix-compatible. These headers also define __WIN__
|
|
|
|
if we are compiling on Windows. */
|
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# include <my_global.h>
|
|
|
|
# include <my_pthread.h>
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
2006-10-25 13:19:12 +02:00
|
|
|
# include <sys/stat.h>
|
2008-03-03 11:25:27 +01:00
|
|
|
# if !defined(__NETWARE__) && !defined(__WIN__)
|
2006-11-01 09:13:58 +01:00
|
|
|
# include <sys/mman.h> /* mmap() for os0proc.c */
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# undef PACKAGE
|
|
|
|
# undef VERSION
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
/* Include the header file generated by GNU autoconf */
|
2007-03-01 14:53:57 +01:00
|
|
|
# ifndef __WIN__
|
|
|
|
# include "config.h"
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# ifdef HAVE_SCHED_H
|
|
|
|
# include <sched.h>
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2007-03-01 14:53:57 +01:00
|
|
|
/* When compiling for Itanium IA64, undefine the flag below to prevent use
|
|
|
|
of the 32-bit x86 assembler in mutex operations. */
|
|
|
|
|
|
|
|
# if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64)
|
|
|
|
# define UNIV_CAN_USE_X86_ASSEMBLER
|
|
|
|
# endif
|
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
/* We only try to do explicit inlining of functions with gcc and
|
|
|
|
Microsoft Visual C++ */
|
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# if !defined(__GNUC__)
|
|
|
|
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
|
|
|
|
# define UNIV_MUST_NOT_INLINE
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
2006-10-25 13:19:12 +02:00
|
|
|
# ifdef HAVE_PREAD
|
|
|
|
# define HAVE_PWRITE
|
|
|
|
# endif
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
#endif /* #if (defined(WIN32) || ... */
|
|
|
|
|
|
|
|
/* DEBUG VERSION CONTROL
|
|
|
|
===================== */
|
|
|
|
|
|
|
|
/* The following flag will make InnoDB to initialize
|
|
|
|
all memory it allocates to zero. It hides Purify
|
|
|
|
warnings about reading unallocated memory unless
|
|
|
|
memory is read outside the allocated blocks. */
|
|
|
|
/*
|
|
|
|
#define UNIV_INIT_MEM_TO_ZERO
|
|
|
|
*/
|
|
|
|
|
2007-10-29 14:03:53 +01:00
|
|
|
/* When this macro is defined then additional test functions will be
|
|
|
|
compiled. These functions live at the end of each relevant source file
|
|
|
|
and have "test_" prefix. These functions are not called from anywhere in
|
|
|
|
the code, they can be called from gdb after
|
|
|
|
innobase_start_or_create_for_mysql() has executed using the call
|
|
|
|
command. Not tested on Windows. */
|
|
|
|
/*
|
|
|
|
#define UNIV_COMPILE_TEST_FUNCS
|
|
|
|
*/
|
|
|
|
|
2006-05-08 08:18:59 +02:00
|
|
|
#if 0
|
2007-01-02 15:36:59 +01:00
|
|
|
#define UNIV_DEBUG_VALGRIND /* Enable extra
|
|
|
|
Valgrind instrumentation */
|
|
|
|
#define UNIV_DEBUG_PRINT /* Enable the compilation of
|
|
|
|
some debug print functions */
|
|
|
|
#define UNIV_BUF_DEBUG /* Enable buffer pool
|
|
|
|
debugging without UNIV_DEBUG */
|
2007-05-06 14:05:21 +02:00
|
|
|
#define UNIV_DEBUG /* Enable ut_ad() assertions
|
|
|
|
and disable UNIV_INLINE */
|
2007-01-02 15:36:59 +01:00
|
|
|
#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
|
|
|
|
(field file_page_was_freed
|
|
|
|
in buf_page_t) */
|
2008-09-17 21:52:30 +02:00
|
|
|
#define UNIV_LRU_DEBUG /* debug the buffer pool LRU */
|
2007-01-24 12:41:19 +01:00
|
|
|
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
|
2007-01-02 15:36:59 +01:00
|
|
|
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
|
|
|
|
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
|
2007-02-27 12:56:38 +01:00
|
|
|
#define UNIV_IBUF_DEBUG /* debug the insert buffer */
|
|
|
|
#define UNIV_IBUF_COUNT_DEBUG /* debug the insert buffer;
|
2007-01-02 15:36:59 +01:00
|
|
|
this limits the database to IBUF_COUNT_N_SPACES and IBUF_COUNT_N_PAGES,
|
|
|
|
and the insert buffer must be empty when the database is started */
|
|
|
|
#define UNIV_SYNC_DEBUG /* debug mutex and latch
|
|
|
|
operations (very slow); also UNIV_DEBUG must be defined */
|
|
|
|
#define UNIV_SEARCH_DEBUG /* debug B-tree comparisons */
|
|
|
|
#define UNIV_SYNC_PERF_STAT /* operation counts for
|
|
|
|
rw-locks and mutexes */
|
|
|
|
#define UNIV_SEARCH_PERF_STAT /* statistics for the
|
|
|
|
adaptive hash index */
|
|
|
|
#define UNIV_SRV_PRINT_LATCH_WAITS /* enable diagnostic output
|
|
|
|
in sync0sync.c */
|
|
|
|
#define UNIV_BTR_PRINT /* enable functions for
|
|
|
|
printing B-trees */
|
2007-01-04 22:40:10 +01:00
|
|
|
#define UNIV_ZIP_DEBUG /* extensive consistency checks
|
|
|
|
for compressed pages */
|
branches/innodb+: Merge revisions 2774:2799 from branches/zip:
------------------------------------------------------------------------
r2781 | marko | 2008-10-13 13:40:57 +0300 (Mon, 13 Oct 2008) | 1 line
branches/zip: page_cur_delete_rec(): Call page_zip_validate_low().
------------------------------------------------------------------------
r2783 | vasil | 2008-10-13 18:34:34 +0300 (Mon, 13 Oct 2008) | 9 lines
branches/zip:
Remove mysql-test/patches/bug37312.diff because MySQL "fixed"
Bug#37312 by removing the test.
http://bugs.mysql.com/37312
http://lists.mysql.com/commits/54462
------------------------------------------------------------------------
r2784 | marko | 2008-10-13 21:35:30 +0300 (Mon, 13 Oct 2008) | 1 line
branches/zip: Add missing NULL check to the assertion added in r2781.
------------------------------------------------------------------------
r2785 | marko | 2008-10-13 22:29:12 +0300 (Mon, 13 Oct 2008) | 2 lines
branches/zip: page_cur_delete_rec(): Remove the bogus page_zip_validate_low()
assertion that was added in r2781 and explain why it was bogus.
------------------------------------------------------------------------
r2786 | calvin | 2008-10-14 19:14:47 +0300 (Tue, 14 Oct 2008) | 7 lines
branches/zip: fix Mantis issue #96 Problem compiling ha_innodb.cc
on 64-bit Windows
Change the definition of srv_replication_delay from ulint to ulong.
ulint is 64-bit on Win64.
Approved by: Heikki (on IM)
------------------------------------------------------------------------
r2787 | calvin | 2008-10-14 19:19:41 +0300 (Tue, 14 Oct 2008) | 7 lines
branches/zip: fix compiler warning
Change the definition of add_on from ulint to ullint, to eliminate
the warning in .\btr\btr0cur.c:
conversion from 'ullint' to 'ulint', possible loss of data
Approved by: Heikki (on IM)
------------------------------------------------------------------------
r2793 | marko | 2008-10-15 10:00:06 +0300 (Wed, 15 Oct 2008) | 2 lines
branches/zip: row_create_table_for_mysql(), row_create_index_for_mysql():
Note that the dictionary object will be freed.
------------------------------------------------------------------------
r2794 | marko | 2008-10-15 10:32:40 +0300 (Wed, 15 Oct 2008) | 9 lines
branches/zip: When invoking page_zip_copy_recs(), update the lock table
and the adaptive hash index. This should fix Issue #95 and Issue #87.
page_zip_copy_recs(): Copy PAGE_MAX_TRX_ID as well, to have similar behavior
to page_copy_rec_list_start() and page_copy_rec_list_end().
btr_root_raise_and_insert(), btr_page_split_and_insert(), btr_lift_page_up():
Update the lock table and the adaptive hash index.
------------------------------------------------------------------------
r2797 | marko | 2008-10-15 13:21:54 +0300 (Wed, 15 Oct 2008) | 3 lines
branches/zip: Introduce UNIV_ZIP_COPY for invoking page_zip_copy_recs()
more often in B-tree operations.
------------------------------------------------------------------------
r2799 | marko | 2008-10-15 14:27:42 +0300 (Wed, 15 Oct 2008) | 25 lines
branches/zip: When the server crashes while freeing an externally stored
column of a compressed table, the BTR_EXTERN_LEN field in the BLOB pointer
will be written as 0. Tolerate this in the functions that deal with
externally stored columns. This fixes Issue #80 and was posted at rb://26.
Note that the clustered index record is always deleted or purged last,
after any secondary index records referring to it have been deleted.
btr_free_externally_stored_field(): On an uncompressed table, zero out
the BTR_EXTERN_LEN, so that half-deleted BLOBs can be detected after
crash recovery.
btr_copy_externally_stored_field_prefix(): Return 0 if the BLOB has been
half-deleted.
row_upd_ext_fetch(): Assert that the externally stored column exists.
row_ext_cache_fill(): Allow btr_copy_externally_stored_field_prefix()
to return 0.
row_sel_sec_rec_is_for_blob(): Return FALSE if the BLOB has been half-deleted.
This is correct, because the clustered index record would have been deleted
or purged last, after any secondary index records referring to it had been
deleted.
------------------------------------------------------------------------
2008-10-15 14:09:17 +02:00
|
|
|
#define UNIV_ZIP_COPY /* call page_zip_copy_recs()
|
|
|
|
more often */
|
2006-05-08 08:18:59 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-02 15:36:59 +01:00
|
|
|
#define UNIV_BTR_DEBUG /* check B-tree links */
|
|
|
|
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_purify
|
|
|
|
/* The following sets all new allocated memory to zero before use:
|
|
|
|
this can be used to eliminate unnecessary Purify warnings, but note that
|
|
|
|
it also masks many bugs Purify could detect. For detailed Purify analysis it
|
|
|
|
is best to remove the define below and look through the warnings one
|
|
|
|
by one. */
|
|
|
|
#define UNIV_SET_MEM_TO_ZERO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define UNIV_SQL_DEBUG
|
|
|
|
#define UNIV_LOG_DEBUG
|
|
|
|
*/
|
|
|
|
/* the above option prevents forcing of log to disk
|
|
|
|
at a buffer page write: it should be tested with this
|
|
|
|
option off; also some ibuf tests are suppressed */
|
|
|
|
/*
|
|
|
|
#define UNIV_BASIC_LOG_DEBUG
|
|
|
|
*/
|
|
|
|
/* the above option enables basic recovery debugging:
|
|
|
|
new allocated file pages are reset */
|
|
|
|
|
2008-02-06 15:17:36 +01:00
|
|
|
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
|
|
|
|
that are only referenced from within InnoDB, not from MySQL */
|
|
|
|
#ifdef __WIN__
|
|
|
|
# define UNIV_INTERN
|
|
|
|
#else
|
|
|
|
# define UNIV_INTERN __attribute__((visibility ("hidden")))
|
|
|
|
#endif
|
|
|
|
|
2007-06-20 10:26:26 +02:00
|
|
|
#if (!defined(UNIV_DEBUG) && !defined(UNIV_MUST_NOT_INLINE))
|
2005-10-27 09:29:40 +02:00
|
|
|
/* Definition for inline version */
|
|
|
|
|
|
|
|
#ifdef __WIN__
|
|
|
|
#define UNIV_INLINE __inline
|
|
|
|
#else
|
2006-04-12 11:32:17 +02:00
|
|
|
#define UNIV_INLINE static __inline__
|
2005-10-27 09:29:40 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
/* If we want to compile a noninlined version we use the following macro
|
|
|
|
definitions: */
|
|
|
|
|
|
|
|
#define UNIV_NONINL
|
2008-02-06 15:17:36 +01:00
|
|
|
#define UNIV_INLINE UNIV_INTERN
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define UNIV_WORD_SIZE 4
|
|
|
|
#elif defined(_WIN64)
|
|
|
|
#define UNIV_WORD_SIZE 8
|
|
|
|
#else
|
|
|
|
/* MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
|
|
|
|
#define UNIV_WORD_SIZE SIZEOF_LONG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following alignment is used in memory allocations in memory heap
|
|
|
|
management to ensure correct alignment for doubles etc. */
|
|
|
|
#define UNIV_MEM_ALIGNMENT 8
|
|
|
|
|
|
|
|
/* The following alignment is used in aligning lints etc. */
|
|
|
|
#define UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE
|
|
|
|
|
|
|
|
/*
|
|
|
|
DATABASE VERSION CONTROL
|
|
|
|
========================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* The 2-logarithm of UNIV_PAGE_SIZE: */
|
2008-11-07 13:16:36 +01:00
|
|
|
#define UNIV_PAGE_SIZE_SHIFT 14
|
2007-12-20 14:23:23 +01:00
|
|
|
/* The universal page size of the database */
|
|
|
|
#define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT)
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
/* Maximum number of parallel threads in a parallelized operation */
|
|
|
|
#define UNIV_MAX_PARALLELISM 32
|
|
|
|
|
|
|
|
/*
|
|
|
|
UNIVERSAL TYPE DEFINITIONS
|
|
|
|
==========================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Note that inside MySQL 'byte' is defined as char on Linux! */
|
|
|
|
#define byte unsigned char
|
|
|
|
|
2006-04-12 11:32:17 +02:00
|
|
|
/* Define an unsigned integer type that is exactly 32 bits. */
|
|
|
|
|
|
|
|
#if SIZEOF_INT == 4
|
|
|
|
typedef unsigned int ib_uint32_t;
|
|
|
|
#elif SIZEOF_LONG == 4
|
|
|
|
typedef unsigned long ib_uint32_t;
|
|
|
|
#else
|
|
|
|
#error "Neither int or long is 4 bytes"
|
|
|
|
#endif
|
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
/* Another basic type we use is unsigned long integer which should be equal to
|
|
|
|
the word size of the machine, that is on a 32-bit platform 32 bits, and on a
|
|
|
|
64-bit platform 64 bits. We also give the printf format for the type as a
|
|
|
|
macro ULINTPF. */
|
|
|
|
|
|
|
|
#ifdef _WIN64
|
|
|
|
typedef unsigned __int64 ulint;
|
|
|
|
#define ULINTPF "%I64u"
|
|
|
|
typedef __int64 lint;
|
|
|
|
#else
|
|
|
|
typedef unsigned long int ulint;
|
|
|
|
#define ULINTPF "%lu"
|
|
|
|
typedef long int lint;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WIN__
|
2008-05-14 17:43:19 +02:00
|
|
|
typedef __int64 ib_int64_t;
|
2006-11-29 15:52:16 +01:00
|
|
|
typedef unsigned __int64 ib_uint64_t;
|
2005-10-27 09:29:40 +02:00
|
|
|
#else
|
2008-05-14 17:43:19 +02:00
|
|
|
/* Note: longlong and ulonglong come from MySQL headers. */
|
|
|
|
typedef longlong ib_int64_t;
|
2006-11-29 15:52:16 +01:00
|
|
|
typedef ulonglong ib_uint64_t;
|
2005-10-27 09:29:40 +02:00
|
|
|
#endif
|
|
|
|
|
2007-08-01 13:18:43 +02:00
|
|
|
typedef unsigned long long int ullint;
|
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
#ifndef __WIN__
|
|
|
|
#if SIZEOF_LONG != SIZEOF_VOIDP
|
|
|
|
#error "Error: InnoDB's ulint must be of the same size as void*"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The 'undefined' value for a ulint */
|
|
|
|
#define ULINT_UNDEFINED ((ulint)(-1))
|
|
|
|
|
|
|
|
/* The undefined 32-bit unsigned integer */
|
|
|
|
#define ULINT32_UNDEFINED 0xFFFFFFFF
|
|
|
|
|
|
|
|
/* Maximum value for a ulint */
|
|
|
|
#define ULINT_MAX ((ulint)(-2))
|
|
|
|
|
2006-11-29 15:52:16 +01:00
|
|
|
/* Maximum value for ib_uint64_t */
|
|
|
|
#define IB_ULONGLONG_MAX ((ib_uint64_t) (~0ULL))
|
2006-11-24 14:05:01 +01:00
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
/* This 'ibool' type is used within Innobase. Remember that different included
|
|
|
|
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
|
|
|
|
#define ibool ulint
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following number as the length of a logical field means that the field
|
|
|
|
has the SQL NULL as its value. NOTE that because we assume that the length
|
|
|
|
of a field is a 32-bit integer when we store it, for example, to an undo log
|
|
|
|
on disk, we must have also this number fit in 32 bits, also in 64-bit
|
|
|
|
computers! */
|
|
|
|
|
2006-02-27 10:33:26 +01:00
|
|
|
#define UNIV_SQL_NULL ULINT32_UNDEFINED
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
/* Lengths which are not UNIV_SQL_NULL, but bigger than the following
|
|
|
|
number indicate that a field contains a reference to an externally
|
|
|
|
stored part of the field in the tablespace. The length field then
|
|
|
|
contains the sum of the following flag and the locally stored len. */
|
|
|
|
|
|
|
|
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
|
|
|
|
|
|
|
|
/* Some macros to improve branch prediction and reduce cache misses */
|
|
|
|
#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
|
|
|
|
/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
|
|
|
|
# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
|
|
|
|
/* Tell the compiler that a pointer is likely to be NULL */
|
|
|
|
# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ulint) ptr, 0)
|
|
|
|
/* Minimize cache-miss latency by moving data at addr into a cache before
|
|
|
|
it is read. */
|
|
|
|
# define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3)
|
|
|
|
/* Minimize cache-miss latency by moving data at addr into a cache before
|
|
|
|
it is read or written. */
|
|
|
|
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
|
|
|
|
#else
|
|
|
|
/* Dummy versions of the macros */
|
|
|
|
# define UNIV_EXPECT(expr,value) (expr)
|
|
|
|
# define UNIV_LIKELY_NULL(expr) (expr)
|
|
|
|
# define UNIV_PREFETCH_R(addr) ((void) 0)
|
|
|
|
# define UNIV_PREFETCH_RW(addr) ((void) 0)
|
|
|
|
#endif
|
|
|
|
/* Tell the compiler that cond is likely to hold */
|
|
|
|
#define UNIV_LIKELY(cond) UNIV_EXPECT(cond, TRUE)
|
|
|
|
/* Tell the compiler that cond is unlikely to hold */
|
|
|
|
#define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE)
|
|
|
|
|
2006-02-17 15:19:39 +01:00
|
|
|
/* Compile-time constant of the given array's size. */
|
|
|
|
#define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
|
|
|
2006-05-08 08:18:59 +02:00
|
|
|
/* The return type from a thread's start function differs between Unix and
|
|
|
|
Windows, so define a typedef for it and a macro to use at the end of such
|
|
|
|
functions. */
|
|
|
|
|
|
|
|
#ifdef __WIN__
|
|
|
|
typedef ulint os_thread_ret_t;
|
|
|
|
#define OS_THREAD_DUMMY_RETURN return(0)
|
|
|
|
#else
|
|
|
|
typedef void* os_thread_ret_t;
|
|
|
|
#define OS_THREAD_DUMMY_RETURN return(NULL)
|
|
|
|
#endif
|
|
|
|
|
2005-10-27 09:29:40 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "ut0dbg.h"
|
|
|
|
#include "ut0ut.h"
|
|
|
|
#include "db0err.h"
|
2006-09-20 14:42:08 +02:00
|
|
|
#ifdef UNIV_DEBUG_VALGRIND
|
|
|
|
# include <valgrind/memcheck.h>
|
|
|
|
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
|
|
|
|
# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
|
2007-01-12 13:36:40 +01:00
|
|
|
# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
|
|
|
|
# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
|
|
|
|
# define UNIV_MEM_DESC(addr, size, b) VALGRIND_CREATE_BLOCK(addr, size, b)
|
|
|
|
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
|
2007-09-10 12:09:01 +02:00
|
|
|
# define UNIV_MEM_ASSERT_RW(addr, size) do { \
|
2007-10-24 12:59:54 +02:00
|
|
|
const void* _p = (const void*) (ulint) \
|
2007-09-10 12:09:01 +02:00
|
|
|
VALGRIND_CHECK_MEM_IS_DEFINED(addr, size); \
|
|
|
|
if (UNIV_LIKELY_NULL(_p)) \
|
2007-10-24 12:59:54 +02:00
|
|
|
fprintf(stderr, "%s:%d: %p[%u] undefined at %ld\n", \
|
|
|
|
__FILE__, __LINE__, \
|
|
|
|
(const void*) (addr), (unsigned) (size), (long) \
|
|
|
|
(((const char*) _p) - ((const char*) (addr)))); \
|
2007-09-10 12:09:01 +02:00
|
|
|
} while (0)
|
|
|
|
# define UNIV_MEM_ASSERT_W(addr, size) do { \
|
2007-10-24 12:59:54 +02:00
|
|
|
const void* _p = (const void*) (ulint) \
|
2007-09-10 12:09:01 +02:00
|
|
|
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, size); \
|
|
|
|
if (UNIV_LIKELY_NULL(_p)) \
|
2007-10-24 12:59:54 +02:00
|
|
|
fprintf(stderr, "%s:%d: %p[%u] unwritable at %ld\n", \
|
|
|
|
__FILE__, __LINE__, \
|
|
|
|
(const void*) (addr), (unsigned) (size), (long) \
|
|
|
|
(((const char*) _p) - ((const char*) (addr)))); \
|
2007-09-10 12:09:01 +02:00
|
|
|
} while (0)
|
2006-09-20 14:42:08 +02:00
|
|
|
#else
|
|
|
|
# define UNIV_MEM_VALID(addr, size) do {} while(0)
|
|
|
|
# define UNIV_MEM_INVALID(addr, size) do {} while(0)
|
2007-01-12 13:36:40 +01:00
|
|
|
# define UNIV_MEM_FREE(addr, size) do {} while(0)
|
|
|
|
# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
|
|
|
|
# define UNIV_MEM_DESC(addr, size, b) do {} while(0)
|
|
|
|
# define UNIV_MEM_UNDESC(b) do {} while(0)
|
2007-09-06 13:36:35 +02:00
|
|
|
# define UNIV_MEM_ASSERT_RW(addr, size) do {} while(0)
|
|
|
|
# define UNIV_MEM_ASSERT_W(addr, size) do {} while(0)
|
2006-09-20 14:42:08 +02:00
|
|
|
#endif
|
2007-09-06 13:36:35 +02:00
|
|
|
#define UNIV_MEM_ASSERT_AND_FREE(addr, size) do { \
|
2007-09-07 14:39:36 +02:00
|
|
|
UNIV_MEM_ASSERT_W(addr, size); \
|
2007-09-06 13:36:35 +02:00
|
|
|
UNIV_MEM_FREE(addr, size); \
|
|
|
|
} while (0)
|
2007-09-28 08:16:20 +02:00
|
|
|
#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size) do { \
|
|
|
|
UNIV_MEM_ASSERT_W(addr, size); \
|
|
|
|
UNIV_MEM_ALLOC(addr, size); \
|
|
|
|
} while (0)
|
2005-10-27 09:29:40 +02:00
|
|
|
|
|
|
|
#endif
|