summaryrefslogtreecommitdiff
path: root/storage/xtradb/include
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/include')
-rw-r--r--storage/xtradb/include/buf0buf.h15
-rw-r--r--storage/xtradb/include/buf0lru.h2
-rw-r--r--storage/xtradb/include/buf0rea.h3
-rw-r--r--storage/xtradb/include/db0err.h2
-rw-r--r--storage/xtradb/include/dict0boot.h20
-rw-r--r--storage/xtradb/include/dict0crea.h18
-rw-r--r--storage/xtradb/include/dict0dict.h8
-rw-r--r--storage/xtradb/include/dict0mem.h2
-rw-r--r--storage/xtradb/include/fil0fil.h24
-rw-r--r--storage/xtradb/include/ha_prototypes.h20
-rw-r--r--storage/xtradb/include/hash0hash.h49
-rw-r--r--storage/xtradb/include/lock0lock.h12
-rw-r--r--storage/xtradb/include/log0log.ic5
-rw-r--r--storage/xtradb/include/mach0data.ic23
-rw-r--r--storage/xtradb/include/mtr0log.ic2
-rw-r--r--storage/xtradb/include/os0proc.h28
-rw-r--r--storage/xtradb/include/page0page.h2
-rw-r--r--storage/xtradb/include/page0page.ic3
-rw-r--r--storage/xtradb/include/page0zip.h2
-rw-r--r--storage/xtradb/include/que0que.h2
-rw-r--r--storage/xtradb/include/rem0cmp.h4
-rw-r--r--storage/xtradb/include/row0mysql.h72
-rw-r--r--storage/xtradb/include/srv0srv.h6
-rw-r--r--storage/xtradb/include/sync0rw.h5
-rw-r--r--storage/xtradb/include/sync0sync.h2
-rw-r--r--storage/xtradb/include/trx0sys.h1
-rw-r--r--storage/xtradb/include/trx0trx.h4
-rw-r--r--storage/xtradb/include/univ.i16
-rw-r--r--storage/xtradb/include/ut0lst.h43
29 files changed, 295 insertions, 100 deletions
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index f93510be6d6..9484146d8a3 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -36,6 +36,7 @@ Created 11/5/1995 Heikki Tuuri
#include "ut0rbt.h"
#ifndef UNIV_HOTBACKUP
#include "os0proc.h"
+#include "srv0srv.h"
/** @name Modes for buf_page_get_gen */
/* @{ */
@@ -1301,11 +1302,23 @@ struct buf_block_struct{
/**********************************************************************//**
Compute the hash fold value for blocks in buf_pool->zip_hash. */
/* @{ */
-#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
+/* the fold should be relative when srv_buffer_pool_shm_key is enabled */
+#define BUF_POOL_ZIP_FOLD_PTR(ptr) (!srv_buffer_pool_shm_key\
+ ?((ulint) (ptr) / UNIV_PAGE_SIZE)\
+ :((ulint) ((void*)ptr - (void*)(buf_pool->chunks->blocks->frame)) / UNIV_PAGE_SIZE))
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
+/** A chunk of buffers. The buffer pool is allocated in chunks. */
+struct buf_chunk_struct{
+ ulint mem_size; /*!< allocated size of the chunk */
+ ulint size; /*!< size of frames[] and blocks[] */
+ void* mem; /*!< pointer to the memory area which
+ was allocated for the frames */
+ buf_block_t* blocks; /*!< array of buffer control blocks */
+};
+
/** @brief The buffer pool statistics structure. */
struct buf_pool_stat_struct{
ulint n_page_gets; /*!< number of page gets performed;
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index 0a7d01c95cf..d3b59e8b579 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -96,7 +96,7 @@ buf_LRU_insert_zip_clean(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
+NOTE: If this function returns BUF_LRU_FREED, it will temporarily
release buf_pool_mutex. Furthermore, the page frame will no longer be
accessible via bpage.
diff --git a/storage/xtradb/include/buf0rea.h b/storage/xtradb/include/buf0rea.h
index 71f62ff7b49..56d3d24a3b7 100644
--- a/storage/xtradb/include/buf0rea.h
+++ b/storage/xtradb/include/buf0rea.h
@@ -158,8 +158,7 @@ buf_read_recv_pages(
/** The size in pages of the area which the read-ahead algorithms read if
invoked */
-#define BUF_READ_AHEAD_AREA \
- ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
+#define BUF_READ_AHEAD_AREA 64
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h
index 747e9b5364e..c841c2b4afe 100644
--- a/storage/xtradb/include/db0err.h
+++ b/storage/xtradb/include/db0err.h
@@ -28,6 +28,8 @@ Created 5/24/1996 Heikki Tuuri
enum db_err {
+ DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new
+ explicit record lock was created */
DB_SUCCESS = 10,
/* The following are error codes */
diff --git a/storage/xtradb/include/dict0boot.h b/storage/xtradb/include/dict0boot.h
index 1a13bd1503a..9239e031a7f 100644
--- a/storage/xtradb/include/dict0boot.h
+++ b/storage/xtradb/include/dict0boot.h
@@ -46,13 +46,14 @@ dict_hdr_get(
/*=========*/
mtr_t* mtr); /*!< in: mtr */
/**********************************************************************//**
-Returns a new row, table, index, or tree id.
-@return the new id */
+Returns a new table, index, or space id. */
UNIV_INTERN
-dulint
+void
dict_hdr_get_new_id(
/*================*/
- ulint type); /*!< in: DICT_HDR_ROW_ID, ... */
+ dulint* table_id, /*!< out: table id (not assigned if NULL) */
+ dulint* index_id, /*!< out: index id (not assigned if NULL) */
+ ulint* space_id); /*!< out: space id (not assigned if NULL) */
/**********************************************************************//**
Returns a new row id.
@return the new id */
@@ -100,6 +101,7 @@ dict_create(void);
#define DICT_COLUMNS_ID ut_dulint_create(0, 2)
#define DICT_INDEXES_ID ut_dulint_create(0, 3)
#define DICT_FIELDS_ID ut_dulint_create(0, 4)
+#define DICT_STATS_ID ut_dulint_create(0, 6)
/* The following is a secondary index on SYS_TABLES */
#define DICT_TABLE_IDS_ID ut_dulint_create(0, 5)
@@ -119,17 +121,21 @@ dict_create(void);
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
-#define DICT_HDR_MIX_ID 24 /* Obsolete, always 0. */
+#define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id, or 0*/
+#define DICT_HDR_MIX_ID_LOW 28 /* Obsolete,always DICT_HDR_FIRST_ID */
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
#define DICT_HDR_FIELDS 48 /* Root of the index field
index tree */
+#define DICT_HDR_STATS 52 /* Root of the stats tree */
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
segment into which the dictionary
header is created */
+
+#define DICT_HDR_XTRADB_MARK 256 /* Flag to distinguish expansion of XtraDB */
/*-------------------------------------------------------------*/
/* The field number of the page number field in the sys_indexes table
@@ -139,11 +145,15 @@ clustered index */
#define DICT_SYS_INDEXES_TYPE_FIELD 6
#define DICT_SYS_INDEXES_NAME_FIELD 4
+#define DICT_SYS_STATS_DIFF_VALS_FIELD 4
+
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
updated */
#define DICT_HDR_ROW_ID_WRITE_MARGIN 256
+#define DICT_HDR_XTRADB_FLAG ut_dulint_create(0x58545241UL,0x44425F31UL) /* "XTRADB_1" */
+
#ifndef UNIV_NONINL
#include "dict0boot.ic"
#endif
diff --git a/storage/xtradb/include/dict0crea.h b/storage/xtradb/include/dict0crea.h
index cce1246b789..0249091a195 100644
--- a/storage/xtradb/include/dict0crea.h
+++ b/storage/xtradb/include/dict0crea.h
@@ -53,6 +53,14 @@ ind_create_graph_create(
dict_index_t* index, /*!< in: index to create, built as a memory data
structure */
mem_heap_t* heap); /*!< in: heap where created */
+/*********************************************************************//**
+*/
+UNIV_INTERN
+ind_node_t*
+ind_insert_stats_graph_create(
+/*==========================*/
+ dict_index_t* index,
+ mem_heap_t* heap);
/***********************************************************//**
Creates a table. This is a high-level function used in SQL execution graphs.
@return query thread to run next or NULL */
@@ -62,6 +70,13 @@ dict_create_table_step(
/*===================*/
que_thr_t* thr); /*!< in: query thread */
/***********************************************************//**
+*/
+UNIV_INTERN
+que_thr_t*
+dict_insert_stats_step(
+/*===================*/
+ que_thr_t* thr);
+/***********************************************************//**
Creates an index. This is a high-level function used in SQL execution
graphs.
@return query thread to run next or NULL */
@@ -170,6 +185,7 @@ struct ind_node_struct{
ins_node_t* field_def; /* child node which does the inserts of
the field definitions; the row to be inserted
is built by the parent node */
+ ins_node_t* stats_def;
commit_node_t* commit_node;
/* child node which performs a commit after
a successful index creation */
@@ -180,6 +196,7 @@ struct ind_node_struct{
dict_table_t* table; /*!< table which owns the index */
dtuple_t* ind_row;/* index definition row built */
ulint field_no;/* next field definition to insert */
+ ulint stats_no;
mem_heap_t* heap; /*!< memory heap used as auxiliary storage */
};
@@ -189,6 +206,7 @@ struct ind_node_struct{
#define INDEX_CREATE_INDEX_TREE 3
#define INDEX_COMMIT_WORK 4
#define INDEX_ADD_TO_CACHE 5
+#define INDEX_BUILD_STATS_COLS 6
#ifndef UNIV_NONINL
#include "dict0crea.ic"
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 0879e91ab33..3c5e620d3c1 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -352,6 +352,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
@@ -1039,8 +1040,9 @@ void
dict_update_statistics_low(
/*=======================*/
dict_table_t* table, /*!< in/out: table */
- ibool has_dict_mutex);/*!< in: TRUE if the caller has the
+ ibool has_dict_mutex, /*!< in: TRUE if the caller has the
dictionary mutex */
+ ibool sync);
/*********************************************************************//**
Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
@@ -1048,7 +1050,8 @@ UNIV_INTERN
void
dict_update_statistics(
/*===================*/
- dict_table_t* table); /*!< in/out: table */
+ dict_table_t* table, /*!< in/out: table */
+ ibool sync);
/********************************************************************//**
Reserves the dictionary system mutex for MySQL. */
UNIV_INTERN
@@ -1159,6 +1162,7 @@ struct dict_sys_struct{
dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
dict_table_t* sys_fields; /*!< SYS_FIELDS table */
+ dict_table_t* sys_stats; /*!< SYS_STATS table */
};
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index ee3107a3be1..37c5a4a24fc 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -382,7 +382,7 @@ initialized to 0, NULL or FALSE in dict_mem_table_create(). */
struct dict_table_struct{
dulint id; /*!< id of the table */
mem_heap_t* heap; /*!< memory heap */
- const char* name; /*!< table name */
+ char* name; /*!< table name */
const char* dir_path_of_temp_table;/*!< NULL or the directory path
where a TEMPORARY table that was explicitly
created by a user should be placed if
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 163cacf2892..07c80ef8609 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -226,6 +226,16 @@ fil_space_create(
0 for uncompressed tablespaces */
ulint purpose);/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
/*******************************************************************//**
+Assigns a new space id for a new single-table tablespace. This works simply by
+incrementing the global counter. If 4 billion id's is not enough, we may need
+to recycle id's.
+@return TRUE if assigned, FALSE if not */
+UNIV_INTERN
+ibool
+fil_assign_new_space_id(
+/*====================*/
+ ulint* space_id); /*!< in/out: space id */
+/*******************************************************************//**
Returns the size of the space in pages. The tablespace must be cached in the
memory cache.
@return space size, 0 if space not found */
@@ -428,9 +438,7 @@ UNIV_INTERN
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
- ulint* space_id, /*!< in/out: space id; if this is != 0,
- then this is an input parameter,
- otherwise output */
+ ulint space_id, /*!< in: space id */
const char* tablename, /*!< in: the table name in the usual
databasename/tablename format
of InnoDB, or a dir path to a temp
@@ -499,16 +507,6 @@ UNIV_INTERN
ulint
fil_load_single_table_tablespaces(void);
/*===================================*/
-/********************************************************************//**
-If we need crash recovery, and we have called
-fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(),
-we can call this function to print an error message of orphaned .ibd files
-for which there is not a data dictionary entry with a matching table name
-and space id. */
-UNIV_INTERN
-void
-fil_print_orphaned_tablespaces(void);
-/*================================*/
/*******************************************************************//**
Returns TRUE if a single-table tablespace does not exist in the memory cache,
or is being deleted there.
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index b737a00b3dc..445d94eeabb 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -215,11 +215,21 @@ innobase_casedn_str(
/**********************************************************************//**
Determines the connection character set.
@return connection character set */
+UNIV_INTERN
struct charset_info_st*
innobase_get_charset(
/*=================*/
void* mysql_thd); /*!< in: MySQL thread handle */
-
+/**********************************************************************//**
+Determines the current SQL statement.
+@return SQL statement string */
+UNIV_INTERN
+const char*
+innobase_get_stmt(
+/*==============*/
+ void* mysql_thd, /*!< in: MySQL thread handle */
+ size_t* length) /*!< out: length of the SQL statement */
+ __attribute__((nonnull));
/******************************************************************//**
This function is used to find the storage length in bytes of the first n
characters for prefix indexes using a multibyte character set. The function
@@ -258,4 +268,12 @@ thd_lock_wait_timeout(
void* thd); /*!< in: thread handle (THD*), or NULL to query
the global innodb_lock_wait_timeout */
+/******************************************************************//**
+*/
+
+ulong
+thd_flush_log_at_trx_commit_session(
+/*================================*/
+ void* thd);
+
#endif
diff --git a/storage/xtradb/include/hash0hash.h b/storage/xtradb/include/hash0hash.h
index b17c21a45ef..9cb410e2ad7 100644
--- a/storage/xtradb/include/hash0hash.h
+++ b/storage/xtradb/include/hash0hash.h
@@ -49,6 +49,28 @@ hash_table_t*
hash_create(
/*========*/
ulint n); /*!< in: number of array cells */
+
+/*************************************************************//**
+*/
+UNIV_INTERN
+ulint
+hash_create_needed(
+/*===============*/
+ ulint n);
+
+UNIV_INTERN
+void
+hash_create_init(
+/*=============*/
+ hash_table_t* table,
+ ulint n);
+
+UNIV_INTERN
+void
+hash_create_reuse(
+/*==============*/
+ hash_table_t* table);
+
#ifndef UNIV_HOTBACKUP
/*************************************************************//**
Creates a mutex array to protect a hash table. */
@@ -328,6 +350,33 @@ do {\
}\
} while (0)
+/********************************************************************//**
+Align nodes with moving location.*/
+#define HASH_OFFSET(TABLE, NODE_TYPE, PTR_NAME, FADDR, FOFFSET, BOFFSET) \
+do {\
+ ulint i2222;\
+ ulint cell_count2222;\
+\
+ cell_count2222 = hash_get_n_cells(TABLE);\
+\
+ for (i2222 = 0; i2222 < cell_count2222; i2222++) {\
+ NODE_TYPE* node2222;\
+\
+ if ((TABLE)->array[i2222].node) \
+ (TABLE)->array[i2222].node \
+ += (((TABLE)->array[i2222].node > (void*)FADDR)?FOFFSET:BOFFSET);\
+ node2222 = HASH_GET_FIRST((TABLE), i2222);\
+\
+ while (node2222) {\
+ if (node2222->PTR_NAME) \
+ node2222->PTR_NAME = ((void*)node2222->PTR_NAME) \
+ + ((((void*)node2222->PTR_NAME) > (void*)FADDR)?FOFFSET:BOFFSET);\
+\
+ node2222 = node2222->PTR_NAME;\
+ }\
+ }\
+} while (0)
+
/************************************************************//**
Gets the mutex index for a fold value in a hash table.
@return mutex number */
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index 89a6977b589..73f885ecf04 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -341,11 +341,12 @@ lock_sec_rec_modify_check_and_lock(
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr); /*!< in/out: mini-transaction */
/*********************************************************************//**
-Like the counterpart for a clustered index below, but now we read a
+Like lock_clust_rec_read_check_and_lock(), but reads a
secondary index record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_sec_rec_read_check_and_lock(
/*=============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
@@ -372,9 +373,10 @@ if the query thread should anyway be suspended for some reason; if not, then
puts the transaction and the query thread to the lock wait state and inserts a
waiting request for a record lock to the lock queue. Sets the requested mode
lock on the record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_clust_rec_read_check_and_lock(
/*===============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic
index 139f4041a36..1ce00fd7313 100644
--- a/storage/xtradb/include/log0log.ic
+++ b/storage/xtradb/include/log0log.ic
@@ -433,7 +433,10 @@ void
log_free_check(void)
/*================*/
{
- /* ut_ad(sync_thread_levels_empty()); */
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(sync_thread_levels_empty_gen(TRUE));
+#endif /* UNIV_SYNC_DEBUG */
if (log_sys->check_flush_or_checkpoint) {
diff --git a/storage/xtradb/include/mach0data.ic b/storage/xtradb/include/mach0data.ic
index ef20356bd31..96d2417ac81 100644
--- a/storage/xtradb/include/mach0data.ic
+++ b/storage/xtradb/include/mach0data.ic
@@ -36,7 +36,7 @@ mach_write_to_1(
ulint n) /*!< in: ulint integer to be stored, >= 0, < 256 */
{
ut_ad(b);
- ut_ad(n <= 0xFFUL);
+ ut_ad((n | 0xFFUL) <= 0xFFUL);
b[0] = (byte)n;
}
@@ -65,7 +65,7 @@ mach_write_to_2(
ulint n) /*!< in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFUL);
+ ut_ad((n | 0xFFFFUL) <= 0xFFFFUL);
b[0] = (byte)(n >> 8);
b[1] = (byte)(n);
@@ -81,10 +81,7 @@ mach_read_from_2(
/*=============*/
const byte* b) /*!< in: pointer to 2 bytes */
{
- ut_ad(b);
- return( ((ulint)(b[0]) << 8)
- + (ulint)(b[1])
- );
+ return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
}
/********************************************************//**
@@ -129,7 +126,7 @@ mach_write_to_3(
ulint n) /*!< in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFFFUL);
+ ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL);
b[0] = (byte)(n >> 16);
b[1] = (byte)(n >> 8);
@@ -148,8 +145,8 @@ mach_read_from_3(
{
ut_ad(b);
return( ((ulint)(b[0]) << 16)
- + ((ulint)(b[1]) << 8)
- + (ulint)(b[2])
+ | ((ulint)(b[1]) << 8)
+ | (ulint)(b[2])
);
}
@@ -183,9 +180,9 @@ mach_read_from_4(
{
ut_ad(b);
return( ((ulint)(b[0]) << 24)
- + ((ulint)(b[1]) << 16)
- + ((ulint)(b[2]) << 8)
- + (ulint)(b[3])
+ | ((ulint)(b[1]) << 16)
+ | ((ulint)(b[2]) << 8)
+ | (ulint)(b[3])
);
}
@@ -721,7 +718,7 @@ mach_read_from_2_little_endian(
/*===========================*/
const byte* buf) /*!< in: from where to read */
{
- return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
+ return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8));
}
/*********************************************************//**
diff --git a/storage/xtradb/include/mtr0log.ic b/storage/xtradb/include/mtr0log.ic
index db017c7d16e..63af02ba409 100644
--- a/storage/xtradb/include/mtr0log.ic
+++ b/storage/xtradb/include/mtr0log.ic
@@ -203,7 +203,7 @@ mlog_write_initial_log_record_fast(
system tablespace */
if ((space == TRX_SYS_SPACE
|| (srv_doublewrite_file && space == TRX_DOUBLEWRITE_SPACE))
- && offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
+ && offset >= (ulint)FSP_EXTENT_SIZE && offset < 3 * (ulint)FSP_EXTENT_SIZE) {
if (trx_doublewrite_buf_is_being_created) {
/* Do nothing: we only come to this branch in an
InnoDB database creation. We do not redo log
diff --git a/storage/xtradb/include/os0proc.h b/storage/xtradb/include/os0proc.h
index fd46bd7db87..582cef6f803 100644
--- a/storage/xtradb/include/os0proc.h
+++ b/storage/xtradb/include/os0proc.h
@@ -32,6 +32,11 @@ Created 9/30/1995 Heikki Tuuri
#ifdef UNIV_LINUX
#include <sys/ipc.h>
#include <sys/shm.h>
+#else
+# if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
+#include <sys/ipc.h>
+#include <sys/shm.h>
+# endif
#endif
typedef void* os_process_t;
@@ -70,6 +75,29 @@ os_mem_free_large(
ulint size); /*!< in: size returned by
os_mem_alloc_large() */
+
+/****************************************************************//**
+Allocates or attaches and reuses shared memory segment.
+The content is not cleared automatically.
+@return allocated memory */
+UNIV_INTERN
+void*
+os_shm_alloc(
+/*=========*/
+ ulint* n, /*!< in/out: number of bytes */
+ uint key,
+ ibool* is_new);
+
+/****************************************************************//**
+Detach shared memory segment. */
+UNIV_INTERN
+void
+os_shm_free(
+/*========*/
+ void *ptr, /*!< in: pointer returned by
+ os_shm_alloc() */
+ ulint size); /*!< in: size returned by
+ os_shm_alloc() */
#ifndef UNIV_NONINL
#include "os0proc.ic"
#endif
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index e182c8f58be..5b2bcf7c054 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -500,7 +500,7 @@ ibool
page_is_leaf(
/*=========*/
const page_t* page) /*!< in: page */
- __attribute__((nonnull, pure));
+ __attribute__((pure));
/************************************************************//**
Gets the pointer to the next record on the page.
@return pointer to next record */
diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic
index 9655e6c7e27..dab9dc742e4 100644
--- a/storage/xtradb/include/page0page.ic
+++ b/storage/xtradb/include/page0page.ic
@@ -275,6 +275,9 @@ page_is_leaf(
/*=========*/
const page_t* page) /*!< in: page */
{
+ if (!page) {
+ return(FALSE);
+ }
return(!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL)));
}
diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h
index 574809e5227..4d37302ed20 100644
--- a/storage/xtradb/include/page0zip.h
+++ b/storage/xtradb/include/page0zip.h
@@ -114,7 +114,7 @@ page_zip_compress(
const page_t* page, /*!< in: uncompressed page */
dict_index_t* index, /*!< in: index of the B-tree node */
mtr_t* mtr) /*!< in: mini-transaction, or NULL */
- __attribute__((nonnull(1,2,3)));
+ __attribute__((nonnull(1,3)));
/**********************************************************************//**
Decompress a page. This function should tolerate errors on the compressed
diff --git a/storage/xtradb/include/que0que.h b/storage/xtradb/include/que0que.h
index 39f8d07af89..09a671f49b1 100644
--- a/storage/xtradb/include/que0que.h
+++ b/storage/xtradb/include/que0que.h
@@ -492,6 +492,8 @@ struct que_fork_struct{
#define QUE_NODE_CALL 31
#define QUE_NODE_EXIT 32
+#define QUE_NODE_INSERT_STATS 34
+
/* Query thread states */
#define QUE_THR_RUNNING 1
#define QUE_THR_PROCEDURE_WAIT 2
diff --git a/storage/xtradb/include/rem0cmp.h b/storage/xtradb/include/rem0cmp.h
index 421308af49b..fcea62ad486 100644
--- a/storage/xtradb/include/rem0cmp.h
+++ b/storage/xtradb/include/rem0cmp.h
@@ -148,7 +148,9 @@ cmp_rec_rec_simple(
const rec_t* rec2, /*!< in: physical record */
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
- const dict_index_t* index); /*!< in: data dictionary index */
+ const dict_index_t* index, /*!< in: data dictionary index */
+ ibool* null_eq);/*!< out: set to TRUE if
+ found matching null values */
/*************************************************************//**
This function is used to compare two physical records. Only the common
first fields are compared, and if an externally stored field is
diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h
index d2a8734c61f..a604f6e3724 100644
--- a/storage/xtradb/include/row0mysql.h
+++ b/storage/xtradb/include/row0mysql.h
@@ -253,15 +253,6 @@ row_table_got_default_clust_index(
/*==============================*/
const dict_table_t* table); /*!< in: table */
/*********************************************************************//**
-Calculates the key number used inside MySQL for an Innobase index. We have
-to take into account if we generated a default clustered index for the table
-@return the key number used inside MySQL */
-UNIV_INTERN
-ulint
-row_get_mysql_key_number_for_index(
-/*===============================*/
- const dict_index_t* index); /*!< in: index */
-/*********************************************************************//**
Does an update or delete of a row for MySQL.
@return error code or DB_SUCCESS */
UNIV_INTERN
@@ -273,27 +264,26 @@ row_update_for_mysql(
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
handle */
/*********************************************************************//**
-This can only be used when srv_locks_unsafe_for_binlog is TRUE or
-session is using a READ COMMITTED isolation level. Before
-calling this function we must use trx_reset_new_rec_lock_info() and
-trx_register_new_rec_lock() to store the information which new record locks
-really were set. This function removes a newly set lock under prebuilt->pcur,
-and also under prebuilt->clust_pcur. Currently, this is only used and tested
-in the case of an UPDATE or a DELETE statement, where the row lock is of the
-LOCK_X type.
-Thus, this implements a 'mini-rollback' that releases the latest record
-locks we set.
-@return error code or DB_SUCCESS */
+This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
+session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+Before calling this function row_search_for_mysql() must have
+initialized prebuilt->new_rec_locks to store the information which new
+record locks really were set. This function removes a newly set
+clustered index record lock under prebuilt->pcur or
+prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
+releases the latest clustered index record lock we set.
+@return error code or DB_SUCCESS */
UNIV_INTERN
int
row_unlock_for_mysql(
/*=================*/
- row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL
+ row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL
handle */
- ibool has_latches_on_recs);/*!< TRUE if called so that we have
- the latches on the records under pcur
- and clust_pcur, and we do not need to
- reposition the cursors. */
+ ibool has_latches_on_recs);/*!< in: TRUE if called
+ so that we have the latches on
+ the records under pcur and
+ clust_pcur, and we do not need
+ to reposition the cursors. */
/*********************************************************************//**
Creates an query graph node of 'update' type to be used in the MySQL
interface.
@@ -386,6 +376,14 @@ row_create_index_for_mysql(
then checked for not being too
large. */
/*********************************************************************//**
+*/
+UNIV_INTERN
+int
+row_insert_stats_for_mysql(
+/*=======================*/
+ dict_index_t* index,
+ trx_t* trx);
+/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
@@ -403,6 +401,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
@@ -710,18 +709,17 @@ struct row_prebuilt_struct {
ulint new_rec_locks; /*!< normally 0; if
srv_locks_unsafe_for_binlog is
TRUE or session is using READ
- COMMITTED isolation level, in a
- cursor search, if we set a new
- record lock on an index, this is
- incremented; this is used in
- releasing the locks under the
- cursors if we are performing an
- UPDATE and we determine after
- retrieving the row that it does
- not need to be locked; thus,
- these can be used to implement a
- 'mini-rollback' that releases
- the latest record locks */
+ COMMITTED or READ UNCOMMITTED
+ isolation level, set in
+ row_search_for_mysql() if we set a new
+ record lock on the secondary
+ or clustered index; this is
+ used in row_unlock_for_mysql()
+ when releasing the lock under
+ the cursor if we determine
+ after retrieving the row that
+ it does not need to be locked
+ ('mini-rollback') */
ulint mysql_prefix_len;/*!< byte offset of the end of
the last requested column */
ulint mysql_row_len; /*!< length in bytes of a row in the
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index a463075f435..0904a5da1eb 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -156,6 +156,8 @@ extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
+extern uint srv_buffer_pool_shm_key;
+
extern ibool srv_thread_concurrency_timer_based;
extern ulint srv_n_file_io_threads;
@@ -207,6 +209,7 @@ extern ulong srv_stats_method;
#define SRV_STATS_METHOD_IGNORE_NULLS 2
extern ulong srv_stats_auto_update;
extern ulint srv_stats_update_need_lock;
+extern ibool srv_use_sys_stats_table;
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
@@ -367,8 +370,9 @@ enum {
when writing data files, but do flush
after writing to log files */
SRV_UNIX_NOSYNC, /*!< do not flush after writing */
- SRV_UNIX_O_DIRECT /*!< invoke os_file_set_nocache() on
+ SRV_UNIX_O_DIRECT, /*!< invoke os_file_set_nocache() on
data files */
+ SRV_UNIX_ALL_O_DIRECT /* new method for examination: logfile also open O_DIRECT */
};
/** Alternatives for file i/o in Windows */
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 1fe517ab30a..4edf93f4042 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -556,11 +556,12 @@ struct rw_lock_struct {
//unsigned cline:14; /*!< Line where created */
unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */
+#ifdef UNIV_DEBUG
ulint magic_n; /*!< RW_LOCK_MAGIC_N */
-};
-
/** Value of rw_lock_struct::magic_n */
#define RW_LOCK_MAGIC_N 22643
+#endif /* UNIV_DEBUG */
+};
#ifdef UNIV_SYNC_DEBUG
/** The structure for storing debug info of an rw-lock */
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index 7e210ea82f1..a500cf1da45 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -438,7 +438,7 @@ or row lock! */
#define SYNC_FILE_FORMAT_TAG 1200 /* Used to serialize access to the
file format tag */
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
- this in X-mode, implicit or backround
+ this in X-mode; implicit or backround
operations purge, rollback, foreign
key checks reserve this in S-mode */
#define SYNC_DICT 1000
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 8b941cdd4e6..9ef9485b611 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -326,6 +326,7 @@ UNIV_INTERN
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
+ trx_sysf_t* sys_header,
const char* file_name_in,/*!< in: MySQL log file name */
ib_int64_t offset, /*!< in: position in that log file */
ulint field, /*!< in: offset of the MySQL log info field in
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 4a4b54b93a0..4c0ce392bcd 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -497,6 +497,7 @@ struct trx_struct{
FALSE, one can save CPU time and about
150 bytes in the undo log size as then
we skip XA steps */
+ ulint flush_log_at_trx_commit_session;
ulint flush_log_later;/* In 2PC, we hold the
prepare_commit mutex across
both phases. In that case, we
@@ -560,9 +561,6 @@ struct trx_struct{
/*------------------------------*/
void* mysql_thd; /*!< MySQL thread handle corresponding
to this trx, or NULL */
- char** mysql_query_str;/* pointer to the field in mysqld_thd
- which contains the pointer to the
- current SQL query string */
const char* mysql_log_file_name;
/* if MySQL binlog is used, this field
contains a pointer to the latest file
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 90ce618b9da..71476443964 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -46,8 +46,8 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 8
-#define PERCONA_INNODB_VERSION 11.2
+#define INNODB_VERSION_BUGFIX 10
+#define PERCONA_INNODB_VERSION 12.0
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -170,7 +170,7 @@ command. Not tested on Windows. */
#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H)
# define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_valgrind */
+#endif
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -208,10 +208,6 @@ operations (very slow); also UNIV_DEBUG must be defined */
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
@@ -301,6 +297,12 @@ management to ensure correct alignment for doubles etc. */
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
+/* The maximum length of a table name. This is the MySQL limit and is
+defined in mysql_com.h like NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN, the
+number does not include a terminating '\0'. InnoDB probably can handle
+longer names internally */
+#define MAX_TABLE_NAME_LEN 192
+
/*
UNIVERSAL TYPE DEFINITIONS
==========================
diff --git a/storage/xtradb/include/ut0lst.h b/storage/xtradb/include/ut0lst.h
index 7b15c052978..69809f22d36 100644
--- a/storage/xtradb/include/ut0lst.h
+++ b/storage/xtradb/include/ut0lst.h
@@ -257,5 +257,48 @@ do { \
ut_a(ut_list_node_313 == NULL); \
} while (0)
+/********************************************************************//**
+Align nodes with moving location.
+@param NAME the name of the list
+@param TYPE node type
+@param BASE base node (not a pointer to it)
+@param OFFSET offset moved */
+#define UT_LIST_OFFSET(NAME, TYPE, BASE, FADDR, FOFFSET, BOFFSET) \
+do { \
+ ulint ut_list_i_313; \
+ TYPE* ut_list_node_313; \
+ \
+ if ((BASE).start) \
+ (BASE).start = ((void*)((BASE).start) \
+ + (((void*)((BASE).start) > (void*)FADDR)?FOFFSET:BOFFSET));\
+ if ((BASE).end) \
+ (BASE).end = ((void*)((BASE).end) \
+ + (((void*)((BASE).end) > (void*)FADDR)?FOFFSET:BOFFSET));\
+ \
+ ut_list_node_313 = (BASE).start; \
+ \
+ for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
+ ut_a(ut_list_node_313); \
+ if ((ut_list_node_313->NAME).prev) \
+ (ut_list_node_313->NAME).prev = ((void*)((ut_list_node_313->NAME).prev)\
+ + (((void*)((ut_list_node_313->NAME).prev) > (void*)FADDR)?FOFFSET:BOFFSET));\
+ if ((ut_list_node_313->NAME).next) \
+ (ut_list_node_313->NAME).next = ((void*)((ut_list_node_313->NAME).next)\
+ + (((void*)((ut_list_node_313->NAME).next)> (void*)FADDR)?FOFFSET:BOFFSET));\
+ ut_list_node_313 = (ut_list_node_313->NAME).next; \
+ } \
+ \
+ ut_a(ut_list_node_313 == NULL); \
+ \
+ ut_list_node_313 = (BASE).end; \
+ \
+ for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
+ ut_a(ut_list_node_313); \
+ ut_list_node_313 = (ut_list_node_313->NAME).prev; \
+ } \
+ \
+ ut_a(ut_list_node_313 == NULL); \
+} while (0)
+
#endif