summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0quiesce.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/row/row0quiesce.cc')
-rw-r--r--storage/innobase/row/row0quiesce.cc98
1 files changed, 51 insertions, 47 deletions
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index 583fbe60fb3..92b78fabde2 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -23,16 +23,18 @@ Quiesce a tablespace.
Created 2012-02-08 by Sunny Bains.
*******************************************************/
-#include "row0quiesce.h"
-#include "row0mysql.h"
+#include "ha_prototypes.h"
+#include "row0quiesce.h"
#ifdef UNIV_NONINL
#include "row0quiesce.ic"
#endif
+#include "row0mysql.h"
#include "ibuf0ibuf.h"
#include "srv0start.h"
#include "trx0purge.h"
+#include "fsp0sysspace.h"
/*********************************************************************//**
Write the meta data (index user fields) config file.
@@ -326,8 +328,7 @@ row_quiesce_write_header(
if (hostname == 0) {
static const char NullHostname[] = "Hostname unknown";
- ib_logf(IB_LOG_LEVEL_WARN,
- "Unable to determine server hostname.");
+ ib::warn() << "Unable to determine server hostname.";
hostname = NullHostname;
}
@@ -350,8 +351,8 @@ row_quiesce_write_header(
}
/* The table name includes the NUL byte. */
- ut_a(table->name != 0);
- len = static_cast<ib_uint32_t>(strlen(table->name) + 1);
+ ut_a(table->name.m_name != NULL);
+ len = static_cast<ib_uint32_t>(strlen(table->name.m_name) + 1);
/* Write the table name. */
mach_write_to_4(value, len);
@@ -359,7 +360,7 @@ row_quiesce_write_header(
DBUG_EXECUTE_IF("ib_export_io_write_failure_6", close(fileno(file)););
if (fwrite(&value, 1, sizeof(value), file) != sizeof(value)
- || fwrite(table->name, 1, len, file) != len) {
+ || fwrite(table->name.m_name, 1, len, file) != len) {
ib_senderrf(
thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
@@ -428,7 +429,7 @@ row_quiesce_write_cfg(
srv_get_meta_data_filename(table, name, sizeof(name));
- ib_logf(IB_LOG_LEVEL_INFO, "Writing table metadata to '%s'", name);
+ ib::info() << "Writing table metadata to '" << name << "'";
FILE* file = fopen(name, "w+b");
@@ -505,7 +506,6 @@ row_quiesce_table_has_fts_index(
/*********************************************************************//**
Quiesce the tablespace that the table resides in. */
-UNIV_INTERN
void
row_quiesce_table_start(
/*====================*/
@@ -516,28 +516,21 @@ row_quiesce_table_start(
ut_a(srv_n_purge_threads > 0);
ut_ad(!srv_read_only_mode);
- char table_name[MAX_FULL_NAME_LEN + 1];
-
ut_a(trx->mysql_thd != 0);
- innobase_format_name(
- table_name, sizeof(table_name), table->name, FALSE);
-
- ib_logf(IB_LOG_LEVEL_INFO,
- "Sync to disk of '%s' started.", table_name);
+ ib::info() << "Sync to disk of " << table->name << " started.";
if (trx_purge_state() != PURGE_STATE_DISABLED) {
trx_purge_stop();
}
for (ulint count = 0;
- ibuf_merge_space(table->space) != 0
+ ibuf_merge_in_background(true, table->space) != 0
&& !trx_is_interrupted(trx);
++count) {
if (!(count % 20)) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Merging change buffer entries for '%s'",
- table_name);
+ ib::info() << "Merging change buffer entries for "
+ << table->name;
}
}
@@ -547,20 +540,19 @@ row_quiesce_table_start(
if (trx_is_interrupted(trx)) {
- ib_logf(IB_LOG_LEVEL_WARN, "Quiesce aborted!");
+ ib::warn() << "Quiesce aborted!";
} else if (row_quiesce_write_cfg(table, trx->mysql_thd)
!= DB_SUCCESS) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "There was an error writing to the "
- "meta data file");
+ ib::warn() << "There was an error writing to the"
+ " meta data file";
} else {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Table '%s' flushed to disk", table_name);
+ ib::info() << "Table " << table->name
+ << " flushed to disk";
}
} else {
- ib_logf(IB_LOG_LEVEL_WARN, "Quiesce aborted!");
+ ib::warn() << "Quiesce aborted!";
}
dberr_t err = row_quiesce_set_state(table, QUIESCE_COMPLETE, trx);
@@ -569,7 +561,6 @@ row_quiesce_table_start(
/*********************************************************************//**
Cleanup after table quiesce. */
-UNIV_INTERN
void
row_quiesce_table_complete(
/*=======================*/
@@ -577,13 +568,9 @@ row_quiesce_table_complete(
trx_t* trx) /*!< in/out: transaction/session */
{
ulint count = 0;
- char table_name[MAX_FULL_NAME_LEN + 1];
ut_a(trx->mysql_thd != 0);
- innobase_format_name(
- table_name, sizeof(table_name), table->name, FALSE);
-
/* We need to wait for the operation to complete if the
transaction has been killed. */
@@ -591,9 +578,8 @@ row_quiesce_table_complete(
/* Print a warning after every minute. */
if (!(count % 60)) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Waiting for quiesce of '%s' to complete",
- table_name);
+ ib::warn() << "Waiting for quiesce of " << table->name
+ << " to complete";
}
/* Sleep for a second. */
@@ -609,10 +595,9 @@ row_quiesce_table_complete(
srv_get_meta_data_filename(table, cfg_name, sizeof(cfg_name));
- os_file_delete_if_exists(innodb_file_data_key, cfg_name);
+ os_file_delete_if_exists(innodb_data_file_key, cfg_name, NULL);
- ib_logf(IB_LOG_LEVEL_INFO,
- "Deleting the meta-data file '%s'", cfg_name);
+ ib::info() << "Deleting the meta-data file '" << cfg_name << "'";
if (trx_purge_state() != PURGE_STATE_DISABLED) {
trx_purge_run();
@@ -625,7 +610,6 @@ row_quiesce_table_complete(
/*********************************************************************//**
Set a table's quiesce state.
@return DB_SUCCESS or error code. */
-UNIV_INTERN
dberr_t
row_quiesce_set_state(
/*==================*/
@@ -642,23 +626,43 @@ row_quiesce_set_state(
return(DB_UNSUPPORTED);
- } else if (table->space == TRX_SYS_SPACE) {
+ } else if (dict_table_is_temporary(table)) {
+
+ ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
+ ER_TABLESPACE_DISCARDED, table->name);
+ /* JAN: TODO: MySQL 5.7
+ ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
+ ER_CANNOT_DISCARD_TEMPORARY_TABLE);
+ */
+
+ return(DB_UNSUPPORTED);
+ } else if (table->space == srv_sys_space.space_id()) {
char table_name[MAX_FULL_NAME_LEN + 1];
innobase_format_name(
- table_name, sizeof(table_name), table->name, FALSE);
+ table_name, sizeof(table_name),
+ table->name.m_name);
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
ER_TABLE_IN_SYSTEM_TABLESPACE, table_name);
return(DB_UNSUPPORTED);
+
+ } else if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
+ std::ostringstream err_msg;
+ err_msg << "FLUSH TABLES FOR EXPORT on table " << table->name
+ << " in a general tablespace.";
+ ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
+ ER_NOT_SUPPORTED_YET, err_msg.str().c_str());
+
+ return(DB_UNSUPPORTED);
} else if (row_quiesce_table_has_fts_index(table)) {
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
ER_NOT_SUPPORTED_YET,
- "FLUSH TABLES on tables that have an FTS index. "
- "FTS auxiliary tables will not be flushed.");
+ "FLUSH TABLES on tables that have an FTS index."
+ " FTS auxiliary tables will not be flushed.");
} else if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
/* If this flag is set then the table may not have any active
@@ -666,10 +670,10 @@ row_quiesce_set_state(
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
ER_NOT_SUPPORTED_YET,
- "FLUSH TABLES on a table that had an FTS index, "
- "created on a hidden column, the "
- "auxiliary tables haven't been dropped as yet. "
- "FTS auxiliary tables will not be flushed.");
+ "FLUSH TABLES on a table that had an FTS index,"
+ " created on a hidden column, the"
+ " auxiliary tables haven't been dropped as yet."
+ " FTS auxiliary tables will not be flushed.");
}
row_mysql_lock_data_dictionary(trx);