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

Merge 10.1 into 10.2

parents 8760ba65 ad4b7056
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -4680,6 +4680,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, ...@@ -4680,6 +4680,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double roru_index_costs; double roru_index_costs;
ha_rows roru_total_records; ha_rows roru_total_records;
double roru_intersect_part= 1.0; double roru_intersect_part= 1.0;
bool only_ror_scans_required= FALSE;
size_t n_child_scans; size_t n_child_scans;
DBUG_ENTER("get_best_disjunct_quick"); DBUG_ENTER("get_best_disjunct_quick");
DBUG_PRINT("info", ("Full table scan cost: %g", read_time)); DBUG_PRINT("info", ("Full table scan cost: %g", read_time));
...@@ -4706,6 +4707,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, ...@@ -4706,6 +4707,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
sizeof(TRP_RANGE*)* sizeof(TRP_RANGE*)*
n_child_scans))) n_child_scans)))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
only_ror_scans_required= !optimizer_flag(param->thd,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION);
/* /*
Collect best 'range' scan for each of disjuncts, and, while doing so, Collect best 'range' scan for each of disjuncts, and, while doing so,
analyze possibility of ROR scans. Also calculate some values needed by analyze possibility of ROR scans. Also calculate some values needed by
...@@ -4718,7 +4722,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, ...@@ -4718,7 +4722,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map, DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map,
"tree in SEL_IMERGE");); "tree in SEL_IMERGE"););
if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE,
read_time, TRUE))) read_time,
only_ror_scans_required)))
{ {
/* /*
One of index scans in this index_merge is more expensive than entire One of index scans in this index_merge is more expensive than entire
...@@ -5040,7 +5045,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge, ...@@ -5040,7 +5045,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
index merge retrievals are not well calibrated index merge retrievals are not well calibrated
*/ */
trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE,
read_time, TRUE); read_time, FALSE);
} }
DBUG_RETURN(trp); DBUG_RETURN(trp);
...@@ -6768,7 +6773,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, ...@@ -6768,7 +6773,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
index_read_must_be_used if TRUE, assume 'index only' option will be set index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes) (except for clustered PK indexes)
read_time don't create read plans with cost > read_time. read_time don't create read plans with cost > read_time.
ror_scans_required set to TRUE for index merge only_ror_scans_required set to TRUE when we are only interested
in ROR scan
RETURN RETURN
Best range read plan Best range read plan
NULL if no plan found or error occurred NULL if no plan found or error occurred
...@@ -6778,7 +6784,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, ...@@ -6778,7 +6784,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used, bool index_read_must_be_used,
bool update_tbl_stats, bool update_tbl_stats,
double read_time, double read_time,
bool ror_scans_required) bool only_ror_scans_required)
{ {
uint idx, UNINIT_VAR(best_idx); uint idx, UNINIT_VAR(best_idx);
SEL_ARG *key_to_read= NULL; SEL_ARG *key_to_read= NULL;
...@@ -6826,8 +6832,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, ...@@ -6826,8 +6832,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
update_tbl_stats, &mrr_flags, update_tbl_stats, &mrr_flags,
&buf_size, &cost); &buf_size, &cost);
if (ror_scans_required && !param->is_ror_scan && if (only_ror_scans_required && !param->is_ror_scan)
!optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
{ {
/* The scan is not a ROR-scan, just skip it */ /* The scan is not a ROR-scan, just skip it */
continue; continue;
......
...@@ -259,6 +259,17 @@ static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) { ...@@ -259,6 +259,17 @@ static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) {
} }
} }
void wsrep_log(void (*fun)(const char *, ...), const char *format, ...)
{
va_list args;
char msg[1024];
va_start(args, format);
vsnprintf(msg, sizeof(msg) - 1, format, args);
va_end(args);
(fun)("WSREP: %s", msg);
}
static void wsrep_log_states (wsrep_log_level_t const level, static void wsrep_log_states (wsrep_log_level_t const level,
const wsrep_uuid_t* const group_uuid, const wsrep_uuid_t* const group_uuid,
wsrep_seqno_t const group_seqno, wsrep_seqno_t const group_seqno,
......
...@@ -203,13 +203,8 @@ extern wsrep_seqno_t wsrep_locked_seqno; ...@@ -203,13 +203,8 @@ extern wsrep_seqno_t wsrep_locked_seqno;
? wsrep_forced_binlog_format : (ulong)(my_format)) ? wsrep_forced_binlog_format : (ulong)(my_format))
// prefix all messages with "WSREP" // prefix all messages with "WSREP"
#define WSREP_LOG(fun, ...) \ void wsrep_log(void (*fun)(const char *, ...), const char *format, ...);
do { \ #define WSREP_LOG(fun, ...) wsrep_log(fun, ## __VA_ARGS__)
char msg[1024] = {'\0'}; \
snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \
fun("WSREP: %s", msg); \
} while(0)
#define WSREP_LOG_CONFLICT_THD(thd, role) \ #define WSREP_LOG_CONFLICT_THD(thd, role) \
WSREP_LOG(sql_print_information, \ WSREP_LOG(sql_print_information, \
"%s: \n " \ "%s: \n " \
......
...@@ -251,7 +251,8 @@ my_bool maria_page_crc_check_index(int res, PAGECACHE_IO_HOOK_ARGS *args) ...@@ -251,7 +251,8 @@ my_bool maria_page_crc_check_index(int res, PAGECACHE_IO_HOOK_ARGS *args)
if (length > share->block_size - CRC_SIZE) if (length > share->block_size - CRC_SIZE)
{ {
DBUG_PRINT("error", ("Wrong page length: %u", length)); DBUG_PRINT("error", ("Wrong page length: %u", length));
return (my_errno= HA_ERR_WRONG_CRC); my_errno= HA_ERR_WRONG_CRC;
return 1;
} }
return maria_page_crc_check(page, (uint32) page_no, share, return maria_page_crc_check(page, (uint32) page_no, share,
MARIA_NO_CRC_NORMAL_PAGE, MARIA_NO_CRC_NORMAL_PAGE,
......
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