From 80c97f8c0c496a4ef9372172704b7d0d9115325f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 17 Dec 2019 22:36:26 +0100 Subject: MDEV-21343 Threadpool/Unix- wait_begin() function does not wake/create threads, when it should Fixed the condition for waking up/creating another thread. If there is some work to do (if the request queue is not empty), a thread should be woken or created. The condition was incorrect since 18c9b34 --- sql/threadpool_unix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index b505ec3dff5..3a90f24f6e9 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -1173,7 +1173,7 @@ void wait_begin(thread_group_t *thread_group) DBUG_ASSERT(thread_group->connection_count > 0); if ((thread_group->active_thread_count == 0) && - (thread_group->queue.is_empty() || !thread_group->listener)) + (!thread_group->queue.is_empty() || !thread_group->listener)) { /* Group might stall while this thread waits, thus wake -- cgit v1.2.1 From 9f7fcb9f25238945e4fb8cc1a1f98e56457b714f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 23 Dec 2019 21:39:10 +0100 Subject: mtr: include restart_opts in --verbose-restart --- mysql-test/mysql-test-run.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 77c307727a6..07cd4fa5392 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5294,12 +5294,12 @@ sub server_need_restart { exists $server->{'restart_opts'}) { my $use_dynamic_option_switch= 0; - delete $server->{'restart_opts'}; + my $restart_opts = delete $server->{'restart_opts'} || []; if (!$use_dynamic_option_switch) { mtr_verbose_restart($server, "running with different options '" . join(" ", @{$extra_opts}) . "' != '" . - join(" ", @{$started_opts}) . "'" ); + join(" ", @{$started_opts}, @{$restart_opts}) . "'" ); return 1; } -- cgit v1.2.1 From 359d91aaeec25825b51b0a00f52f272edad7d6cc Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Thu, 26 Dec 2019 17:14:51 +0530 Subject: MDEV-19680:: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' or alike failed upon SELECT with mix of functions from simple view Set read_set bitmap for view from the JOIN::all_fields list instead of JOIN::fields_list as split_sum_func would have added items to the all_fields list. --- mysql-test/r/func_misc.result | 13 +++++++++++++ mysql-test/t/func_misc.test | 15 +++++++++++++++ sql/sql_lex.cc | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 287a70f1f73..89f6102ef83 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -1479,3 +1479,16 @@ EXECUTE stmt; x x DEALLOCATE PREPARE stmt; +# +# MDEV-19680: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || +# (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' +# or alike failed upon SELECT with mix of functions from simple view +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT ISNULL( BENCHMARK(1, MIN(a))) FROM v1; +ISNULL( BENCHMARK(1, MIN(a))) +0 +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index a8da9068ab8..6412980a5fa 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -1154,3 +1154,18 @@ DROP PROCEDURE p1; PREPARE stmt FROM "SELECT 'x' ORDER BY NAME_CONST( 'f', 'foo' )"; EXECUTE stmt; DEALLOCATE PREPARE stmt; + +--echo # +--echo # MDEV-19680: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || +--echo # (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' +--echo # or alike failed upon SELECT with mix of functions from simple view +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT ISNULL( BENCHMARK(1, MIN(a))) FROM v1; + +DROP VIEW v1; +DROP TABLE t1; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index a36a19357eb..1cd2a369d7a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4177,7 +4177,7 @@ void SELECT_LEX::update_used_tables() } Item *item; - List_iterator_fast it(join->fields_list); + List_iterator_fast it(join->all_fields); while ((item= it++)) { item->update_used_tables(); -- cgit v1.2.1 From 4a012ce2f457e26a799115e8324967a945d4cba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Dec 2019 18:12:55 +0200 Subject: Post-fix for MDEV-12253: Remove redundant log writes The 8 bytes at FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION will be overwritten at page flush, in buf_page_encrypt_before_write(), ever since commit 765a43605a42c069ede604826ede2d93d72c4fdd (MariaDB 10.1.23, 10.2.6, 10.3.1). btr_store_big_rec_extern_fields(): Remove useless writes to the page header (and to the redo log) for ROW_FORMAT=COMPRESSED BLOB pages. --- storage/innobase/btr/btr0cur.cc | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 06094eb65b3..f8498fa1748 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -7109,33 +7109,6 @@ btr_store_big_rec_extern_fields( /* Initialize the unused "prev page" pointer */ mlog_write_ulint(page + FIL_PAGE_PREV, FIL_NULL, MLOG_4BYTES, &mtr); - /* Write a back pointer to the record - into the otherwise unused area. This - information could be useful in - debugging. Later, we might want to - implement the possibility to relocate - BLOB pages. Then, we would need to be - able to adjust the BLOB pointer in the - record. We do not store the heap - number of the record, because it can - change in page_zip_reorganize() or - btr_page_reorganize(). However, also - the page number of the record may - change when B-tree nodes are split or - merged. - NOTE: FIL_PAGE_FILE_FLUSH_LSN space is - used by R-tree index for a Split Sequence - Number */ - ut_ad(!dict_index_is_spatial(index)); - - mlog_write_ulint(page - + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, - space_id, - MLOG_4BYTES, &mtr); - mlog_write_ulint(page - + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, - rec_page_no, - MLOG_4BYTES, &mtr); /* Zero out the unused part of the page. */ memset(page + page_zip_get_size(page_zip) -- cgit v1.2.1 From faf2a6e5f03b9c7bd52d838b2a9b4860c3b65bee Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 31 Dec 2019 11:00:15 +0530 Subject: MDEV-20922: Adding an order by changes the query results For Item_direct_view_ref , get value from val_* methods instead of result* family The val_* methods gets value from the item on which it is referred. --- mysql-test/r/group_by.result | 16 ++++++++++++++++ mysql-test/t/group_by.test | 14 ++++++++++++++ sql/item.cc | 40 ++++++++++++++++++++++++++++++++++++++++ sql/item.h | 8 ++++++++ 4 files changed, 78 insertions(+) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index eb730a8c954..9e50ba12db3 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2792,3 +2792,19 @@ SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ); 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ) 0 drop table t1; +# +# MDEV-20922: Adding an order by changes the query results +# +CREATE TABLE t1(a int, b int); +INSERT INTO t1 values (1, 100), (2, 200), (3, 100), (4, 200); +create view v1 as select a, b+1 as x from t1; +SELECT x, COUNT(DISTINCT a) AS y FROM v1 GROUP BY x ORDER BY y; +x y +101 2 +201 2 +SELECT b+1 AS x, COUNT(DISTINCT a) AS y FROM t1 GROUP BY x ORDER BY y; +x y +101 2 +201 2 +drop view v1; +drop table t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 0401ad9780c..71e29d55303 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1915,3 +1915,17 @@ INSERT INTO t1 VALUES (0,'foo'),(1,'bar'); SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ); drop table t1; +--echo # +--echo # MDEV-20922: Adding an order by changes the query results +--echo # + +CREATE TABLE t1(a int, b int); +INSERT INTO t1 values (1, 100), (2, 200), (3, 100), (4, 200); + +create view v1 as select a, b+1 as x from t1; + +SELECT x, COUNT(DISTINCT a) AS y FROM v1 GROUP BY x ORDER BY y; +SELECT b+1 AS x, COUNT(DISTINCT a) AS y FROM t1 GROUP BY x ORDER BY y; + +drop view v1; +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index 17eb570ad80..a05fafae3b2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8149,6 +8149,46 @@ Item *Item_direct_view_ref::replace_equal_field(THD *thd, uchar *arg) } +double Item_direct_view_ref::val_result() +{ + double tmp=(*ref)->val_result(); + null_value=(*ref)->null_value; + return tmp; +} + + +longlong Item_direct_view_ref::val_int_result() +{ + longlong tmp=(*ref)->val_int_result(); + null_value=(*ref)->null_value; + return tmp; +} + + +String *Item_direct_view_ref::str_result(String* tmp) +{ + tmp=(*ref)->str_result(tmp); + null_value=(*ref)->null_value; + return tmp; +} + + +my_decimal *Item_direct_view_ref::val_decimal_result(my_decimal *val) +{ + my_decimal *tmp= (*ref)->val_decimal_result(val); + null_value=(*ref)->null_value; + return tmp; +} + + +bool Item_direct_view_ref::val_bool_result() +{ + bool tmp= (*ref)->val_bool_result(); + null_value=(*ref)->null_value; + return tmp; +} + + bool Item_default_value::eq(const Item *item, bool binary_cmp) const { return item->type() == DEFAULT_VALUE_ITEM && diff --git a/sql/item.h b/sql/item.h index bea09620ef8..8a90d99db9d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4477,6 +4477,14 @@ public: item_equal= NULL; Item_direct_ref::cleanup(); } + /* + TODO move these val_*_result function to Item_dierct_ref (maybe) + */ + double val_result(); + longlong val_int_result(); + String *str_result(String* tmp); + my_decimal *val_decimal_result(my_decimal *val); + bool val_bool_result(); }; -- cgit v1.2.1 From ef1e488be369b3d3c7eb26cfba1f44840221d502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 2 Jan 2020 08:06:23 +0200 Subject: MDEV-13569: wsrep_info.plugin failed in buildbot with "no nodes coming from prim view Modify configuration so that all nodes are part of galera cluster i.e. wsrep_on=ON. --- plugin/wsrep_info/mysql-test/wsrep_info/my.cnf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf index 52c7789e9f7..c9d47e40d4b 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf +++ b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf @@ -11,6 +11,7 @@ wsrep_provider=@ENV.WSREP_PROVIDER [mysqld.1] #galera_port=@OPT.port #sst_port=@OPT.port +wsrep-on=1 wsrep_provider_options='base_port=@mysqld.1.#galera_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' wsrep_node_name=test-node-1 @@ -18,6 +19,7 @@ wsrep_node_name=test-node-1 [mysqld.2] #galera_port=@OPT.port #sst_port=@OPT.port +wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' wsrep_provider_options='base_port=@mysqld.2.#galera_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' -- cgit v1.2.1 From 3c94c5b8fab0c3bb0febe62d72b89bc8d51c3932 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 3 Jan 2020 10:25:46 +0100 Subject: MDEV-21416: main.events_bugs fails due to 2020-01-01 date Moved to the next problematic year (2038). --- mysql-test/r/events_bugs.result | 4 ++-- mysql-test/t/events_bugs.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 30bc4f89d8c..1729862dba8 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -643,7 +643,7 @@ SET GLOBAL READ_ONLY = 1; # Connection: u1_con (mysqltest_u1@localhost/events_test). # -CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1; ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement ALTER EVENT e1 COMMENT 'comment'; @@ -656,7 +656,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can # Connection: root_con (root@localhost/events_test). # -CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1; ALTER EVENT e1 COMMENT 'comment'; diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index dc31556998a..aca1f144ec3 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1033,7 +1033,7 @@ SET GLOBAL READ_ONLY = 1; --echo --error ER_OPTION_PREVENTS_STATEMENT -CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1; --echo @@ -1057,7 +1057,7 @@ DROP EVENT e1; --echo -CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1; --echo -- cgit v1.2.1