From be00e279c6061134a33a8099fd69d4304735d02e Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 27 Aug 2014 18:47:33 +0400 Subject: [PATCH 1/8] MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE Let range optimizer remove parts of OR-clauses for which range analysis produced SEL_TREE(IMPOSSIBLE). There is no need to remove parts of AND-clauses: either they are inside of OR (and the whole AND-clause will be removed), or the AND-clause is at the top level, in which case the whole WHERE (or ON) is always FALSE and this is a degenerate case which receives special treatment. The removal process takes care not to produce 1-way ORs (in that case we substitute the OR for its remaining member). --- mysql-test/r/index_merge_myisam.result | 2 +- mysql-test/r/join_outer.result | 4 +- mysql-test/r/join_outer_jcl6.result | 4 +- mysql-test/r/range.result | 45 +++++++++++ mysql-test/r/range_mrr_icp.result | 45 +++++++++++ mysql-test/t/range.test | 32 ++++++++ sql/opt_range.cc | 101 +++++++++++++++++++++---- sql/opt_range.h | 6 +- sql/sql_select.cc | 40 ++++++---- 9 files changed, 241 insertions(+), 38 deletions(-) diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index c907997573a..9820170aa59 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where +1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using index condition explain select * from t0 where key2 = 45 or key1 is not null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index c4770182598..36c2f1898f8 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2090,10 +2090,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 862fc194a7a..6f3da3efdd7 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2101,10 +2101,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index f2ad42ebc8d..fe528e1b2e9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2196,3 +2196,48 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 16b35448c50..62bea71173c 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2198,4 +2198,49 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 7b68f42c4cb..6249d2b5e4f 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1745,3 +1745,35 @@ explain select * from t3, t2 where t2.a < t3.b and t3.a=1; --echo # The second table should use 'range': explain select * from t3, t2 where t3.b > t2.a and t3.a=1; drop table t1,t2,t3; + +--echo # +--echo # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select + A.a + B.a* 10 + C.a * 100, + A.a + B.a* 10 + C.a * 100, + 12345 +from + t1 A, t1 B, t1 C; + +--echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; + +--echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); + +--echo # Here, conditions b will not be removed, because "c<44" is not sargable +--echo # and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); + +--echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; + +--echo # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); + +drop table t1,t2; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2616e044025..b795411130d 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -829,6 +829,12 @@ public: */ bool remove_jump_scans; + /* + TRUE <=> Range analyzer should remove parts of condition that are found + to be always FALSE. + */ + bool remove_false_where_parts; + /* used_key_no -> table_key_no translation table. Only makes sense if using_real_indexes==TRUE @@ -908,7 +914,7 @@ static SEL_TREE * get_mm_parts(RANGE_OPT_PARAM *param,COND *cond_func,Field *fie static SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param,COND *cond_func,Field *field, KEY_PART *key_part, Item_func::Functype type,Item *value); -static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond); +static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond); static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts); static ha_rows check_quick_select(PARAM *param, uint idx, bool index_only, @@ -2941,7 +2947,8 @@ static int fill_used_fields_bitmap(PARAM *param) int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, table_map prev_tables, ha_rows limit, bool force_quick_range, - bool ordered_output) + bool ordered_output, + bool remove_false_parts_of_where) { uint idx; double scan_time; @@ -3000,6 +3007,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, param.imerge_cost_buff_size= 0; param.using_real_indexes= TRUE; param.remove_jump_scans= TRUE; + param.remove_false_where_parts= remove_false_parts_of_where; param.force_default_mrr= ordered_output; param.possible_keys.clear_all(); @@ -3073,7 +3081,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, if (cond) { - if ((tree= get_mm_tree(¶m,cond))) + if ((tree= get_mm_tree(¶m, &cond))) { if (tree->type == SEL_TREE::IMPOSSIBLE) { @@ -3415,7 +3423,7 @@ double records_in_column_ranges(PARAM *param, uint idx, TRUE otherwise */ -bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) +bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) { uint keynr; uint max_quick_key_parts= 0; @@ -3425,7 +3433,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) table->cond_selectivity= 1.0; - if (!cond || table_records == 0) + if (!*cond || table_records == 0) DBUG_RETURN(FALSE); if (table->pos_in_table_list->schema_table) @@ -3529,6 +3537,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) param.old_root= thd->mem_root; param.table= table; param.is_ror_scan= FALSE; + param.remove_false_where_parts= true; if (create_key_parts_for_pseudo_indexes(¶m, used_fields)) goto free_alloc; @@ -3606,7 +3615,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) ulong check_rows= MY_MIN(thd->variables.optimizer_selectivity_sampling_limit, (ulong) (table_records * SELECTIVITY_SAMPLING_SHARE)); - if (cond && check_rows > SELECTIVITY_SAMPLING_THRESHOLD && + if (*cond && check_rows > SELECTIVITY_SAMPLING_THRESHOLD && thd->variables.optimizer_use_condition_selectivity > 4) { find_selective_predicates_list_processor_data *dt= @@ -3617,8 +3626,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) DBUG_RETURN(TRUE); dt->list.empty(); dt->table= table; - if (cond->walk(&Item::find_selective_predicates_list_processor, 0, - (uchar*) dt)) + if ((*cond)->walk(&Item::find_selective_predicates_list_processor, 0, + (uchar*) dt)) DBUG_RETURN(TRUE); if (dt->list.elements > 0) { @@ -3951,6 +3960,8 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) /* range_par->cond doesn't need initialization */ range_par->prev_tables= range_par->read_tables= 0; range_par->current_table= table->map; + /* It should be possible to switch the following ON: */ + range_par->remove_false_where_parts= false; range_par->keys= 1; // one index range_par->using_real_indexes= FALSE; @@ -3967,7 +3978,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) SEL_TREE *tree; int res; - tree= get_mm_tree(range_par, pprune_cond); + tree= get_mm_tree(range_par, &pprune_cond); if (!tree) goto all_used; @@ -7855,15 +7866,33 @@ static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param, DBUG_RETURN(ftree); } - /* make a select tree of all keys in condition */ +/* + make a select tree of all keys in condition + + @param param Context + @param cond INOUT condition to perform range analysis on. -static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond) + @detail + Range analysis may infer that some conditions are never true. + - If the condition is never true, SEL_TREE(type=IMPOSSIBLE) is returned + - if parts of condition are never true, the function may remove these parts + from the condition 'cond'. Sometimes, this will cause the condition to + be substituted for something else. + + + @return + NULL - Could not infer anything from condition cond. + SEL_TREE with type=IMPOSSIBLE - condition can never be true. +*/ + +static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) { SEL_TREE *tree=0; SEL_TREE *ftree= 0; Item_field *field_item= 0; bool inv= FALSE; Item *value= 0; + Item *cond= *cond_ptr; DBUG_ENTER("get_mm_tree"); if (cond->type() == Item::COND_ITEM) @@ -7876,31 +7905,75 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond) Item *item; while ((item=li++)) { - SEL_TREE *new_tree= get_mm_tree(param,item); + SEL_TREE *new_tree= get_mm_tree(param,li.ref()); if (param->statement_should_be_aborted()) DBUG_RETURN(NULL); tree= tree_and(param,tree,new_tree); if (tree && tree->type == SEL_TREE::IMPOSSIBLE) + { + /* + Do not remove 'item' from 'cond'. We return a SEL_TREE::IMPOSSIBLE + and that is sufficient for the caller to see that the whole + condition is never true. + */ break; + } } } else { // COND OR - tree= get_mm_tree(param,li++); + bool replace_cond= false; + Item *replacement_item= li++; + tree= get_mm_tree(param, li.ref()); if (param->statement_should_be_aborted()) DBUG_RETURN(NULL); if (tree) { + if (tree->type == SEL_TREE::IMPOSSIBLE && + param->remove_false_where_parts) + { + /* See the other li.remove() call below */ + li.remove(); + if (((Item_cond*)cond)->argument_list()->elements <= 1) + replace_cond= true; + } + Item *item; while ((item=li++)) { - SEL_TREE *new_tree=get_mm_tree(param,item); + SEL_TREE *new_tree=get_mm_tree(param,li.ref()); if (new_tree == NULL || param->statement_should_be_aborted()) DBUG_RETURN(NULL); tree= tree_or(param,tree,new_tree); if (tree == NULL || tree->type == SEL_TREE::ALWAYS) + { + replacement_item= *li.ref(); break; + } + + if (new_tree && new_tree->type == SEL_TREE::IMPOSSIBLE && + param->remove_false_where_parts) + { + /* + This is a condition in form + + cond = item1 OR ... OR item_i OR ... itemN + + and item_i produces SEL_TREE(IMPOSSIBLE). We should remove item_i + from cond. This may cause 'cond' to become a degenerate, + one-way OR. In that case, we replace 'cond' with the remaining + item_i. + */ + li.remove(); + if (((Item_cond*)cond)->argument_list()->elements <= 1) + replace_cond= true; + } + else + replacement_item= *li.ref(); } + + if (replace_cond) + *cond_ptr= replacement_item; } } DBUG_RETURN(tree); diff --git a/sql/opt_range.h b/sql/opt_range.h index 1ca245ea420..f602408ea82 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -994,7 +994,7 @@ class SQL_SELECT :public Sql_alloc { { key_map tmp; tmp.set_all(); - return test_quick_select(thd, tmp, 0, limit, force_quick_range, FALSE) < 0; + return test_quick_select(thd, tmp, 0, limit, force_quick_range, FALSE, FALSE) < 0; } /* RETURN @@ -1011,7 +1011,7 @@ class SQL_SELECT :public Sql_alloc { } int test_quick_select(THD *thd, key_map keys, table_map prev_tables, ha_rows limit, bool force_quick_range, - bool ordered_output); + bool ordered_output, bool remove_false_parts_of_where); }; @@ -1036,7 +1036,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, table_map read_tables, COND *conds, bool allow_null_cond, int *error); -bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond); +bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond); #ifdef WITH_PARTITION_STORAGE_ENGINE bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 05c88a5f534..52f05e46e40 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -69,7 +69,7 @@ struct st_sargable_param; static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array); static bool make_join_statistics(JOIN *join, List &leaves, - COND *conds, DYNAMIC_ARRAY *keyuse); + DYNAMIC_ARRAY *keyuse); static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse, JOIN_TAB *join_tab, uint tables, COND *conds, @@ -1338,7 +1338,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S /* Calculate how to do the join */ THD_STAGE_INFO(thd, stage_statistics); - if (make_join_statistics(this, select_lex->leaf_tables, conds, &keyuse) || + if (make_join_statistics(this, select_lex->leaf_tables, &keyuse) || thd->is_fatal_error) { DBUG_PRINT("error",("Error: make_join_statistics() failed")); @@ -3355,7 +3355,8 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select, select->head=table; table->reginfo.impossible_range=0; if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0, - limit, 0, FALSE)) == 1) + limit, 0, FALSE, + TRUE /* remove_where_parts*/)) == 1) DBUG_RETURN(select->quick->records); if (error == -1) { @@ -3393,7 +3394,7 @@ typedef struct st_sargable_param static bool make_join_statistics(JOIN *join, List &tables_list, - COND *conds, DYNAMIC_ARRAY *keyuse_array) + DYNAMIC_ARRAY *keyuse_array) { int error= 0; TABLE *table; @@ -3597,10 +3598,10 @@ make_join_statistics(JOIN *join, List &tables_list, } } - if (conds || outer_join) + if (join->conds || outer_join) { if (update_ref_and_keys(join->thd, keyuse_array, stat, join->table_count, - conds, ~outer_join, join->select_lex, &sargables)) + join->conds, ~outer_join, join->select_lex, &sargables)) goto error; /* Keyparts without prefixes may be useful if this JOIN is a subquery, and @@ -3844,8 +3845,9 @@ make_join_statistics(JOIN *join, List &tables_list, } join->impossible_where= false; - if (conds && const_count) - { + if (join->conds && const_count) + { + Item* &conds= join->conds; conds->update_used_tables(); conds= remove_eq_conds(join->thd, conds, &join->cond_value); if (conds && conds->type() == Item::COND_ITEM && @@ -3857,7 +3859,7 @@ make_join_statistics(JOIN *join, List &tables_list, join->impossible_where= true; conds=new Item_int((longlong) 0,1); } - join->conds= conds; + join->cond_equal= NULL; if (conds) { @@ -3942,12 +3944,18 @@ make_join_statistics(JOIN *join, List &tables_list, { select= make_select(s->table, found_const_table_map, found_const_table_map, - *s->on_expr_ref ? *s->on_expr_ref : conds, + *s->on_expr_ref ? *s->on_expr_ref : join->conds, 1, &error); if (!select) goto error; records= get_quick_record_count(join->thd, select, s->table, &s->const_keys, join->row_limit); + /* Range analyzer could modify the condition. */ + if (*s->on_expr_ref) + *s->on_expr_ref= select->cond; + else + join->conds= select->cond; + s->quick=select->quick; s->needed_reg=select->needed_reg; select->quick=0; @@ -3958,7 +3966,7 @@ make_join_statistics(JOIN *join, List &tables_list, if (join->thd->variables.optimizer_use_condition_selectivity > 1) calculate_cond_selectivity_for_table(join->thd, s->table, *s->on_expr_ref ? - *s->on_expr_ref : conds); + s->on_expr_ref : &join->conds); if (s->table->reginfo.impossible_range) { impossible_range= TRUE; @@ -9658,7 +9666,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt), 0, - FALSE) < 0) + FALSE, FALSE) < 0) { /* Before reporting "Impossible WHERE" for the whole query @@ -9672,7 +9680,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt),0, - FALSE) < 0) + FALSE, FALSE) < 0) DBUG_RETURN(1); // Impossible WHERE } else @@ -18496,7 +18504,7 @@ test_if_quick_select(JOIN_TAB *tab) tab->select->quick=0; return tab->select->test_quick_select(tab->join->thd, tab->keys, (table_map) 0, HA_POS_ERROR, 0, - FALSE); + FALSE, /*remove where parts*/FALSE); } @@ -20169,7 +20177,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, OPTION_FOUND_ROWS) ? HA_POS_ERROR : tab->join->unit->select_limit_cnt,0, - TRUE) <= 0; + TRUE, FALSE) <= 0; if (res) { select->cond= save_cond; @@ -20227,7 +20235,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt, - TRUE, FALSE); + TRUE, FALSE, FALSE); } order_direction= best_key_direction; /* From f1a1683309899e484c0c0d38933530dcd5012c75 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 27 Aug 2014 20:08:32 +0400 Subject: [PATCH 2/8] MDEV-6384: It seems like OPTIMIZER take into account the order of indexes in the table When ORDER BY ... LIMIT check whether it should switch from index IDX1 to index IDX2, it should not ignore the fact that IDX2 may have a potential range or ref(const) access. Istead, it should calculate their costs: there is now a saved range optimizer cost and code to re-calculate what best_access_path() calculated for ref(const). /* in current cost model these two can be very different numbers unfortunately */ --- mysql-test/r/innodb_ext_key.result | 2 +- sql/opt_range.cc | 1 + sql/sql_select.cc | 118 ++++++++++++++++++++++++++++- 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index 9140f306f77..cae402a9f12 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -1002,7 +1002,7 @@ insert into t2 (b) values (null), (null), (null); set optimizer_switch='extended_keys=on'; explain select a from t1 where b is null order by a desc limit 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 9 const 2 Using where; Using filesort +1 SIMPLE t1 index b PRIMARY 8 NULL 3 Using where select a from t1 where b is null order by a desc limit 2; a 3 diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b795411130d..99c731d1541 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -10690,6 +10690,7 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only, param->table->quick_condition_rows= MY_MIN(param->table->quick_condition_rows, rows); param->table->quick_rows[keynr]= rows; + param->table->quick_costs[keynr]= cost->total_cost(); } } /* Figure out if the key scan is ROR (returns rows in ROWID order) or not */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 52f05e46e40..79d74d02708 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -20224,7 +20224,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, !(table->file->index_flags(best_key, 0, 1) & HA_CLUSTERED_INDEX))) goto use_filesort; - if (select && + if (select && // psergey: why doesn't this use a quick? table->quick_keys.is_set(best_key) && best_key != ref_key) { key_map map; @@ -24693,6 +24693,109 @@ void JOIN::cache_const_exprs() } } + +/* + Get a cost of reading rows_limit rows through index keynr. + + @detail + - If there is a quick select, we try to use it. + - if there is a ref(const) access, we try to use it, too. + - quick and ref(const) use different cost formulas, so if both are possible + we should make a cost-based choice. + + @return + true There was a possible quick or ref access, its cost is in the OUT + parameters. + false No quick or ref(const) possible (and so, the caller will attempt + to use a full index scan on this index). +*/ + +static bool get_range_limit_read_cost(const JOIN_TAB *tab, + const TABLE *table, + uint keynr, + ha_rows rows_limit, + double *read_time) +{ + bool res= false; + /* + We need to adjust the estimates if we had a quick select (or ref(const)) on + index keynr. + */ + if (table->quick_keys.is_set(keynr)) + { + /* + Start from quick select's rows and cost. These are always cheaper than + full index scan/cost. + */ + double best_rows= table->quick_rows[keynr]; + double best_cost= table->quick_costs[keynr]; + + /* + Check if ref(const) access was possible on this index. + */ + if (tab) + { + key_part_map const_parts= 0; + key_part_map map= 1; + uint kp; + /* Find how many key parts would be used by ref(const) */ + for (kp=0; kp < MAX_REF_PARTS; map=map << 1, kp++) + { + if (!(table->const_key_parts[keynr] & map)) + break; + const_parts |= map; + } + + if (kp > 0) + { + ha_rows ref_rows; + /* + Two possible cases: + 1. ref(const) uses the same #key parts as range access. + 2. ref(const) uses fewer key parts, becasue there is a + range_cond(key_part+1). + */ + if (kp == table->quick_key_parts[keynr]) + ref_rows= table->quick_rows[keynr]; + else + ref_rows= table->key_info[keynr].actual_rec_per_key(kp-1); + + if (ref_rows > 0) + { + double tmp= ref_rows; + /* Reuse the cost formula from best_access_path: */ + set_if_smaller(tmp, (double) tab->join->thd->variables.max_seeks_for_key); + if (table->covering_keys.is_set(keynr)) + tmp= table->file->keyread_time(keynr, 1, (ha_rows) tmp); + else + tmp= table->file->read_time(keynr, 1, + (ha_rows) MY_MIN(tmp,tab->worst_seeks)); + if (tmp < best_cost) + { + best_cost= tmp; + best_rows= ref_rows; + } + } + } + } + + if (best_rows > rows_limit) + { + /* + LIMIT clause specifies that we will need to read fewer records than + quick select will return. Assume that quick select's cost is + proportional to the number of records we need to return (e.g. if we + only need 1/3rd of records, it will cost us 1/3rd of quick select's + read time) + */ + best_cost *= rows_limit / best_rows; + } + *read_time= best_cost; + res= true; + } + return res; +} + /** Find a cheaper access key than a given @a key @@ -24786,6 +24889,11 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, } else read_time= table->file->scan_time(); + + /* + TODO: add cost of sorting here. + */ + read_time += COST_EPS; /* Calculate the selectivity of the ref_key for REF_ACCESS. For @@ -24945,6 +25053,14 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, */ index_scan_time= select_limit/rec_per_key * MY_MIN(rec_per_key, table->file->scan_time()); + double range_scan_time; + if (get_range_limit_read_cost(tab, table, nr, select_limit, + &range_scan_time)) + { + if (range_scan_time < index_scan_time) + index_scan_time= range_scan_time; + } + if ((ref_key < 0 && (group || table->force_index || is_covering)) || index_scan_time < read_time) { From f8f8a59c189254baeb7f90920b6b23da227984e8 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 27 Aug 2014 23:31:27 +0400 Subject: [PATCH 3/8] Forgot one file in previous commit --- sql/table.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/table.h b/sql/table.h index b57e9c7227d..bbe4b181339 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1113,6 +1113,7 @@ public: and max #key parts that range access would use. */ ha_rows quick_rows[MAX_KEY]; + double quick_costs[MAX_KEY]; /* Bitmaps of key parts that =const for the duration of join execution. If From d161546b67142cdd5322a4ed160441045ae0cd1e Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 4 Sep 2014 01:12:49 +0400 Subject: [PATCH 4/8] MDEV-6689: valgrind errors in view.test in 10.1 SHOW COLUMNS and SHOW KEYS commands fill IS_table_read_plan in a special way - they don't set or use lookup_field_vals member. Added a "trivial_show_command" flag that signals that lookup_field_vals has no valid data, made EXPLAIN code honor it. --- sql/sql_select.cc | 14 +++++++++----- sql/sql_show.cc | 1 + sql/sql_show.h | 10 +++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 05c88a5f534..1fedf12b595 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -23490,16 +23490,19 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab const char *tmp_buff; int f_idx; StringBuffer<64> key_name_buf; - if (is_table_read_plan->has_db_lookup_value()) + if (is_table_read_plan->trivial_show_command || + is_table_read_plan->has_db_lookup_value()) { /* The "key" has the name of the column referring to the database */ f_idx= table_list->schema_table->idx_field1; tmp_buff= table_list->schema_table->fields_info[f_idx].field_name; key_name_buf.append(tmp_buff, strlen(tmp_buff), cs); } - if (is_table_read_plan->has_table_lookup_value()) + if (is_table_read_plan->trivial_show_command || + is_table_read_plan->has_table_lookup_value()) { - if (is_table_read_plan->has_db_lookup_value()) + if (is_table_read_plan->trivial_show_command || + is_table_read_plan->has_db_lookup_value()) key_name_buf.append(','); f_idx= table_list->schema_table->idx_field2; @@ -23630,8 +23633,9 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab else eta->push_extra(ET_OPEN_FULL_TABLE); /* psergey-note: the following has a bug.*/ - if (table_list->is_table_read_plan->has_db_lookup_value() && - table_list->is_table_read_plan->has_table_lookup_value()) + if (table_list->is_table_read_plan->trivial_show_command || + (table_list->is_table_read_plan->has_db_lookup_value() && + table_list->is_table_read_plan->has_table_lookup_value())) eta->push_extra(ET_SCANNED_0_DATABASES); else if (table_list->is_table_read_plan->has_db_lookup_value() || table_list->is_table_read_plan->has_table_lookup_value()) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index bb8ae16189a..ec7d4979a4e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8035,6 +8035,7 @@ static bool optimize_for_get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond if (lsel && lsel->table_list.first) { /* These do not need to have a query plan */ + plan->trivial_show_command= true; goto end; } diff --git a/sql/sql_show.h b/sql/sql_show.h index 2f1cb26d17a..2b58fc45d4c 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -192,9 +192,17 @@ typedef struct st_lookup_field_values class IS_table_read_plan : public Sql_alloc { public: - IS_table_read_plan() : no_rows(false) {} + IS_table_read_plan() : no_rows(false), trivial_show_command(FALSE) {} bool no_rows; + /* + For EXPLAIN only: For SHOW KEYS and SHOW COLUMNS, we know which + db_name.table_name will be read, however for some reason we don't + set the fields in this->lookup_field_vals. + In order to not have JOIN::save_explain_data() walking over uninitialized + data, we set trivial_show_command=true. + */ + bool trivial_show_command; LOOKUP_FIELD_VALUES lookup_field_vals; Item *partial_cond; From d3ceb934f1e537bedfaa96d157acdbfcf7b7ae67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 8 Sep 2014 09:34:03 +0300 Subject: [PATCH 5/8] MDEV-6701: InnoDB tests fail in 10.1 Fixed test failures seen on defragment tests, innodb.innodb-wl5522-debug-zip and innodb.innodb_bug12902967. --- .../innodb/r/innodb_defrag_binlog.result | 16 +-- .../suite/innodb/r/innodb_defrag_stats.result | 129 ++++++++++++++---- .../suite/innodb/r/innodb_defragment.result | 98 +++++++++---- .../r/innodb_defragment_fill_factor.result | 21 +-- .../suite/innodb/t/innodb_defrag_binlog.test | 5 +- .../innodb/t/innodb_defrag_concurrent.test | 3 + .../suite/innodb/t/innodb_defrag_stats.test | 64 +++++++-- .../t/innodb_defrag_stats_many_tables.test | 2 + .../suite/innodb/t/innodb_defragment.test | 82 +++++------ .../t/innodb_defragment_fill_factor.test | 42 ++++-- storage/innobase/fil/fil0fil.cc | 8 +- storage/innobase/srv/srv0start.cc | 4 - storage/xtradb/fil/fil0fil.cc | 8 +- storage/xtradb/srv/srv0start.cc | 4 - 14 files changed, 335 insertions(+), 151 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_defrag_binlog.result b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result index 2a1992e449d..7cc471f6345 100644 --- a/mysql-test/suite/innodb/r/innodb_defrag_binlog.result +++ b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result @@ -11,19 +11,19 @@ drop table t1; show binlog events in 'master-bin.000001' from 313; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 313 Gtid 1 351 GTID 0-1-1 -master-bin.000001 351 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` +master-bin.000001 351 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ master-bin.000001 465 Gtid 1 503 GTID 0-1-2 master-bin.000001 503 Query 1 669 use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb master-bin.000001 669 Gtid 1 707 BEGIN GTID 0-1-3 -master-bin.000001 707 Table_map 1 751 table_id: 82 (test.t1) -master-bin.000001 751 Write_rows_v1 1 1043 table_id: 82 flags: STMT_END_F -master-bin.000001 1043 Xid 1 1070 COMMIT +master-bin.000001 707 Table_map 1 751 table_id: # (test.t1) +master-bin.000001 751 Write_rows_v1 1 1043 table_id: # flags: STMT_END_F +master-bin.000001 1043 Xid 1 1070 COMMIT /* XID */ master-bin.000001 1070 Gtid 1 1108 BEGIN GTID 0-1-4 -master-bin.000001 1108 Table_map 1 1152 table_id: 82 (test.t1) -master-bin.000001 1152 Write_rows_v1 1 1444 table_id: 82 flags: STMT_END_F -master-bin.000001 1444 Xid 1 1471 COMMIT +master-bin.000001 1108 Table_map 1 1152 table_id: # (test.t1) +master-bin.000001 1152 Write_rows_v1 1 1444 table_id: # flags: STMT_END_F +master-bin.000001 1444 Xid 1 1471 COMMIT /* XID */ master-bin.000001 1471 Gtid 1 1509 GTID 0-1-5 master-bin.000001 1509 Query 1 1589 use `test`; optimize table t1 master-bin.000001 1589 Gtid 1 1627 GTID 0-1-6 -master-bin.000001 1627 Query 1 1731 use `test`; DROP TABLE `t1` +master-bin.000001 1627 Query 1 1731 use `test`; DROP TABLE `t1` /* generated by server */ include/rpl_end.inc diff --git a/mysql-test/suite/innodb/r/innodb_defrag_stats.result b/mysql-test/suite/innodb/r/innodb_defrag_stats.result index 0838a199b3b..7092688f07b 100644 --- a/mysql-test/suite/innodb/r/innodb_defrag_stats.result +++ b/mysql-test/suite/innodb/r/innodb_defrag_stats.result @@ -18,14 +18,26 @@ INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; # Not enough page splits to trigger persistent stats write yet. -select count(*) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); -count(*) -0 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 INSERT INTO t1 (b) SELECT b from t1; # Persistent stats recorded. -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); count(stat_value) > 0 -0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 # Delete some rows. delete from t1 where a between 100 * 20 and 100 * 20 + 30; delete from t1 where a between 100 * 19 and 100 * 19 + 30; @@ -49,46 +61,115 @@ delete from t1 where a between 100 * 2 and 100 * 2 + 30; delete from t1 where a between 100 * 1 and 100 * 1 + 30; # Server Restarted # Confirm persistent stats still there after restart. -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); count(stat_value) > 0 -0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK -# n_page_split should be 0 after defragmentation, n_pages_freed should be non-zero. -select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; -stat_value = 0 +select sleep(2); +sleep(2) +0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 1 -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed', 'n_leaf_pages_defrag'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); count(stat_value) > 0 1 set global innodb_defragment_stats_accuracy = 40; INSERT INTO t1 (b) SELECT b from t1; -# Not enough operation to trigger persistent stats write -select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; -stat_value = 0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 1 INSERT INTO t1 (b) SELECT b from t1; -# Persistent stats write triggered -select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; -stat_value > 0 -0 -0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 # Table rename should cause stats rename. rename table t1 to t2; -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select sleep(1); +sleep(1) +0 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); count(stat_value) > 0 1 # Drop index should cause stats drop. drop index SECOND on t2; -select count(*) from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND'; -count(*) -4 +select sleep(3); +sleep(3) +0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 Server Restarted -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); count(stat_value) > 0 1 # Clean up DROP TABLE t2; +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 diff --git a/mysql-test/suite/innodb/r/innodb_defragment.result b/mysql-test/suite/innodb/r/innodb_defragment.result index b8f61b0eba3..5f3fd523946 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment.result +++ b/mysql-test/suite/innodb/r/innodb_defragment.result @@ -17,65 +17,109 @@ set @i = 0; repeat set @i = @i + 1; optimize table t1; -select sleep(5); until @i = 3 end repeat; end // -select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); -count(stat_value) = 0 -1 -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); -count(stat_value) > 0 -1 -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); -count(stat_value) > 0 -1 +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) +0 +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) +2 +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) +2 select count(*) from t1; count(*) 10004 -select count(*) from t1 force index (second); -count(*) -10004 call defragment(); optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK -select sleep(5); -sleep(5) -0 select count(*) from t1; count(*) 7904 -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); -count(stat_value) > 0 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 select count(*) from t1 force index (second); count(*) 7904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 SET @@global.innodb_defragment_n_pages = 3; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); -count(stat_value) > 0 -0 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) < 3 +1 select count(*) from t1; count(*) 6904 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) < 3 +1 select count(*) from t1 force index (second); count(*) 6904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 SET @@global.innodb_defragment_n_pages = 10; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); -count(stat_value) > 0 -0 -select count(*) from t1; -count(*) -6904 +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 1 +1 +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 1 +1 +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 1 +1 select count(*) from t1 force index (second); count(*) 6904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 DROP PROCEDURE defragment; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result index 90dcbc004f7..7c153eaaa93 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result +++ b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result @@ -14,13 +14,14 @@ count(*) # A few more insertions on the page should not cause a page split. insert into t1 values (81, REPEAT('A', 256)); insert into t1 values (83, REPEAT('A', 256)); -insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (82, REPEAT('A', 256)); -insert into t1 values (86, REPEAT('A', 256)); # More insertions will cause page splits insert into t1 values (88, REPEAT('A', 50)); -Too much space are reserved on primary index. -Too much space are reserved on second index. +insert into t1 values (85, REPEAT('A', 256)); +insert into t1 values (84, REPEAT('A', 256)); +insert into t1 values (87, REPEAT('A', 256)); +insert into t1 values (89, REPEAT('A', 256)); +insert into t1 values (82, REPEAT('A', 256)); +insert into t1 values (86, REPEAT('A', 256)); DROP TABLE t1; Testing table with small records CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB; @@ -48,12 +49,16 @@ insert into t2 values(1197, REPEAT('A', 16)); insert into t2 values(1188, REPEAT('A', 16)); insert into t2 values(1198, REPEAT('A', 16)); insert into t2 values(1189, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); More insertions will cause page split. insert into t2 values(1280, REPEAT('A', 16)); insert into t2 values(1290, REPEAT('A', 16)); insert into t2 values(1281, REPEAT('A', 16)); insert into t2 values(1291, REPEAT('A', 16)); +insert into t2 values(1199, REPEAT('A', 16)); +insert into t2 values(1190, REPEAT('A', 16)); +insert into t2 values(1180, REPEAT('A', 16)); +insert into t2 values(1295, REPEAT('A', 16)); +insert into t2 values(1294, REPEAT('A', 16)); +insert into t2 values(1292, REPEAT('A', 16)); +insert into t2 values(1293, REPEAT('A', 16)); DROP TABLE t2; diff --git a/mysql-test/suite/innodb/t/innodb_defrag_binlog.test b/mysql-test/suite/innodb/t/innodb_defrag_binlog.test index c0d4b377cb1..ec3203893a4 100644 --- a/mysql-test/suite/innodb/t/innodb_defrag_binlog.test +++ b/mysql-test/suite/innodb/t/innodb_defrag_binlog.test @@ -1,5 +1,8 @@ --source include/have_innodb.inc --source include/master-slave.inc +--source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc --disable_warnings drop table if exists t1; @@ -13,7 +16,7 @@ optimize table t1; drop table t1; ---replace_regex /\/\*.*// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000001' from 313; --source include/rpl_end.inc diff --git a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test index 7cf00e1da4c..2b08613535c 100644 --- a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test +++ b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test @@ -1,4 +1,7 @@ --source include/have_innodb.inc +--source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc --disable_warnings DROP TABLE if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_defrag_stats.test b/mysql-test/suite/innodb/t/innodb_defrag_stats.test index f07544df4f6..2a5026a68e5 100644 --- a/mysql-test/suite/innodb/t/innodb_defrag_stats.test +++ b/mysql-test/suite/innodb/t/innodb_defrag_stats.test @@ -1,5 +1,7 @@ --source include/have_innodb.inc --source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc --disable_warnings DROP TABLE if exists t1; @@ -29,12 +31,16 @@ INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; --echo # Not enough page splits to trigger persistent stats write yet. -select count(*) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); INSERT INTO t1 (b) SELECT b from t1; --echo # Persistent stats recorded. -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); --echo # Delete some rows. let $num_delete = 20; @@ -49,39 +55,71 @@ while ($num_delete) --echo # Server Restarted --echo # Confirm persistent stats still there after restart. -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); optimize table t1; ---echo # n_page_split should be 0 after defragmentation, n_pages_freed should be non-zero. -select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed', 'n_leaf_pages_defrag'); +select sleep(2); + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); set global innodb_defragment_stats_accuracy = 40; INSERT INTO t1 (b) SELECT b from t1; ---echo # Not enough operation to trigger persistent stats write -select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); + INSERT INTO t1 (b) SELECT b from t1; ---echo # Persistent stats write triggered -select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); + --echo # Table rename should cause stats rename. rename table t1 to t2; -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select sleep(1); + +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); --echo # Drop index should cause stats drop. drop index SECOND on t2; -select count(*) from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND'; +select sleep(3); + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_leaf_pages_defrag'); --source include/restart_mysqld.inc --echo Server Restarted -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); + +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); --echo # Clean up DROP TABLE t2; +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag'); + --disable_query_log EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig; --enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_defrag_stats_many_tables.test b/mysql-test/suite/innodb/t/innodb_defrag_stats_many_tables.test index e1a463459be..601883c35aa 100644 --- a/mysql-test/suite/innodb/t/innodb_defrag_stats_many_tables.test +++ b/mysql-test/suite/innodb/t/innodb_defrag_stats_many_tables.test @@ -1,5 +1,7 @@ --source include/have_innodb.inc --source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc --disable_warnings DROP TABLE if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_defragment.test b/mysql-test/suite/innodb/t/innodb_defragment.test index 77fceeaa56b..22b72a4aa6b 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment.test +++ b/mysql-test/suite/innodb/t/innodb_defragment.test @@ -1,4 +1,7 @@ --source include/have_innodb.inc +--source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc --disable_warnings DROP TABLE if exists t1; @@ -36,7 +39,6 @@ begin repeat set @i = @i + 1; optimize table t1; - select sleep(5); until @i = 3 end repeat; end // delimiter ;// @@ -53,25 +55,12 @@ while ($i) } --enable_query_log -select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); select count(*) from t1; -if (!`select count(*) > 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number; -} - -select count(*) from t1 force index (second); - -if (!`select count(*) > 170 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; -} - - connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection con1; @@ -98,26 +87,19 @@ connection default; disconnect con1; optimize table t1; -select sleep(5); --source include/restart_mysqld.inc select count(*) from t1; -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); - -# After deletion & defragmentation, there are 8000 records left -if (!`select count(*) < 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number; -} +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); select count(*) from t1 force index (second); -# secondary index is pretty much the same size as primary index so the number of pages should be similar. -if (!`select count(*) < 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; -} +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); ## Test-4 defragment with larger n_pages @@ -139,23 +121,25 @@ optimize table t1; --source include/restart_mysqld.inc -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); select count(*) from t1; # We didn't create large wholes with the previous deletion, so if innodb_defragment_n_pages = 3, we won't be able to free up many pages. -if (!`select count(*) > 130 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number; -} + +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); + select count(*) from t1 force index (second); # Same holds for secondary index, not many pages are released. -if (!`select count(*) > 100 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; -} +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); SET @@global.innodb_defragment_n_pages = 10; @@ -163,25 +147,21 @@ optimize table t1; --source include/restart_mysqld.inc -select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); -select count(*) from t1; - -# This time we used innodb_defragment_n_pages = 10, so we should be able to free up some pages. -if (!`select count(*) < 165 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number; -} select count(*) from t1 force index (second); -if (!`select count(*) < 165 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) -{ -select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; -} +# Same holds for secondary index, not many pages are released. +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); DROP PROCEDURE defragment; DROP TABLE t1; + # reset system --disable_query_log EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig; diff --git a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test index b2fdfa4a409..24c23448a30 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test +++ b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test @@ -1,4 +1,8 @@ --source include/have_innodb.inc +--source include/big_test.inc +--source include/not_valgrind.inc +--source include/not_embedded.inc + --disable_warnings DROP TABLE if exists t1; DROP TABLE if exists t2; @@ -34,34 +38,44 @@ select count(*) from t1; select count(*) from t1 force index (second); # secondary index is slightly bigger than primary index so the number of pages should be similar. --let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) + --echo # A few more insertions on the page should not cause a page split. insert into t1 values (81, REPEAT('A', 256)); insert into t1 values (83, REPEAT('A', 256)); -insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (82, REPEAT('A', 256)); -insert into t1 values (86, REPEAT('A', 256)); + --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) + if ($primary_before != $primary_after) { --echo Insertion caused page split on primary, which should be avoided by innodb_defragment_fill_factor. } + if ($second_before != $second_after) { --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. } + --echo # More insertions will cause page splits insert into t1 values (88, REPEAT('A', 50)); -#insert into t1 values (85, REPEAT('A', 256)); -#insert into t1 values (84, REPEAT('A', 256)); -#insert into t1 values (89, REPEAT('A', 256)); +insert into t1 values (85, REPEAT('A', 256)); +insert into t1 values (84, REPEAT('A', 256)); +insert into t1 values (87, REPEAT('A', 256)); +insert into t1 values (89, REPEAT('A', 256)); +insert into t1 values (82, REPEAT('A', 256)); +insert into t1 values (86, REPEAT('A', 256)); + --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) + if ($primary_before == $primary_after) { --echo Too much space are reserved on primary index. } + if ($second_before == $second_after) { --echo Too much space are reserved on second index. } + DROP TABLE t1; + --echo Testing table with small records CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB; # Populate table. @@ -111,20 +125,30 @@ insert into t2 values(1197, REPEAT('A', 16)); insert into t2 values(1188, REPEAT('A', 16)); insert into t2 values(1198, REPEAT('A', 16)); insert into t2 values(1189, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); + --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) + if ($second_before != $second_after) { --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. } + --echo More insertions will cause page split. insert into t2 values(1280, REPEAT('A', 16)); insert into t2 values(1290, REPEAT('A', 16)); insert into t2 values(1281, REPEAT('A', 16)); insert into t2 values(1291, REPEAT('A', 16)); +insert into t2 values(1199, REPEAT('A', 16)); +insert into t2 values(1190, REPEAT('A', 16)); +insert into t2 values(1180, REPEAT('A', 16)); +insert into t2 values(1295, REPEAT('A', 16)); +insert into t2 values(1294, REPEAT('A', 16)); +insert into t2 values(1292, REPEAT('A', 16)); +insert into t2 values(1293, REPEAT('A', 16)); + --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) + if ($second_before == $second_after) { --echo Too much space are reserved on second index. } + DROP TABLE t2; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index be6a1ce30ef..e406d008705 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -3727,7 +3727,13 @@ fil_open_single_table_tablespace( #endif /* UNIV_SYNC_DEBUG */ ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex))); - if (!fsp_flags_is_valid(flags)) { + /* Table flags can be ULINT_UNDEFINED if + dict_tf_to_fsp_flags_failure is set. */ + if (flags != ULINT_UNDEFINED) { + if (!fsp_flags_is_valid(flags)) { + return(DB_CORRUPTION); + } + } else { return(DB_CORRUPTION); } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 6a02b08c3b7..bfdcbfaeee0 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -3003,10 +3003,6 @@ innobase_shutdown_for_mysql(void) buf_mtflu_io_thread_exit(); } -#ifdef UNIV_DEBUG - fprintf(stderr, "InnoDB: Note: %s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count); -#endif - os_mutex_enter(os_sync_mutex); if (os_thread_count == 0) { diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index d9398e3ceb5..017e96e6111 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -3752,7 +3752,13 @@ fil_open_single_table_tablespace( #endif /* UNIV_SYNC_DEBUG */ ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex))); - if (!fsp_flags_is_valid(flags)) { + /* Table flags can be ULINT_UNDEFINED if + dict_tf_to_fsp_flags_failure is set. */ + if (flags != ULINT_UNDEFINED) { + if (!fsp_flags_is_valid(flags)) { + return(DB_CORRUPTION); + } + } else { return(DB_CORRUPTION); } diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index cb7aa9bc3c7..86b0764d948 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -3085,12 +3085,8 @@ innobase_shutdown_for_mysql(void) buf_mtflu_io_thread_exit(); } -#ifdef UNIV_DEBUG - fprintf(stderr, "InnoDB: Note: %s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count); -#endif os_mutex_enter(os_sync_mutex); - if (os_thread_count == 0) { /* All the threads have exited or are just exiting; NOTE that the threads may not have completed their From 7c58dd80e599862f42c60186c0c913cb9f64b6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 8 Sep 2014 15:12:18 +0300 Subject: [PATCH 6/8] Fix another set of test failures caused by galera merge. --- .../suite/perfschema/r/stage_mdl_function.result | 2 +- .../suite/perfschema/r/stage_mdl_procedure.result | 2 +- mysql-test/suite/perfschema/r/stage_mdl_table.result | 2 +- mysql-test/suite/roles/set_default_role_for.result | 12 ++++++------ mysql-test/suite/roles/set_default_role_for.test | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/perfschema/r/stage_mdl_function.result b/mysql-test/suite/perfschema/r/stage_mdl_function.result index d949b19586a..098ff4f2132 100644 --- a/mysql-test/suite/perfschema/r/stage_mdl_function.result +++ b/mysql-test/suite/perfschema/r/stage_mdl_function.result @@ -11,7 +11,6 @@ username event_name sql_text user1 statement/sql/select select test.f1() username event_name nesting_event_type username event_name nesting_event_type -user1 stage/sql/optimizing STATEMENT user1 stage/sql/executing STATEMENT user1 stage/sql/Opening tables STATEMENT user1 stage/sql/After opening tables STATEMENT @@ -19,6 +18,7 @@ user1 stage/sql/closing tables STATEMENT user1 stage/sql/end STATEMENT user1 stage/sql/query end STATEMENT user1 stage/sql/closing tables STATEMENT +user1 stage/sql/Unlocking tables STATEMENT user1 stage/sql/freeing items STATEMENT user1 stage/sql/cleaning up STATEMENT call dump_one_thread('user2'); diff --git a/mysql-test/suite/perfschema/r/stage_mdl_procedure.result b/mysql-test/suite/perfschema/r/stage_mdl_procedure.result index 263c00c98e6..1eeae4fc4fa 100644 --- a/mysql-test/suite/perfschema/r/stage_mdl_procedure.result +++ b/mysql-test/suite/perfschema/r/stage_mdl_procedure.result @@ -18,7 +18,6 @@ username event_name sql_text user1 statement/sql/select select test.f1() username event_name nesting_event_type username event_name nesting_event_type -user1 stage/sql/query end STATEMENT user1 stage/sql/closing tables STATEMENT user1 stage/sql/Opening tables STATEMENT user1 stage/sql/After opening tables STATEMENT @@ -26,6 +25,7 @@ user1 stage/sql/closing tables STATEMENT user1 stage/sql/end STATEMENT user1 stage/sql/query end STATEMENT user1 stage/sql/closing tables STATEMENT +user1 stage/sql/Unlocking tables STATEMENT user1 stage/sql/freeing items STATEMENT user1 stage/sql/cleaning up STATEMENT call dump_one_thread('user2'); diff --git a/mysql-test/suite/perfschema/r/stage_mdl_table.result b/mysql-test/suite/perfschema/r/stage_mdl_table.result index 60e83e8a179..0699c28ac47 100644 --- a/mysql-test/suite/perfschema/r/stage_mdl_table.result +++ b/mysql-test/suite/perfschema/r/stage_mdl_table.result @@ -13,7 +13,6 @@ username event_name sql_text user1 statement/sql/select select * from test.t1 for update username event_name nesting_event_type username event_name nesting_event_type -user1 stage/sql/optimizing STATEMENT user1 stage/sql/statistics STATEMENT user1 stage/sql/preparing STATEMENT user1 stage/sql/executing STATEMENT @@ -21,6 +20,7 @@ user1 stage/sql/Sending data STATEMENT user1 stage/sql/end STATEMENT user1 stage/sql/query end STATEMENT user1 stage/sql/closing tables STATEMENT +user1 stage/sql/Unlocking tables STATEMENT user1 stage/sql/freeing items STATEMENT user1 stage/sql/cleaning up STATEMENT call dump_one_thread('user2'); diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result index 7289319a428..3e444a5f537 100644 --- a/mysql-test/suite/roles/set_default_role_for.result +++ b/mysql-test/suite/roles/set_default_role_for.result @@ -21,17 +21,17 @@ Grants for user_a@localhost GRANT role_a TO 'user_a'@'localhost' GRANT USAGE ON *.* TO 'user_a'@'localhost' GRANT SELECT ON *.* TO 'role_a' -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; user host default_role user_a localhost role_a user_b localhost role_b set default role NONE for current_user; -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; user host default_role user_a localhost user_b localhost role_b set default role current_role for current_user; -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; user host default_role user_a localhost role_a user_b localhost role_b @@ -42,7 +42,7 @@ Grants for user_b@localhost GRANT role_b TO 'user_b'@'localhost' GRANT USAGE ON *.* TO 'user_b'@'localhost' GRANT INSERT, UPDATE ON *.* TO 'role_b' -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user' insert into mysql.user (user, host) values ('someuser', 'somehost'); Warnings: @@ -56,10 +56,10 @@ Grants for user_a@localhost GRANT role_a TO 'user_a'@'localhost' GRANT USAGE ON *.* TO 'user_a'@'localhost' GRANT INSERT, UPDATE ON *.* TO 'role_b' -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table 'user' drop role role_a; drop role role_b; -delete from mysql.user where user = 'someuser' && host = 'somehost'; +delete from mysql.user where user = 'someuser' && host = 'somehost' order by user; drop user user_a@localhost; drop user user_b@localhost; diff --git a/mysql-test/suite/roles/set_default_role_for.test b/mysql-test/suite/roles/set_default_role_for.test index d7a3372ae23..2e798b49733 100644 --- a/mysql-test/suite/roles/set_default_role_for.test +++ b/mysql-test/suite/roles/set_default_role_for.test @@ -44,13 +44,13 @@ set default role role_b for user_b@localhost; change_user 'user_a'; show grants; -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; set default role NONE for current_user; -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; set default role current_role for current_user; -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; # Make sure we can't set a default role not granted to us, using current_user --error ER_INVALID_ROLE @@ -60,7 +60,7 @@ change_user 'user_b'; show grants; --error ER_TABLEACCESS_DENIED_ERROR -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; # Make sure the default role setting worked from root. insert into mysql.user (user, host) values ('someuser', 'somehost'); @@ -73,12 +73,12 @@ change_user 'user_a'; # There is no default role set any more. show grants; --error ER_TABLEACCESS_DENIED_ERROR -select user, host, default_role from mysql.user where user like 'user_%'; +select user, host, default_role from mysql.user where user like 'user_%' order by user; change_user 'root'; drop role role_a; drop role role_b; -delete from mysql.user where user = 'someuser' && host = 'somehost'; +delete from mysql.user where user = 'someuser' && host = 'somehost' order by user; drop user user_a@localhost; drop user user_b@localhost; From 26e048ffd30e05a60a330a708341e1fff0df0a9e Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Mon, 8 Sep 2014 13:19:20 -0400 Subject: [PATCH 7/8] Merged sys_vars.wsrep_* tests from maria-10.0-galera tree. --- .../wsrep_auto_increment_control_basic.result | 53 ++++++++-- .../r/wsrep_causal_reads_basic.result | 58 +++++++++-- .../r/wsrep_certify_nonpk_basic.result | 53 ++++++++-- .../r/wsrep_cluster_address_basic.result | 97 +++++++++--------- .../r/wsrep_cluster_name_basic.result | 48 +++++++-- .../r/wsrep_convert_lock_to_trx_basic.result | 53 ++++++++-- .../r/wsrep_data_home_dir_basic.result | 94 +++++++++--------- .../sys_vars/r/wsrep_dbug_option_basic.result | 51 +++++++++- .../suite/sys_vars/r/wsrep_debug_basic.result | 53 ++++++++-- .../sys_vars/r/wsrep_desync_basic.result | 51 +++++++++- ...srep_drupal_282555_workaround_basic.result | 53 ++++++++-- .../r/wsrep_forced_binlog_format_basic.result | 59 +++++++++-- .../r/wsrep_load_data_splitting_basic.result | 53 ++++++++-- .../r/wsrep_log_conflicts_basic.result | 53 ++++++++-- .../sys_vars/r/wsrep_max_ws_rows_basic.result | 64 +++++++++--- .../sys_vars/r/wsrep_max_ws_size_basic.result | 69 ++++++++++--- ...srep_mysql_replication_bundle_basic.result | 68 +++++++++---- .../r/wsrep_node_address_basic.result | 92 ++++++++--------- .../wsrep_node_incoming_address_basic.result | 99 ++++++++++--------- .../sys_vars/r/wsrep_node_name_basic.result | 52 +++++++++- .../sys_vars/r/wsrep_notify_cmd_basic.result | 51 +++++++++- .../suite/sys_vars/r/wsrep_on_basic.result | 58 +++++++++-- .../sys_vars/r/wsrep_osu_method_basic.result | 72 +++++++++++--- .../sys_vars/r/wsrep_provider_basic.result | 44 ++++++++- .../r/wsrep_provider_options_basic.result | 52 +++++++++- .../sys_vars/r/wsrep_recover_basic.result | 69 ++++--------- .../r/wsrep_replicate_myisam_basic.result | 39 ++++++-- .../r/wsrep_restart_slave_basic.result | 39 ++++++-- .../r/wsrep_retry_autocommit_basic.result | 71 +++++++++++-- .../r/wsrep_slave_threads_basic.result | 63 ++++++++---- .../sys_vars/r/wsrep_sst_auth_basic.result | 55 ++++++++++- .../sys_vars/r/wsrep_sst_donor_basic.result | 58 +++++++++-- ...rep_sst_donor_rejects_queries_basic.result | 53 ++++++++-- .../sys_vars/r/wsrep_sst_method_basic.result | 64 +++++++++--- .../r/wsrep_sst_receive_address_basic.result | 72 ++++++++++++-- .../r/wsrep_start_position_basic.result | 63 ++++++++++-- .../t/wsrep_auto_increment_control_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_causal_reads_basic.test | 52 ++++++++-- .../suite/sys_vars/t/wsrep_certify_nonpk | 13 --- .../sys_vars/t/wsrep_certify_nonpk_basic.test | 49 +++++++-- .../t/wsrep_cluster_address_basic.test | 74 +++++++------- .../sys_vars/t/wsrep_cluster_name_basic.test | 46 +++++++-- .../t/wsrep_convert_lock_to_trx_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_data_home_dir_basic.test | 77 +++++++-------- .../sys_vars/t/wsrep_dbug_option_basic.test | 47 +++++++-- .../suite/sys_vars/t/wsrep_debug_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_debug_option_basic.test | 13 --- .../suite/sys_vars/t/wsrep_desync_basic.test | 51 +++++++++- .../wsrep_drupal_282555_workaround_basic.test | 49 +++++++-- .../t/wsrep_forced_binlog_format_basic.test | 52 ++++++++-- .../t/wsrep_load_data_splitting_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_log_conflicts_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_max_ws_rows_basic.test | 53 +++++++--- .../sys_vars/t/wsrep_max_ws_size_basic.test | 53 +++++++--- .../wsrep_mysql_replication_bundle_basic.test | 53 +++++++--- .../sys_vars/t/wsrep_node_address_basic.test | 71 ++++++------- .../t/wsrep_node_incoming_address_basic.test | 73 +++++++------- .../sys_vars/t/wsrep_node_name_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_notify_cmd_basic.test | 48 +++++++-- .../suite/sys_vars/t/wsrep_on_basic.test | 52 ++++++++-- .../sys_vars/t/wsrep_osu_method_basic.test | 60 ++++++++--- .../sys_vars/t/wsrep_provider_basic.test | 42 +++++++- .../t/wsrep_provider_options_basic.test | 47 ++++++++- .../suite/sys_vars/t/wsrep_recover_basic.test | 63 ++++-------- .../t/wsrep_replicate_myisam_basic.test | 43 ++++++-- .../sys_vars/t/wsrep_restart_slave_basic.test | 43 ++++++-- .../t/wsrep_retry_autocommit_basic.test | 59 +++++++++-- .../sys_vars/t/wsrep_slave_threads_basic.test | 53 +++++++--- .../sys_vars/t/wsrep_sst_auth_basic.test | 53 ++++++++-- .../sys_vars/t/wsrep_sst_donor_basic.test | 51 ++++++++-- ...wsrep_sst_donor_rejects_queries_basic.test | 49 +++++++-- .../sys_vars/t/wsrep_sst_method_basic.test | 58 ++++++++--- .../t/wsrep_sst_receive_address_basic.test | 60 +++++++++-- .../t/wsrep_start_position_basic.test | 62 ++++++++++-- .../t/wsrep_wsrep_provider_basic.test | 11 --- 75 files changed, 3166 insertions(+), 1004 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_certify_nonpk delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_debug_option_basic.test delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_wsrep_provider_basic.test diff --git a/mysql-test/suite/sys_vars/r/wsrep_auto_increment_control_basic.result b/mysql-test/suite/sys_vars/r/wsrep_auto_increment_control_basic.result index d5affeaf5e4..2608e58b986 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_auto_increment_control_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_auto_increment_control_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_auto_increment_control; -set @@global.wsrep_auto_increment_control=ON; -set @@global.wsrep_auto_increment_control=OFF; -set @@global.wsrep_auto_increment_control=1; -set @@global.wsrep_auto_increment_control=0; -SET @@global.wsrep_auto_increment_control = -1; -ERROR 42000: Variable 'wsrep_auto_increment_control' can't be set to the value of '-1' -set @@global.wsrep_auto_increment_control = @start_value; +# +# wsrep_auto_increment_control +# +# save the initial value +SET @wsrep_auto_increment_control_global_saved = @@global.wsrep_auto_increment_control; +# default +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +1 + +# scope +SELECT @@session.wsrep_auto_increment_control; +ERROR HY000: Variable 'wsrep_auto_increment_control' is a GLOBAL variable +SET @@global.wsrep_auto_increment_control=OFF; +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +0 +SET @@global.wsrep_auto_increment_control=ON; +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +1 + +# valid values +SET @@global.wsrep_auto_increment_control='OFF'; +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +0 +SET @@global.wsrep_auto_increment_control=ON; +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +1 +SET @@global.wsrep_auto_increment_control=default; +SELECT @@global.wsrep_auto_increment_control; +@@global.wsrep_auto_increment_control +1 + +# invalid values +SET @@global.wsrep_auto_increment_control=NULL; +ERROR 42000: Variable 'wsrep_auto_increment_control' can't be set to the value of 'NULL' +SET @@global.wsrep_auto_increment_control='junk'; +ERROR 42000: Variable 'wsrep_auto_increment_control' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_auto_increment_control = @wsrep_auto_increment_control_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_causal_reads_basic.result b/mysql-test/suite/sys_vars/r/wsrep_causal_reads_basic.result index 3b96654f8c7..501117dda9f 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_causal_reads_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_causal_reads_basic.result @@ -1,8 +1,50 @@ -set @start_value = @@wsrep_causal_reads; -set @@global.wsrep_causal_reads=ON; -set @@global.wsrep_causal_reads=OFF; -set @@global.wsrep_causal_reads=1; -set @@global.wsrep_causal_reads=0; -SET @@global.wsrep_causal_reads = -1; -ERROR 42000: Variable 'wsrep_causal_reads' can't be set to the value of '-1' -set @@global.wsrep_causal_reads = @start_value; +# +# wsrep_causal_reads +# +# save the initial values +SET @wsrep_causal_reads_global_saved = @@global.wsrep_causal_reads; +SET @wsrep_causal_reads_session_saved = @@session.wsrep_causal_reads; +# default +SELECT @@global.wsrep_causal_reads; +@@global.wsrep_causal_reads +0 +SELECT @@session.wsrep_causal_reads; +@@session.wsrep_causal_reads +0 + +# scope and valid values +SET @@global.wsrep_causal_reads=OFF; +SELECT @@global.wsrep_causal_reads; +@@global.wsrep_causal_reads +0 +SET @@global.wsrep_causal_reads=ON; +SELECT @@global.wsrep_causal_reads; +@@global.wsrep_causal_reads +1 +SET @@session.wsrep_causal_reads=OFF; +SELECT @@session.wsrep_causal_reads; +@@session.wsrep_causal_reads +0 +SET @@session.wsrep_causal_reads=ON; +SELECT @@session.wsrep_causal_reads; +@@session.wsrep_causal_reads +1 +SET @@session.wsrep_causal_reads=default; +SELECT @@session.wsrep_causal_reads; +@@session.wsrep_causal_reads +1 + +# invalid values +SET @@global.wsrep_causal_reads=NULL; +ERROR 42000: Variable 'wsrep_causal_reads' can't be set to the value of 'NULL' +SET @@global.wsrep_causal_reads='junk'; +ERROR 42000: Variable 'wsrep_causal_reads' can't be set to the value of 'junk' +SET @@session.wsrep_causal_reads=NULL; +ERROR 42000: Variable 'wsrep_causal_reads' can't be set to the value of 'NULL' +SET @@session.wsrep_causal_reads='junk'; +ERROR 42000: Variable 'wsrep_causal_reads' can't be set to the value of 'junk' + +# restore the initial values +SET @@global.wsrep_causal_reads = @wsrep_causal_reads_global_saved; +SET @@session.wsrep_causal_reads = @wsrep_causal_reads_session_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_certify_nonpk_basic.result b/mysql-test/suite/sys_vars/r/wsrep_certify_nonpk_basic.result index 4b02f9fb61e..7200d14f75f 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_certify_nonpk_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_certify_nonpk_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_certify_nonpk; -set @@global.wsrep_certify_nonpk=ON; -set @@global.wsrep_certify_nonpk=OFF; -set @@global.wsrep_certify_nonpk=1; -set @@global.wsrep_certify_nonpk=0; -SET @@global.wsrep_certify_nonpk = -1; -ERROR 42000: Variable 'wsrep_certify_nonPK' can't be set to the value of '-1' -set @@global.wsrep_certify_nonpk = @start_value; +# +# wsrep_certify_nonpk +# +# save the initial value +SET @wsrep_certify_nonpk_global_saved = @@global.wsrep_certify_nonpk; +# default +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +1 + +# scope +SELECT @@session.wsrep_certify_nonpk; +ERROR HY000: Variable 'wsrep_certify_nonPK' is a GLOBAL variable +SET @@global.wsrep_certify_nonpk=OFF; +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +0 +SET @@global.wsrep_certify_nonpk=ON; +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +1 + +# valid values +SET @@global.wsrep_certify_nonpk='OFF'; +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +0 +SET @@global.wsrep_certify_nonpk=ON; +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +1 +SET @@global.wsrep_certify_nonpk=default; +SELECT @@global.wsrep_certify_nonpk; +@@global.wsrep_certify_nonpk +1 + +# invalid values +SET @@global.wsrep_certify_nonpk=NULL; +ERROR 42000: Variable 'wsrep_certify_nonPK' can't be set to the value of 'NULL' +SET @@global.wsrep_certify_nonpk='junk'; +ERROR 42000: Variable 'wsrep_certify_nonPK' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_certify_nonpk = @wsrep_certify_nonpk_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result b/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result index 734908d42e5..8497e220523 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result @@ -1,45 +1,54 @@ -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); -COUNT(@@GLOBAL.wsrep_cluster_address) -1 -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); -COUNT(@@GLOBAL.wsrep_cluster_address) -1 -1 Expected -SELECT @@GLOBAL.wsrep_cluster_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_cluster_address'; -@@GLOBAL.wsrep_cluster_address = VARIABLE_VALUE -1 -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); -COUNT(@@GLOBAL.wsrep_cluster_address) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_cluster_address'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -SELECT @@wsrep_cluster_address = @@GLOBAL.wsrep_cluster_address; -@@wsrep_cluster_address = @@GLOBAL.wsrep_cluster_address -1 -1 Expected -SELECT COUNT(@@wsrep_cluster_address); -COUNT(@@wsrep_cluster_address) -1 -1 Expected -SELECT COUNT(@@local.wsrep_cluster_address); +# +# wsrep_cluster_address +# +call mtr.add_suppression("safe_mutex: Found wrong usage of mutex.*"); +# save the initial value +SET @wsrep_cluster_address_global_saved = @@global.wsrep_cluster_address; +# default +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address + + +# scope +SELECT @@session.wsrep_cluster_address; ERROR HY000: Variable 'wsrep_cluster_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.wsrep_cluster_address); -ERROR HY000: Variable 'wsrep_cluster_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); -COUNT(@@GLOBAL.wsrep_cluster_address) -1 -1 Expected -SELECT wsrep_cluster_address = @@SESSION.wsrep_cluster_address; -ERROR 42S22: Unknown column 'wsrep_cluster_address' in 'field list' -Expected error 'Readonly variable' +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address + + +# valid values +SET @@global.wsrep_cluster_address='127.0.0.1'; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address +127.0.0.1 +SET @@global.wsrep_cluster_address=AUTO; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address +AUTO +SET @@global.wsrep_cluster_address=default; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address + + +# invalid values +SET @@global.wsrep_node_address=NULL; +ERROR 42000: Variable 'wsrep_node_address' can't be set to the value of 'NULL' +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address + +SET @@global.wsrep_cluster_address=ON; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address +ON +SET @@global.wsrep_cluster_address='OFF'; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address +OFF +SET @@global.wsrep_cluster_address='junk'; +SELECT @@global.wsrep_cluster_address; +@@global.wsrep_cluster_address +junk + +# restore the initial value +SET @@global.wsrep_cluster_address = @wsrep_cluster_address_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_cluster_name_basic.result b/mysql-test/suite/sys_vars/r/wsrep_cluster_name_basic.result index 59c3b9381d1..29a2d966489 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_cluster_name_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_cluster_name_basic.result @@ -1,7 +1,43 @@ -set @start_value = @@wsrep_cluster_name; -set @@global.wsrep_cluster_name='test'; -set @@global.wsrep_cluster_name=NULL; +# +# wsrep_cluster_name +# +# save the initial value +SET @wsrep_cluster_name_global_saved = @@global.wsrep_cluster_name; +# default +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +my_wsrep_cluster + +# scope +SELECT @@session.wsrep_cluster_name; +ERROR HY000: Variable 'wsrep_cluster_name' is a GLOBAL variable +SET @@global.wsrep_cluster_name='my_galera_cluster'; +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +my_galera_cluster + +# valid values +SET @@global.wsrep_cluster_name='my_quoted_galera_cluster'; +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +my_quoted_galera_cluster +SET @@global.wsrep_cluster_name=my_unquoted_cluster; +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +my_unquoted_cluster +SET @@global.wsrep_cluster_name=OFF; +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +OFF +SET @@global.wsrep_cluster_name=default; +SELECT @@global.wsrep_cluster_name; +@@global.wsrep_cluster_name +my_wsrep_cluster + +# invalid values +SET @@global.wsrep_cluster_name=NULL; ERROR 42000: Variable 'wsrep_cluster_name' can't be set to the value of 'NULL' -SET @@global.wsrep_cluster_name = 1; -ERROR 42000: Incorrect argument type to variable 'wsrep_cluster_name' -set @@global.wsrep_cluster_name = @start_value; + +# restore the initial value +SET @@global.wsrep_cluster_name = @wsrep_cluster_name_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_convert_lock_to_trx_basic.result b/mysql-test/suite/sys_vars/r/wsrep_convert_lock_to_trx_basic.result index 10043812289..80210c4c4b6 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_convert_lock_to_trx_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_convert_lock_to_trx_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_convert_lock_to_trx; -set @@global.wsrep_convert_lock_to_trx=ON; -set @@global.wsrep_convert_lock_to_trx=OFF; -set @@global.wsrep_convert_lock_to_trx=1; -set @@global.wsrep_convert_lock_to_trx=0; -SET @@global.wsrep_convert_lock_to_trx = -1; -ERROR 42000: Variable 'wsrep_convert_LOCK_to_trx' can't be set to the value of '-1' -set @@global.wsrep_convert_lock_to_trx = @start_value; +# +# wsrep_convert_lock_to_trx +# +# save the initial value +SET @wsrep_convert_lock_to_trx_global_saved = @@global.wsrep_convert_lock_to_trx; +# default +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +0 + +# scope +SELECT @@session.wsrep_convert_lock_to_trx; +ERROR HY000: Variable 'wsrep_convert_LOCK_to_trx' is a GLOBAL variable +SET @@global.wsrep_convert_lock_to_trx=OFF; +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +0 +SET @@global.wsrep_convert_lock_to_trx=ON; +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +1 + +# valid values +SET @@global.wsrep_convert_lock_to_trx='OFF'; +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +0 +SET @@global.wsrep_convert_lock_to_trx=ON; +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +1 +SET @@global.wsrep_convert_lock_to_trx=default; +SELECT @@global.wsrep_convert_lock_to_trx; +@@global.wsrep_convert_lock_to_trx +0 + +# invalid values +SET @@global.wsrep_convert_lock_to_trx=NULL; +ERROR 42000: Variable 'wsrep_convert_LOCK_to_trx' can't be set to the value of 'NULL' +SET @@global.wsrep_convert_lock_to_trx='junk'; +ERROR 42000: Variable 'wsrep_convert_LOCK_to_trx' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_convert_lock_to_trx = @wsrep_convert_lock_to_trx_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_data_home_dir_basic.result b/mysql-test/suite/sys_vars/r/wsrep_data_home_dir_basic.result index 668aebe30f1..044ef8bf3bc 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_data_home_dir_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_data_home_dir_basic.result @@ -1,48 +1,48 @@ -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); -COUNT(@@GLOBAL.wsrep_data_home_dir) -1 -1 Expected -SET @@GLOBAL.wsrep_data_home_dir=1; +# +# wsrep_data_home_dir (readonly) +# +# default +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + + +# scope +SELECT @@session.wsrep_data_home_dir; +ERROR HY000: Variable 'wsrep_data_home_dir' is a GLOBAL variable +SET @@global.wsrep_data_home_dir='/tmp/data'; ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable -Expected error 'Read only variable' -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); -COUNT(@@GLOBAL.wsrep_data_home_dir) -1 -1 Expected -SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_data_home_dir'; -@@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE -1 -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); -COUNT(@@GLOBAL.wsrep_data_home_dir) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_data_home_dir'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -SELECT @@wsrep_data_home_dir = @@GLOBAL.wsrep_data_home_dir; -@@wsrep_data_home_dir = @@GLOBAL.wsrep_data_home_dir -1 -1 Expected -SELECT COUNT(@@wsrep_data_home_dir); -COUNT(@@wsrep_data_home_dir) -1 -1 Expected -SELECT COUNT(@@local.wsrep_data_home_dir); -ERROR HY000: Variable 'wsrep_data_home_dir' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.wsrep_data_home_dir); -ERROR HY000: Variable 'wsrep_data_home_dir' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); -COUNT(@@GLOBAL.wsrep_data_home_dir) -1 -1 Expected -SELECT wsrep_data_home_dir = @@SESSION.wsrep_data_home_dir; -ERROR 42S22: Unknown column 'wsrep_data_home_dir' in 'field list' -Expected error 'Readonly variable' +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + + +# valid values +SET @@global.wsrep_data_home_dir='/tmp/data'; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + +SET @@global.wsrep_data_home_dir=junk-dir; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + +SET @@global.wsrep_data_home_dir=junk/dir; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + +SET @@global.wsrep_data_home_dir=OFF; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + +SET @@global.wsrep_data_home_dir=default; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +SELECT @@global.wsrep_data_home_dir; +@@global.wsrep_data_home_dir + + +# invalid values +SET @@global.wsrep_data_home_dir=NULL; +ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_dbug_option_basic.result b/mysql-test/suite/sys_vars/r/wsrep_dbug_option_basic.result index 36ebcb17002..2092d54681e 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_dbug_option_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_dbug_option_basic.result @@ -1,6 +1,47 @@ -set @start_value = @@wsrep_dbug_option; -set @@global.wsrep_dbug_option='foo:bar'; -set @@global.wsrep_dbug_option=NULL; -SET @@global.wsrep_dbug_option = -1; +# +# wsrep_dbug_option +# +# save the initial value +SET @wsrep_dbug_option_global_saved = @@global.wsrep_dbug_option; +# default +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option + + +# scope +SELECT @@session.wsrep_dbug_option; +ERROR HY000: Variable 'wsrep_dbug_option' is a GLOBAL variable +SET @@global.wsrep_dbug_option='test-dbug-string'; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option +test-dbug-string + +# valid values +SET @@global.wsrep_dbug_option='quoted-dbug-string'; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option +quoted-dbug-string +SET @@global.wsrep_dbug_option=unquoted_dbug_string; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option +unquoted_dbug_string +SET @@global.wsrep_dbug_option=OFF; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option +OFF +SET @@global.wsrep_dbug_option=NULL; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option +NULL +SET @@global.wsrep_dbug_option=default; +SELECT @@global.wsrep_dbug_option; +@@global.wsrep_dbug_option + + +# invalid values +SET @@global.wsrep_dbug_option=1; ERROR 42000: Incorrect argument type to variable 'wsrep_dbug_option' -set @@global.wsrep_dbug_option = @start_value; + +# restore the initial value +SET @@global.wsrep_dbug_option = @wsrep_dbug_option_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result b/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result index 6bbe780316b..96c262c110c 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_debug; -set @@global.wsrep_debug=ON; -set @@global.wsrep_debug=OFF; -set @@global.wsrep_debug=1; -set @@global.wsrep_debug=0; -SET @@global.wsrep_debug = -1; -ERROR 42000: Variable 'wsrep_debug' can't be set to the value of '-1' -set @@global.wsrep_debug = @start_value; +# +# wsrep_debug +# +# save the initial value +SET @wsrep_debug_global_saved = @@global.wsrep_debug; +# default +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +0 + +# scope +SELECT @@session.wsrep_debug; +ERROR HY000: Variable 'wsrep_debug' is a GLOBAL variable +SET @@global.wsrep_debug=OFF; +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +0 +SET @@global.wsrep_debug=ON; +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +1 + +# valid values +SET @@global.wsrep_debug='OFF'; +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +0 +SET @@global.wsrep_debug=ON; +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +1 +SET @@global.wsrep_debug=default; +SELECT @@global.wsrep_debug; +@@global.wsrep_debug +0 + +# invalid values +SET @@global.wsrep_debug=NULL; +ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'NULL' +SET @@global.wsrep_debug='junk'; +ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_debug = @wsrep_debug_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result index a61367ca200..69599c4b47a 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result @@ -1,3 +1,52 @@ -select @@global.wsrep_desync; +# +# wsrep_desync +# +call mtr.add_suppression("WSREP: SET desync failed 9 for SET @@global.wsrep_desync=ON"); +# save the initial value +SET @wsrep_desync_global_saved = @@global.wsrep_desync; +# default +SELECT @@global.wsrep_desync; @@global.wsrep_desync 0 + +# scope +SELECT @@session.wsrep_desync; +ERROR HY000: Variable 'wsrep_desync' is a GLOBAL variable +SET @@global.wsrep_desync=OFF; +Warnings: +Warning 1231 'wsrep_desync' is already OFF. +SELECT @@global.wsrep_desync; +@@global.wsrep_desync +0 +SET @@global.wsrep_desync=ON; +ERROR HY000: Operation 'desync' failed for SET @@global.wsrep_desync=ON +SELECT @@global.wsrep_desync; +@@global.wsrep_desync +1 + +# valid values +SET @@global.wsrep_desync='OFF'; +SELECT @@global.wsrep_desync; +@@global.wsrep_desync +0 +SET @@global.wsrep_desync=ON; +ERROR HY000: Operation 'desync' failed for SET @@global.wsrep_desync=ON +SELECT @@global.wsrep_desync; +@@global.wsrep_desync +1 +SET @@global.wsrep_desync=default; +SELECT @@global.wsrep_desync; +@@global.wsrep_desync +0 + +# invalid values +SET @@global.wsrep_desync=NULL; +ERROR 42000: Variable 'wsrep_desync' can't be set to the value of 'NULL' +SET @@global.wsrep_desync='junk'; +ERROR 42000: Variable 'wsrep_desync' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_desync = @wsrep_desync_global_saved; +Warnings: +Warning 1231 'wsrep_desync' is already OFF. +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_drupal_282555_workaround_basic.result b/mysql-test/suite/sys_vars/r/wsrep_drupal_282555_workaround_basic.result index 5a8d5a8abee..52bfc01e810 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_drupal_282555_workaround_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_drupal_282555_workaround_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_drupal_282555_workaround; -set @@global.wsrep_drupal_282555_workaround=ON; -set @@global.wsrep_drupal_282555_workaround=OFF; -set @@global.wsrep_drupal_282555_workaround=1; -set @@global.wsrep_drupal_282555_workaround=0; -SET @@global.wsrep_drupal_282555_workaround = -1; -ERROR 42000: Variable 'wsrep_drupal_282555_workaround' can't be set to the value of '-1' -set @@global.wsrep_drupal_282555_workaround = @start_value; +# +# wsrep_drupal_282555_workaround +# +# save the initial value +SET @wsrep_drupal_282555_workaround_global_saved = @@global.wsrep_drupal_282555_workaround; +# default +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +0 + +# scope +SELECT @@session.wsrep_drupal_282555_workaround; +ERROR HY000: Variable 'wsrep_drupal_282555_workaround' is a GLOBAL variable +SET @@global.wsrep_drupal_282555_workaround=OFF; +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +0 +SET @@global.wsrep_drupal_282555_workaround=ON; +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +1 + +# valid values +SET @@global.wsrep_drupal_282555_workaround='OFF'; +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +0 +SET @@global.wsrep_drupal_282555_workaround=ON; +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +1 +SET @@global.wsrep_drupal_282555_workaround=default; +SELECT @@global.wsrep_drupal_282555_workaround; +@@global.wsrep_drupal_282555_workaround +0 + +# invalid values +SET @@global.wsrep_drupal_282555_workaround=NULL; +ERROR 42000: Variable 'wsrep_drupal_282555_workaround' can't be set to the value of 'NULL' +SET @@global.wsrep_drupal_282555_workaround='junk'; +ERROR 42000: Variable 'wsrep_drupal_282555_workaround' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_drupal_282555_workaround = @wsrep_drupal_282555_workaround_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result b/mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result index 58bdb45c8de..3cf5ffcaf4e 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result @@ -1,8 +1,51 @@ -set @start_value = @@wsrep_forced_binlog_format; -set @@global.wsrep_forced_binlog_format = ROW; -set @@global.wsrep_forced_binlog_format = MIXED; -set @@global.wsrep_forced_binlog_format = STATEMENT; -set @@global.wsrep_forced_binlog_format = NONE; -set @@global.wsrep_forced_binlog_format = FOO; -ERROR 42000: Variable 'wsrep_forced_binlog_format' can't be set to the value of 'FOO' -set @@global.wsrep_forced_binlog_format = @start_value; +# +# wsrep_forced_binlog_format +# +# save the initial value +SET @wsrep_forced_binlog_format_global_saved = @@global.wsrep_forced_binlog_format; +# default +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +NONE + +# scope +SELECT @@session.wsrep_forced_binlog_format; +ERROR HY000: Variable 'wsrep_forced_binlog_format' is a GLOBAL variable +SET @@global.wsrep_forced_binlog_format=STATEMENT; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +STATEMENT + +# valid values +SET @@global.wsrep_forced_binlog_format=STATEMENT; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +STATEMENT +SET @@global.wsrep_forced_binlog_format=ROW; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +ROW +SET @@global.wsrep_forced_binlog_format=MIXED; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +MIXED +SET @@global.wsrep_forced_binlog_format=NONE; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +NONE +SET @@global.wsrep_forced_binlog_format=default; +SELECT @@global.wsrep_forced_binlog_format; +@@global.wsrep_forced_binlog_format +NONE + +# invalid values +SET @@global.wsrep_forced_binlog_format=NULL; +ERROR 42000: Variable 'wsrep_forced_binlog_format' can't be set to the value of 'NULL' +SET @@global.wsrep_forced_binlog_format='junk'; +ERROR 42000: Variable 'wsrep_forced_binlog_format' can't be set to the value of 'junk' +SET @@global.wsrep_forced_binlog_format=ON; +ERROR 42000: Variable 'wsrep_forced_binlog_format' can't be set to the value of 'ON' + +# restore the initial value +SET @@global.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_load_data_splitting_basic.result b/mysql-test/suite/sys_vars/r/wsrep_load_data_splitting_basic.result index be73397f35e..687934a7705 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_load_data_splitting_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_load_data_splitting_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_load_data_splitting; -set @@global.wsrep_load_data_splitting=ON; -set @@global.wsrep_load_data_splitting=OFF; -set @@global.wsrep_load_data_splitting=1; -set @@global.wsrep_load_data_splitting=0; -SET @@global.wsrep_load_data_splitting = -1; -ERROR 42000: Variable 'wsrep_load_data_splitting' can't be set to the value of '-1' -set @@global.wsrep_load_data_splitting = @start_value; +# +# wsrep_load_data_splitting +# +# save the initial value +SET @wsrep_load_data_splitting_global_saved = @@global.wsrep_load_data_splitting; +# default +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +1 + +# scope +SELECT @@session.wsrep_load_data_splitting; +ERROR HY000: Variable 'wsrep_load_data_splitting' is a GLOBAL variable +SET @@global.wsrep_load_data_splitting=OFF; +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +0 +SET @@global.wsrep_load_data_splitting=ON; +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +1 + +# valid values +SET @@global.wsrep_load_data_splitting='OFF'; +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +0 +SET @@global.wsrep_load_data_splitting=ON; +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +1 +SET @@global.wsrep_load_data_splitting=default; +SELECT @@global.wsrep_load_data_splitting; +@@global.wsrep_load_data_splitting +1 + +# invalid values +SET @@global.wsrep_load_data_splitting=NULL; +ERROR 42000: Variable 'wsrep_load_data_splitting' can't be set to the value of 'NULL' +SET @@global.wsrep_load_data_splitting='junk'; +ERROR 42000: Variable 'wsrep_load_data_splitting' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_load_data_splitting = @wsrep_load_data_splitting_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_log_conflicts_basic.result b/mysql-test/suite/sys_vars/r/wsrep_log_conflicts_basic.result index 22d8cbb568a..4d577daa904 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_log_conflicts_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_log_conflicts_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_log_conflicts; -set @@global.wsrep_log_conflicts=ON; -set @@global.wsrep_log_conflicts=OFF; -set @@global.wsrep_log_conflicts=1; -set @@global.wsrep_log_conflicts=0; -SET @@global.wsrep_log_conflicts = -1; -ERROR 42000: Variable 'wsrep_log_conflicts' can't be set to the value of '-1' -set @@global.wsrep_log_conflicts = @start_value; +# +# wsrep_log_conflicts +# +# save the initial value +SET @wsrep_log_conflicts_global_saved = @@global.wsrep_log_conflicts; +# default +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +0 + +# scope +SELECT @@session.wsrep_log_conflicts; +ERROR HY000: Variable 'wsrep_log_conflicts' is a GLOBAL variable +SET @@global.wsrep_log_conflicts=OFF; +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +0 +SET @@global.wsrep_log_conflicts=ON; +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +1 + +# valid values +SET @@global.wsrep_log_conflicts='OFF'; +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +0 +SET @@global.wsrep_log_conflicts=ON; +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +1 +SET @@global.wsrep_log_conflicts=default; +SELECT @@global.wsrep_log_conflicts; +@@global.wsrep_log_conflicts +0 + +# invalid values +SET @@global.wsrep_log_conflicts=NULL; +ERROR 42000: Variable 'wsrep_log_conflicts' can't be set to the value of 'NULL' +SET @@global.wsrep_log_conflicts='junk'; +ERROR 42000: Variable 'wsrep_log_conflicts' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_log_conflicts = @wsrep_log_conflicts_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result b/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result index fc4dd38ade3..15438a2afd5 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result @@ -1,17 +1,53 @@ -set @start_value = @@wsrep_max_ws_rows; -set @@global.wsrep_max_ws_rows=256000; -set @@global.wsrep_max_ws_rows=0; +# +# wsrep_max_ws_rows +# +# save the initial value +SET @wsrep_max_ws_rows_global_saved = @@global.wsrep_max_ws_rows; +# default +SELECT @@global.wsrep_max_ws_rows; +@@global.wsrep_max_ws_rows +131072 + +# scope +SELECT @@session.wsrep_max_ws_rows; +ERROR HY000: Variable 'wsrep_max_ws_rows' is a GLOBAL variable +SET @@global.wsrep_max_ws_rows=1; +SELECT @@global.wsrep_max_ws_rows; +@@global.wsrep_max_ws_rows +1 + +# valid values +SET @@global.wsrep_max_ws_rows=131072; +SELECT @@global.wsrep_max_ws_rows; +@@global.wsrep_max_ws_rows +131072 +SET @@global.wsrep_max_ws_rows=131073; +SELECT @@global.wsrep_max_ws_rows; +@@global.wsrep_max_ws_rows +131073 +SET @@global.wsrep_max_ws_rows=0; Warnings: Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '0' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '0' -set @@global.wsrep_max_ws_rows=-1; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '-1' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '-1' -SET @@global.wsrep_max_ws_rows = r; +SELECT @@global.wsrep_max_ws_rows; +@@global.wsrep_max_ws_rows +1 +SET @@global.wsrep_max_ws_rows=default; +SELECT @global.wsrep_max_ws_rows; +@global.wsrep_max_ws_rows +NULL + +# invalid values +SET @@global.wsrep_max_ws_rows=NULL; ERROR 42000: Incorrect argument type to variable 'wsrep_max_ws_rows' -set @@global.wsrep_max_ws_rows = @start_value; +SET @@global.wsrep_max_ws_rows='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_max_ws_rows' +SET @@global.wsrep_max_ws_rows=-1; +Warnings: +Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '-1' +SELECT @global.wsrep_max_ws_rows; +@global.wsrep_max_ws_rows +NULL + +# restore the initial value +SET @@global.wsrep_max_ws_rows = @wsrep_max_ws_rows_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result b/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result index 292fd4e02d8..26d8d823a5c 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result @@ -1,17 +1,58 @@ -set @start_value = @@wsrep_max_ws_size; -set @@global.wsrep_max_ws_size=256000; -set @@global.wsrep_max_ws_size=0; +# +# wsrep_max_ws_size +# +# save the initial value +SET @wsrep_max_ws_size_global_saved = @@global.wsrep_max_ws_size; +# default +SELECT @@global.wsrep_max_ws_size; +@@global.wsrep_max_ws_size +1073741824 + +# scope +SELECT @@session.wsrep_max_ws_size; +ERROR HY000: Variable 'wsrep_max_ws_size' is a GLOBAL variable +SET @@global.wsrep_max_ws_size=1; +Warnings: +Warning 1292 Truncated incorrect wsrep_max_ws_size value: '1' +SELECT @@global.wsrep_max_ws_size; +@@global.wsrep_max_ws_size +1024 + +# valid values +SET @@global.wsrep_max_ws_size=1073741824; +SELECT @@global.wsrep_max_ws_size; +@@global.wsrep_max_ws_size +1073741824 +SET @@global.wsrep_max_ws_size=1073741825; +SELECT @@global.wsrep_max_ws_size; +@@global.wsrep_max_ws_size +1073741825 +SET @@global.wsrep_max_ws_size=0; Warnings: Warning 1292 Truncated incorrect wsrep_max_ws_size value: '0' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '0' -set @@global.wsrep_max_ws_size=-1; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '-1' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '-1' -SET @@global.wsrep_max_ws_size = r; +SELECT @@global.wsrep_max_ws_size; +@@global.wsrep_max_ws_size +1024 +SET @@global.wsrep_max_ws_size=default; +SELECT @global.wsrep_max_ws_size; +@global.wsrep_max_ws_size +NULL + +# invalid values +SET @@global.wsrep_max_ws_size=NULL; ERROR 42000: Incorrect argument type to variable 'wsrep_max_ws_size' -set @@global.wsrep_max_ws_size = @start_value; +SET @@global.wsrep_max_ws_size='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_max_ws_size' +SELECT @global.wsrep_max_ws_size; +@global.wsrep_max_ws_size +NULL +SET @@global.wsrep_max_ws_size=-1; +Warnings: +Warning 1292 Truncated incorrect wsrep_max_ws_size value: '-1' +SELECT @global.wsrep_max_ws_size; +@global.wsrep_max_ws_size +NULL + +# restore the initial value +SET @@global.wsrep_max_ws_size = @wsrep_max_ws_size_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_mysql_replication_bundle_basic.result b/mysql-test/suite/sys_vars/r/wsrep_mysql_replication_bundle_basic.result index ad435a2c05f..1d69d800703 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_mysql_replication_bundle_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_mysql_replication_bundle_basic.result @@ -1,18 +1,52 @@ -set @start_value = @@wsrep_mysql_replication_bundle; -set @@global.wsrep_mysql_replication_bundle=0; -set @@global.wsrep_mysql_replication_bundle=1000; -set @@global.wsrep_mysql_replication_bundle=-1; -Warnings: -Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '-1' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '-1' -set @@global.wsrep_mysql_replication_bundle=1001; -Warnings: -Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '1001' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '1001' -SET @@global.wsrep_mysql_replication_bundle = r; +# +# wsrep_mysql_replication_bundle +# +# save the initial value +SET @wsrep_mysql_replication_bundle_global_saved = @@global.wsrep_mysql_replication_bundle; +# default +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +0 + +# scope +SELECT @@session.wsrep_mysql_replication_bundle; +ERROR HY000: Variable 'wsrep_mysql_replication_bundle' is a GLOBAL variable +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +0 + +# valid values +SET @@global.wsrep_mysql_replication_bundle=0; +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +0 +SET @@global.wsrep_mysql_replication_bundle=1000; +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +1000 +SET @@global.wsrep_mysql_replication_bundle=default; +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +0 + +# invalid values +SET @@global.wsrep_mysql_replication_bundle=NULL; ERROR 42000: Incorrect argument type to variable 'wsrep_mysql_replication_bundle' -set @@global.wsrep_mysql_replication_bundle = @start_value; +SET @@global.wsrep_mysql_replication_bundle='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_mysql_replication_bundle' +SET @@global.wsrep_mysql_replication_bundle=-1; +Warnings: +Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '-1' +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +0 +SET @@global.wsrep_mysql_replication_bundle=1001; +Warnings: +Warning 1292 Truncated incorrect wsrep_mysql_replication_bundle value: '1001' +SELECT @@global.wsrep_mysql_replication_bundle; +@@global.wsrep_mysql_replication_bundle +1000 + +# restore the initial value +SET @@global.wsrep_mysql_replication_bundle = @wsrep_mysql_replication_bundle_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_node_address_basic.result b/mysql-test/suite/sys_vars/r/wsrep_node_address_basic.result index 96ae51cc70f..e9a93d2fcd6 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_node_address_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_node_address_basic.result @@ -1,45 +1,49 @@ -SELECT COUNT(@@GLOBAL.wsrep_node_address); -COUNT(@@GLOBAL.wsrep_node_address) -1 -1 Expected -SET @@GLOBAL.wsrep_node_address=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_node_address' -Expected error 'Read only variable' -SELECT COUNT(@@GLOBAL.wsrep_node_address); -COUNT(@@GLOBAL.wsrep_node_address) -1 -1 Expected -SELECT @@GLOBAL.wsrep_node_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_address'; -@@GLOBAL.wsrep_node_address = VARIABLE_VALUE -1 -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_node_address); -COUNT(@@GLOBAL.wsrep_node_address) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_address'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -SELECT @@wsrep_node_address = @@GLOBAL.wsrep_node_address; -@@wsrep_node_address = @@GLOBAL.wsrep_node_address -1 -1 Expected -SELECT COUNT(@@wsrep_node_address); -COUNT(@@wsrep_node_address) -1 -1 Expected -SELECT COUNT(@@local.wsrep_node_address); +# +# wsrep_node_address +# +# save the initial value +SET @wsrep_node_address_global_saved = @@global.wsrep_node_address; +# default +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address + + +# scope +SELECT @@session.wsrep_node_address; ERROR HY000: Variable 'wsrep_node_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.wsrep_node_address); -ERROR HY000: Variable 'wsrep_node_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.wsrep_node_address); -COUNT(@@GLOBAL.wsrep_node_address) -1 -1 Expected +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address + + +# valid values +SET @@global.wsrep_node_address='127.0.0.1'; +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address +127.0.0.1 +SET @@global.wsrep_node_address=default; +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address + + +# invalid values +SET @@global.wsrep_node_address=NULL; +ERROR 42000: Variable 'wsrep_node_address' can't be set to the value of 'NULL' +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address + +SET @@global.wsrep_node_address=ON; +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address +ON +SET @@global.wsrep_node_address='OFF'; +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address +OFF +SET @@global.wsrep_node_address='junk'; +SELECT @@global.wsrep_node_address; +@@global.wsrep_node_address +junk + +# restore the initial value +SET @@global.wsrep_node_address = @wsrep_node_address_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_node_incoming_address_basic.result b/mysql-test/suite/sys_vars/r/wsrep_node_incoming_address_basic.result index 9ccf9706484..2340c61db28 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_node_incoming_address_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_node_incoming_address_basic.result @@ -1,45 +1,56 @@ -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); -COUNT(@@GLOBAL.wsrep_node_incoming_address) -1 -1 Expected -SET @@GLOBAL.wsrep_node_incoming_address=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_node_incoming_address' -Expected error 'Read only variable' -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); -COUNT(@@GLOBAL.wsrep_node_incoming_address) -1 -1 Expected -SELECT @@GLOBAL.wsrep_node_incoming_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_incoming_address'; -@@GLOBAL.wsrep_node_incoming_address = VARIABLE_VALUE -1 -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); -COUNT(@@GLOBAL.wsrep_node_incoming_address) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_incoming_address'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -SELECT @@wsrep_node_incoming_address = @@GLOBAL.wsrep_node_incoming_address; -@@wsrep_node_incoming_address = @@GLOBAL.wsrep_node_incoming_address -1 -1 Expected -SELECT COUNT(@@wsrep_node_incoming_address); -COUNT(@@wsrep_node_incoming_address) -1 -1 Expected -SELECT COUNT(@@local.wsrep_node_incoming_address); +# +# wsrep_node_incoming_address +# +# save the initial value +SET @wsrep_node_incoming_address_global_saved = @@global.wsrep_node_incoming_address; +# default +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +AUTO + +# scope +SELECT @@session.wsrep_node_incoming_address; ERROR HY000: Variable 'wsrep_node_incoming_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.wsrep_node_incoming_address); -ERROR HY000: Variable 'wsrep_node_incoming_address' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); -COUNT(@@GLOBAL.wsrep_node_incoming_address) -1 -1 Expected +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +AUTO + +# valid values +SET @@global.wsrep_node_incoming_address='127.0.0.1:4444'; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +127.0.0.1:4444 +SET @@global.wsrep_node_incoming_address='127.0.0.1'; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +127.0.0.1 +SET @@global.wsrep_node_incoming_address=AUTO; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +AUTO +SET @@global.wsrep_node_incoming_address=default; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +AUTO + +# invalid values +SET @@global.wsrep_node_incoming_address=ON; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +ON +SET @@global.wsrep_node_incoming_address='OFF'; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +OFF +SET @@global.wsrep_node_incoming_address=NULL; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +NULL +SET @@global.wsrep_node_incoming_address='junk'; +SELECT @@global.wsrep_node_incoming_address; +@@global.wsrep_node_incoming_address +junk + +# restore the initial value +SET @@global.wsrep_node_incoming_address = @wsrep_node_incoming_address_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_node_name_basic.result b/mysql-test/suite/sys_vars/r/wsrep_node_name_basic.result index f3c03570b7b..9657e6bf428 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_node_name_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_node_name_basic.result @@ -1,6 +1,48 @@ -set @start_value = @@wsrep_node_name; -set @@global.wsrep_node_name='test'; -set @@global.wsrep_node_name=NULL; -SET @@global.wsrep_node_name = 1; +# +# wsrep_node_name +# +call mtr.add_suppression("WSREP: Failed to get provider options"); +# save the initial value +SET @wsrep_node_name_global_saved = @@global.wsrep_node_name; +# default +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name + + +# scope +SELECT @@session.wsrep_node_name; +ERROR HY000: Variable 'wsrep_node_name' is a GLOBAL variable +SET @@global.wsrep_node_name='node_name'; +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name +node_name + +# valid values +SET @@global.wsrep_node_name='my_node'; +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name +my_node +SET @@global.wsrep_node_name='hyphenated-node-name'; +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name +hyphenated-node-name +SET @@global.wsrep_node_name=default; +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name + + +# invalid values +SET @@global.wsrep_node_name=NULL; +ERROR 42000: Variable 'wsrep_node_name' can't be set to the value of 'NULL' +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name + +SET @@global.wsrep_node_name=1; ERROR 42000: Incorrect argument type to variable 'wsrep_node_name' -set @@global.wsrep_node_name = @start_value; +SELECT @@global.wsrep_node_name; +@@global.wsrep_node_name + + +# restore the initial value +SET @@global.wsrep_node_name = @wsrep_node_name_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result index d1d68ea036b..056ff8c817b 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result @@ -1,6 +1,47 @@ -set @start_value = @@wsrep_notify_cmd; -set @@global.wsrep_notify_cmd='test'; -set @@global.wsrep_notify_cmd=NULL; -SET @@global.wsrep_notify_cmd = 1; +# +# wsrep_notify_cmd +# +call mtr.add_suppression("WSREP: Failed to get provider options"); +# save the initial value +SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; +# default +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd + + +# scope +SELECT @@session.wsrep_notify_cmd; +ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable +SET @@global.wsrep_notify_cmd='notify_cmd'; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd +notify_cmd + +# valid values +SET @@global.wsrep_notify_cmd='command'; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd +command +SET @@global.wsrep_notify_cmd='hyphenated-command'; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd +hyphenated-command +SET @@global.wsrep_notify_cmd=default; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd + +SET @@global.wsrep_notify_cmd=NULL; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd +NULL + +# invalid values +SET @@global.wsrep_notify_cmd=1; ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd' -set @@global.wsrep_notify_cmd = @start_value; +SELECT @@global.wsrep_notify_cmd; +@@global.wsrep_notify_cmd +NULL + +# restore the initial value +SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_on_basic.result b/mysql-test/suite/sys_vars/r/wsrep_on_basic.result index 629c0e866cb..735e2d77180 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_on_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_on_basic.result @@ -1,8 +1,50 @@ -set @start_value = @@wsrep_on; -set @@global.wsrep_on=ON; -set @@global.wsrep_on=OFF; -set @@global.wsrep_on=1; -set @@global.wsrep_on=0; -SET @@global.wsrep_on = -1; -ERROR 42000: Variable 'wsrep_on' can't be set to the value of '-1' -set @@global.wsrep_on = @start_value; +# +# wsrep_on +# +# save the initial values +SET @wsrep_on_global_saved = @@global.wsrep_on; +SET @wsrep_on_session_saved = @@session.wsrep_on; +# default +SELECT @@global.wsrep_on; +@@global.wsrep_on +0 +SELECT @@session.wsrep_on; +@@session.wsrep_on +0 + +# scope and valid values +SET @@global.wsrep_on=OFF; +SELECT @@global.wsrep_on; +@@global.wsrep_on +0 +SET @@global.wsrep_on=ON; +SELECT @@global.wsrep_on; +@@global.wsrep_on +1 +SET @@session.wsrep_on=OFF; +SELECT @@session.wsrep_on; +@@session.wsrep_on +0 +SET @@session.wsrep_on=ON; +SELECT @@session.wsrep_on; +@@session.wsrep_on +1 +SET @@session.wsrep_on=default; +SELECT @@session.wsrep_on; +@@session.wsrep_on +1 + +# invalid values +SET @@global.wsrep_on=NULL; +ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL' +SET @@global.wsrep_on='junk'; +ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk' +SET @@session.wsrep_on=NULL; +ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL' +SET @@session.wsrep_on='junk'; +ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk' + +# restore the initial values +SET @@global.wsrep_on = @wsrep_on_global_saved; +SET @@session.wsrep_on = @wsrep_on_session_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result b/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result index 84c828e5965..95b59e62adc 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_osu_method_basic.result @@ -1,12 +1,60 @@ -set @start_value = @@wsrep_osu_method; -set @@global.wsrep_osu_method='TOI'; -set @@global.wsrep_osu_method='RSU'; -set @@global.wsrep_osu_method=TOI; -set @@global.wsrep_osu_method=RSU; -set @@global.wsrep_osu_method=TSU; -ERROR 42000: Variable 'wsrep_OSU_method' can't be set to the value of 'TSU' -set @@global.wsrep_osu_method='TSU'; -ERROR 42000: Variable 'wsrep_OSU_method' can't be set to the value of 'TSU' -SET @@global.wsrep_on = -1; -ERROR 42000: Variable 'wsrep_on' can't be set to the value of '-1' -set @@global.wsrep_osu_method = @start_value; +# +# wsrep_osu_method +# +# save the initial value +SET @wsrep_osu_method_global_saved = @@global.wsrep_osu_method; +# default +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +TOI + +# scope +SELECT @@session.wsrep_osu_method; +ERROR HY000: Variable 'wsrep_OSU_method' is a GLOBAL variable +SET @@global.wsrep_osu_method=TOI; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +TOI + +# valid values +SET @@global.wsrep_osu_method=TOI; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +TOI +SET @@global.wsrep_osu_method=RSU; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU +SET @@global.wsrep_osu_method="RSU"; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU +SET @@global.wsrep_osu_method=default; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +TOI +SET @@global.wsrep_osu_method=1; +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU + +# invalid values +SET @@global.wsrep_osu_method=4; +ERROR 42000: Variable 'wsrep_OSU_method' can't be set to the value of '4' +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU +SET @@global.wsrep_osu_method=NULL; +ERROR 42000: Variable 'wsrep_OSU_method' can't be set to the value of 'NULL' +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU +SET @@global.wsrep_osu_method='junk'; +ERROR 42000: Variable 'wsrep_OSU_method' can't be set to the value of 'junk' +SELECT @@global.wsrep_osu_method; +@@global.wsrep_osu_method +RSU + +# restore the initial value +SET @@global.wsrep_osu_method = @wsrep_osu_method_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result index 2de1e84e6c0..3e4ac8ca883 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result @@ -1,4 +1,40 @@ -SELECT COUNT(@@GLOBAL.wsrep_provider); -COUNT(@@GLOBAL.wsrep_provider) -1 -1 Expected +# +# wsrep_provider +# +# save the initial value +SET @wsrep_provider_global_saved = @@global.wsrep_provider; +# default +SELECT @@global.wsrep_provider; +@@global.wsrep_provider +none + +# scope +SELECT @@session.wsrep_provider; +ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable +SELECT @@global.wsrep_provider; +@@global.wsrep_provider +none + +# valid values +SET @@global.wsrep_provider=default; +SELECT @@global.wsrep_provider; +@@global.wsrep_provider +none + +# invalid values +SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; +ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so' +SET @@global.wsrep_provider=NULL; +ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL' +SELECT @@global.wsrep_provider; +@@global.wsrep_provider +none +SET @@global.wsrep_provider=1; +ERROR 42000: Incorrect argument type to variable 'wsrep_provider' +SELECT @@global.wsrep_provider; +@@global.wsrep_provider +none + +# restore the initial value +SET @@global.wsrep_provider = @wsrep_provider_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result index 28b55e782bc..ed6b125e064 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result @@ -1,4 +1,48 @@ -SELECT COUNT(@@GLOBAL.wsrep_provider_options); -COUNT(@@GLOBAL.wsrep_provider_options) -1 -1 Expected +# +# wsrep_provider_options +# +call mtr.add_suppression("WSREP: Failed to get provider options"); +# save the initial value +SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; +# default +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options + + +# scope +SELECT @@session.wsrep_provider_options; +ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable +SET @@global.wsrep_provider_options='option1'; +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options +option1 + +# valid values +SET @@global.wsrep_provider_options='name1=value1;name2=value2'; +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options +name1=value1;name2=value2 +SET @@global.wsrep_provider_options='hyphenated-name:value'; +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options +hyphenated-name:value +SET @@global.wsrep_provider_options=default; +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options + + +# invalid values +SET @@global.wsrep_provider_options=1; +ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options' +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options + +SET @@global.wsrep_provider_options=NULL; +ERROR HY000: Incorrect arguments to SET +SELECT @@global.wsrep_provider_options; +@@global.wsrep_provider_options +NULL + +# restore the initial value +SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_recover_basic.result b/mysql-test/suite/sys_vars/r/wsrep_recover_basic.result index b9f7e41047e..b26c1121a4c 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_recover_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_recover_basic.result @@ -1,49 +1,22 @@ -SELECT COUNT(@@GLOBAL.wsrep_recover); -COUNT(@@GLOBAL.wsrep_recover) -1 -1 Expected -set @@global.wsrep_recover=ON; -ERROR HY000: Variable 'wsrep_recover' is a read only variable -Expected error 'Readonly variable' -set @@global.wsrep_recover=OFF; -ERROR HY000: Variable 'wsrep_recover' is a read only variable -Expected error 'Readonly variable' -SELECT @@GLOBAL.wsrep_recover = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_recover'; -@@GLOBAL.wsrep_recover = VARIABLE_VALUE -1 -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'OFF' -1 Expected -SELECT COUNT(@@GLOBAL.wsrep_recover); -COUNT(@@GLOBAL.wsrep_recover) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_recover'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -SELECT @@wsrep_recover = @@GLOBAL.wsrep_recover; -@@wsrep_recover = @@GLOBAL.wsrep_recover -1 -1 Expected -SELECT COUNT(@@wsrep_recover); -COUNT(@@wsrep_recover) -1 -1 Expected -SELECT COUNT(@@local.wsrep_recover); +# +# wsrep_recover +# +# default +SELECT @@global.wsrep_recover; +@@global.wsrep_recover +0 +SELECT @@session.wsrep_recover; ERROR HY000: Variable 'wsrep_recover' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.wsrep_recover); -ERROR HY000: Variable 'wsrep_recover' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.wsrep_recover); -COUNT(@@GLOBAL.wsrep_recover) -1 -1 Expected -SELECT wsrep_recover = @@SESSION.wsrep_recover; -ERROR 42S22: Unknown column 'wsrep_recover' in 'field list' -Expected error 'Readonly variable' + +# scope and valid values +SET @@global.wsrep_recover=OFF; +ERROR HY000: Variable 'wsrep_recover' is a read only variable +SET @@global.wsrep_recover=ON; +ERROR HY000: Variable 'wsrep_recover' is a read only variable + +# invalid values +SET @@global.wsrep_recover=NULL; +ERROR HY000: Variable 'wsrep_recover' is a read only variable +SET @@global.wsrep_recover='junk'; +ERROR HY000: Variable 'wsrep_recover' is a read only variable +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result b/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result index 644258206a5..3625f29aa0f 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result @@ -1,8 +1,31 @@ -set @start_value = @@wsrep_replicate_myisam; -set @@global.wsrep_replicate_myisam=ON; -set @@global.wsrep_replicate_myisam=OFF; -set @@global.wsrep_replicate_myisam=1; -set @@global.wsrep_replicate_myisam=0; -SET @@global.wsrep_replicate_myisam = -1; -ERROR 42000: Variable 'wsrep_replicate_myisam' can't be set to the value of '-1' -set @@global.wsrep_replicate_myisam = @start_value; +# +# wsrep_replicate_myisam +# +# save the initial value +SET @wsrep_replicate_myisam_global_saved = @@global.wsrep_replicate_myisam; +# default +SELECT @@global.wsrep_replicate_myisam; +@@global.wsrep_replicate_myisam +0 +SELECT @@session.wsrep_replicate_myisam; +ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable + +# scope and valid values +SET @@global.wsrep_replicate_myisam=OFF; +SELECT @@global.wsrep_replicate_myisam; +@@global.wsrep_replicate_myisam +0 +SET @@global.wsrep_replicate_myisam=ON; +SELECT @@global.wsrep_replicate_myisam; +@@global.wsrep_replicate_myisam +1 + +# invalid values +SET @@global.wsrep_replicate_myisam=NULL; +ERROR 42000: Variable 'wsrep_replicate_myisam' can't be set to the value of 'NULL' +SET @@global.wsrep_replicate_myisam='junk'; +ERROR 42000: Variable 'wsrep_replicate_myisam' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_replicate_myisam = @wsrep_replicate_myisam_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_restart_slave_basic.result b/mysql-test/suite/sys_vars/r/wsrep_restart_slave_basic.result index 811981b6a37..0ecdf915992 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_restart_slave_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_restart_slave_basic.result @@ -1,8 +1,31 @@ -set @start_value = @@wsrep_restart_slave; -set @@global.wsrep_restart_slave=ON; -set @@global.wsrep_restart_slave=OFF; -set @@global.wsrep_restart_slave=1; -set @@global.wsrep_restart_slave=0; -SET @@global.wsrep_restart_slave = -1; -ERROR 42000: Variable 'wsrep_restart_slave' can't be set to the value of '-1' -set @@global.wsrep_restart_slave = @start_value; +# +# wsrep_restart_slave +# +# save the initial value +SET @wsrep_restart_slave_global_saved = @@global.wsrep_restart_slave; +# default +SELECT @@global.wsrep_restart_slave; +@@global.wsrep_restart_slave +0 +SELECT @@session.wsrep_restart_slave; +ERROR HY000: Variable 'wsrep_restart_slave' is a GLOBAL variable + +# scope and valid values +SET @@global.wsrep_restart_slave=OFF; +SELECT @@global.wsrep_restart_slave; +@@global.wsrep_restart_slave +0 +SET @@global.wsrep_restart_slave=ON; +SELECT @@global.wsrep_restart_slave; +@@global.wsrep_restart_slave +1 + +# invalid values +SET @@global.wsrep_restart_slave=NULL; +ERROR 42000: Variable 'wsrep_restart_slave' can't be set to the value of 'NULL' +SET @@global.wsrep_restart_slave='junk'; +ERROR 42000: Variable 'wsrep_restart_slave' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_restart_slave = @wsrep_restart_slave_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_retry_autocommit_basic.result b/mysql-test/suite/sys_vars/r/wsrep_retry_autocommit_basic.result index 811981b6a37..d848dadd24d 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_retry_autocommit_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_retry_autocommit_basic.result @@ -1,8 +1,63 @@ -set @start_value = @@wsrep_restart_slave; -set @@global.wsrep_restart_slave=ON; -set @@global.wsrep_restart_slave=OFF; -set @@global.wsrep_restart_slave=1; -set @@global.wsrep_restart_slave=0; -SET @@global.wsrep_restart_slave = -1; -ERROR 42000: Variable 'wsrep_restart_slave' can't be set to the value of '-1' -set @@global.wsrep_restart_slave = @start_value; +# +# wsrep_retry_autocommit +# +# save the initial values +SET @wsrep_retry_autocommit_global_saved = @@global.wsrep_retry_autocommit; +SET @wsrep_retry_autocommit_session_saved = @@session.wsrep_retry_autocommit; +# default +SELECT @@global.wsrep_retry_autocommit; +@@global.wsrep_retry_autocommit +1 + +# scope +SET @@session.wsrep_retry_autocommit=1; +SELECT @@session.wsrep_retry_autocommit; +@@session.wsrep_retry_autocommit +1 +SET @@global.wsrep_retry_autocommit=1; +SELECT @@global.wsrep_retry_autocommit; +@@global.wsrep_retry_autocommit +1 + +# valid values +SET @@global.wsrep_retry_autocommit=10; +SELECT @@global.wsrep_retry_autocommit; +@@global.wsrep_retry_autocommit +10 +SET @@global.wsrep_retry_autocommit=0; +SELECT @@global.wsrep_retry_autocommit; +@@global.wsrep_retry_autocommit +0 +SET @@global.wsrep_retry_autocommit=default; +SELECT @global.wsrep_retry_autocommit; +@global.wsrep_retry_autocommit +NULL +SET @@session.wsrep_retry_autocommit=10; +SELECT @@session.wsrep_retry_autocommit; +@@session.wsrep_retry_autocommit +10 +SET @@session.wsrep_retry_autocommit=0; +SELECT @@session.wsrep_retry_autocommit; +@@session.wsrep_retry_autocommit +0 +SET @@session.wsrep_retry_autocommit=default; +SELECT @session.wsrep_retry_autocommit; +@session.wsrep_retry_autocommit +NULL + +# invalid values +SET @@global.wsrep_retry_autocommit=NULL; +ERROR 42000: Incorrect argument type to variable 'wsrep_retry_autocommit' +SET @@global.wsrep_retry_autocommit='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_retry_autocommit' +SET @@global.wsrep_retry_autocommit=-1; +Warnings: +Warning 1292 Truncated incorrect wsrep_retry_autocommit value: '-1' +SELECT @global.wsrep_retry_autocommit; +@global.wsrep_retry_autocommit +NULL + +# restore the initial value +SET @@global.wsrep_retry_autocommit = @wsrep_retry_autocommit_global_saved; +SET @@session.wsrep_retry_autocommit = @wsrep_retry_autocommit_session_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result b/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result index f8105660c6e..62be5a42416 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result @@ -1,20 +1,49 @@ -set @start_value = @@wsrep_slave_threads; -set @@global.wsrep_slave_threads=1; -set @@global.wsrep_slave_threads=4; -show warnings; -Level Code Message -set @@global.wsrep_slave_threads=0; +# +# wsrep_slave_threads +# +# save the initial value +SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads; +# default +SELECT @@global.wsrep_slave_threads; +@@global.wsrep_slave_threads +1 + +# scope +SELECT @@session.wsrep_slave_threads; +ERROR HY000: Variable 'wsrep_slave_threads' is a GLOBAL variable +SET @@global.wsrep_slave_threads=1; +SELECT @@global.wsrep_slave_threads; +@@global.wsrep_slave_threads +1 + +# valid values +SET @@global.wsrep_slave_threads=10; +SELECT @@global.wsrep_slave_threads; +@@global.wsrep_slave_threads +10 +SET @@global.wsrep_slave_threads=0; Warnings: Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' -set @@global.wsrep_slave_threads=-1; -Warnings: -Warning 1292 Truncated incorrect wsrep_slave_threads value: '-1' -show warnings; -Level Code Message -Warning 1292 Truncated incorrect wsrep_slave_threads value: '-1' -SET @@global.wsrep_slave_threads = r; +SELECT @@global.wsrep_slave_threads; +@@global.wsrep_slave_threads +1 +SET @@global.wsrep_slave_threads=default; +SELECT @global.wsrep_slave_threads; +@global.wsrep_slave_threads +NULL + +# invalid values +SET @@global.wsrep_slave_threads=NULL; ERROR 42000: Incorrect argument type to variable 'wsrep_slave_threads' -set @@global.wsrep_slave_threads = @start_value; +SET @@global.wsrep_slave_threads='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_slave_threads' +SET @@global.wsrep_slave_threads=-1; +Warnings: +Warning 1292 Truncated incorrect wsrep_slave_threads value: '-1' +SELECT @global.wsrep_slave_threads; +@global.wsrep_slave_threads +NULL + +# restore the initial value +SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_auth_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_auth_basic.result index a8a31dbea61..e6b532c6bba 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_auth_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_auth_basic.result @@ -1,3 +1,52 @@ -SELECT COUNT(@@wsrep_sst_auth); -COUNT(@@wsrep_sst_auth) -0 +# +# wsrep_sst_auth +# +# save the initial value +SET @wsrep_sst_auth_global_saved = @@global.wsrep_sst_auth; +# default +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +NULL + +# scope +SELECT @@session.wsrep_sst_auth; +ERROR HY000: Variable 'wsrep_sst_auth' is a GLOBAL variable +SET @@global.wsrep_sst_auth='user:pass'; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** + +# valid values +SET @@global.wsrep_sst_auth=user; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** +SET @@global.wsrep_sst_auth='user:1234'; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** +SET @@global.wsrep_sst_auth='hyphenated-user-name:'; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** +SET @@global.wsrep_sst_auth=default; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +NULL +SET @@global.wsrep_sst_auth=NULL; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +NULL + +# invalid values +SET @@global.wsrep_sst_auth=1; +ERROR 42000: Incorrect argument type to variable 'wsrep_sst_auth' +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +NULL +SET @@global.wsrep_sst_auth=user:pass; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':pass' at line 1 + +# restore the initial value +SET @@global.wsrep_sst_auth = @wsrep_sst_auth_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_donor_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_donor_basic.result index fc359690275..3d4fc24df7f 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_donor_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_donor_basic.result @@ -1,10 +1,50 @@ -SELECT COUNT(@@wsrep_sst_donor); -COUNT(@@wsrep_sst_donor) -1 -set @start_value = @@wsrep_sst_donor; -set @@global.wsrep_sst_donor='foo'; -set @@global.wsrep_sst_donor=NULL; -set @@global.wsrep_sst_donor=r; -set @@global.wsrep_sst_donor=1; +# +# wsrep_sst_donor +# +# save the initial value +SET @wsrep_sst_donor_global_saved = @@global.wsrep_sst_donor; +# default +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor + + +# scope +SELECT @@session.wsrep_sst_donor; +ERROR HY000: Variable 'wsrep_sst_donor' is a GLOBAL variable +SET @@global.wsrep_sst_donor=rsync; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +rsync + +# valid values +SET @@global.wsrep_sst_donor=node1; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +node1 +SET @@global.wsrep_sst_donor='node1,node2'; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +node1,node2 +SET @@global.wsrep_sst_donor='hyphenated-donor-name'; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +hyphenated-donor-name +SET @@global.wsrep_sst_donor=default; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor + +SET @@global.wsrep_sst_donor=NULL; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +NULL + +# invalid values +SET @@global.wsrep_sst_donor=1; ERROR 42000: Incorrect argument type to variable 'wsrep_sst_donor' -set @@global.wsrep_sst_donor = @start_value; +SELECT @@global.wsrep_sst_donor; +@@global.wsrep_sst_donor +NULL + +# restore the initial value +SET @@global.wsrep_sst_donor = @wsrep_sst_donor_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_donor_rejects_queries_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_donor_rejects_queries_basic.result index 55aa56f27ed..c9f95beec0a 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_donor_rejects_queries_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_donor_rejects_queries_basic.result @@ -1,8 +1,45 @@ -set @start_value = @@wsrep_sst_donor_rejects_queries; -set @@global.wsrep_sst_donor_rejects_queries=ON; -set @@global.wsrep_sst_donor_rejects_queries=OFF; -set @@global.wsrep_sst_donor_rejects_queries=1; -set @@global.wsrep_sst_donor_rejects_queries=0; -SET @@global.wsrep_sst_donor_rejects_queries = -1; -ERROR 42000: Variable 'wsrep_sst_donor_rejects_queries' can't be set to the value of '-1' -set @@global.wsrep_sst_donor_rejects_queries = @start_value; +# +# wsrep_sst_donor_rejects_queries +# +# save the initial value +SET @wsrep_sst_donor_rejects_queries_global_saved = @@global.wsrep_sst_donor_rejects_queries; +# default +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +0 + +# scope +SELECT @@session.wsrep_sst_donor_rejects_queries; +ERROR HY000: Variable 'wsrep_sst_donor_rejects_queries' is a GLOBAL variable +SET @@global.wsrep_sst_donor_rejects_queries=OFF; +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +0 +SET @@global.wsrep_sst_donor_rejects_queries=ON; +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +1 + +# valid values +SET @@global.wsrep_sst_donor_rejects_queries='OFF'; +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +0 +SET @@global.wsrep_sst_donor_rejects_queries=ON; +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +1 +SET @@global.wsrep_sst_donor_rejects_queries=default; +SELECT @@global.wsrep_sst_donor_rejects_queries; +@@global.wsrep_sst_donor_rejects_queries +0 + +# invalid values +SET @@global.wsrep_sst_donor_rejects_queries=NULL; +ERROR 42000: Variable 'wsrep_sst_donor_rejects_queries' can't be set to the value of 'NULL' +SET @@global.wsrep_sst_donor_rejects_queries='junk'; +ERROR 42000: Variable 'wsrep_sst_donor_rejects_queries' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_sst_donor_rejects_queries = @wsrep_sst_donor_rejects_queries_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result index 682a5683026..cbdac640c36 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result @@ -1,12 +1,54 @@ -set @start_value = @@wsrep_sst_method; -set @@global.wsrep_sst_method='xtrabackup'; -set @@global.wsrep_sst_method='xtrabackup-v2'; -set @@global.wsrep_sst_method='rsync'; -set @@global.wsrep_sst_method='mysqldump'; -set @@global.wsrep_sst_method='myscript'; -set @@global.wsrep_sst_method='skip'; -set @@global.wsrep_sst_method=NULL; +# +# wsrep_sst_method +# +# save the initial value +SET @wsrep_sst_method_global_saved = @@global.wsrep_sst_method; +# default +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +rsync + +# scope +SELECT @@session.wsrep_sst_method; +ERROR HY000: Variable 'wsrep_sst_method' is a GLOBAL variable +SET @@global.wsrep_sst_method=rsync; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +rsync + +# valid values +SET @@global.wsrep_sst_method=rsync; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +rsync +SET @@global.wsrep_sst_method=mysqldump; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +mysqldump +SET @@global.wsrep_sst_method=xtrabackup; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +xtrabackup +SET @@global.wsrep_sst_method="xtrabackup-v2"; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +xtrabackup-v2 +SET @@global.wsrep_sst_method=default; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +rsync +SET @@global.wsrep_sst_method='junk'; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +junk + +# invalid values +SET @@global.wsrep_sst_method=NULL; ERROR 42000: Variable 'wsrep_sst_method' can't be set to the value of 'NULL' -SET @@global.wsrep_sst_method = -1; -ERROR 42000: Incorrect argument type to variable 'wsrep_sst_method' -set @@global.wsrep_sst_method = @start_value; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +junk + +# restore the initial value +SET @@global.wsrep_sst_method = @wsrep_sst_method_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_receive_address_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_receive_address_basic.result index a23b7efafa8..6db52eb8150 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_receive_address_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_receive_address_basic.result @@ -1,8 +1,64 @@ -set @start_value = @@wsrep_sst_receive_address; -set @@global.wsrep_sst_receive_address='128.0.2.1'; -set @@global.wsrep_sst_receive_address=AUTO; -set @@global.wsrep_sst_receive_address='AUTO'; -set @@global.wsrep_sst_receive_address=NULL; -SET @@global.wsrep_sst_receive_address = -1; -ERROR 42000: Incorrect argument type to variable 'wsrep_sst_receive_address' -set @@global.wsrep_sst_receive_address = @start_value; +# +# wsrep_sst_receive_address +# +# save the initial value +SET @wsrep_sst_receive_address_global_saved = @@global.wsrep_sst_receive_address; +# default +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +AUTO + +# scope +SELECT @@session.wsrep_sst_receive_address; +ERROR HY000: Variable 'wsrep_sst_receive_address' is a GLOBAL variable +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +AUTO + +# valid values +SET @@global.wsrep_sst_receive_address=AUTO; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +AUTO +SET @@global.wsrep_sst_receive_address=default; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +AUTO +SET @@global.wsrep_sst_receive_address='192.168.2.254'; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +192.168.2.254 + +# invalid values +SET @@global.wsrep_sst_receive_address='127.0.0.1:4444'; +ERROR 42000: Variable 'wsrep_sst_receive_address' can't be set to the value of '127.0.0.1:4444' +SET @@global.wsrep_sst_receive_address='127.0.0.1'; +ERROR 42000: Variable 'wsrep_sst_receive_address' can't be set to the value of '127.0.0.1' +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +192.168.2.254 +SET @@global.wsrep_sst_receive_address=NULL; +ERROR 42000: Variable 'wsrep_sst_receive_address' can't be set to the value of 'NULL' +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +192.168.2.254 +SET @@global.wsrep_sst_receive_address='OFF'; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +OFF +SET @@global.wsrep_sst_receive_address=ON; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +ON +SET @@global.wsrep_sst_receive_address=''; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address + +SET @@global.wsrep_sst_receive_address='junk'; +SELECT @@global.wsrep_sst_receive_address; +@@global.wsrep_sst_receive_address +junk + +# restore the initial value +SET @@global.wsrep_sst_receive_address = @wsrep_sst_receive_address_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_start_position_basic.result b/mysql-test/suite/sys_vars/r/wsrep_start_position_basic.result index ad3606d6d55..a49e6135d47 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_start_position_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_start_position_basic.result @@ -1,8 +1,57 @@ -set @start_value = @@wsrep_start_position; -set @@global.wsrep_start_position='foo:bar'; -ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'foo:bar' -set @@global.wsrep_start_position=NULL; +# +# wsrep_start_position +# +# save the initial value +SET @wsrep_start_position_global_saved = @@global.wsrep_start_position; +# default +SELECT @@global.wsrep_start_position; +@@global.wsrep_start_position +00000000-0000-0000-0000-000000000000:-1 + +# scope +SELECT @@session.wsrep_start_position; +ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable +SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1'; +SELECT @@global.wsrep_start_position; +@@global.wsrep_start_position +00000000-0000-0000-0000-000000000000:-1 + +# valid values +SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2'; +SELECT @@global.wsrep_start_position; +@@global.wsrep_start_position +00000000-0000-0000-0000-000000000000:-2 +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100'; +SELECT @@global.wsrep_start_position; +@@global.wsrep_start_position +12345678-1234-1234-1234-123456789012:100 +SET @@global.wsrep_start_position=default; +SELECT @@global.wsrep_start_position; +@@global.wsrep_start_position +00000000-0000-0000-0000-000000000000:-1 + +# invalid values +SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1' +SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100' +SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0' +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999' +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a' +SET @@global.wsrep_start_position='OFF'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF' +SET @@global.wsrep_start_position=ON; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON' +SET @@global.wsrep_start_position=''; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '' +SET @@global.wsrep_start_position=NULL; ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL' -SET @@global.wsrep_start_position = -1; -ERROR 42000: Incorrect argument type to variable 'wsrep_start_position' -set @@global.wsrep_start_position = @start_value; +SET @@global.wsrep_start_position='junk'; +ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_start_position = @wsrep_start_position_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test b/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test index 91d3c578a2c..5dc23cf2ad6 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_auto_increment_control; +--echo # +--echo # wsrep_auto_increment_control +--echo # -set @@global.wsrep_auto_increment_control=ON; -set @@global.wsrep_auto_increment_control=OFF; -set @@global.wsrep_auto_increment_control=1; -set @@global.wsrep_auto_increment_control=0; ---Error 1231 -SET @@global.wsrep_auto_increment_control = -1; +--echo # save the initial value +SET @wsrep_auto_increment_control_global_saved = @@global.wsrep_auto_increment_control; -set @@global.wsrep_auto_increment_control = @start_value; +--echo # default +SELECT @@global.wsrep_auto_increment_control; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_auto_increment_control; +SET @@global.wsrep_auto_increment_control=OFF; +SELECT @@global.wsrep_auto_increment_control; +SET @@global.wsrep_auto_increment_control=ON; +SELECT @@global.wsrep_auto_increment_control; + +--echo +--echo # valid values +SET @@global.wsrep_auto_increment_control='OFF'; +SELECT @@global.wsrep_auto_increment_control; +SET @@global.wsrep_auto_increment_control=ON; +SELECT @@global.wsrep_auto_increment_control; +SET @@global.wsrep_auto_increment_control=default; +SELECT @@global.wsrep_auto_increment_control; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_auto_increment_control=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_auto_increment_control='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_auto_increment_control = @wsrep_auto_increment_control_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test b/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test index 2fb597e842e..6539e5cba85 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test @@ -1,13 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_causal_reads; +--echo # +--echo # wsrep_causal_reads +--echo # -set @@global.wsrep_causal_reads=ON; -set @@global.wsrep_causal_reads=OFF; -set @@global.wsrep_causal_reads=1; -set @@global.wsrep_causal_reads=0; ---Error 1231 -SET @@global.wsrep_causal_reads = -1; +--echo # save the initial values +SET @wsrep_causal_reads_global_saved = @@global.wsrep_causal_reads; +SET @wsrep_causal_reads_session_saved = @@session.wsrep_causal_reads; -set @@global.wsrep_causal_reads = @start_value; +--echo # default +SELECT @@global.wsrep_causal_reads; +SELECT @@session.wsrep_causal_reads; + +--echo +--echo # scope and valid values +SET @@global.wsrep_causal_reads=OFF; +SELECT @@global.wsrep_causal_reads; +SET @@global.wsrep_causal_reads=ON; +SELECT @@global.wsrep_causal_reads; + +SET @@session.wsrep_causal_reads=OFF; +SELECT @@session.wsrep_causal_reads; +SET @@session.wsrep_causal_reads=ON; +SELECT @@session.wsrep_causal_reads; +SET @@session.wsrep_causal_reads=default; +SELECT @@session.wsrep_causal_reads; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_causal_reads=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_causal_reads='junk'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@session.wsrep_causal_reads=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@session.wsrep_causal_reads='junk'; + +--echo +--echo # restore the initial values +SET @@global.wsrep_causal_reads = @wsrep_causal_reads_global_saved; +SET @@session.wsrep_causal_reads = @wsrep_causal_reads_session_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk b/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk deleted file mode 100644 index f4512aeb5da..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk +++ /dev/null @@ -1,13 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc - -set @start_value = @@wsrep_certify_nonpk; - -set @@global.wsrep_certify_nonpk=ON; -set @@global.wsrep_certify_nonpk=OFF; -set @@global.wsrep_certify_nonpk=1; -set @@global.wsrep_certify_nonpk=0; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_certify_nonpk = -1; - -set @@global.wsrep_certify_nonpk = @start_value; diff --git a/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test b/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test index b623d8eb073..a2c690e5954 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_certify_nonpk; +--echo # +--echo # wsrep_certify_nonpk +--echo # -set @@global.wsrep_certify_nonpk=ON; -set @@global.wsrep_certify_nonpk=OFF; -set @@global.wsrep_certify_nonpk=1; -set @@global.wsrep_certify_nonpk=0; ---Error 1231 -SET @@global.wsrep_certify_nonpk = -1; +--echo # save the initial value +SET @wsrep_certify_nonpk_global_saved = @@global.wsrep_certify_nonpk; -set @@global.wsrep_certify_nonpk = @start_value; +--echo # default +SELECT @@global.wsrep_certify_nonpk; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_certify_nonpk; +SET @@global.wsrep_certify_nonpk=OFF; +SELECT @@global.wsrep_certify_nonpk; +SET @@global.wsrep_certify_nonpk=ON; +SELECT @@global.wsrep_certify_nonpk; + +--echo +--echo # valid values +SET @@global.wsrep_certify_nonpk='OFF'; +SELECT @@global.wsrep_certify_nonpk; +SET @@global.wsrep_certify_nonpk=ON; +SELECT @@global.wsrep_certify_nonpk; +SET @@global.wsrep_certify_nonpk=default; +SELECT @@global.wsrep_certify_nonpk; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_certify_nonpk=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_certify_nonpk='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_certify_nonpk = @wsrep_certify_nonpk_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test index b61d5ea60c3..b9e00901eb6 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test @@ -1,44 +1,48 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); ---echo 1 Expected +--echo # +--echo # wsrep_cluster_address +--echo # -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); ---echo 1 Expected +call mtr.add_suppression("safe_mutex: Found wrong usage of mutex.*"); -SELECT @@GLOBAL.wsrep_cluster_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_cluster_address'; ---echo 1 Expected +--echo # save the initial value +SET @wsrep_cluster_address_global_saved = @@global.wsrep_cluster_address; -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); ---echo 1 Expected +--echo # default +SELECT @@global.wsrep_cluster_address; -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_cluster_address'; ---echo 1 Expected +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_cluster_address; +SELECT @@global.wsrep_cluster_address; -SELECT @@wsrep_cluster_address = @@GLOBAL.wsrep_cluster_address; ---echo 1 Expected +--echo +--echo # valid values +SET @@global.wsrep_cluster_address='127.0.0.1'; +SELECT @@global.wsrep_cluster_address; +SET @@global.wsrep_cluster_address=AUTO; +SELECT @@global.wsrep_cluster_address; +SET @@global.wsrep_cluster_address=default; +SELECT @@global.wsrep_cluster_address; -SELECT COUNT(@@wsrep_cluster_address); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.wsrep_cluster_address); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.wsrep_cluster_address); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.wsrep_cluster_address); ---echo 1 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT wsrep_cluster_address = @@SESSION.wsrep_cluster_address; ---echo Expected error 'Readonly variable' +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_node_address=NULL; +SELECT @@global.wsrep_node_address; +# The values being assigned to wsrep_node_address are not verified so the +# following alues are currently valid too. +SET @@global.wsrep_cluster_address=ON; +SELECT @@global.wsrep_cluster_address; +SET @@global.wsrep_cluster_address='OFF'; +SELECT @@global.wsrep_cluster_address; +SET @@global.wsrep_cluster_address='junk'; +SELECT @@global.wsrep_cluster_address; +--echo +--echo # restore the initial value +SET @@global.wsrep_cluster_address = @wsrep_cluster_address_global_saved; +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test index 104c342bfe4..a6fc3ef7b1e 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test @@ -1,12 +1,40 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_cluster_name; +--echo # +--echo # wsrep_cluster_name +--echo # -set @@global.wsrep_cluster_name='test'; ---Error 1231 -set @@global.wsrep_cluster_name=NULL; ---Error 1232 -SET @@global.wsrep_cluster_name = 1; +--echo # save the initial value +SET @wsrep_cluster_name_global_saved = @@global.wsrep_cluster_name; -set @@global.wsrep_cluster_name = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_cluster_name; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_cluster_name; +SET @@global.wsrep_cluster_name='my_galera_cluster'; +SELECT @@global.wsrep_cluster_name; + +--echo +--echo # valid values +SET @@global.wsrep_cluster_name='my_quoted_galera_cluster'; +SELECT @@global.wsrep_cluster_name; +SET @@global.wsrep_cluster_name=my_unquoted_cluster; +SELECT @@global.wsrep_cluster_name; +SET @@global.wsrep_cluster_name=OFF; +SELECT @@global.wsrep_cluster_name; +SET @@global.wsrep_cluster_name=default; +SELECT @@global.wsrep_cluster_name; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_cluster_name=NULL; + +--echo +--echo # restore the initial value +SET @@global.wsrep_cluster_name = @wsrep_cluster_name_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test b/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test index 84b92085238..486832fb394 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_convert_lock_to_trx; +--echo # +--echo # wsrep_convert_lock_to_trx +--echo # -set @@global.wsrep_convert_lock_to_trx=ON; -set @@global.wsrep_convert_lock_to_trx=OFF; -set @@global.wsrep_convert_lock_to_trx=1; -set @@global.wsrep_convert_lock_to_trx=0; ---Error 1231 -SET @@global.wsrep_convert_lock_to_trx = -1; +--echo # save the initial value +SET @wsrep_convert_lock_to_trx_global_saved = @@global.wsrep_convert_lock_to_trx; -set @@global.wsrep_convert_lock_to_trx = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_convert_lock_to_trx; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_convert_lock_to_trx; +SET @@global.wsrep_convert_lock_to_trx=OFF; +SELECT @@global.wsrep_convert_lock_to_trx; +SET @@global.wsrep_convert_lock_to_trx=ON; +SELECT @@global.wsrep_convert_lock_to_trx; + +--echo +--echo # valid values +SET @@global.wsrep_convert_lock_to_trx='OFF'; +SELECT @@global.wsrep_convert_lock_to_trx; +SET @@global.wsrep_convert_lock_to_trx=ON; +SELECT @@global.wsrep_convert_lock_to_trx; +SET @@global.wsrep_convert_lock_to_trx=default; +SELECT @@global.wsrep_convert_lock_to_trx; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_convert_lock_to_trx=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_convert_lock_to_trx='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_convert_lock_to_trx = @wsrep_convert_lock_to_trx_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test b/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test index fccf685193e..41f97cfdaf6 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test @@ -1,48 +1,41 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); ---echo 1 Expected +--echo # +--echo # wsrep_data_home_dir (readonly) +--echo # +--echo # default +SELECT @@global.wsrep_data_home_dir; + +--echo +--echo # scope --error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.wsrep_data_home_dir=1; ---echo Expected error 'Read only variable' +SELECT @@session.wsrep_data_home_dir; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir='/tmp/data'; +SELECT @@global.wsrep_data_home_dir; -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); ---echo 1 Expected - -SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_data_home_dir'; ---echo 1 Expected - -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); ---echo 1 Expected - -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_data_home_dir'; ---echo 1 Expected - -SELECT @@wsrep_data_home_dir = @@GLOBAL.wsrep_data_home_dir; ---echo 1 Expected - -SELECT COUNT(@@wsrep_data_home_dir); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.wsrep_data_home_dir); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.wsrep_data_home_dir); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.wsrep_data_home_dir); ---echo 1 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT wsrep_data_home_dir = @@SESSION.wsrep_data_home_dir; ---echo Expected error 'Readonly variable' +--echo +--echo # valid values +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir='/tmp/data'; +SELECT @@global.wsrep_data_home_dir; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir=junk-dir; +SELECT @@global.wsrep_data_home_dir; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir=junk/dir; +SELECT @@global.wsrep_data_home_dir; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir=OFF; +SELECT @@global.wsrep_data_home_dir; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir=default; +SELECT @@global.wsrep_data_home_dir; +--echo +--echo # invalid values +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_data_home_dir=NULL; +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test b/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test index 0a559fe8d27..80ce190a154 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test @@ -1,11 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_dbug_option; +--echo # +--echo # wsrep_dbug_option +--echo # -set @@global.wsrep_dbug_option='foo:bar'; -set @@global.wsrep_dbug_option=NULL; ---Error 1232 -SET @@global.wsrep_dbug_option = -1; +--echo # save the initial value +SET @wsrep_dbug_option_global_saved = @@global.wsrep_dbug_option; -set @@global.wsrep_dbug_option = @start_value; +--echo # default +SELECT @@global.wsrep_dbug_option; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_dbug_option; +SET @@global.wsrep_dbug_option='test-dbug-string'; +SELECT @@global.wsrep_dbug_option; + +--echo +--echo # valid values +SET @@global.wsrep_dbug_option='quoted-dbug-string'; +SELECT @@global.wsrep_dbug_option; +SET @@global.wsrep_dbug_option=unquoted_dbug_string; +SELECT @@global.wsrep_dbug_option; +SET @@global.wsrep_dbug_option=OFF; +SELECT @@global.wsrep_dbug_option; +SET @@global.wsrep_dbug_option=NULL; +SELECT @@global.wsrep_dbug_option; +SET @@global.wsrep_dbug_option=default; +SELECT @@global.wsrep_dbug_option; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_dbug_option=1; + +--echo +--echo # restore the initial value +SET @@global.wsrep_dbug_option = @wsrep_dbug_option_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test index 194c163baa6..50576ff064e 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_debug; +--echo # +--echo # wsrep_debug +--echo # -set @@global.wsrep_debug=ON; -set @@global.wsrep_debug=OFF; -set @@global.wsrep_debug=1; -set @@global.wsrep_debug=0; ---Error 1231 -SET @@global.wsrep_debug = -1; +--echo # save the initial value +SET @wsrep_debug_global_saved = @@global.wsrep_debug; -set @@global.wsrep_debug = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_debug; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_debug; +SET @@global.wsrep_debug=OFF; +SELECT @@global.wsrep_debug; +SET @@global.wsrep_debug=ON; +SELECT @@global.wsrep_debug; + +--echo +--echo # valid values +SET @@global.wsrep_debug='OFF'; +SELECT @@global.wsrep_debug; +SET @@global.wsrep_debug=ON; +SELECT @@global.wsrep_debug; +SET @@global.wsrep_debug=default; +SELECT @@global.wsrep_debug; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_debug=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_debug='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_debug = @wsrep_debug_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_debug_option_basic.test b/mysql-test/suite/sys_vars/t/wsrep_debug_option_basic.test deleted file mode 100644 index 060e721b676..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_debug_option_basic.test +++ /dev/null @@ -1,13 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc - -set @start_value = @@wsrep_debug_option; - ---error 1231 -set @@global.wsrep_debug_option='foo:bar'; ---error 1231 -set @@global.wsrep_debug_option=NULL; ---Error 1232 -SET @@global.wsrep_debug_option = -1; - -set @@global.wsrep_debug_option = @start_value; diff --git a/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test index 3c64d8cb30f..15226c75d8b 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test @@ -1,4 +1,49 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -select @@global.wsrep_desync; +--echo # +--echo # wsrep_desync +--echo # + +# expected as no wsrep provider is currently loaded +call mtr.add_suppression("WSREP: SET desync failed 9 for SET @@global.wsrep_desync=ON"); + +--echo # save the initial value +SET @wsrep_desync_global_saved = @@global.wsrep_desync; + +--echo # default +SELECT @@global.wsrep_desync; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_desync; +SET @@global.wsrep_desync=OFF; +SELECT @@global.wsrep_desync; +# expected as no wsrep provider is currently loaded +--error ER_CANNOT_USER +SET @@global.wsrep_desync=ON; +SELECT @@global.wsrep_desync; + +--echo +--echo # valid values +SET @@global.wsrep_desync='OFF'; +SELECT @@global.wsrep_desync; +# expected as no wsrep provider is currently loaded +--error ER_CANNOT_USER +SET @@global.wsrep_desync=ON; +SELECT @@global.wsrep_desync; +SET @@global.wsrep_desync=default; +SELECT @@global.wsrep_desync; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_desync=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_desync='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_desync = @wsrep_desync_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test b/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test index ada08bb125d..e24f6a15265 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_drupal_282555_workaround; +--echo # +--echo # wsrep_drupal_282555_workaround +--echo # -set @@global.wsrep_drupal_282555_workaround=ON; -set @@global.wsrep_drupal_282555_workaround=OFF; -set @@global.wsrep_drupal_282555_workaround=1; -set @@global.wsrep_drupal_282555_workaround=0; ---Error 1231 -SET @@global.wsrep_drupal_282555_workaround = -1; +--echo # save the initial value +SET @wsrep_drupal_282555_workaround_global_saved = @@global.wsrep_drupal_282555_workaround; -set @@global.wsrep_drupal_282555_workaround = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_drupal_282555_workaround; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_drupal_282555_workaround; +SET @@global.wsrep_drupal_282555_workaround=OFF; +SELECT @@global.wsrep_drupal_282555_workaround; +SET @@global.wsrep_drupal_282555_workaround=ON; +SELECT @@global.wsrep_drupal_282555_workaround; + +--echo +--echo # valid values +SET @@global.wsrep_drupal_282555_workaround='OFF'; +SELECT @@global.wsrep_drupal_282555_workaround; +SET @@global.wsrep_drupal_282555_workaround=ON; +SELECT @@global.wsrep_drupal_282555_workaround; +SET @@global.wsrep_drupal_282555_workaround=default; +SELECT @@global.wsrep_drupal_282555_workaround; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_drupal_282555_workaround=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_drupal_282555_workaround='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_drupal_282555_workaround = @wsrep_drupal_282555_workaround_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test b/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test index 5e5530a8f64..455034bb623 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test @@ -1,14 +1,46 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_forced_binlog_format; +--echo # +--echo # wsrep_forced_binlog_format +--echo # -set @@global.wsrep_forced_binlog_format = ROW; -set @@global.wsrep_forced_binlog_format = MIXED; -set @@global.wsrep_forced_binlog_format = STATEMENT; -set @@global.wsrep_forced_binlog_format = NONE; +--echo # save the initial value +SET @wsrep_forced_binlog_format_global_saved = @@global.wsrep_forced_binlog_format; ---error 1231 -set @@global.wsrep_forced_binlog_format = FOO; +--echo # default +SELECT @@global.wsrep_forced_binlog_format; -set @@global.wsrep_forced_binlog_format = @start_value; \ No newline at end of file +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_forced_binlog_format; +SET @@global.wsrep_forced_binlog_format=STATEMENT; +SELECT @@global.wsrep_forced_binlog_format; + +--echo +--echo # valid values +SET @@global.wsrep_forced_binlog_format=STATEMENT; +SELECT @@global.wsrep_forced_binlog_format; +SET @@global.wsrep_forced_binlog_format=ROW; +SELECT @@global.wsrep_forced_binlog_format; +SET @@global.wsrep_forced_binlog_format=MIXED; +SELECT @@global.wsrep_forced_binlog_format; +SET @@global.wsrep_forced_binlog_format=NONE; +SELECT @@global.wsrep_forced_binlog_format; +SET @@global.wsrep_forced_binlog_format=default; +SELECT @@global.wsrep_forced_binlog_format; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_forced_binlog_format=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_forced_binlog_format='junk'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_forced_binlog_format=ON; + +--echo +--echo # restore the initial value +SET @@global.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test b/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test index 61ff27d6894..d52e388fc60 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_load_data_splitting; +--echo # +--echo # wsrep_load_data_splitting +--echo # -set @@global.wsrep_load_data_splitting=ON; -set @@global.wsrep_load_data_splitting=OFF; -set @@global.wsrep_load_data_splitting=1; -set @@global.wsrep_load_data_splitting=0; ---Error 1231 -SET @@global.wsrep_load_data_splitting = -1; +--echo # save the initial value +SET @wsrep_load_data_splitting_global_saved = @@global.wsrep_load_data_splitting; -set @@global.wsrep_load_data_splitting = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_load_data_splitting; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_load_data_splitting; +SET @@global.wsrep_load_data_splitting=OFF; +SELECT @@global.wsrep_load_data_splitting; +SET @@global.wsrep_load_data_splitting=ON; +SELECT @@global.wsrep_load_data_splitting; + +--echo +--echo # valid values +SET @@global.wsrep_load_data_splitting='OFF'; +SELECT @@global.wsrep_load_data_splitting; +SET @@global.wsrep_load_data_splitting=ON; +SELECT @@global.wsrep_load_data_splitting; +SET @@global.wsrep_load_data_splitting=default; +SELECT @@global.wsrep_load_data_splitting; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_load_data_splitting=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_load_data_splitting='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_load_data_splitting = @wsrep_load_data_splitting_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test b/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test index dbd696c45a2..eee4d966855 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_log_conflicts; +--echo # +--echo # wsrep_log_conflicts +--echo # -set @@global.wsrep_log_conflicts=ON; -set @@global.wsrep_log_conflicts=OFF; -set @@global.wsrep_log_conflicts=1; -set @@global.wsrep_log_conflicts=0; ---Error 1231 -SET @@global.wsrep_log_conflicts = -1; +--echo # save the initial value +SET @wsrep_log_conflicts_global_saved = @@global.wsrep_log_conflicts; -set @@global.wsrep_log_conflicts = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_log_conflicts; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_log_conflicts; +SET @@global.wsrep_log_conflicts=OFF; +SELECT @@global.wsrep_log_conflicts; +SET @@global.wsrep_log_conflicts=ON; +SELECT @@global.wsrep_log_conflicts; + +--echo +--echo # valid values +SET @@global.wsrep_log_conflicts='OFF'; +SELECT @@global.wsrep_log_conflicts; +SET @@global.wsrep_log_conflicts=ON; +SELECT @@global.wsrep_log_conflicts; +SET @@global.wsrep_log_conflicts=default; +SELECT @@global.wsrep_log_conflicts; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_log_conflicts=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_log_conflicts='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_log_conflicts = @wsrep_log_conflicts_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test b/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test index f607a567d80..ed78662c02d 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test @@ -1,14 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_max_ws_rows; +--echo # +--echo # wsrep_max_ws_rows +--echo # -set @@global.wsrep_max_ws_rows=256000; -set @@global.wsrep_max_ws_rows=0; -show warnings; -set @@global.wsrep_max_ws_rows=-1; -show warnings; ---Error 1232 -SET @@global.wsrep_max_ws_rows = r; +--echo # save the initial value +SET @wsrep_max_ws_rows_global_saved = @@global.wsrep_max_ws_rows; -set @@global.wsrep_max_ws_rows = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_max_ws_rows; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_max_ws_rows; +SET @@global.wsrep_max_ws_rows=1; +SELECT @@global.wsrep_max_ws_rows; + +--echo +--echo # valid values +SET @@global.wsrep_max_ws_rows=131072; +SELECT @@global.wsrep_max_ws_rows; +SET @@global.wsrep_max_ws_rows=131073; +SELECT @@global.wsrep_max_ws_rows; +SET @@global.wsrep_max_ws_rows=0; +SELECT @@global.wsrep_max_ws_rows; +SET @@global.wsrep_max_ws_rows=default; +SELECT @global.wsrep_max_ws_rows; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_max_ws_rows=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_max_ws_rows='junk'; +# expect warnings (Truncated incorrect wsrep_max_ws_rows value: '-1') +SET @@global.wsrep_max_ws_rows=-1; +SELECT @global.wsrep_max_ws_rows; + +--echo +--echo # restore the initial value +SET @@global.wsrep_max_ws_rows = @wsrep_max_ws_rows_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test index 6b1d1f71090..e7af4558f24 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test @@ -1,14 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_max_ws_size; +--echo # +--echo # wsrep_max_ws_size +--echo # -set @@global.wsrep_max_ws_size=256000; -set @@global.wsrep_max_ws_size=0; -show warnings; -set @@global.wsrep_max_ws_size=-1; -show warnings; ---Error 1232 -SET @@global.wsrep_max_ws_size = r; +--echo # save the initial value +SET @wsrep_max_ws_size_global_saved = @@global.wsrep_max_ws_size; -set @@global.wsrep_max_ws_size = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_max_ws_size; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_max_ws_size; +SET @@global.wsrep_max_ws_size=1; +SELECT @@global.wsrep_max_ws_size; + +--echo +--echo # valid values +SET @@global.wsrep_max_ws_size=1073741824; +SELECT @@global.wsrep_max_ws_size; +SET @@global.wsrep_max_ws_size=1073741825; +SELECT @@global.wsrep_max_ws_size; +SET @@global.wsrep_max_ws_size=0; +SELECT @@global.wsrep_max_ws_size; +SET @@global.wsrep_max_ws_size=default; +SELECT @global.wsrep_max_ws_size; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_max_ws_size=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_max_ws_size='junk'; +SELECT @global.wsrep_max_ws_size; +SET @@global.wsrep_max_ws_size=-1; +SELECT @global.wsrep_max_ws_size; + +--echo +--echo # restore the initial value +SET @@global.wsrep_max_ws_size = @wsrep_max_ws_size_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test b/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test index 20a0dc9bf9f..c293048c43f 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test @@ -1,16 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_mysql_replication_bundle; +--echo # +--echo # wsrep_mysql_replication_bundle +--echo # -set @@global.wsrep_mysql_replication_bundle=0; -set @@global.wsrep_mysql_replication_bundle=1000; +--echo # save the initial value +SET @wsrep_mysql_replication_bundle_global_saved = @@global.wsrep_mysql_replication_bundle; -set @@global.wsrep_mysql_replication_bundle=-1; -show warnings; -set @@global.wsrep_mysql_replication_bundle=1001; -show warnings; ---Error 1232 -SET @@global.wsrep_mysql_replication_bundle = r; +--echo # default +SELECT @@global.wsrep_mysql_replication_bundle; -set @@global.wsrep_mysql_replication_bundle = @start_value; \ No newline at end of file +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_mysql_replication_bundle; +SELECT @@global.wsrep_mysql_replication_bundle; + +--echo +--echo # valid values +SET @@global.wsrep_mysql_replication_bundle=0; +SELECT @@global.wsrep_mysql_replication_bundle; +SET @@global.wsrep_mysql_replication_bundle=1000; +SELECT @@global.wsrep_mysql_replication_bundle; +SET @@global.wsrep_mysql_replication_bundle=default; +SELECT @@global.wsrep_mysql_replication_bundle; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_mysql_replication_bundle=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_mysql_replication_bundle='junk'; +# expect warning (truncated incorrect value) +SET @@global.wsrep_mysql_replication_bundle=-1; +SELECT @@global.wsrep_mysql_replication_bundle; +# expect warning (truncated incorrect value) +SET @@global.wsrep_mysql_replication_bundle=1001; +SELECT @@global.wsrep_mysql_replication_bundle; + +--echo +--echo # restore the initial value +SET @@global.wsrep_mysql_replication_bundle = @wsrep_mysql_replication_bundle_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test index feace325044..fccb40de6bf 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test @@ -1,42 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_node_address); ---echo 1 Expected +--echo # +--echo # wsrep_node_address +--echo # ---error 1232 -SET @@GLOBAL.wsrep_node_address=1; ---echo Expected error 'Read only variable' +--echo # save the initial value +SET @wsrep_node_address_global_saved = @@global.wsrep_node_address; -SELECT COUNT(@@GLOBAL.wsrep_node_address); ---echo 1 Expected +--echo # default +SELECT @@global.wsrep_node_address; -SELECT @@GLOBAL.wsrep_node_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_address'; ---echo 1 Expected +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_node_address; +SELECT @@global.wsrep_node_address; -SELECT COUNT(@@GLOBAL.wsrep_node_address); ---echo 1 Expected +--echo +--echo # valid values +SET @@global.wsrep_node_address='127.0.0.1'; +SELECT @@global.wsrep_node_address; +# default == '' +SET @@global.wsrep_node_address=default; +SELECT @@global.wsrep_node_address; -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_address'; ---echo 1 Expected +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_node_address=NULL; +SELECT @@global.wsrep_node_address; +# The values being assigned to wsrep_node_address are not verified so the +# following alues are currently valid too. +SET @@global.wsrep_node_address=ON; +SELECT @@global.wsrep_node_address; +SET @@global.wsrep_node_address='OFF'; +SELECT @@global.wsrep_node_address; +SET @@global.wsrep_node_address='junk'; +SELECT @@global.wsrep_node_address; -SELECT @@wsrep_node_address = @@GLOBAL.wsrep_node_address; ---echo 1 Expected +--echo +--echo # restore the initial value +SET @@global.wsrep_node_address = @wsrep_node_address_global_saved; -SELECT COUNT(@@wsrep_node_address); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.wsrep_node_address); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.wsrep_node_address); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.wsrep_node_address); ---echo 1 Expected +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test index 188a5960eb9..9ab9525d2a9 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test @@ -1,42 +1,47 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); ---echo 1 Expected +--echo # +--echo # wsrep_node_incoming_address +--echo # ---error 1232 -SET @@GLOBAL.wsrep_node_incoming_address=1; ---echo Expected error 'Read only variable' +--echo # save the initial value +SET @wsrep_node_incoming_address_global_saved = @@global.wsrep_node_incoming_address; -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); ---echo 1 Expected +--echo # default +SELECT @@global.wsrep_node_incoming_address; -SELECT @@GLOBAL.wsrep_node_incoming_address = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_incoming_address'; ---echo 1 Expected +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_node_incoming_address; +SELECT @@global.wsrep_node_incoming_address; -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); ---echo 1 Expected +--echo +--echo # valid values +SET @@global.wsrep_node_incoming_address='127.0.0.1:4444'; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address='127.0.0.1'; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address=AUTO; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address=default; +SELECT @@global.wsrep_node_incoming_address; -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_node_incoming_address'; ---echo 1 Expected +--echo +--echo # invalid values +# The values being assigned to wsrep_node_incoming_address are not verified so +# the following values are currently valid too. +SET @@global.wsrep_node_incoming_address=ON; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address='OFF'; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address=NULL; +SELECT @@global.wsrep_node_incoming_address; +SET @@global.wsrep_node_incoming_address='junk'; +SELECT @@global.wsrep_node_incoming_address; -SELECT @@wsrep_node_incoming_address = @@GLOBAL.wsrep_node_incoming_address; ---echo 1 Expected +--echo +--echo # restore the initial value +SET @@global.wsrep_node_incoming_address = @wsrep_node_incoming_address_global_saved; -SELECT COUNT(@@wsrep_node_incoming_address); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.wsrep_node_incoming_address); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.wsrep_node_incoming_address); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.wsrep_node_incoming_address); ---echo 1 Expected +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test index 3220ae373e2..1f3ccc0de2c 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test @@ -1,11 +1,44 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_node_name; +--echo # +--echo # wsrep_node_name +--echo # -set @@global.wsrep_node_name='test'; -set @@global.wsrep_node_name=NULL; ---Error 1232 -SET @@global.wsrep_node_name = 1; +call mtr.add_suppression("WSREP: Failed to get provider options"); -set @@global.wsrep_node_name = @start_value; \ No newline at end of file +--echo # save the initial value +SET @wsrep_node_name_global_saved = @@global.wsrep_node_name; + +--echo # default +SELECT @@global.wsrep_node_name; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_node_name; +SET @@global.wsrep_node_name='node_name'; +SELECT @@global.wsrep_node_name; + +--echo +--echo # valid values +SET @@global.wsrep_node_name='my_node'; +SELECT @@global.wsrep_node_name; +SET @@global.wsrep_node_name='hyphenated-node-name'; +SELECT @@global.wsrep_node_name; +SET @@global.wsrep_node_name=default; +SELECT @@global.wsrep_node_name; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_node_name=NULL; +SELECT @@global.wsrep_node_name; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_node_name=1; +SELECT @@global.wsrep_node_name; + +--echo +--echo # restore the initial value +SET @@global.wsrep_node_name = @wsrep_node_name_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test index d816453f8a3..6d1535ba148 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test @@ -1,11 +1,43 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_notify_cmd; +--echo # +--echo # wsrep_notify_cmd +--echo # -set @@global.wsrep_notify_cmd='test'; -set @@global.wsrep_notify_cmd=NULL; ---Error 1232 -SET @@global.wsrep_notify_cmd = 1; +call mtr.add_suppression("WSREP: Failed to get provider options"); -set @@global.wsrep_notify_cmd = @start_value; \ No newline at end of file +--echo # save the initial value +SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; + +--echo # default +SELECT @@global.wsrep_notify_cmd; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_notify_cmd; +SET @@global.wsrep_notify_cmd='notify_cmd'; +SELECT @@global.wsrep_notify_cmd; + +--echo +--echo # valid values +SET @@global.wsrep_notify_cmd='command'; +SELECT @@global.wsrep_notify_cmd; +SET @@global.wsrep_notify_cmd='hyphenated-command'; +SELECT @@global.wsrep_notify_cmd; +SET @@global.wsrep_notify_cmd=default; +SELECT @@global.wsrep_notify_cmd; +SET @@global.wsrep_notify_cmd=NULL; +SELECT @@global.wsrep_notify_cmd; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_notify_cmd=1; +SELECT @@global.wsrep_notify_cmd; + +--echo +--echo # restore the initial value +SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_basic.test b/mysql-test/suite/sys_vars/t/wsrep_on_basic.test index 5afe5c4451f..229d771b5e7 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_on_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_on_basic.test @@ -1,13 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_on; +--echo # +--echo # wsrep_on +--echo # -set @@global.wsrep_on=ON; -set @@global.wsrep_on=OFF; -set @@global.wsrep_on=1; -set @@global.wsrep_on=0; ---Error 1231 -SET @@global.wsrep_on = -1; +--echo # save the initial values +SET @wsrep_on_global_saved = @@global.wsrep_on; +SET @wsrep_on_session_saved = @@session.wsrep_on; -set @@global.wsrep_on = @start_value; +--echo # default +SELECT @@global.wsrep_on; +SELECT @@session.wsrep_on; + +--echo +--echo # scope and valid values +SET @@global.wsrep_on=OFF; +SELECT @@global.wsrep_on; +SET @@global.wsrep_on=ON; +SELECT @@global.wsrep_on; + +SET @@session.wsrep_on=OFF; +SELECT @@session.wsrep_on; +SET @@session.wsrep_on=ON; +SELECT @@session.wsrep_on; +SET @@session.wsrep_on=default; +SELECT @@session.wsrep_on; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_on=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_on='junk'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@session.wsrep_on=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@session.wsrep_on='junk'; + +--echo +--echo # restore the initial values +SET @@global.wsrep_on = @wsrep_on_global_saved; +SET @@session.wsrep_on = @wsrep_on_session_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test index 9e1adde76a3..d6d461075a5 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test @@ -1,18 +1,50 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_osu_method; +--echo # +--echo # wsrep_osu_method +--echo # -set @@global.wsrep_osu_method='TOI'; -set @@global.wsrep_osu_method='RSU'; -set @@global.wsrep_osu_method=TOI; -set @@global.wsrep_osu_method=RSU; +--echo # save the initial value +SET @wsrep_osu_method_global_saved = @@global.wsrep_osu_method; ---Error 1231 -set @@global.wsrep_osu_method=TSU; ---Error 1231 -set @@global.wsrep_osu_method='TSU'; ---Error 1231 -SET @@global.wsrep_on = -1; +--echo # default +SELECT @@global.wsrep_osu_method; -set @@global.wsrep_osu_method = @start_value; +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_osu_method; +SET @@global.wsrep_osu_method=TOI; +SELECT @@global.wsrep_osu_method; + +--echo +--echo # valid values +SET @@global.wsrep_osu_method=TOI; +SELECT @@global.wsrep_osu_method; +SET @@global.wsrep_osu_method=RSU; +SELECT @@global.wsrep_osu_method; +SET @@global.wsrep_osu_method="RSU"; +SELECT @@global.wsrep_osu_method; +SET @@global.wsrep_osu_method=default; +SELECT @@global.wsrep_osu_method; +# numeric value +SET @@global.wsrep_osu_method=1; +SELECT @@global.wsrep_osu_method; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_osu_method=4; +SELECT @@global.wsrep_osu_method; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_osu_method=NULL; +SELECT @@global.wsrep_osu_method; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_osu_method='junk'; +SELECT @@global.wsrep_osu_method; + +--echo +--echo # restore the initial value +SET @@global.wsrep_osu_method = @wsrep_osu_method_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test index aae122c42fe..1190ab41bb0 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test @@ -1,5 +1,39 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_provider); ---echo 1 Expected +--echo # +--echo # wsrep_provider +--echo # + +--echo # save the initial value +SET @wsrep_provider_global_saved = @@global.wsrep_provider; + +--echo # default +SELECT @@global.wsrep_provider; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_provider; +SELECT @@global.wsrep_provider; + +--echo +--echo # valid values +SET @@global.wsrep_provider=default; +SELECT @@global.wsrep_provider; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_provider=NULL; +SELECT @@global.wsrep_provider; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_provider=1; +SELECT @@global.wsrep_provider; + +--echo +--echo # restore the initial value +SET @@global.wsrep_provider = @wsrep_provider_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test index e2d8b63b2fd..10ca8298029 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test @@ -1,5 +1,44 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_provider_options); ---echo 1 Expected +--echo # +--echo # wsrep_provider_options +--echo # + +call mtr.add_suppression("WSREP: Failed to get provider options"); + +--echo # save the initial value +SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; + +--echo # default +SELECT @@global.wsrep_provider_options; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_provider_options; +SET @@global.wsrep_provider_options='option1'; +SELECT @@global.wsrep_provider_options; + +--echo +--echo # valid values +SET @@global.wsrep_provider_options='name1=value1;name2=value2'; +SELECT @@global.wsrep_provider_options; +SET @@global.wsrep_provider_options='hyphenated-name:value'; +SELECT @@global.wsrep_provider_options; +SET @@global.wsrep_provider_options=default; +SELECT @@global.wsrep_provider_options; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_provider_options=1; +SELECT @@global.wsrep_provider_options; +--error ER_WRONG_ARGUMENTS +SET @@global.wsrep_provider_options=NULL; +SELECT @@global.wsrep_provider_options; + +--echo +--echo # restore the initial value +SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test b/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test index f4e1707a434..f935e12e258 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test @@ -1,47 +1,26 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@GLOBAL.wsrep_recover); ---echo 1 Expected +--echo # +--echo # wsrep_recover +--echo # ---Error 1238 -set @@global.wsrep_recover=ON; ---echo Expected error 'Readonly variable' ---Error 1238 -set @@global.wsrep_recover=OFF; ---echo Expected error 'Readonly variable' +--echo # default +SELECT @@global.wsrep_recover; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_recover; -SELECT @@GLOBAL.wsrep_recover = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_recover'; ---echo 1 Expected +--echo +--echo # scope and valid values +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_recover=OFF; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_recover=ON; -SELECT COUNT(@@GLOBAL.wsrep_recover); ---echo 1 Expected - -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='wsrep_recover'; ---echo 1 Expected - -SELECT @@wsrep_recover = @@GLOBAL.wsrep_recover; ---echo 1 Expected - -SELECT COUNT(@@wsrep_recover); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.wsrep_recover); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.wsrep_recover); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.wsrep_recover); ---echo 1 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT wsrep_recover = @@SESSION.wsrep_recover; ---echo Expected error 'Readonly variable' +--echo +--echo # invalid values +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_recover=NULL; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_recover='junk'; +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test b/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test index c03d76b5123..812fb0cfd73 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test @@ -1,13 +1,36 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_replicate_myisam; +--echo # +--echo # wsrep_replicate_myisam +--echo # -set @@global.wsrep_replicate_myisam=ON; -set @@global.wsrep_replicate_myisam=OFF; -set @@global.wsrep_replicate_myisam=1; -set @@global.wsrep_replicate_myisam=0; ---Error 1231 -SET @@global.wsrep_replicate_myisam = -1; +--echo # save the initial value +SET @wsrep_replicate_myisam_global_saved = @@global.wsrep_replicate_myisam; -set @@global.wsrep_replicate_myisam = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_replicate_myisam; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_replicate_myisam; + +--echo +--echo # scope and valid values +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +#TODO: check if it is expected for variable to be dynamic? +SET @@global.wsrep_replicate_myisam=OFF; +SELECT @@global.wsrep_replicate_myisam; +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_replicate_myisam=ON; +SELECT @@global.wsrep_replicate_myisam; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_replicate_myisam=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_replicate_myisam='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_replicate_myisam = @wsrep_replicate_myisam_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test b/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test index 82f5a97327d..c656111aed6 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test @@ -1,13 +1,36 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_restart_slave; +--echo # +--echo # wsrep_restart_slave +--echo # -set @@global.wsrep_restart_slave=ON; -set @@global.wsrep_restart_slave=OFF; -set @@global.wsrep_restart_slave=1; -set @@global.wsrep_restart_slave=0; ---Error 1231 -SET @@global.wsrep_restart_slave = -1; +--echo # save the initial value +SET @wsrep_restart_slave_global_saved = @@global.wsrep_restart_slave; -set @@global.wsrep_restart_slave = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_restart_slave; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_restart_slave; + +--echo +--echo # scope and valid values +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +#TODO: check if it is expected for variable to be dynamic? +SET @@global.wsrep_restart_slave=OFF; +SELECT @@global.wsrep_restart_slave; +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.wsrep_restart_slave=ON; +SELECT @@global.wsrep_restart_slave; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_restart_slave=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_restart_slave='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_restart_slave = @wsrep_restart_slave_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test b/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test index 82f5a97327d..aa6f27f816d 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test @@ -1,13 +1,52 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_restart_slave; +--echo # +--echo # wsrep_retry_autocommit +--echo # -set @@global.wsrep_restart_slave=ON; -set @@global.wsrep_restart_slave=OFF; -set @@global.wsrep_restart_slave=1; -set @@global.wsrep_restart_slave=0; ---Error 1231 -SET @@global.wsrep_restart_slave = -1; +--echo # save the initial values +SET @wsrep_retry_autocommit_global_saved = @@global.wsrep_retry_autocommit; +SET @wsrep_retry_autocommit_session_saved = @@session.wsrep_retry_autocommit; -set @@global.wsrep_restart_slave = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_retry_autocommit; + +--echo +--echo # scope +SET @@session.wsrep_retry_autocommit=1; +SELECT @@session.wsrep_retry_autocommit; +SET @@global.wsrep_retry_autocommit=1; +SELECT @@global.wsrep_retry_autocommit; + +--echo +--echo # valid values +SET @@global.wsrep_retry_autocommit=10; +SELECT @@global.wsrep_retry_autocommit; +SET @@global.wsrep_retry_autocommit=0; +SELECT @@global.wsrep_retry_autocommit; +SET @@global.wsrep_retry_autocommit=default; +SELECT @global.wsrep_retry_autocommit; + +SET @@session.wsrep_retry_autocommit=10; +SELECT @@session.wsrep_retry_autocommit; +SET @@session.wsrep_retry_autocommit=0; +SELECT @@session.wsrep_retry_autocommit; +SET @@session.wsrep_retry_autocommit=default; +SELECT @session.wsrep_retry_autocommit; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_retry_autocommit=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_retry_autocommit='junk'; +# expect warning : Truncated incorrect wsrep_retry_autocommit value: '-1' +SET @@global.wsrep_retry_autocommit=-1; +SELECT @global.wsrep_retry_autocommit; + +--echo +--echo # restore the initial value +SET @@global.wsrep_retry_autocommit = @wsrep_retry_autocommit_global_saved; +SET @@session.wsrep_retry_autocommit = @wsrep_retry_autocommit_session_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test b/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test index cff4f433846..80b4648982d 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test @@ -1,16 +1,43 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_slave_threads; +--echo # +--echo # wsrep_slave_threads +--echo # -set @@global.wsrep_slave_threads=1; -set @@global.wsrep_slave_threads=4; -show warnings; -set @@global.wsrep_slave_threads=0; -show warnings; -set @@global.wsrep_slave_threads=-1; -show warnings; ---Error 1232 -SET @@global.wsrep_slave_threads = r; +--echo # save the initial value +SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads; -set @@global.wsrep_slave_threads = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_slave_threads; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_slave_threads; +SET @@global.wsrep_slave_threads=1; +SELECT @@global.wsrep_slave_threads; + +--echo +--echo # valid values +SET @@global.wsrep_slave_threads=10; +SELECT @@global.wsrep_slave_threads; +SET @@global.wsrep_slave_threads=0; +SELECT @@global.wsrep_slave_threads; +SET @@global.wsrep_slave_threads=default; +SELECT @global.wsrep_slave_threads; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_slave_threads=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_slave_threads='junk'; +# expect warning : Truncated incorrect wsrep_slave_threads value: '-1' +SET @@global.wsrep_slave_threads=-1; +SELECT @global.wsrep_slave_threads; + +--echo +--echo # restore the initial value +SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test index 6db2a4cd844..aa901ef9ff7 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test @@ -1,12 +1,45 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@wsrep_sst_auth); +--echo # +--echo # wsrep_sst_auth +--echo # -# Cause crash, fix later -#set @start_value = @@wsrep_sst_auth; -#set @@global.wsrep_sst_auth='root:pass'; -#set @@global.wsrep_sst_auth=NULL; -#set @@global.wsrep_sst_auth=r; -#set @@global.wsrep_sst_auth=1; -#set @@global.wsrep_sst_auth = @start_value; +--echo # save the initial value +SET @wsrep_sst_auth_global_saved = @@global.wsrep_sst_auth; + +--echo # default +SELECT @@global.wsrep_sst_auth; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_sst_auth; +SET @@global.wsrep_sst_auth='user:pass'; +SELECT @@global.wsrep_sst_auth; + +--echo +--echo # valid values +SET @@global.wsrep_sst_auth=user; +SELECT @@global.wsrep_sst_auth; +SET @@global.wsrep_sst_auth='user:1234'; +SELECT @@global.wsrep_sst_auth; +SET @@global.wsrep_sst_auth='hyphenated-user-name:'; +SELECT @@global.wsrep_sst_auth; +SET @@global.wsrep_sst_auth=default; +SELECT @@global.wsrep_sst_auth; +SET @@global.wsrep_sst_auth=NULL; +SELECT @@global.wsrep_sst_auth; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_sst_auth=1; +SELECT @@global.wsrep_sst_auth; +--error ER_PARSE_ERROR +SET @@global.wsrep_sst_auth=user:pass; + +--echo +--echo # restore the initial value +SET @@global.wsrep_sst_auth = @wsrep_sst_auth_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test index 58d005282a0..7d3d6598557 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test @@ -1,12 +1,43 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -SELECT COUNT(@@wsrep_sst_donor); +--echo # +--echo # wsrep_sst_donor +--echo # -set @start_value = @@wsrep_sst_donor; -set @@global.wsrep_sst_donor='foo'; -set @@global.wsrep_sst_donor=NULL; -set @@global.wsrep_sst_donor=r; ---error 1232 -set @@global.wsrep_sst_donor=1; -set @@global.wsrep_sst_donor = @start_value; +--echo # save the initial value +SET @wsrep_sst_donor_global_saved = @@global.wsrep_sst_donor; + +--echo # default +SELECT @@global.wsrep_sst_donor; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_sst_donor; +SET @@global.wsrep_sst_donor=rsync; +SELECT @@global.wsrep_sst_donor; + +--echo +--echo # valid values +SET @@global.wsrep_sst_donor=node1; +SELECT @@global.wsrep_sst_donor; +SET @@global.wsrep_sst_donor='node1,node2'; +SELECT @@global.wsrep_sst_donor; +SET @@global.wsrep_sst_donor='hyphenated-donor-name'; +SELECT @@global.wsrep_sst_donor; +SET @@global.wsrep_sst_donor=default; +SELECT @@global.wsrep_sst_donor; +SET @@global.wsrep_sst_donor=NULL; +SELECT @@global.wsrep_sst_donor; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_sst_donor=1; +SELECT @@global.wsrep_sst_donor; + +--echo +--echo # restore the initial value +SET @@global.wsrep_sst_donor = @wsrep_sst_donor_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test index fc8633ce00f..bd34e23cd2a 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test @@ -1,13 +1,42 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_sst_donor_rejects_queries; +--echo # +--echo # wsrep_sst_donor_rejects_queries +--echo # -set @@global.wsrep_sst_donor_rejects_queries=ON; -set @@global.wsrep_sst_donor_rejects_queries=OFF; -set @@global.wsrep_sst_donor_rejects_queries=1; -set @@global.wsrep_sst_donor_rejects_queries=0; ---Error 1231 -SET @@global.wsrep_sst_donor_rejects_queries = -1; +--echo # save the initial value +SET @wsrep_sst_donor_rejects_queries_global_saved = @@global.wsrep_sst_donor_rejects_queries; -set @@global.wsrep_sst_donor_rejects_queries = @start_value; +--echo # default +SELECT @@global.wsrep_sst_donor_rejects_queries; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_sst_donor_rejects_queries; +SET @@global.wsrep_sst_donor_rejects_queries=OFF; +SELECT @@global.wsrep_sst_donor_rejects_queries; +SET @@global.wsrep_sst_donor_rejects_queries=ON; +SELECT @@global.wsrep_sst_donor_rejects_queries; + +--echo +--echo # valid values +SET @@global.wsrep_sst_donor_rejects_queries='OFF'; +SELECT @@global.wsrep_sst_donor_rejects_queries; +SET @@global.wsrep_sst_donor_rejects_queries=ON; +SELECT @@global.wsrep_sst_donor_rejects_queries; +SET @@global.wsrep_sst_donor_rejects_queries=default; +SELECT @@global.wsrep_sst_donor_rejects_queries; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_donor_rejects_queries=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_donor_rejects_queries='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_sst_donor_rejects_queries = @wsrep_sst_donor_rejects_queries_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test index dab5831ff01..3f40a3922dd 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test @@ -1,17 +1,47 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_sst_method; +--echo # +--echo # wsrep_sst_method +--echo # -set @@global.wsrep_sst_method='xtrabackup'; -set @@global.wsrep_sst_method='xtrabackup-v2'; -set @@global.wsrep_sst_method='rsync'; -set @@global.wsrep_sst_method='mysqldump'; -set @@global.wsrep_sst_method='myscript'; -set @@global.wsrep_sst_method='skip'; ---error 1231 -set @@global.wsrep_sst_method=NULL; ---Error 1232 -SET @@global.wsrep_sst_method = -1; +--echo # save the initial value +SET @wsrep_sst_method_global_saved = @@global.wsrep_sst_method; -set @@global.wsrep_sst_method = @start_value; \ No newline at end of file +--echo # default +SELECT @@global.wsrep_sst_method; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_sst_method; +SET @@global.wsrep_sst_method=rsync; +SELECT @@global.wsrep_sst_method; + +--echo +--echo # valid values +SET @@global.wsrep_sst_method=rsync; +SELECT @@global.wsrep_sst_method; +SET @@global.wsrep_sst_method=mysqldump; +SELECT @@global.wsrep_sst_method; +SET @@global.wsrep_sst_method=xtrabackup; +SELECT @@global.wsrep_sst_method; +SET @@global.wsrep_sst_method="xtrabackup-v2"; +SELECT @@global.wsrep_sst_method; +SET @@global.wsrep_sst_method=default; +SELECT @@global.wsrep_sst_method; + +# Its a valid name for an SST method +SET @@global.wsrep_sst_method='junk'; +SELECT @@global.wsrep_sst_method; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_method=NULL; +SELECT @@global.wsrep_sst_method; + +--echo +--echo # restore the initial value +SET @@global.wsrep_sst_method = @wsrep_sst_method_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test index 0a18098d77f..9e50cbf8947 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test @@ -1,13 +1,53 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_sst_receive_address; +--echo # +--echo # wsrep_sst_receive_address +--echo # -set @@global.wsrep_sst_receive_address='128.0.2.1'; -set @@global.wsrep_sst_receive_address=AUTO; -set @@global.wsrep_sst_receive_address='AUTO'; -set @@global.wsrep_sst_receive_address=NULL; ---Error 1232 -SET @@global.wsrep_sst_receive_address = -1; +--echo # save the initial value +SET @wsrep_sst_receive_address_global_saved = @@global.wsrep_sst_receive_address; -set @@global.wsrep_sst_receive_address = @start_value; +--echo # default +SELECT @@global.wsrep_sst_receive_address; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_sst_receive_address; +SELECT @@global.wsrep_sst_receive_address; + +--echo +--echo # valid values +SET @@global.wsrep_sst_receive_address=AUTO; +SELECT @@global.wsrep_sst_receive_address; +SET @@global.wsrep_sst_receive_address=default; +SELECT @@global.wsrep_sst_receive_address; +SET @@global.wsrep_sst_receive_address='192.168.2.254'; +SELECT @@global.wsrep_sst_receive_address; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_receive_address='127.0.0.1:4444'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_receive_address='127.0.0.1'; +SELECT @@global.wsrep_sst_receive_address; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_sst_receive_address=NULL; +SELECT @@global.wsrep_sst_receive_address; +# Currently there is no strict checking performed for wsrep_sst_receive_address +# so following values jusr pass through. +SET @@global.wsrep_sst_receive_address='OFF'; +SELECT @@global.wsrep_sst_receive_address; +SET @@global.wsrep_sst_receive_address=ON; +SELECT @@global.wsrep_sst_receive_address; +SET @@global.wsrep_sst_receive_address=''; +SELECT @@global.wsrep_sst_receive_address; +SET @@global.wsrep_sst_receive_address='junk'; +SELECT @@global.wsrep_sst_receive_address; + +--echo +--echo # restore the initial value +SET @@global.wsrep_sst_receive_address = @wsrep_sst_receive_address_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_start_position_basic.test b/mysql-test/suite/sys_vars/t/wsrep_start_position_basic.test index 3e30d10c016..3e57cfa6da2 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_start_position_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_start_position_basic.test @@ -1,14 +1,56 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_wsrep.inc -set @start_value = @@wsrep_start_position; +--echo # +--echo # wsrep_start_position +--echo # ---error 1231 -set @@global.wsrep_start_position='foo:bar'; ---error 1231 -set @@global.wsrep_start_position=NULL; ---Error 1232 -SET @@global.wsrep_start_position = -1; +--echo # save the initial value +SET @wsrep_start_position_global_saved = @@global.wsrep_start_position; -set @@global.wsrep_start_position = @start_value; +--echo # default +SELECT @@global.wsrep_start_position; +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_start_position; +SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1'; +SELECT @@global.wsrep_start_position; + +--echo +--echo # valid values +SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2'; +SELECT @@global.wsrep_start_position; +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100'; +SELECT @@global.wsrep_start_position; +SET @@global.wsrep_start_position=default; +SELECT @@global.wsrep_start_position; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='OFF'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position=ON; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position=''; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_start_position='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_start_position = @wsrep_start_position_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_wsrep_provider_basic.test deleted file mode 100644 index f4faaccc6a7..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_wsrep_provider_basic.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc - -set @start_value = @@wsrep_provider; - -set @@global.wsrep_provider=none; - ---Error 1231 -SET @@global.wsrep_provider = -1; - -set @@global.wsrep_provider = @start_value; From bf30585eaf29139ee471a348fc394162ca3333bd Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 9 Sep 2014 13:26:23 +0400 Subject: [PATCH 8/8] MDEV-465: Optimizer : wrong index choice: Add a testcase. --- mysql-test/r/order_by.result | 36 +++++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 294142737d9..28a276d16c1 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -2949,3 +2949,39 @@ explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 li id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer drop table t1,t2; +# +# MDEV-465: Optimizer : wrong index choice, leading to strong performances issues +# +CREATE TABLE t1 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_234_date (id2,id3,id4,date), +KEY id_23_date (id2,id3,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t1 has "bad" index declaration order.. +CREATE TABLE t2 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_23_date (id2,id3,date), +KEY id_234_date (id2,id3,id4,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t2 has a "good" index declaration order +INSERT INTO t1 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +# The following two must both use id_23_date and no "using filesort": +EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range id_234_date,id_23_date id_23_date 2 NULL 3 Using where +# See above query +EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref id_23_date,id_234_date id_23_date 2 const,const 3 Using where +drop table t1,t2; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index cf6a4d473c3..bdd6f3b825f 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -1958,3 +1958,42 @@ select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C; --echo # Should show rows=2, not rows=100 explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2; drop table t1,t2; + +--echo # +--echo # MDEV-465: Optimizer : wrong index choice, leading to strong performances issues +--echo # +CREATE TABLE t1 ( + id1 int(10) unsigned NOT NULL auto_increment, + id2 tinyint(3) unsigned NOT NULL default '0', + id3 tinyint(3) unsigned NOT NULL default '0', + id4 int(10) unsigned NOT NULL default '0', + date timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (id1), + KEY id_234_date (id2,id3,id4,date), + KEY id_23_date (id2,id3,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +--echo # t1 has "bad" index declaration order.. + +CREATE TABLE t2 ( + id1 int(10) unsigned NOT NULL auto_increment, + id2 tinyint(3) unsigned NOT NULL default '0', + id3 tinyint(3) unsigned NOT NULL default '0', + id4 int(10) unsigned NOT NULL default '0', + date timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (id1), + KEY id_23_date (id2,id3,date), + KEY id_234_date (id2,id3,id4,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +--echo # t2 has a "good" index declaration order + +INSERT INTO t1 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); + +--echo # The following two must both use id_23_date and no "using filesort": +EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +--echo # See above query +EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; + +drop table t1,t2; +