Skip to content

Commit

Permalink
Merge 10.2 into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 3, 2017
2 parents 64bfad6 + ebc2f0d commit 1641879
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 83 deletions.
4 changes: 2 additions & 2 deletions scripts/wsrep_sst_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ parse_cnf()

# look in group+suffix
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

# look in group
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

# use default if we haven't found a value
Expand Down
12 changes: 6 additions & 6 deletions scripts/wsrep_sst_xtrabackup-v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ read_cnf()
ssystag+="-"

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
fi
fi
Expand Down Expand Up @@ -671,7 +671,7 @@ check_extra()
local use_socket=1
if [[ $uextra -eq 1 ]];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
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
Expand Down Expand Up @@ -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 "
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 "
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)"
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_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi

else
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"
INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.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_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
fi

get_stream
Expand Down
8 changes: 4 additions & 4 deletions sql/opt_range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
if (!tree)
return HA_POS_ERROR;
return DBL_MAX;
if (tree->type == SEL_ARG::IMPOSSIBLE)
return (0L);

Expand All @@ -2847,9 +2847,9 @@ double records_in_column_ranges(PARAM *param, uint idx,
max_endp= range.end_key.length? &range.end_key : NULL;
rows= get_column_range_cardinality(field, min_endp, max_endp,
range.range_flag);
if (HA_POS_ERROR == rows)
if (DBL_MAX == rows)
{
total_rows= HA_POS_ERROR;
total_rows= DBL_MAX;
break;
}
total_rows += rows;
Expand Down Expand Up @@ -3083,7 +3083,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
else
{
rows= records_in_column_ranges(&param, idx, key);
if (rows != HA_POS_ERROR)
if (rows != DBL_MAX)
key->field->cond_selectivity= rows/table_records;
}
}
Expand Down
5 changes: 4 additions & 1 deletion sql/sql_statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3751,7 +3751,10 @@ double get_column_avg_frequency(Field * field)
using the statistical data from the table column_stats.
@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,
Expand Down
8 changes: 5 additions & 3 deletions storage/innobase/dict/dict0boot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ dict_hdr_get_new_id(

mtr_start(&mtr);
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) {
/* 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
cache and re-loaded it would assign temporary tablespace id
to another tablespace.
This is not a case with read-only mode as there is no new object
that is created except temporary tablespace. */
mtr_set_log_mode(&mtr,
(srv_read_only_mode ? MTR_LOG_NONE : MTR_LOG_NO_REDO));
mtr.set_log_mode(srv_read_only_mode
? MTR_LOG_NONE : MTR_LOG_NO_REDO);
}

/* Server started and let's say space-id = x
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/dict/dict0stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ dict_stats_update_transient_for_index(
ulint size;

mtr_start(&mtr);
dict_disable_redo_if_temporary(index->table, &mtr);

mtr_s_lock(dict_index_get_lock(index), &mtr);

Expand Down
19 changes: 1 addition & 18 deletions storage/innobase/include/dict0dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -1946,24 +1946,7 @@ dict_table_is_discarded(
const dict_table_t* table) /*!< in: table to check */
MY_ATTRIBUTE((warn_unused_result));

/********************************************************************//**
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 */
#define dict_table_is_temporary(table) (table)->is_temporary()

/*********************************************************************//**
This function should be called whenever a page is successfully
Expand Down
26 changes: 0 additions & 26 deletions storage/innobase/include/dict0dict.ic
Original file line number Diff line number Diff line change
Expand Up @@ -1525,32 +1525,6 @@ dict_table_is_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.
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
Expand Down
6 changes: 6 additions & 0 deletions storage/innobase/include/dict0mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,12 @@ struct dict_table_t {
{
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
@retval true normally
@retval false if this is a single-table tablespace
Expand Down
11 changes: 7 additions & 4 deletions storage/innobase/row/row0ins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2487,9 +2487,12 @@ row_ins_index_entry_big_rec(

DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern_latch");

mtr_start(&mtr);
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
mtr.start();
if (index->table->is_temporary()) {
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,
&pcur, &mtr);
Expand All @@ -2508,7 +2511,7 @@ row_ins_index_entry_big_rec(
index, offsets);
}

mtr_commit(&mtr);
mtr.commit();

btr_pcur_close(&pcur);

Expand Down
22 changes: 14 additions & 8 deletions storage/innobase/row/row0uins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ row_undo_ins_remove_clust_rec(
ut_ad(dict_index_is_clust(index));
ut_ad(node->trx->in_rollback);

mtr_start(&mtr);
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
mtr.start();
if (index->table->is_temporary()) {
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
already have copied this row from the log to the new table.
Expand Down Expand Up @@ -125,9 +128,9 @@ row_undo_ins_remove_clust_rec(
dict_drop_index_tree(
btr_pcur_get_rec(&node->pcur), &(node->pcur), &mtr);

mtr_commit(&mtr);
mtr.commit();

mtr_start(&mtr);
mtr.start();

success = btr_pcur_restore_position(
BTR_MODIFY_LEAF, &node->pcur, &mtr);
Expand All @@ -142,9 +145,12 @@ row_undo_ins_remove_clust_rec(
btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
retry:
/* If did not succeed, try pessimistic descent to tree */
mtr_start(&mtr);
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
mtr.start();
if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}

success = btr_pcur_restore_position(
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE,
Expand Down
30 changes: 21 additions & 9 deletions storage/innobase/row/row0umod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,12 @@ row_undo_mod_clust(
pcur = &node->pcur;
index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur));

mtr_start(&mtr);
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
mtr.start();
if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}

online = dict_index_is_online_ddl(index);
if (online) {
Expand Down Expand Up @@ -304,8 +307,11 @@ row_undo_mod_clust(
descent down the index tree */

mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}

err = row_undo_mod_clust_low(
node, &offsets, &offsets_heap,
Expand Down Expand Up @@ -363,8 +369,11 @@ row_undo_mod_clust(
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) {

mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}

/* It is not necessary to call row_log_table,
because the record is delete-marked and would thus
Expand All @@ -378,8 +387,11 @@ row_undo_mod_clust(
pessimistic descent down the index tree */

mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space);
dict_disable_redo_if_temporary(index->table, &mtr);
if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}

err = row_undo_mod_remove_clust_low(
node, &mtr,
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/row/row0undo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ row_undo_search_clust_to_pcur(
rec_offs_init(offsets_);

mtr_start(&mtr);
dict_disable_redo_if_temporary(node->table, &mtr);

clust_index = dict_table_get_first_index(node->table);

Expand Down

0 comments on commit 1641879

Please sign in to comment.