Commit 16418793 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into bb-10.2-ext

parents 64bfad63 ebc2f0da
...@@ -256,12 +256,12 @@ parse_cnf() ...@@ -256,12 +256,12 @@ parse_cnf()
# look in group+suffix # look in group+suffix
if [[ -n $WSREP_SST_OPT_CONF_SUFFIX ]]; then if [[ -n $WSREP_SST_OPT_CONF_SUFFIX ]]; then
reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF "${group}${WSREP_SST_OPT_CONF_SUFFIX}" | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) reval=$($MY_PRINT_DEFAULTS "${group}${WSREP_SST_OPT_CONF_SUFFIX}" | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
fi fi
# look in group # look in group
if [[ -z $reval ]]; then if [[ -z $reval ]]; then
reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
fi fi
# use default if we haven't found a value # use default if we haven't found a value
......
...@@ -494,7 +494,7 @@ read_cnf() ...@@ -494,7 +494,7 @@ read_cnf()
ssystag+="-" ssystag+="-"
if [[ $ssyslog -ne -1 ]];then if [[ $ssyslog -ne -1 ]];then
if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
ssyslog=1 ssyslog=1
fi fi
fi fi
...@@ -671,7 +671,7 @@ check_extra() ...@@ -671,7 +671,7 @@ check_extra()
local use_socket=1 local use_socket=1
if [[ $uextra -eq 1 ]];then if [[ $uextra -eq 1 ]];then
if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
local eport=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) local eport=$($MY_PRINT_DEFAULTS mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
if [[ -n $eport ]];then if [[ -n $eport ]];then
# Xtrabackup works only locally. # Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally. # Hence, setting host to 127.0.0.1 unconditionally.
...@@ -867,14 +867,14 @@ if [[ $ssyslog -eq 1 ]];then ...@@ -867,14 +867,14 @@ if [[ $ssyslog -eq 1 ]];then
} }
INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply " INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move " INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi fi
else else
INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log" INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
fi fi
get_stream get_stream
......
...@@ -2827,7 +2827,7 @@ double records_in_column_ranges(PARAM *param, uint idx, ...@@ -2827,7 +2827,7 @@ double records_in_column_ranges(PARAM *param, uint idx,
/* Handle cases when we don't have a valid non-empty list of range */ /* Handle cases when we don't have a valid non-empty list of range */
if (!tree) if (!tree)
return HA_POS_ERROR; return DBL_MAX;
if (tree->type == SEL_ARG::IMPOSSIBLE) if (tree->type == SEL_ARG::IMPOSSIBLE)
return (0L); return (0L);
...@@ -2847,9 +2847,9 @@ double records_in_column_ranges(PARAM *param, uint idx, ...@@ -2847,9 +2847,9 @@ double records_in_column_ranges(PARAM *param, uint idx,
max_endp= range.end_key.length? &range.end_key : NULL; max_endp= range.end_key.length? &range.end_key : NULL;
rows= get_column_range_cardinality(field, min_endp, max_endp, rows= get_column_range_cardinality(field, min_endp, max_endp,
range.range_flag); range.range_flag);
if (HA_POS_ERROR == rows) if (DBL_MAX == rows)
{ {
total_rows= HA_POS_ERROR; total_rows= DBL_MAX;
break; break;
} }
total_rows += rows; total_rows += rows;
...@@ -3083,7 +3083,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) ...@@ -3083,7 +3083,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
else else
{ {
rows= records_in_column_ranges(&param, idx, key); rows= records_in_column_ranges(&param, idx, key);
if (rows != HA_POS_ERROR) if (rows != DBL_MAX)
key->field->cond_selectivity= rows/table_records; key->field->cond_selectivity= rows/table_records;
} }
} }
......
...@@ -3751,7 +3751,10 @@ double get_column_avg_frequency(Field * field) ...@@ -3751,7 +3751,10 @@ double get_column_avg_frequency(Field * field)
using the statistical data from the table column_stats. using the statistical data from the table column_stats.
@retval @retval
The required estimate of the rows in the column range - The required estimate of the rows in the column range
- If there is some kind of error, this function should return DBL_MAX (and
not HA_POS_ERROR as that is an integer constant).
*/ */
double get_column_range_cardinality(Field *field, double get_column_range_cardinality(Field *field,
......
...@@ -79,7 +79,9 @@ dict_hdr_get_new_id( ...@@ -79,7 +79,9 @@ dict_hdr_get_new_id(
mtr_start(&mtr); mtr_start(&mtr);
if (table) { if (table) {
dict_disable_redo_if_temporary(table, &mtr); if (table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
}
} else if (disable_redo) { } else if (disable_redo) {
/* In non-read-only mode we need to ensure that space-id header /* In non-read-only mode we need to ensure that space-id header
page is written to disk else if page is removed from buffer page is written to disk else if page is removed from buffer
...@@ -87,8 +89,8 @@ dict_hdr_get_new_id( ...@@ -87,8 +89,8 @@ dict_hdr_get_new_id(
to another tablespace. to another tablespace.
This is not a case with read-only mode as there is no new object This is not a case with read-only mode as there is no new object
that is created except temporary tablespace. */ that is created except temporary tablespace. */
mtr_set_log_mode(&mtr, mtr.set_log_mode(srv_read_only_mode
(srv_read_only_mode ? MTR_LOG_NONE : MTR_LOG_NO_REDO)); ? MTR_LOG_NONE : MTR_LOG_NO_REDO);
} }
/* Server started and let's say space-id = x /* Server started and let's say space-id = x
......
...@@ -887,7 +887,6 @@ dict_stats_update_transient_for_index( ...@@ -887,7 +887,6 @@ dict_stats_update_transient_for_index(
ulint size; ulint size;
mtr_start(&mtr); mtr_start(&mtr);
dict_disable_redo_if_temporary(index->table, &mtr);
mtr_s_lock(dict_index_get_lock(index), &mtr); mtr_s_lock(dict_index_get_lock(index), &mtr);
......
...@@ -1946,24 +1946,7 @@ dict_table_is_discarded( ...@@ -1946,24 +1946,7 @@ dict_table_is_discarded(
const dict_table_t* table) /*!< in: table to check */ const dict_table_t* table) /*!< in: table to check */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//** #define dict_table_is_temporary(table) (table)->is_temporary()
Check if it is a temporary table.
@return true if temporary table flag is set. */
UNIV_INLINE
bool
dict_table_is_temporary(
/*====================*/
const dict_table_t* table) /*!< in: table to check */
MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Turn-off redo-logging if temporary table. */
UNIV_INLINE
void
dict_disable_redo_if_temporary(
/*===========================*/
const dict_table_t* table, /*!< in: table to check */
mtr_t* mtr); /*!< out: mini-transaction */
/*********************************************************************//** /*********************************************************************//**
This function should be called whenever a page is successfully This function should be called whenever a page is successfully
......
...@@ -1525,32 +1525,6 @@ dict_table_is_discarded( ...@@ -1525,32 +1525,6 @@ dict_table_is_discarded(
return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_DISCARDED)); return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_DISCARDED));
} }
/********************************************************************//**
Check if it is a temporary table.
@return true if temporary table flag is set. */
UNIV_INLINE
bool
dict_table_is_temporary(
/*====================*/
const dict_table_t* table) /*!< in: table to check */
{
return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY));
}
/********************************************************************//**
Turn-off redo-logging if temporary table. */
UNIV_INLINE
void
dict_disable_redo_if_temporary(
/*===========================*/
const dict_table_t* table, /*!< in: table to check */
mtr_t* mtr) /*!< out: mini-transaction */
{
if (dict_table_is_temporary(table)) {
mtr_set_log_mode(mtr, MTR_LOG_NO_REDO);
}
}
/** Check if the table is found is a file_per_table tablespace. /** Check if the table is found is a file_per_table tablespace.
This test does not use table flags2 since some REDUNDANT tables in the This test does not use table flags2 since some REDUNDANT tables in the
system tablespace may have garbage in the MIX_LEN field where flags2 is system tablespace may have garbage in the MIX_LEN field where flags2 is
......
...@@ -1313,6 +1313,12 @@ struct dict_table_t { ...@@ -1313,6 +1313,12 @@ struct dict_table_t {
{ {
return !(~flags & DICT_TF_MASK_NO_ROLLBACK); return !(~flags & DICT_TF_MASK_NO_ROLLBACK);
} }
/** @return whether this is a temporary table */
bool is_temporary() const
{
return flags2 & DICT_TF2_TEMPORARY;
}
/** @return whether this table is readable /** @return whether this table is readable
@retval true normally @retval true normally
@retval false if this is a single-table tablespace @retval false if this is a single-table tablespace
......
...@@ -2487,9 +2487,12 @@ row_ins_index_entry_big_rec( ...@@ -2487,9 +2487,12 @@ row_ins_index_entry_big_rec(
DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern_latch"); DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern_latch");
mtr_start(&mtr); mtr.start();
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
btr_pcur_open(index, entry, PAGE_CUR_LE, BTR_MODIFY_TREE, btr_pcur_open(index, entry, PAGE_CUR_LE, BTR_MODIFY_TREE,
&pcur, &mtr); &pcur, &mtr);
...@@ -2508,7 +2511,7 @@ row_ins_index_entry_big_rec( ...@@ -2508,7 +2511,7 @@ row_ins_index_entry_big_rec(
index, offsets); index, offsets);
} }
mtr_commit(&mtr); mtr.commit();
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
......
...@@ -76,9 +76,12 @@ row_undo_ins_remove_clust_rec( ...@@ -76,9 +76,12 @@ row_undo_ins_remove_clust_rec(
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
ut_ad(node->trx->in_rollback); ut_ad(node->trx->in_rollback);
mtr_start(&mtr); mtr.start();
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
/* This is similar to row_undo_mod_clust(). The DDL thread may /* This is similar to row_undo_mod_clust(). The DDL thread may
already have copied this row from the log to the new table. already have copied this row from the log to the new table.
...@@ -125,9 +128,9 @@ row_undo_ins_remove_clust_rec( ...@@ -125,9 +128,9 @@ row_undo_ins_remove_clust_rec(
dict_drop_index_tree( dict_drop_index_tree(
btr_pcur_get_rec(&node->pcur), &(node->pcur), &mtr); btr_pcur_get_rec(&node->pcur), &(node->pcur), &mtr);
mtr_commit(&mtr); mtr.commit();
mtr_start(&mtr); mtr.start();
success = btr_pcur_restore_position( success = btr_pcur_restore_position(
BTR_MODIFY_LEAF, &node->pcur, &mtr); BTR_MODIFY_LEAF, &node->pcur, &mtr);
...@@ -142,9 +145,12 @@ row_undo_ins_remove_clust_rec( ...@@ -142,9 +145,12 @@ row_undo_ins_remove_clust_rec(
btr_pcur_commit_specify_mtr(&node->pcur, &mtr); btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
retry: retry:
/* If did not succeed, try pessimistic descent to tree */ /* If did not succeed, try pessimistic descent to tree */
mtr_start(&mtr); mtr.start();
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
success = btr_pcur_restore_position( success = btr_pcur_restore_position(
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE,
......
...@@ -272,9 +272,12 @@ row_undo_mod_clust( ...@@ -272,9 +272,12 @@ row_undo_mod_clust(
pcur = &node->pcur; pcur = &node->pcur;
index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur)); index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur));
mtr_start(&mtr); mtr.start();
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
online = dict_index_is_online_ddl(index); online = dict_index_is_online_ddl(index);
if (online) { if (online) {
...@@ -304,8 +307,11 @@ row_undo_mod_clust( ...@@ -304,8 +307,11 @@ row_undo_mod_clust(
descent down the index tree */ descent down the index tree */
mtr_start_trx(&mtr, thr_get_trx(thr)); mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
err = row_undo_mod_clust_low( err = row_undo_mod_clust_low(
node, &offsets, &offsets_heap, node, &offsets, &offsets_heap,
...@@ -363,8 +369,11 @@ row_undo_mod_clust( ...@@ -363,8 +369,11 @@ row_undo_mod_clust(
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) { if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) {
mtr_start_trx(&mtr, thr_get_trx(thr)); mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
/* It is not necessary to call row_log_table, /* It is not necessary to call row_log_table,
because the record is delete-marked and would thus because the record is delete-marked and would thus
...@@ -378,8 +387,11 @@ row_undo_mod_clust( ...@@ -378,8 +387,11 @@ row_undo_mod_clust(
pessimistic descent down the index tree */ pessimistic descent down the index tree */
mtr_start_trx(&mtr, thr_get_trx(thr)); mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
dict_disable_redo_if_temporary(index->table, &mtr); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
err = row_undo_mod_remove_clust_low( err = row_undo_mod_remove_clust_low(
node, &mtr, node, &mtr,
......
...@@ -172,7 +172,6 @@ row_undo_search_clust_to_pcur( ...@@ -172,7 +172,6 @@ row_undo_search_clust_to_pcur(
rec_offs_init(offsets_); rec_offs_init(offsets_);
mtr_start(&mtr); mtr_start(&mtr);
dict_disable_redo_if_temporary(node->table, &mtr);
clust_index = dict_table_get_first_index(node->table); clust_index = dict_table_get_first_index(node->table);
......
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