mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 23:34:34 +01:00
2dca2a1a5d
Fixed BUG#19542 "InnoDB doesn't increase the Handler_read_prev couter". Fixed BUG#19609 "Case sensitivity of innodb_data_file_path gives stupid error". Fixed BUG#19727 "InnoDB crashed server and crashed tables are ot recoverable". Also: * Remove remnants of the obsolete concept of memoryfixing tables and indexes. * Remove unused dict_table_LRU_trim(). * Remove unused 'trx' parameter from dict_table_get_on_id_low(), dict_table_get(), dict_table_get_and_increment_handle_count(). * Add a normal linked list implementation. * Add a work queue implementation. * Add 'level' parameter to mutex_create() and rw_lock_create(). Remove mutex_set_level() and rw_lock_set_level(). * Rename SYNC_LEVEL_NONE to SYNC_LEVEL_VARYING. * Add support for bound ids in InnoDB's parser. * Define UNIV_BTR_DEBUG for enabling consistency checks of FIL_PAGE_NEXT and FIL_PAGE_PREV when accessing sibling pages of B-tree indexes. btr_validate_level(): Check the validity of the doubly linked list formed by FIL_PAGE_NEXT and FIL_PAGE_PREV. * Adapt InnoDB to the new tablename to filename encoding in MySQL 5.1. ut_print_name(), ut_print_name1(): Add parameter 'table_id' for distinguishing names of tables from other identifiers. New: innobase_convert_from_table_id(), innobase_convert_from_id(), innobase_convert_from_filename(), innobase_get_charset. dict_accept(), dict_scan_id(), dict_scan_col(), dict_scan_table_name(), dict_skip_word(), dict_create_foreign_constraints_low(): Add parameter 'cs' so that isspace() can be replaced with my_isspace(), whose operation depends on the connection character set. dict_scan_id(): Convert identifier to UTF-8. dict_str_starts_with_keyword(): New extern function, to replace dict_accept() in row_search_for_mysql(). mysql_get_identifier_quote_char(): Replaced with innobase_print_identifier(). ha_innobase::create(): Remove the thd->convert_strin() call. Pass the statement to InnoDB in the connection character set and let InnoDB convert the identifier to UTF-8. * Add max_row_size to dict_table_t. * btr0cur.c btr_copy_externally_stored_field(): Only set the 'offset' variable when needed. * buf0buf.c buf_page_io_complete(): Write to the error log if the page number or the space id o the disk do not match those in memory. Also write to the error log if a page was read from the doublewrite buffer. The doublewrite buffer should be only read by the lower-level function fil_io() at database startup. * dict0dict.c dict_scan_table_name(): Remove fallback to differently encoded name when the table is not found. The encoding is handled at a higher level. * ha_innodb.cc Increment statistic counter in ha_innobase::index_prev() (bug 19542). Add innobase_convert_string wrapper function and a new file ha_prototypes.h. innobase_print_identifier(): Remove TODO comment before calling get_quote_char_for_identifier(). That function apparently assumes the identifier to be encoded in UTF-8. * ibuf0ibuf.c|h ibuf_count_get(), ibuf_counts[], ibuf_count_inited(): Define these only #ifdef UNIV_IBUF_DEBUG. Previously, when compiled without UNIV_IBUF_DEBUG, invoking ibuf_count_get() would crash InnoDB. The function is only being called #ifdef UNIV_IBUF_DEBUG. * innodb.result Adjust the results for changes in the foreign key error messages. * mem0mem.c|h New: mem_heap_dup(), mem_heap_printf(), mem_heap_cat(). * os0file.c Check the page trailers also after writing to disk. This improves chances of diagnosing bug 18886. os_file_check_page_trailers(): New function for checking that the two copies of the LSN stamped on the page match. os_aio_simulated_handle(): Call os_file_check_page_trailers() before and after os_file_write(). * row0mysql.c Move trx_commit_for_mysql(trx) calls before calls to row_mysql_unlock_data_dictionary(trx) (bug 19727). * row0sel.c row_fetch_print(): Handle SQL NULL values without crashing. row_sel_store_mysql_rec(): Remove useless call to rec_get_nth_field when handling an externally stored column. Fetch externally stored fields when using InnoDB's internal SQL parser. Optimize BLOB selects by using prebuilt->blob_heap directly instead of first reading BLOB data to a temporary heap and then copying it to prebuilt->blob_heap. * srv0srv.c srv_master_thread(): Remove unreachable code. * srv0start.c srv_parse_data_file_paths_and_sizes(): Accept lower-case 'm' and 'g' as abbreviations of megabyte and gigabyte (bug 19609). srv_parse_megabytes(): New fuction. * ut0dbg.c|h Implement InnoDB assertions (ut_a and ut_error) with abort() when the code is compiled with GCC 3 or later on other platforms than Windows or Netware. Also disable the variable ut_dbg_stop_threads and the function ut_dbg_stop_thread() i this case, unless UNIV_SYC_DEBUG is defined. This should allow the compiler to generate more compact code for assertions. * ut0list.c|h Add ib_list_create_heap(). mysql-test/r/innodb.result: Applied innodb-5.1-ss594 snapshot. mysql-test/t/innodb.test: Copy the comment from the beginning of the file to the end because MySQL developers continue adding test cases to this file. sql/ha_innodb.cc: Applied innodb-5.1-ss594 snapshot. storage/innobase/CMakeLists.txt: Applied innodb-5.1-ss594 snapshot. storage/innobase/Makefile.am: Applied innodb-5.1-ss594 snapshot. storage/innobase/btr/btr0btr.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/btr/btr0cur.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/btr/btr0pcur.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/btr/btr0sea.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/buf/buf0buf.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/buf/buf0flu.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/data/data0type.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/dict/dict0crea.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/dict/dict0dict.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/dict/dict0load.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/dict/dict0mem.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/fil/fil0fil.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/ha/hash0hash.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/ibuf/ibuf0ibuf.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/data0type.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/dict0dict.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/dict0dict.ic: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/dict0mem.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/fil0fil.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/fsp0fsp.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ibuf0ibuf.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/mem0mem.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/pars0pars.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/pars0sym.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/pars0types.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/rem0rec.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/row0purge.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/row0undo.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/srv0srv.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/sync0rw.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/sync0sync.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/univ.i: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ut0dbg.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ut0ut.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/lock/lock0lock.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/log/log0log.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/log/log0recv.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/mem/mem0dbg.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/mem/mem0mem.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/mem/mem0pool.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/os/os0file.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/os/os0thread.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/pars/lexyy.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/pars/pars0lex.l: Applied innodb-5.1-ss594 snapshot. storage/innobase/pars/pars0pars.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/pars/pars0sym.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0ins.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0mysql.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0purge.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0row.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0sel.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/row/row0upd.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/srv/srv0srv.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/srv/srv0start.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/sync/sync0arr.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/sync/sync0rw.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/sync/sync0sync.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/thr/thr0loc.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0purge.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0rec.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0roll.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0rseg.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0sys.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/trx/trx0trx.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/ut/Makefile.am: Applied innodb-5.1-ss594 snapshot. storage/innobase/ut/ut0dbg.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/ut/ut0ut.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ha_prototypes.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ut0list.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ut0list.ic: Applied innodb-5.1-ss594 snapshot. storage/innobase/include/ut0wqueue.h: Applied innodb-5.1-ss594 snapshot. storage/innobase/ut/ut0list.c: Applied innodb-5.1-ss594 snapshot. storage/innobase/ut/ut0wqueue.c: Applied innodb-5.1-ss594 snapshot.
295 lines
8 KiB
OpenEdge ABL
295 lines
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 */
|
|
#ifndef __WIN__
|
|
#include "../ib_config.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_SCHED_H
|
|
#include <sched.h>
|
|
#endif
|
|
|
|
/* 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
|
|
|
|
/* We only try to do explicit inlining of functions with gcc and
|
|
Microsoft Visual C++ */
|
|
|
|
#if !defined(__GNUC__) && !defined(__WIN__)
|
|
#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
|
|
#endif
|
|
|
|
#define UNIV_BTR_DEBUG
|
|
#define UNIV_LIGHT_MEM_DEBUG
|
|
|
|
#define YYDEBUG 1
|
|
|
|
#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
|