Commit 2ed4d634 authored by Vadim Tkachenko's avatar Vadim Tkachenko

1.0.2 version imported

parent 84f733af
......@@ -17,6 +17,14 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -D_LIB)
# Bug 19424 - InnoDB: Possibly a memory overrun of the buffer being freed (64-bit Visual C)
# Removing Win64 compiler optimizations for all innodb/mem/* files.
IF(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_SIZEOF_VOID_P MATCHES 8)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/storage/innobase/mem/mem0mem.c
${CMAKE_SOURCE_DIR}/storage/innobase/mem/mem0pool.c
PROPERTIES COMPILE_FLAGS -Od)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_SIZEOF_VOID_P MATCHES 8)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/storage/innobase/include
${CMAKE_SOURCE_DIR}/storage/innobase/handler
......@@ -61,4 +69,28 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(innobase ${INNOBASE_SOURCES})
ADD_DEPENDENCIES(innobase GenError)
IF(INNODB_DYNAMIC_PLUGIN)
# The dynamic plugin requires CMake 2.6.0 or later. Otherwise, the /DELAYLOAD property
# will not be set
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
ADD_LIBRARY(ha_innodb SHARED ${INNOBASE_SOURCES} ha_innodb.def handler/win_delay_loader.cc)
ADD_DEPENDENCIES(ha_innodb GenError mysqld)
# If build type is not specified as Release, default to Debug
# This is a workaround to a problem in CMake 2.6, which does not
# set the path of mysqld.lib correctly
IF(CMAKE_BUILD_TYPE MATCHES Release)
SET(CMAKE_BUILD_TYPE "Release")
ELSE(CMAKE_BUILD_TYPE MATCHES Release)
SET(CMAKE_BUILD_TYPE "Debug")
ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
TARGET_LINK_LIBRARIES(ha_innodb strings zlib)
TARGET_LINK_LIBRARIES(ha_innodb ${CMAKE_SOURCE_DIR}/sql/${CMAKE_BUILD_TYPE}/mysqld.lib)
SET_TARGET_PROPERTIES(ha_innodb PROPERTIES OUTPUT_NAME ha_innodb)
SET_TARGET_PROPERTIES(ha_innodb PROPERTIES LINK_FLAGS "/MAP /MAPINFO:EXPORTS")
SET_TARGET_PROPERTIES(ha_innodb PROPERTIES LINK_FLAGS "/ENTRY:\"_DllMainCRTStartup@12\"")
SET_TARGET_PROPERTIES(ha_innodb PROPERTIES COMPILE_FLAGS "-DMYSQL_DYNAMIC_PLUGIN")
SET_TARGET_PROPERTIES(ha_innodb PROPERTIES LINK_FLAGS "/DELAYLOAD:mysqld.exe")
ENDIF(INNODB_DYNAMIC_PLUGIN)
ENDIF(NOT SOURCE_SUBLIBS)
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This is the source of the InnoDB Plugin 1.0.1 for MySQL 5.1
This is the source of the InnoDB Plugin 1.0.2 for MySQL 5.1
===========================================================
Instructions for compiling the plugin:
......@@ -23,4 +23,7 @@ http://www.innodb.com/doc/innodb_plugin-1.0/innodb-plugin-installation.html
For more information about InnoDB visit
http://www.innodb.com
Please report any problems or issues with the plugin in the InnoDB Forums
http://forums.innodb.com/ or in the MySQL Bugs database http://bugs.mysql.com
Thank you for using the InnoDB plugin!
This diff is collapsed.
This diff is collapsed.
......@@ -208,6 +208,7 @@ btr_pcur_restore_position(
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
putc('\n', stderr);
if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known, 0);
}
......@@ -243,10 +244,10 @@ btr_pcur_restore_position(
cursor->block_when_stored,
cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(btr_pcur_get_block(cursor),
SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG
const rec_t* rec;
......
......@@ -188,6 +188,7 @@ btr_search_info_create(
info->magic_n = BTR_SEARCH_MAGIC_N;
#endif /* UNIV_DEBUG */
info->ref_count = 0;
info->root_guess = NULL;
info->hash_analysis = 0;
......@@ -211,6 +212,32 @@ btr_search_info_create(
return(info);
}
/*********************************************************************
Returns the value of ref_count. The value is protected by
btr_search_latch. */
UNIV_INTERN
ulint
btr_search_info_get_ref_count(
/*==========================*/
/* out: ref_count value. */
btr_search_t* info) /* in: search info. */
{
ulint ret;
ut_ad(info);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
rw_lock_s_lock(&btr_search_latch);
ret = info->ref_count;
rw_lock_s_unlock(&btr_search_latch);
return(ret);
}
/*************************************************************************
Updates the search info of an index about hash successes. NOTE that info
is NOT protected by any semaphore, to save CPU time! Do not assume its fields
......@@ -818,9 +845,7 @@ btr_search_guess_on_hash(
rw_lock_s_unlock(&btr_search_latch);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */
}
if (UNIV_UNLIKELY(buf_block_get_state(block)
......@@ -947,8 +972,8 @@ btr_search_drop_page_hash_index(
hash_table_t* table;
ulint n_fields;
ulint n_bytes;
page_t* page;
rec_t* rec;
const page_t* page;
const rec_t* rec;
ulint fold;
ulint prev_fold;
dulint index_id;
......@@ -957,7 +982,7 @@ btr_search_drop_page_hash_index(
ulint* folds;
ulint i;
mem_heap_t* heap;
dict_index_t* index;
const dict_index_t* index;
ulint* offsets;
#ifdef UNIV_SYNC_DEBUG
......@@ -1007,7 +1032,7 @@ btr_search_drop_page_hash_index(
n_cached = 0;
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
rec = page_rec_get_next_low(rec, page_is_comp(page));
index_id = btr_page_get_index_id(page);
......@@ -1035,7 +1060,7 @@ btr_search_drop_page_hash_index(
folds[n_cached] = fold;
n_cached++;
next_rec:
rec = page_rec_get_next(rec);
rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
prev_fold = fold;
}
......@@ -1070,8 +1095,12 @@ btr_search_drop_page_hash_index(
ha_remove_all_nodes_to_page(table, folds[i], page);
}
ut_a(index->search_info->ref_count > 0);
index->search_info->ref_count--;
block->is_hashed = FALSE;
block->index = NULL;
cleanup:
#ifdef UNIV_DEBUG
if (UNIV_UNLIKELY(block->n_pointers)) {
......@@ -1127,9 +1156,7 @@ btr_search_drop_page_hash_when_freed(
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */
btr_search_drop_page_hash_index(block);
......@@ -1295,6 +1322,15 @@ btr_search_build_page_hash_index(
goto exit_func;
}
/* This counter is decremented every time we drop page
hash index entries and is incremented here. Since we can
rebuild hash index for a page that is already hashed, we
have to take care not to increment the counter in that
case. */
if (!block->is_hashed) {
index->search_info->ref_count++;
}
block->is_hashed = TRUE;
block->n_hash_helps = 0;
......
......@@ -406,7 +406,7 @@ buf_page_is_corrupted(
}
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
(always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
(always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
if (checksum_field != 0
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
......@@ -443,7 +443,7 @@ buf_page_print(
fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
(ulong) size);
ut_print_buf(stderr, read_buf, size);
fputs("InnoDB: End of page dump\n", stderr);
fputs("\nInnoDB: End of page dump\n", stderr);
if (zip_size) {
/* Print compressed page. */
......@@ -1053,6 +1053,14 @@ buf_relocate(
if (UNIV_UNLIKELY(buf_pool->LRU_old == bpage)) {
buf_pool->LRU_old = dpage;
#ifdef UNIV_LRU_DEBUG
/* buf_pool->LRU_old must be the first item in the LRU list
whose "old" flag is set. */
ut_a(!UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)
|| !UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)->old);
ut_a(!UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)
|| UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)->old);
#endif /* UNIV_LRU_DEBUG */
}
ut_d(UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU));
......@@ -2193,9 +2201,8 @@ buf_page_optimistic_get_func(
}
if (UNIV_UNLIKELY(modify_clock != block->modify_clock)) {
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
if (rw_latch == RW_S_LATCH) {
rw_lock_s_unlock(&(block->lock));
} else {
......@@ -2395,9 +2402,8 @@ buf_page_try_get_func(
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->page.file_page_was_freed == FALSE);
#endif /* UNIV_DEBUG_FILE_ACCESSES */
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
buf_pool->n_page_gets++;
return(block);
......@@ -3070,9 +3076,6 @@ buf_page_io_complete(
ut_error;
}
mutex_exit(buf_page_get_mutex(bpage));
buf_pool_mutex_exit();
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr, "Has %s page space %lu page no %lu\n",
......@@ -3081,6 +3084,9 @@ buf_page_io_complete(
(ulong) buf_page_get_page_no(bpage));
}
#endif /* UNIV_DEBUG */
mutex_exit(buf_page_get_mutex(bpage));
buf_pool_mutex_exit();
}
/*************************************************************************
......@@ -3446,6 +3452,7 @@ buf_print(void)
}
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
#ifdef UNIV_DEBUG
/*************************************************************************
Returns the number of latched pages in the buffer pool. */
UNIV_INTERN
......@@ -3532,6 +3539,7 @@ buf_get_latched_pages_number(void)
return(fixed_pages_number);
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Returns the number of pending buf pool ios. */
......
......@@ -168,6 +168,7 @@ buf_flush_ready_for_replace(
" in the LRU list!\n",
(ulong) buf_page_get_state(bpage));
ut_print_buf(stderr, bpage, sizeof(buf_page_t));
putc('\n', stderr);
return(FALSE);
}
......@@ -634,6 +635,13 @@ buf_flush_init_for_writing(
return;
}
ut_print_timestamp(stderr);
fputs(" InnoDB: ERROR: The compressed page to be written"
" seems corrupt:", stderr);
ut_print_buf(stderr, page, zip_size);
fputs("\nInnoDB: Possibly older version of the page:", stderr);
ut_print_buf(stderr, page_zip->data, zip_size);
putc('\n', stderr);
ut_error;
}
......
This diff is collapsed.
......@@ -607,6 +607,7 @@ dtuple_convert_big_rec(
while (page_zip_rec_needs_ext(rec_get_converted_size(index, entry,
*n_ext),
dict_table_is_comp(index->table),
dict_index_get_n_fields(index),
dict_table_zip_size(index->table))) {
ulint i;
ulint longest = 0;
......
......@@ -39,9 +39,9 @@ dict_hdr_get(
block = buf_page_get(DICT_HDR_SPACE, 0, DICT_HDR_PAGE_NO,
RW_X_LATCH, mtr);
header = DICT_HDR + buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_DICT_HEADER);
#endif /* UNIV_SYNC_DEBUG */
return(header);
}
......@@ -279,7 +279,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
/*-------------------------*/
......@@ -291,7 +292,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
/*-------------------------*/
......@@ -322,7 +324,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
/*-------------------------*/
......@@ -363,7 +366,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
/*-------------------------*/
......@@ -389,7 +393,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
mtr_commit(&mtr);
......
......@@ -216,8 +216,6 @@ dict_build_table_def_step(
const char* path_or_name;
ibool is_path;
mtr_t mtr;
ulint i;
ulint row_len;
ut_ad(mutex_own(&(dict_sys->mutex)));
......@@ -227,14 +225,6 @@ dict_build_table_def_step(
thr_get_trx(thr)->table_id = table->id;
row_len = 0;
for (i = 0; i < table->n_def; i++) {
row_len += dict_col_get_min_size(&table->cols[i]);
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
}
if (srv_file_per_table) {
/* We create a new single-table tablespace for the table.
We initially let it be 4 pages:
......@@ -543,11 +533,7 @@ dict_build_index_def_step(
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| dict_index_is_clust(index));
/* For fast index creation we have already allocated an index id
for this index so that we could write an UNDO log record for it.*/
if (ut_dulint_is_zero(index->id)) {
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
}
/* Inherit the space id from the table; we store all indexes of a
table in the same tablespace */
......@@ -1093,7 +1079,7 @@ dict_create_index_step(
dulint index_id = node->index->id;
err = dict_index_add_to_cache(node->table, node->index,
FIL_NULL);
FIL_NULL, trx_is_strict(trx));
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
......@@ -1239,7 +1225,6 @@ dict_create_or_check_foreign_constraint_tables(void)
" FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
" ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n"
"END;\n"
, FALSE, trx);
......@@ -1262,7 +1247,7 @@ dict_create_or_check_foreign_constraint_tables(void)
error = DB_MUST_GET_MORE_FILE_SPACE;
}
trx->op_info = "";
trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
......
This diff is collapsed.
......@@ -765,7 +765,8 @@ dict_load_indexes(
index->id = id;
dict_load_fields(index, heap);
error = dict_index_add_to_cache(table, index, page_no);
error = dict_index_add_to_cache(table, index, page_no,
FALSE);
/* The data dictionary tables should never contain
invalid index definitions. If we ignored this error
and simply did not load this index definition, the
......
......@@ -58,13 +58,15 @@ dict_mem_table_create(
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t));
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
table->autoinc_lock = mem_heap_alloc(heap, lock_get_size());
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
/* The actual increment value will be set by MySQL, we simply
default to 1 here.*/
table->autoinc_increment = 1;
table->autoinc = 0;
/* The number of transactions that are either waiting on the
AUTOINC lock or have been granted the lock. */
table->n_waiting_or_granted_auto_inc_locks = 0;
#ifdef UNIV_DEBUG
table->magic_n = DICT_TABLE_MAGIC_N;
......
......@@ -4312,18 +4312,16 @@ fil_io(
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|| !ibuf_bitmap_page(zip_size, block_offset)
|| sync || is_log);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|| ibuf_page(space_id, zip_size, block_offset));
#endif
#endif
if (sync) {
mode = OS_AIO_SYNC;
} else if (type == OS_FILE_READ && !is_log
&& ibuf_page(space_id, zip_size, block_offset)) {
mode = OS_AIO_IBUF;
} else if (is_log) {
mode = OS_AIO_LOG;
} else if (type == OS_FILE_READ
&& ibuf_page(space_id, zip_size, block_offset)) {
mode = OS_AIO_IBUF;
} else {
mode = OS_AIO_NORMAL;
}
......@@ -4492,8 +4490,6 @@ fil_aio_wait(
#ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, &fil_node,
&message, &type);
#elif defined(POSIX_ASYNC_IO)
ret = os_aio_posix_handle(segment, &fil_node, &message);
#else
ret = 0; /* Eliminate compiler warning */
ut_error;
......
......@@ -345,9 +345,8 @@ fsp_get_space_header(
block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));
ut_ad(zip_size == dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + header)));
......@@ -700,6 +699,7 @@ xdes_get_descriptor_with_space_hdr(
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
size = mach_read_from_4(sp_header + FSP_SIZE);
......@@ -730,9 +730,8 @@ xdes_get_descriptor_with_space_hdr(
block = buf_page_get(space, zip_size, descr_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
descr_page = buf_block_get_frame(block);
}
......@@ -765,9 +764,8 @@ xdes_get_descriptor(
fsp_header_t* sp_header;
block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
mtr));
......@@ -948,9 +946,7 @@ fsp_header_init(
zip_size = dict_table_flags_to_zip_size(flags);
block = buf_page_create(space, 0, zip_size, mtr);
buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
/* The prior contents of the file page should be ignored */
......@@ -1316,6 +1312,7 @@ fsp_fill_free_list(
mtr_t ibuf_mtr;
ut_ad(header && mtr);
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
/* Check if we can fill free list from above the free list limit */
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
......@@ -1380,10 +1377,9 @@ fsp_fill_free_list(
space, i, zip_size, mtr);
buf_page_get(space, zip_size, i,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block,
SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(block, mtr);
mlog_write_ulint(buf_block_get_frame(block)
+ FIL_PAGE_TYPE,
......@@ -1404,9 +1400,8 @@ fsp_fill_free_list(
buf_page_get(space, zip_size,
i + FSP_IBUF_BITMAP_OFFSET,
RW_X_LATCH, &ibuf_mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(block, &ibuf_mtr);
ibuf_bitmap_page_init(block, &ibuf_mtr);
......@@ -1577,6 +1572,7 @@ fsp_alloc_free_page(
if (free == ULINT_UNDEFINED) {
ut_print_buf(stderr, ((byte*)descr) - 500, 1000);
putc('\n', stderr);
ut_error;
}
......@@ -1636,9 +1632,7 @@ fsp_alloc_free_page(
buf_page_create(space, page_no, zip_size, mtr);
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
/* Prior contents of the page should be ignored */
fsp_init_file_page(block, mtr);
......@@ -1760,6 +1754,7 @@ fsp_free_extent(
if (xdes_get_state(descr, mtr) == XDES_FREE) {
ut_print_buf(stderr, (byte*)descr - 500, 1000);
putc('\n', stderr);
ut_error;
}
......@@ -1867,6 +1862,8 @@ fsp_alloc_seg_inode_page(
ulint zip_size;
ulint i;
ut_ad(page_offset(space_header) == FSP_HEADER_OFFSET);
space = page_get_space_id(page_align(space_header));
zip_size = dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + space_header));
......@@ -1879,9 +1876,7 @@ fsp_alloc_seg_inode_page(
}
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
block->check_index_page_at_flush = FALSE;
......@@ -1922,6 +1917,8 @@ fsp_alloc_seg_inode(
ulint zip_size;
ulint n;
ut_ad(page_offset(space_header) == FSP_HEADER_OFFSET);
if (flst_get_len(space_header + FSP_SEG_INODES_FREE, mtr) == 0) {
/* Allocate a new segment inode page */
......@@ -1939,9 +1936,8 @@ fsp_alloc_seg_inode(
mach_read_from_4(FSP_SPACE_FLAGS + space_header));
block = buf_page_get(page_get_space_id(page_align(space_header)),
zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(block);
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
......@@ -2402,6 +2398,7 @@ fseg_fill_free_list(
ulint used;
ut_ad(inode && mtr);
ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
......@@ -2462,6 +2459,8 @@ fseg_alloc_free_extent(
dulint seg_id;
fil_addr_t first;
ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
if (flst_get_len(inode + FSEG_FREE, mtr) > 0) {
/* Segment free list is not empty, allocate from it */
......@@ -2531,6 +2530,7 @@ fseg_alloc_free_page_low(
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
ut_ad(!ut_dulint_is_zero(seg_id));
......@@ -2712,9 +2712,8 @@ fseg_alloc_free_page_low(
mach_read_from_4(FSP_SPACE_FLAGS + space_header));
block = buf_page_create(space, ret_page, zip_size, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
if (UNIV_UNLIKELY(block != buf_page_get(space, zip_size,
ret_page, RW_X_LATCH,
mtr))) {
......@@ -3121,6 +3120,7 @@ fseg_mark_page_used(
ulint not_full_n_used;
ut_ad(seg_inode && mtr);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
descr = xdes_get_descriptor(space, zip_size, page, mtr);
......@@ -3183,6 +3183,7 @@ fseg_free_page_low(
ut_ad(seg_inode && mtr);
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
/* Drop search system page hash index if the page is found in
the pool and is hashed */
......
......@@ -373,11 +373,20 @@ ha_print_info(
FILE* file, /* in: file where to print */
hash_table_t* table) /* in: hash table */
{
#ifdef UNIV_DEBUG
/* Some of the code here is disabled for performance reasons in production
builds, see http://bugs.mysql.com/36941 */
#define PRINT_USED_CELLS
#endif /* UNIV_DEBUG */
#ifdef PRINT_USED_CELLS
hash_cell_t* cell;
ulint cells = 0;
ulint n_bufs;
ulint i;
#endif /* PRINT_USED_CELLS */
ulint n_bufs;
#ifdef PRINT_USED_CELLS
for (i = 0; i < hash_get_n_cells(table); i++) {
cell = hash_get_nth_cell(table, i);
......@@ -387,10 +396,14 @@ ha_print_info(
cells++;
}
}
#endif /* PRINT_USED_CELLS */
fprintf(file, "Hash table size %lu",
(ulong) hash_get_n_cells(table));
fprintf(file,
"Hash table size %lu, used cells %lu",
(ulong) hash_get_n_cells(table), (ulong) cells);
#ifdef PRINT_USED_CELLS
fprintf(file, ", used cells %lu", (ulong) cells);
#endif /* PRINT_USED_CELLS */
if (table->heaps == NULL && table->heap != NULL) {
......
EXPORTS
_mysql_plugin_interface_version_
_mysql_sizeof_struct_st_plugin_
_mysql_plugin_declarations_
This diff is collapsed.
......@@ -73,12 +73,15 @@ class ha_innobase: public handler
void update_thd();
int change_active_index(uint keynr);
int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(ulonglong* ret);
ulong innobase_autoinc_lock();
ulong innobase_set_max_autoinc(ulonglong auto_inc);
ulong innobase_reset_autoinc(ulonglong auto_inc);
ulong innobase_get_auto_increment(ulonglong* value);
ulint innobase_lock_autoinc();
ulonglong innobase_peek_autoinc();
ulint innobase_set_max_autoinc(ulonglong auto_inc);
ulint innobase_reset_autoinc(ulonglong auto_inc);
ulint innobase_get_autoinc(ulonglong* value);
ulint innobase_update_autoinc(ulonglong auto_inc);
ulint innobase_initialize_autoinc();
dict_index_t* innobase_get_index(uint keynr);
ulonglong innobase_get_int_col_max_value(const Field* field);
/* Init values for the class: */
public:
......
......@@ -18,6 +18,7 @@ extern "C" {
}
#include "ha_innodb.h"
#include "handler0vars.h"
/*****************************************************************
Copies an InnoDB column to a MySQL field. This function is
......@@ -635,9 +636,6 @@ ha_innobase::add_index(
trx = trx_allocate_for_mysql();
trx_start_if_not_started(trx);
trans_register_ha(user_thd, FALSE, ht);
prebuilt->trx->active_trans = 1;
trx->mysql_thd = user_thd;
trx->mysql_query_str = thd_query(user_thd);
......@@ -801,7 +799,9 @@ ha_innobase::add_index(
const char* old_name;
char* tmp_name;
case DB_SUCCESS:
ut_ad(!dict_locked);
ut_a(!dict_locked);
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
if (!new_primary) {
error = row_merge_rename_indexes(trx, indexed_table);
......@@ -822,9 +822,6 @@ ha_innobase::add_index(
tmp_name = innobase_create_temporary_tablename(heap, '2',
old_name);
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
error = row_merge_rename_tables(innodb_table, indexed_table,
tmp_name, trx);
......@@ -868,6 +865,11 @@ ha_innobase::add_index(
if (new_primary) {
row_merge_drop_table(trx, indexed_table);
} else {
if (!dict_locked) {
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
}
row_merge_drop_indexes(trx, indexed_table,
index, num_created);
}
......@@ -986,15 +988,16 @@ ha_innobase::prepare_drop_index(
if (trx->check_foreigns
&& thd_sql_command(user_thd) != SQLCOM_CREATE_INDEX) {
dict_index_t* index
= dict_table_get_first_index(prebuilt->table);
dict_index_t* index;
do {
for (index = dict_table_get_first_index(prebuilt->table);
index;
index = dict_table_get_next_index(index)) {
dict_foreign_t* foreign;
if (!index->to_be_dropped) {
goto next_index;
continue;
}
/* Check if the index is referenced. */
......@@ -1022,20 +1025,61 @@ ha_innobase::prepare_drop_index(
ut_a(foreign->foreign_index == index);
/* Search for an equivalent index that
the foreign key contraint could use
the foreign key constraint could use
if this index were to be deleted. */
if (!dict_table_find_equivalent_index(
prebuilt->table,
foreign->foreign_index)) {
if (!dict_foreign_find_equiv_index(
foreign)) {
goto index_needed;
}
}
}
}
} else if (thd_sql_command(user_thd) == SQLCOM_CREATE_INDEX) {
/* This is a drop of a foreign key constraint index that
was created by MySQL when the constraint was added. MySQL
does this when the user creates an index explicitly which
can be used in place of the automatically generated index. */
next_index:
index = dict_table_get_next_index(index);
} while (index);
dict_index_t* index;
for (index = dict_table_get_first_index(prebuilt->table);
index;
index = dict_table_get_next_index(index)) {
dict_foreign_t* foreign;
if (!index->to_be_dropped) {
continue;
}
/* Check if this index references some other table */
foreign = dict_table_get_foreign_constraint(
prebuilt->table, index);
if (foreign == NULL) {
continue;
}
ut_a(foreign->foreign_index == index);
/* Search for an equivalent index that the
foreign key constraint could use if this index
were to be deleted. */
if (!dict_foreign_find_equiv_index(foreign)) {
trx_set_detailed_error(
trx,
"Index needed in foreign key "
"constraint");
trx->error_info = foreign->foreign_index;
err = HA_ERR_DROP_INDEX_FK;
break;
}
}
}
func_exit:
......@@ -1084,9 +1128,6 @@ ha_innobase::final_drop_index(
trx = trx_allocate_for_mysql();
trx_start_if_not_started(trx);
trans_register_ha(user_thd, FALSE, ht);
prebuilt->trx->active_trans = 1;
trx->mysql_thd = user_thd;
trx->mysql_query_str = thd_query(user_thd);
......@@ -1100,25 +1141,22 @@ ha_innobase::final_drop_index(
row_merge_lock_table(prebuilt->trx, prebuilt->table, LOCK_X),
prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx);
if (UNIV_UNLIKELY(err)) {
/* Unmark the indexes to be dropped. */
row_mysql_lock_data_dictionary(trx);
for (index = dict_table_get_first_index(prebuilt->table);
index; index = dict_table_get_next_index(index)) {
index->to_be_dropped = FALSE;
}
row_mysql_unlock_data_dictionary(trx);
goto func_exit;
}
/* Drop indexes marked to be dropped */
row_mysql_lock_data_dictionary(trx);
index = dict_table_get_first_index(prebuilt->table);
while (index) {
......@@ -1143,11 +1181,11 @@ ha_innobase::final_drop_index(
#ifdef UNIV_DEBUG
dict_table_check_for_dup_indexes(prebuilt->table);
#endif
row_mysql_unlock_data_dictionary(trx);
func_exit:
trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx);
/* Flush the log to reduce probability that the .frm files and
the InnoDB data dictionary get out-of-sync if the user runs
......
/***********************************************************************
This file contains accessor functions for dynamic plugin on Windows.
(c) 2008 Innobase Oy
***********************************************************************/
#if defined __WIN__ && defined MYSQL_DYNAMIC_PLUGIN
/***********************************************************************
This is a list of externals that can not be resolved by delay loading.
They have to be resolved indirectly via their addresses in the .map file.
All of them are external variables. */
extern CHARSET_INFO* wdl_my_charset_bin;
extern CHARSET_INFO* wdl_my_charset_latin1;
extern CHARSET_INFO* wdl_my_charset_filename;
extern CHARSET_INFO** wdl_system_charset_info;
extern CHARSET_INFO** wdl_default_charset_info;
extern CHARSET_INFO** wdl_all_charsets;
extern system_variables* wdl_global_system_variables;
extern char* wdl_mysql_real_data_home;
extern char** wdl_mysql_data_home;
extern char** wdl_tx_isolation_names;
extern char** wdl_binlog_format_names;
extern char* wdl_reg_ext;
extern pthread_mutex_t* wdl_LOCK_thread_count;
extern key_map* wdl_key_map_full;
extern MY_TMPDIR* wdl_mysql_tmpdir_list;
extern bool* wdl_mysqld_embedded;
extern uint* wdl_lower_case_table_names;
extern ulong* wdl_specialflag;
extern int* wdl_my_umask;
#define my_charset_bin (*wdl_my_charset_bin)
#define my_charset_latin1 (*wdl_my_charset_latin1)
#define my_charset_filename (*wdl_my_charset_filename)
#define system_charset_info (*wdl_system_charset_info)
#define default_charset_info (*wdl_default_charset_info)
#define all_charsets (wdl_all_charsets)
#define global_system_variables (*wdl_global_system_variables)
#define mysql_real_data_home (wdl_mysql_real_data_home)
#define mysql_data_home (*wdl_mysql_data_home)
#define tx_isolation_names (wdl_tx_isolation_names)
#define binlog_format_names (wdl_binlog_format_names)
#define reg_ext (wdl_reg_ext)
#define LOCK_thread_count (*wdl_LOCK_thread_count)
#define key_map_full (*wdl_key_map_full)
#define mysql_tmpdir_list (*wdl_mysql_tmpdir_list)
#define mysqld_embedded (*wdl_mysqld_embedded)
#define lower_case_table_names (*wdl_lower_case_table_names)
#define specialflag (*wdl_specialflag)
#define my_umask (*wdl_my_umask)
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
SET storage_engine=InnoDB;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment