Commit da927da0 authored by Jan Lindström's avatar Jan Lindström

Fixed issue on atomic writes and system tables. Atomic writes can be used

also on system tables but not per table.
parent 1fa19bf7
......@@ -298,7 +298,7 @@ mtflush_service_io(
switch(work_item->tsk) {
case MT_WRK_NONE:
ut_a(work_item->wi_status == WRK_ITEM_EXIT);
work_item->wi_status = WRK_ITEM_SUCCESS;
work_item->wi_status = WRK_ITEM_EXIT;
ib_wqueue_add(mtflush_io->wr_cq, work_item, mtflush_io->wheap);
break;
......@@ -419,11 +419,17 @@ buf_mtflu_io_thread_exit(void)
work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, 50000);
if (work_item) {
/* If we receive reply to work item and it's status is exit,
thead has processed this message and existed */
if (work_item && work_item->wi_status == WRK_ITEM_EXIT) {
i++;
}
}
/* Wait about 1/2 sec to allow threads really exit */
os_thread_sleep(50000);
ut_a(ib_wqueue_is_empty(mtflush_io->wq));
ut_a(ib_wqueue_is_empty(mtflush_io->wr_cq));
ut_a(ib_wqueue_is_empty(mtflush_io->rd_cq));
......@@ -432,10 +438,10 @@ buf_mtflu_io_thread_exit(void)
ib_wqueue_free(mtflush_io->wr_cq);
ib_wqueue_free(mtflush_io->rd_cq);
os_fast_mutex_free(&mtflush_mtx);
/* Free heap */
mem_heap_free(mtflush_io->wheap);
os_fast_mutex_free(&mtflush_mtx);
}
/******************************************************************//**
......
/*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -645,6 +645,24 @@ dict_tf_is_valid(
}
}
if (atomic_writes) {
if(atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr,
"InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
"InnoDB: compact %ld atomic_blobs %ld\n"
"InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
"InnoDB: page_compression %ld page_compression_level %ld\n"
"InnoDB: atomic_writes %ld\n",
flags, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
return(false);
}
}
/* CREATE TABLE ... DATA DIRECTORY is supported for any row format,
so the DATA_DIR flag is compatible with all other table flags. */
......@@ -670,7 +688,8 @@ dict_sys_tables_type_validate(
ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(type);
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type);
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type);
atomic_writes_t awrites = (atomic_writes_t)atomic_writes;
ut_a(atomic_writes >= 0 && atomic_writes <= ATOMIC_WRITES_OFF);
/* The low order bit of SYS_TABLES.TYPE is always set to 1.
If the format is UNIV_FORMAT_B or higher, this field is the same
......@@ -748,16 +767,6 @@ dict_sys_tables_type_validate(
}
}
if (awrites == ATOMIC_WRITES_ON ||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes)) {
if (!atomic_blobs) {
fprintf(stderr, "InnoDB Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu atomic_blobs %lu\n",
type, atomic_writes, atomic_blobs);
return(ULINT_UNDEFINED);
}
}
/* Return the validated SYS_TABLES.TYPE. */
return(type);
}
......@@ -871,16 +880,8 @@ dict_tf_set(
ut_ad(dict_tf_get_page_compression_level(*flags) == page_compression_level);
}
if (awrites != ATOMIC_WRITES_DEFAULT) {
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES);
ut_ad(dict_tf_get_atomic_writes(*flags) == awrites);
}
if (awrites == ATOMIC_WRITES_ON ||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes )) {
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES)
| (1 << DICT_TF_POS_ATOMIC_BLOBS);
}
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES);
ut_ad(dict_tf_get_atomic_writes(*flags) == awrites);
if (use_data_dir) {
*flags |= (1 << DICT_TF_POS_DATA_DIR);
......
......@@ -304,7 +304,7 @@ mtflush_service_io(
switch(work_item->tsk) {
case MT_WRK_NONE:
ut_a(work_item->wi_status == WRK_ITEM_EXIT);
work_item->wi_status = WRK_ITEM_SUCCESS;
work_item->wi_status = WRK_ITEM_EXIT;
ib_wqueue_add(mtflush_io->wr_cq, work_item, mtflush_io->wheap);
break;
......@@ -425,11 +425,17 @@ buf_mtflu_io_thread_exit(void)
work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, 50000);
if (work_item) {
/* If we receive reply to work item and it's status is exit,
thead has processed this message and existed */
if (work_item && work_item->wi_status == WRK_ITEM_EXIT) {
i++;
}
}
/* Wait about 1/2 sec to allow threads really exit */
os_thread_sleep(50000);
ut_a(ib_wqueue_is_empty(mtflush_io->wq));
ut_a(ib_wqueue_is_empty(mtflush_io->wr_cq));
ut_a(ib_wqueue_is_empty(mtflush_io->rd_cq));
......@@ -438,10 +444,10 @@ buf_mtflu_io_thread_exit(void)
ib_wqueue_free(mtflush_io->wr_cq);
ib_wqueue_free(mtflush_io->rd_cq);
os_fast_mutex_free(&mtflush_mtx);
/* Free heap */
mem_heap_free(mtflush_io->wheap);
os_fast_mutex_free(&mtflush_mtx);
}
/******************************************************************//**
......
/*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -649,6 +649,24 @@ dict_tf_is_valid(
}
}
if (atomic_writes) {
if(atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr,
"InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
"InnoDB: compact %ld atomic_blobs %ld\n"
"InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
"InnoDB: page_compression %ld page_compression_level %ld\n"
"InnoDB: atomic_writes %ld\n",
flags, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
return(false);
}
}
/* CREATE TABLE ... DATA DIRECTORY is supported for any row format,
so the DATA_DIR flag is compatible with all other table flags. */
......@@ -674,7 +692,8 @@ dict_sys_tables_type_validate(
ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(type);
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type);
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type);
atomic_writes_t awrites = (atomic_writes_t)atomic_writes;
ut_a(atomic_writes >= 0 && atomic_writes <= ATOMIC_WRITES_OFF);
/* The low order bit of SYS_TABLES.TYPE is always set to 1.
If the format is UNIV_FORMAT_B or higher, this field is the same
......@@ -752,16 +771,6 @@ dict_sys_tables_type_validate(
}
}
if (awrites == ATOMIC_WRITES_ON ||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes)) {
if (!atomic_blobs) {
fprintf(stderr, "InnoDB Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu atomic_blobs %lu\n",
type, atomic_writes, atomic_blobs);
return(ULINT_UNDEFINED);
}
}
/* Return the validated SYS_TABLES.TYPE. */
return(type);
}
......@@ -879,16 +888,8 @@ dict_tf_set(
ut_ad(dict_tf_get_page_compression_level(*flags) == page_compression_level);
}
if (awrites != ATOMIC_WRITES_DEFAULT) {
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES);
ut_ad(dict_tf_get_atomic_writes(*flags) == awrites);
}
if (awrites == ATOMIC_WRITES_ON ||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes )) {
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES)
| (1 << DICT_TF_POS_ATOMIC_BLOBS);
}
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES);
ut_ad(dict_tf_get_atomic_writes(*flags) == awrites);
}
/********************************************************************//**
......
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