1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-6184 10.0.11 merge

XtraDB 5.6.16-64.2
This commit is contained in:
Sergei Golubchik
2014-05-06 10:21:34 +02:00
70 changed files with 3082 additions and 1204 deletions

View File

@@ -3870,6 +3870,7 @@ ib_table_truncate(
ib_err_t trunc_err;
ib_trx_t ib_trx = NULL;
ib_crsr_t ib_crsr = NULL;
ib_ulint_t memcached_sync = 0;
ib_trx = ib_trx_begin(IB_TRX_SERIALIZABLE, true, false);
@@ -3885,6 +3886,13 @@ ib_table_truncate(
err = DB_TABLE_NOT_FOUND;
}
/* Remember the memcached_sync_count and set it to 0, so the
truncate can be executed. */
if (table != NULL && err == DB_SUCCESS) {
memcached_sync = table->memcached_sync_count;
table->memcached_sync_count = 0;
}
dict_mutex_exit_for_mysql();
if (err == DB_SUCCESS) {
@@ -3910,6 +3918,15 @@ ib_table_truncate(
ut_a(err == DB_SUCCESS);
}
/* Set the memcached_sync_count back. */
if (table != NULL && memcached_sync != 0) {
dict_mutex_enter_for_mysql();
table->memcached_sync_count = memcached_sync;
dict_mutex_exit_for_mysql();
}
return(trunc_err);
}
@@ -3972,3 +3989,51 @@ ib_cfg_get_cfg()
return(cfg_status);
}
/*****************************************************************//**
Increase/decrease the memcached sync count of table to sync memcached
DML with SQL DDLs.
@return DB_SUCCESS or error number */
UNIV_INTERN
ib_err_t
ib_cursor_set_memcached_sync(
/*=========================*/
ib_crsr_t ib_crsr, /*!< in: cursor */
ib_bool_t flag) /*!< in: true for increase */
{
const ib_cursor_t* cursor = (const ib_cursor_t*) ib_crsr;
row_prebuilt_t* prebuilt = cursor->prebuilt;
dict_table_t* table = prebuilt->table;
ib_err_t err = DB_SUCCESS;
if (table != NULL) {
/* If memcached_sync_count is -1, means table is
doing DDL, we just return error. */
if (table->memcached_sync_count == DICT_TABLE_IN_DDL) {
return(DB_ERROR);
}
if (flag) {
#ifdef HAVE_ATOMIC_BUILTINS
os_atomic_increment_lint(&table->memcached_sync_count, 1);
#else
dict_mutex_enter_for_mysql();
++table->memcached_sync_count;
dict_mutex_exit_for_mysql();
#endif
} else {
#ifdef HAVE_ATOMIC_BUILTINS
os_atomic_decrement_lint(&table->memcached_sync_count, 1);
#else
dict_mutex_enter_for_mysql();
--table->memcached_sync_count;
dict_mutex_exit_for_mysql();
#endif
ut_a(table->memcached_sync_count >= 0);
}
} else {
err = DB_TABLE_NOT_FOUND;
}
return(err);
}