mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 15:24:16 +01:00
f6f91b9d3b
Fixes: - Bug #18077: InnoDB uses full explicit table locks in stored FUNCTION storage/innobase/btr/btr0btr.c: Apply InnoDB snapshot ss923 Revision r919: btr_page_get_father_for_rec(): Remove bogus comment about removed dict_tree_t. storage/innobase/dict/dict0dict.c: Apply InnoDB snapshot ss923 Revision r892: Merge changes from MySQL AB. dict_col_copy_type_noninline(): Remove the return statement. Some compilers do not allow return expressions of void type. innobase_start_or_create_for_mysql(): Do not cap srv_max_threads to 1000 on Windows. Makefile.am (EXTRA_DIST): Add plug.in Revision r897: dict_index_get_if_in_cache(): Enclose in #ifdef UNIV_DEBUG. Replace the search loop with a call to dict_index_find_on_id_low(). storage/innobase/handler/ha_innodb.cc: Apply InnoDB snapshot ss923 Revision r887: storage/innobase/handler: Merge changes from MySQL AB: ChangeSet 2006/09/30 18:44:42-07:00 brian@zim.(none) Merge zim.(none):/home/brian/mysql/merge-5.1 into zim.(none):/home/brian/mysql/arch-5.1 ChangeSet 2006/09/30 12:49:46-07:00 brian@zim.(none) This patch adds handlerton passing to functions. NDB and Innodb still require a global hanlderton in the main code due to the nature of the sql_cache call back function (should be solveable... another patch). Partitioning now has a flag to allow disabling of engines from being compatible with partitioning. Cleaned up heap naming convention on panic call. ChangeSet 2006/09/29 17:19:02-07:00 brian@zim.(none) This removes the passing of global hton to engine instance. ChangeSet 2006/09/28 13:22:56+02:00 gbichot@dl145h.mysql.com Merge gbichot@bk-internal:/home/bk/mysql-5.1-arch into dl145h.mysql.com:/users/gbichot/mysql-5.1-arch ChangeSet 2006/09/28 13:19:43+02:00 gbichot@dl145h.mysql.com In the handlerton, cursor creation function don't have an argument and so the engine calls current_thd to derive transaction information; instead we now pass THD to those functions, it looks more logical (it makes the implicit current_thd parameter more visible). Approved by Brian and Monty. ChangeSet 2006/09/26 22:51:53-07:00 brian@zim.(none) Merge zim.(none):/home/brian/mysql/merge-5.1 into zim.(none):/home/brian/mysql/arch-5.1 Revision r895: Merge changes from MySQL AB, and remove two compilation warnings. ha_innodb.cc: innodb_mutex_show_status(): Add (ulong) casts to ulonglong expressions being passed to fprintf %lu. The warnings were apparently introduced by MySQL AB developers. mysql_declare_plugin(innobase): Add PLUGIN_LICENSE_GPL. have_innodb.inc: Merge changes from MySQL AB. Revision r923: ha_innobase::store_lock(): When downgrading table locks, do not check thd->in_lock_tables but test if thd->lex->sql_command == SQLCOM_LOCK_TABLES instead. Otherwise, stored functions will use table locks. (Bug #18077) This patch is from Heikki. storage/innobase/include/dict0dict.h: Apply InnoDB snapshot ss923 Revision r897: dict_index_get_if_in_cache(): Enclose in #ifdef UNIV_DEBUG. Replace the search loop with a call to dict_index_find_on_id_low(). storage/innobase/include/mem0dbg.h: Apply InnoDB snapshot ss923 Revision r901: Enclose some mem debug functions in #ifdef UNIV_DEBUG or #ifdef UNIV_MEM_DEBUG. storage/innobase/include/mtr0mtr.h: Apply InnoDB snapshot ss923 Revision r866: mtr_print(), mtr_memo_contains(): Disable unless #ifdef UNIV_DEBUG. storage/innobase/include/mtr0mtr.ic: Apply InnoDB snapshot ss923 Revision r866: mtr_print(), mtr_memo_contains(): Disable unless #ifdef UNIV_DEBUG. storage/innobase/include/sync0rw.h: Apply InnoDB snapshot ss923 Revision r907: Send all SHOW ENGINE INNODB STATUS information to the client also when UNIV_SYNC_DEBUG is defined. rw_lock_list_print_info(): Add parameter "file". mutex_list_print_info(): Add parameter "file". Make the function static. storage/innobase/include/sync0sync.h: Apply InnoDB snapshot ss923 Revision r907: Send all SHOW ENGINE INNODB STATUS information to the client also when UNIV_SYNC_DEBUG is defined. rw_lock_list_print_info(): Add parameter "file". mutex_list_print_info(): Add parameter "file". Make the function static. storage/innobase/include/univ.i: Apply InnoDB snapshot ss923 Revision r894: univ.i: Indent some of the directives, and remove conditions about Windows in the "#else" branch of "#if building on Windows". storage/innobase/mem/mem0dbg.c: Apply InnoDB snapshot ss923 Revision r901: Enclose some mem debug functions in #ifdef UNIV_DEBUG or #ifdef UNIV_MEM_DEBUG. Revision r902: mem0dbg.c: Enclose some more function definitions in #ifdef UNIV_MEM_DEBUG. The declarations were already enclosed in #ifdef UNIV_MEM_DEBUG. storage/innobase/mem/mem0pool.c: Apply InnoDB snapshot ss923 Revision r896: mem0pool.c: Remove obsolete comments about the dictionary cache being managed with an LRU algorithm. storage/innobase/mtr/mtr0mtr.c: Apply InnoDB snapshot ss923 Revision r866: mtr_print(), mtr_memo_contains(): Disable unless #ifdef UNIV_DEBUG. storage/innobase/row/row0purge.c: Apply InnoDB snapshot ss923 Revision r869: row_purge_parse_undo_rec(): Correct a faulty condition. Luckily, this bug would only surface if the InnoDB SQL interpreter were used for updating fixed-length columns. Currently (as the UPD_NODE_NO_SIZE_CHANGE flag is never set), cmpl_info can only be 0 or UPD_NODE_NO_ORD_CHANGE. Luckily, UPD_NODE_NO_ORD_CHANGE is 1, and the condition was simplified to !cmpl_info. storage/innobase/sync/sync0rw.c: Apply InnoDB snapshot ss923 Revision r907: Send all SHOW ENGINE INNODB STATUS information to the client also when UNIV_SYNC_DEBUG is defined. rw_lock_list_print_info(): Add parameter "file". mutex_list_print_info(): Add parameter "file". Make the function static. storage/innobase/sync/sync0sync.c: Apply InnoDB snapshot ss923 Revision r907: Send all SHOW ENGINE INNODB STATUS information to the client also when UNIV_SYNC_DEBUG is defined. rw_lock_list_print_info(): Add parameter "file". mutex_list_print_info(): Add parameter "file". Make the function static.
285 lines
7.8 KiB
OpenEdge ABL
285 lines
7.8 KiB
OpenEdge ABL
/***************************************************************************
|
|
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
|
|
|
|
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
|
|
# undef __WIN__
|
|
# define __WIN__
|
|
|
|
# include <windows.h>
|
|
|
|
# if !defined(WIN64) && !defined(_WIN64)
|
|
# define UNIV_CAN_USE_X86_ASSEMBLER
|
|
# endif
|
|
|
|
# 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. */
|
|
|
|
# include <my_global.h>
|
|
# include <my_pthread.h>
|
|
|
|
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
|
# include <sys/stat.h>
|
|
|
|
# undef PACKAGE
|
|
# undef VERSION
|
|
|
|
/* Include the header file generated by GNU autoconf */
|
|
# include "config.h"
|
|
|
|
# ifdef HAVE_SCHED_H
|
|
# include <sched.h>
|
|
# endif
|
|
|
|
/* We only try to do explicit inlining of functions with gcc and
|
|
Microsoft Visual C++ */
|
|
|
|
# if !defined(__GNUC__)
|
|
# 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) || ... */
|
|
|
|
/* 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
|
|
*/
|
|
|
|
/* Make a non-inline debug version */
|
|
|
|
#if 0
|
|
#define UNIV_DEBUG
|
|
#define UNIV_MEM_DEBUG
|
|
#define UNIV_IBUF_DEBUG
|
|
#define UNIV_SYNC_DEBUG
|
|
#define UNIV_SEARCH_DEBUG
|
|
#define UNIV_SYNC_PERF_STAT
|
|
#define UNIV_SEARCH_PERF_STAT
|
|
#define UNIV_SRV_PRINT_LATCH_WAITS
|
|
#define UNIV_BTR_PRINT
|
|
#endif
|
|
|
|
#define UNIV_BTR_DEBUG
|
|
#define UNIV_LIGHT_MEM_DEBUG
|
|
|
|
#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 */
|
|
|
|
#if (!defined(UNIV_DEBUG) && !defined(INSIDE_HA_INNOBASE_CC) && !defined(UNIV_MUST_NOT_INLINE))
|
|
/* Definition for inline version */
|
|
|
|
#ifdef __WIN__
|
|
#define UNIV_INLINE __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
|
|
|
|
#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 universal page size of the database */
|
|
#define UNIV_PAGE_SIZE (2 * 8192) /* NOTE! Currently, this has to be a
|
|
power of 2 */
|
|
/* The 2-logarithm of UNIV_PAGE_SIZE: */
|
|
#define UNIV_PAGE_SIZE_SHIFT 14
|
|
|
|
/* 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_longlong;
|
|
#else
|
|
typedef longlong ib_longlong;
|
|
#endif
|
|
|
|
#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))
|
|
|
|
/* 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)
|
|
#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"
|
|
|
|
#endif
|