mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 23:34:34 +01:00
0ecec12df3
------------------------------------------------------------ revno: 3414 revision-id: marko.makela@oracle.com-20100422093342-jf9ojlzdqsdebohn parent: marko.makela@oracle.com-20100421185359-8qaxoa2yyrpzwdd7 committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Thu 2010-04-22 12:33:42 +0300 message: Correct the definition of DICT_SYS_INDEXES_NAME_FIELD. When row_merge_drop_temp_indexes() was reworked to drop the indexes via the data dictionary cache, the code was broken because it would read the index name from the wrong field. modified: storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/dict/dict0boot.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fdict%2Fdict0boot.c storage/innodb_plugin/include/dict0boot.h 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fdict0boot.h ------------------------------------------------------------ revno: 3413 revision-id: marko.makela@oracle.com-20100421185359-8qaxoa2yyrpzwdd7 parent: marko.makela@oracle.com-20100421102723-0i80uezbyu0ekj5d committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 21:53:59 +0300 message: btr_page_split_and_insert(): Avoid an infinite loop. (Bug #52964) btr_page_tuple_smaller(): New function, refactored from btr_page_split_and_insert(). btr_page_get_split_rec(): Renamed from btr_page_get_sure_split_rec(). Note that a NULL return may mean that the tuple is to be inserted into either the lower or upper page, to be determined by btr_page_tuple_smaller(). btr_page_split_and_insert(): When btr_page_get_split_rec() returns NULL, invoke btr_page_tuple_smaller() to determine which half-page the tuple belongs to. Reviewed by Sunny Bains modified: storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/btr/btr0btr.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0btr.c ------------------------------------------------------------ revno: 3412 revision-id: marko.makela@oracle.com-20100421102723-0i80uezbyu0ekj5d parent: marko.makela@oracle.com-20100421100029-mji6lmdgvuqh96qq committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 13:27:23 +0300 message: dict_create_index_step(): Be strict about DYNAMIC and COMPRESSED tables. Bug #50495 is about REDUNDANT and COMPACT tables, after all. modified: mysql-test/suite/innodb_plugin/r/innodb-zip.result 2252@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb-zip.result mysql-test/suite/innodb_plugin/t/innodb-zip.test 2252@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb-zip.test storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/dict/dict0crea.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fdict%2Fdict0crea.c ------------------------------------------------------------ revno: 3411 revision-id: marko.makela@oracle.com-20100421100029-mji6lmdgvuqh96qq parent: marko.makela@oracle.com-20100421095033-0acvzxb8um8cms0a committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 13:00:29 +0300 message: ha_innobase::add_index(): Only check for duplicate indexes when the data dictionary is locked. This fixes a UNIV_DEBUG assertion failure in innodb-index.test. modified: storage/innodb_plugin/handler/handler0alter.cc 1845@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fhandler%2Fhandler0alter.cc ------------------------------------------------------------ revno: 3410 revision-id: marko.makela@oracle.com-20100421095033-0acvzxb8um8cms0a parent: marko.makela@oracle.com-20100421094032-ir4glqk46qvg2ywn committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 12:50:33 +0300 message: dtuple_convert_big_rec(): Store locally any fields whose maximum length is less than 256 bytes. (Bug #52745) Add related comments and debug assertions to the "offsets" functions in rem0rec.c. Approved by Sunny Bains modified: storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/data/data0data.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fdata%2Fdata0data.c storage/innodb_plugin/rem/rem0rec.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Frem%2Frem0rec.c ------------------------------------------------------------ revno: 3409 revision-id: marko.makela@oracle.com-20100421094032-ir4glqk46qvg2ywn parent: marko.makela@oracle.com-20100421091611-uu46iygmv5sizjru committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 12:40:32 +0300 message: Adjust tests for the Bug #50495 fix. modified: mysql-test/suite/innodb_plugin/r/innodb-zip.result 2252@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb-zip.result mysql-test/suite/innodb_plugin/t/innodb-zip.test 2252@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb-zip.test mysql-test/suite/innodb_plugin/t/innodb_bug36169.test 2418@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug36169.test ------------------------------------------------------------ revno: 3408 revision-id: marko.makela@oracle.com-20100421091611-uu46iygmv5sizjru parent: marko.makela@oracle.com-20100421063916-h3gwjea7jzjilyww committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 12:16:11 +0300 message: rec_convert_dtuple_to_rec(): Correct the debug check. The "extern" accessor functions return zero or nonzero, not 0 or 1. modified: storage/innodb_plugin/rem/rem0rec.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Frem%2Frem0rec.c ------------------------------------------------------------ revno: 3407 revision-id: marko.makela@oracle.com-20100421063916-h3gwjea7jzjilyww parent: marko.makela@oracle.com-20100420201550-cax1xywvlcdshgfg committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Wed 2010-04-21 09:39:16 +0300 message: rec_convert_dtuple_to_rec(): Add a debug check. modified: storage/innodb_plugin/rem/rem0rec.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Frem%2Frem0rec.c ------------------------------------------------------------ revno: 3406 revision-id: marko.makela@oracle.com-20100420201550-cax1xywvlcdshgfg parent: marko.makela@oracle.com-20100420114222-diq7h2hiom9ww6me committer: Marko Makela <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Tue 2010-04-20 23:15:50 +0300 message: btr_cur_optimistic_insert(): Remove unused variable "heap". modified: storage/innodb_plugin/btr/btr0cur.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0cur.c ------------------------------------------------------------ revno: 3405 revision-id: marko.makela@oracle.com-20100420114222-diq7h2hiom9ww6me parent: marko.makela@oracle.com-20100420082908-tpako8jd4imkh1xb committer: Marko Makela <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Tue 2010-04-20 14:42:22 +0300 message: dict_create_index_step(): Invoke dict_index_add_to_cache() in strict mode only if innodb_strict_mode is set. (Bug #50495) trx_is_strict(): New function, for checking innodb_strict_mode. modified: storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/dict/dict0crea.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fdict%2Fdict0crea.c storage/innodb_plugin/handler/ha_innodb.cc 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fhandler%2Fha_innodb.cc storage/innodb_plugin/include/trx0trx.h 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0trx.h ------------------------------------------------------------ revno: 3404 revision-id: marko.makela@oracle.com-20100420082908-tpako8jd4imkh1xb parent: marko.makela@oracle.com-20100419103603-u5pz4qc6hfhx4nua committer: Marko M?kel? <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Tue 2010-04-20 11:29:08 +0300 message: Implement UNIV_BTR_AVOID_COPY, an optimization of page splits. modified: storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/btr/btr0btr.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0btr.c storage/innodb_plugin/include/univ.i 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Funiv.i ------------------------------------------------------------ revno: 3403 revision-id: marko.makela@oracle.com-20100419103603-u5pz4qc6hfhx4nua parent: marko.makela@oracle.com-20100419094405-fd3xwadullishv07 committer: Marko =?ISO-8859-1?Q?M=E4kel=E4?= <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Mon 2010-04-19 13:36:03 +0300 message: Enable UNIV_DEBUG_VALGRIND when HAVE_purify is set. modified: storage/innobase/include/univ.i 2@cee13dc7-1704-0410-992b-c9b4543f1246:trunk%2Finclude%2Funiv.i storage/innodb_plugin/include/univ.i 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Funiv.i
508 lines
17 KiB
OpenEdge ABL
508 lines
17 KiB
OpenEdge ABL
/*****************************************************************************
|
|
|
|
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
|
|
Copyright (c) 2008, Google Inc.
|
|
Copyright (c) 2009, Sun Microsystems, Inc.
|
|
|
|
Portions of this file contain modifications contributed and copyrighted by
|
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
|
briefly in the InnoDB documentation. The contributions by Google are
|
|
incorporated with their permission, and subject to the conditions contained in
|
|
the file COPYING.Google.
|
|
|
|
Portions of this file contain modifications contributed and copyrighted by
|
|
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
|
|
are described briefly in the InnoDB documentation. The contributions by
|
|
Sun Microsystems are incorporated with their permission, and subject to the
|
|
conditions contained in the file COPYING.Sun_Microsystems.
|
|
|
|
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
|
|
|
|
*****************************************************************************/
|
|
|
|
/***********************************************************************//**
|
|
@file include/univ.i
|
|
Version control for database, common definitions, and include files
|
|
|
|
Created 1/20/1994 Heikki Tuuri
|
|
****************************************************************************/
|
|
|
|
#ifndef univ_i
|
|
#define univ_i
|
|
|
|
#ifdef UNIV_HOTBACKUP
|
|
#include "hb_univ.i"
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
#define INNODB_VERSION_MAJOR 1
|
|
#define INNODB_VERSION_MINOR 1
|
|
#define INNODB_VERSION_BUGFIX 1
|
|
|
|
/* The following is the InnoDB version as shown in
|
|
SELECT plugin_version FROM information_schema.plugins;
|
|
calculated 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)
|
|
|
|
#define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/"
|
|
|
|
#ifdef MYSQL_DYNAMIC_PLUGIN
|
|
/* 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. */
|
|
# define ha_innobase ha_innodb
|
|
#endif /* MYSQL_DYNAMIC_PLUGIN */
|
|
|
|
/* if any of the following macros is defined at this point this means
|
|
that the code from the "right" plug.in was executed and we do not
|
|
need to include ut0auxconf.h which would either define the same macros
|
|
or will be empty */
|
|
#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
|
|
&& !defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \
|
|
&& !defined(HAVE_IB_SOLARIS_ATOMICS) \
|
|
&& !defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \
|
|
&& !defined(SIZEOF_PTHREAD_T) \
|
|
&& !defined(HAVE_IB_PAUSE_INSTRUCTION)
|
|
# include "ut0auxconf.h"
|
|
#endif
|
|
|
|
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
|
|
# undef __WIN__
|
|
# define __WIN__
|
|
|
|
# include <windows.h>
|
|
|
|
# ifdef _NT_
|
|
# define __NT__
|
|
# endif
|
|
|
|
#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. */
|
|
|
|
#ifndef UNIV_HOTBACKUP
|
|
# include <my_global.h>
|
|
# include <my_pthread.h>
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
|
# include <sys/stat.h>
|
|
# if !defined(__NETWARE__) && !defined(__WIN__)
|
|
# include <sys/mman.h> /* mmap() for os0proc.c */
|
|
# endif
|
|
|
|
/* Include the header file generated by GNU autoconf */
|
|
# ifndef __WIN__
|
|
# ifndef UNIV_HOTBACKUP
|
|
# include "config.h"
|
|
# endif /* UNIV_HOTBACKUP */
|
|
# endif
|
|
|
|
# ifdef HAVE_SCHED_H
|
|
# include <sched.h>
|
|
# endif
|
|
|
|
/* We only try to do explicit inlining of functions with gcc and
|
|
Sun Studio */
|
|
|
|
# if !defined(__GNUC__) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC))
|
|
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
|
|
# define UNIV_MUST_NOT_INLINE
|
|
# endif
|
|
|
|
# ifdef HAVE_PREAD
|
|
# define HAVE_PWRITE
|
|
# endif
|
|
|
|
#endif /* #if (defined(WIN32) || ... */
|
|
|
|
/* Following defines are to enable performance schema
|
|
instrumentation in each of four InnoDB modules if
|
|
HAVE_PSI_INTERFACE is defined. */
|
|
#ifdef HAVE_PSI_INTERFACE
|
|
# define UNIV_PFS_MUTEX
|
|
# define UNIV_PFS_RWLOCK
|
|
/* For I/O instrumentation, performance schema rely
|
|
on a native descriptor to identify the file, this
|
|
descriptor could conflict with our OS level descriptor.
|
|
Disable IO instrumentation on Windows until this is
|
|
resolved */
|
|
# ifndef __WIN__
|
|
# define UNIV_PFS_IO
|
|
# endif
|
|
# define UNIV_PFS_THREAD
|
|
#endif /* HAVE_PSI_INTERFACE */
|
|
|
|
/* 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
|
|
*/
|
|
|
|
/* 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
|
|
*/
|
|
|
|
#ifdef HAVE_purify
|
|
# define UNIV_DEBUG_VALGRIND
|
|
#endif /* HAVE_purify */
|
|
#if 0
|
|
#define UNIV_DEBUG_VALGRIND /* Enable extra
|
|
Valgrind instrumentation */
|
|
#define UNIV_DEBUG_PRINT /* Enable the compilation of
|
|
some debug print functions */
|
|
#define UNIV_AHI_DEBUG /* Enable adaptive hash index
|
|
debugging without UNIV_DEBUG */
|
|
#define UNIV_BUF_DEBUG /* Enable buffer pool
|
|
debugging without UNIV_DEBUG */
|
|
#define UNIV_DEBUG /* Enable ut_ad() assertions
|
|
and disable UNIV_INLINE */
|
|
#define UNIV_DEBUG_LOCK_VALIDATE /* Enable
|
|
ut_ad(lock_rec_validate_page())
|
|
assertions. */
|
|
#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
|
|
(field file_page_was_freed
|
|
in buf_page_t) */
|
|
#define UNIV_LRU_DEBUG /* debug the buffer pool LRU */
|
|
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
|
|
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
|
|
#define UNIV_LOG_LSN_DEBUG /* write LSN to the redo log;
|
|
this will break redo log file compatibility, but it may be useful when
|
|
debugging redo log application problems. */
|
|
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
|
|
#define UNIV_IBUF_DEBUG /* debug the insert buffer */
|
|
#define UNIV_IBUF_COUNT_DEBUG /* debug the insert buffer;
|
|
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_AVOID_COPY /* when splitting B-tree nodes,
|
|
do not move any records when
|
|
all the records would
|
|
be moved */
|
|
#define UNIV_BTR_PRINT /* enable functions for
|
|
printing B-trees */
|
|
#define UNIV_ZIP_DEBUG /* extensive consistency checks
|
|
for compressed pages */
|
|
#define UNIV_ZIP_COPY /* call page_zip_copy_recs()
|
|
more often */
|
|
#define UNIV_AIO_DEBUG /* prints info about
|
|
submitted and reaped AIO
|
|
requests to the log. */
|
|
#endif
|
|
|
|
#define UNIV_BTR_DEBUG /* check B-tree links */
|
|
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
|
|
|
|
#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 */
|
|
|
|
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
|
|
that are only referenced from within InnoDB, not from MySQL */
|
|
#if defined(__GNUC__) && (__GNUC__ >= 4) || defined(__INTEL_COMPILER)
|
|
# define UNIV_INTERN __attribute__((visibility ("hidden")))
|
|
#else
|
|
# define UNIV_INTERN
|
|
#endif
|
|
|
|
#if (!defined(UNIV_DEBUG) && !defined(UNIV_MUST_NOT_INLINE))
|
|
/* Definition for inline version */
|
|
|
|
#ifdef __WIN__
|
|
# define UNIV_INLINE __inline
|
|
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
|
|
# define UNIV_INLINE static inline
|
|
#else
|
|
# define UNIV_INLINE static __inline__
|
|
#endif
|
|
|
|
#else
|
|
/* If we want to compile a noninlined version we use the following macro
|
|
definitions: */
|
|
|
|
#define UNIV_NONINL
|
|
#define UNIV_INLINE UNIV_INTERN
|
|
|
|
#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: */
|
|
#define UNIV_PAGE_SIZE_SHIFT 14
|
|
/* The universal page size of the database */
|
|
#define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT)
|
|
|
|
/* 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
|
|
|
|
/* 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
|
|
|
|
/* 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__
|
|
typedef __int64 ib_int64_t;
|
|
typedef unsigned __int64 ib_uint64_t;
|
|
#elif !defined(UNIV_HOTBACKUP)
|
|
/* Note: longlong and ulonglong come from MySQL headers. */
|
|
typedef longlong ib_int64_t;
|
|
typedef ulonglong ib_uint64_t;
|
|
#endif
|
|
|
|
#ifndef UNIV_HOTBACKUP
|
|
typedef unsigned long long int ullint;
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
#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))
|
|
|
|
/* Maximum value for ib_uint64_t */
|
|
#define IB_ULONGLONG_MAX ((ib_uint64_t) (~0ULL))
|
|
|
|
/* 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! */
|
|
|
|
#define UNIV_SQL_NULL ULINT32_UNDEFINED
|
|
|
|
/* 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)
|
|
/* Sun Studio includes sun_prefetch.h as of version 5.9 */
|
|
#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) \
|
|
|| (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
|
|
# include <sun_prefetch.h>
|
|
#if __SUNPRO_C >= 0x550
|
|
# undef UNIV_INTERN
|
|
# define UNIV_INTERN __hidden
|
|
#endif /* __SUNPRO_C >= 0x550 */
|
|
/* Use sun_prefetch when compile with Sun Studio */
|
|
# define UNIV_EXPECT(expr,value) (expr)
|
|
# define UNIV_LIKELY_NULL(expr) (expr)
|
|
# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many(addr)
|
|
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
|
|
#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)
|
|
|
|
/* Compile-time constant of the given array's size. */
|
|
#define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
|
|
/* 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
|
|
|
|
#include <stdio.h>
|
|
#include "ut0dbg.h"
|
|
#include "ut0ut.h"
|
|
#include "db0err.h"
|
|
#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)
|
|
# 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)
|
|
# define UNIV_MEM_ASSERT_RW(addr, size) do { \
|
|
const void* _p = (const void*) (ulint) \
|
|
VALGRIND_CHECK_MEM_IS_DEFINED(addr, size); \
|
|
if (UNIV_LIKELY_NULL(_p)) \
|
|
fprintf(stderr, "%s:%d: %p[%u] undefined at %ld\n", \
|
|
__FILE__, __LINE__, \
|
|
(const void*) (addr), (unsigned) (size), (long) \
|
|
(((const char*) _p) - ((const char*) (addr)))); \
|
|
} while (0)
|
|
# define UNIV_MEM_ASSERT_W(addr, size) do { \
|
|
const void* _p = (const void*) (ulint) \
|
|
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, size); \
|
|
if (UNIV_LIKELY_NULL(_p)) \
|
|
fprintf(stderr, "%s:%d: %p[%u] unwritable at %ld\n", \
|
|
__FILE__, __LINE__, \
|
|
(const void*) (addr), (unsigned) (size), (long) \
|
|
(((const char*) _p) - ((const char*) (addr)))); \
|
|
} while (0)
|
|
#else
|
|
# define UNIV_MEM_VALID(addr, size) do {} while(0)
|
|
# define UNIV_MEM_INVALID(addr, size) do {} while(0)
|
|
# 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)
|
|
# define UNIV_MEM_ASSERT_RW(addr, size) do {} while(0)
|
|
# define UNIV_MEM_ASSERT_W(addr, size) do {} while(0)
|
|
#endif
|
|
#define UNIV_MEM_ASSERT_AND_FREE(addr, size) do { \
|
|
UNIV_MEM_ASSERT_W(addr, size); \
|
|
UNIV_MEM_FREE(addr, size); \
|
|
} while (0)
|
|
#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size) do { \
|
|
UNIV_MEM_ASSERT_W(addr, size); \
|
|
UNIV_MEM_ALLOC(addr, size); \
|
|
} while (0)
|
|
|
|
#endif
|