Re: [Maria-developers] Mdev-10664 Add statuses about optimistic parallel replication stalls.
Sachin Setiya
writes: Right, but you still need _some_ way to synchronise multiple threads
I used atomic builtins my_atomic_add64_explicit.
That seems fine (but see comment below).
Documentation:-
Slave_DDL_Events:-
Description: Number of DDL statements slave have executed in replication channel X. Scope: Per Replication Channel Data Type: numeric Introduced: MariaDB 10.1
Slave_Non_Transactional_Events:-
Description: Number of Non Transactional "no idea what should be the next word " slave have executed in replication channel X. Scope: Per Replication Channel Data Type: numeric Introduced: MariaDB 10.1
I checked, the term "event group" is used already multiple places in the documentation, so I think it can be used here also. An event group can be a transaction (possibly with multiple transactional DML statements), or a DDL or non-transactional statement.
What you are doing is introducing status variables to help understand optimistic (and aggressive) parallel replication modes.
In optimistic parallel replication, a non-transactional event group is not safe to run in parallel with other non-transactional events. So that event is made to wait for all prior event groups to reach commit state, before being allowed to execute. However, other transactional events are not delayed by the non-transactional event group.
Slave_Non_Transactional_Events counts the occurences of this.
Then in case of a DDL statement, this can potentially be unsafe to run in parallel even with other transactional events. So for a DDL, the DDL has to wait for all prior event groups, _and_ subsequent event groups have to wait for the DDL.
Slave_DDL_Events counts these occurences.
This is what the documentation, and commit messages, should explain, I think.
I think the status variables describe the values for @@default_master_connection?, this should also be explained in the documentation.
Why did you decide to put this information into a status variable? Normally, slave status is seen in SHOW SLAVE STATUS, which supports showing status for a particular connection without using @@default_master_connection.
Sorry for this , I guess It was a confusion I was looking at Slave_Running
Hi Kristian!
Sorry for late reply , I was on vacations.
On Tue, Jan 10, 2017 at 7:31 PM, Kristian Nielsen
diff --git a/sql/log_event.h b/sql/log_event.h index 90900f6..579607f 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -50,6 +50,7 @@ #endif
#include "rpl_gtid.h" +#include "my_atomic.h"
Why include my_atomic.h in the header file, when you only use it in the .cc file?
Changed.
+ mysql_mutex_lock(&LOCK_active_mi); + if (master_info_index) + { + mi= master_info_index-> + get_master_info(&thd->variables.default_master_connection, + Sql_condition::WARN_LEVEL_NOTE); + if (mi) + tmp= mi->total_ddl_events;
+ if (mi) + tmp= mi->total_non_trans_events;
Better use an atomic primitive here to read the value. Taking a mutex does not help synchronise against my_atomic_add64_explicit().
Changed.
+ } + mysql_mutex_unlock(&LOCK_active_mi); + if (mi) + *((longlong *)buff)= tmp; + else + var->type= SHOW_UNDEF; + + return 0; +} #endif /* HAVE_REPLICATION */
static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff,
index 9365c06..a474aa5 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -303,6 +303,12 @@ class Master_info : public Slave_reporting_capability
/* The parallel replication mode. */ enum_slave_parallel_mode parallel_mode; + + /* No of DDL statements */ + long total_ddl_events; + + /* No of non-transactional statements*/ + long total_non_trans_events;
"long" is not the appropriate type here. Certainly not since you are using my_atomic_add64_explicit(). Use a type that is the same size on all platforms (and why use a signed type?).
Changed to uint64.
- Kristian.
Attached a newer version of patch , please review it. -- Regards Sachin
Sachin Setiya
Why did you decide to put this information into a status variable? Normally, slave status is seen in SHOW SLAVE STATUS, which supports showing status for a particular connection without using @@default_master_connection.
Sorry for this , I guess It was a confusion I was looking at Slave_Running this is avaliable in show status as well as show slave status. So I thought for if I want to show some information in SHOW slave status this has to be in show status. And this is wrong. Now we can see non trans events / ddl events in show slave status. Show I remove this vars from Show Status, or it is okay ?
But what do you think? What would you prefer, as a user? How about asking on the mailing list to get the input of actual users of the database, how they would use the feature and what they would prefer? I really worry that MariaDB development is deteriorated to the point that little thought goes into proper design anymore. It's all about "when can you push" whatever was assigned in Jira to your sprint. And little concern about _what_ is pushed. I do not think the information should be duplicated in SHOW STATUS and SHOW SLAVE STATUS, so yes, one should be removed. SHOW SLAVE STATUS seems most appropriate, since it is naturally able to show per-master-connection information. Looking at the documentation for SHOW STATUS: https://mariadb.com/kb/en/mariadb/show-status/ "With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. With SESSION, it displays the status values for the current connection." Your patch makes SHOW STATUS display status for whatever is in @@default_master_connection (if I understand it correctly?). That seems inconsistent with how SHOW STATUS normally works.
Attached a newer version of patch , please review it.
diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test new file mode 100644 index 0000000..b4f60e3 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.test
+--save_master_pos + +--connection slave +--sync_with_master 0,'master2' +show slave 'master2' status like 'Slave_DDL_Events'; +show slave 'master2' status like 'Slave_Non_Transactional_Events';
I do not understand. This does not appear to be valid syntax. Your .result file does not have this, instead it has:
+set default_master_connection = 'master2'; +show status like 'Slave_DDL_Events'; +Variable_name Value +Slave_ddl_events 18 +show status like 'Slave_Non_Transactional_Events'; +Variable_name Value +Slave_non_transactional_events 36
Do I misunderstand, or did you not even run your test case before sending it to me for review? If you did not, that simply is an unacceptable waste of the reviewer's time.
diff --git a/sql/slave.cc b/sql/slave.cc index 1846938..0feace4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2823,6 +2823,15 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, gtid_pos_length), mem_root); } + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_DDL_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Non_Transactional_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); DBUG_VOID_RETURN; }
If I read this correctly, you seem to have put the new SHOW SLAVE STATUS fields _after_ the extra fields output with the ALL SLAVES option. Doesn't that seem a bit messy? Other new options were added _before_ those of the ALL SLAVES option. See also this mailing list discussion: https://lists.launchpad.net/maria-developers/msg09993.html Also, this seems to be based on MariaDB-10.1 code (since 10.2 has Slave_SQL_Running_State at this point)? A new feature like this shouldn't go into 10.1. - Kristian.
HI Kristian,
On Thu, Jan 26, 2017 at 2:05 PM, Kristian Nielsen
Sachin Setiya
writes: Why did you decide to put this information into a status variable? Normally, slave status is seen in SHOW SLAVE STATUS, which supports showing status for a particular connection without using @@default_master_connection.
Sorry for this , I guess It was a confusion I was looking at Slave_Running this is avaliable in show status as well as show slave status. So I thought for if I want to show some information in SHOW slave status this has to be in show status. And this is wrong. Now we can see non trans events / ddl events in show slave status. Show I remove this vars from Show Status, or it is okay ?
But what do you think? What would you prefer, as a user? How about asking on the mailing list to get the input of actual users of the database, how they would use the feature and what they would prefer?
I really worry that MariaDB development is deteriorated to the point that little thought goes into proper design anymore. It's all about "when can you push" whatever was assigned in Jira to your sprint. And little concern about _what_ is pushed. No , this is only me. Other people are doing great work.
I do not think the information should be duplicated in SHOW STATUS and SHOW SLAVE STATUS, so yes, one should be removed. SHOW SLAVE STATUS seems most appropriate, since it is naturally able to show per-master-connection information. Looking at the documentation for SHOW STATUS:
https://mariadb.com/kb/en/mariadb/show-status/
"With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. With SESSION, it displays the status values for the current connection."
Your patch makes SHOW STATUS display status for whatever is in @@default_master_connection (if I understand it correctly?). That seems inconsistent with how SHOW STATUS normally works.
Attached a newer version of patch , please review it.
diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test new file mode 100644 index 0000000..b4f60e3 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.test
+--save_master_pos + +--connection slave +--sync_with_master 0,'master2' +show slave 'master2' status like 'Slave_DDL_Events'; +show slave 'master2' status like 'Slave_Non_Transactional_Events';
I do not understand. This does not appear to be valid syntax. Your .result file does not have this, instead it has:
+set default_master_connection = 'master2'; +show status like 'Slave_DDL_Events'; +Variable_name Value +Slave_ddl_events 18 +show status like 'Slave_Non_Transactional_Events'; +Variable_name Value +Slave_non_transactional_events 36
Do I misunderstand, or did you not even run your test case before sending it to me for review? If you did not, that simply is an unacceptable waste of the reviewer's time.
Sorry for this. I run test cases in pc and sent patch from laptop. Pc was on older version , I just forgot to sync them :(. Sorry for wasting your time, next time I will be more careful.
diff --git a/sql/slave.cc b/sql/slave.cc index 1846938..0feace4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2823,6 +2823,15 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, gtid_pos_length), mem_root); } + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_DDL_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Non_Transactional_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); DBUG_VOID_RETURN; }
If I read this correctly, you seem to have put the new SHOW SLAVE STATUS fields _after_ the extra fields output with the ALL SLAVES option. Doesn't that seem a bit messy? Other new options were added _before_ those of the ALL SLAVES option. See also this mailing list discussion:
Changed. Yes you are right.
Also, this seems to be based on MariaDB-10.1 code (since 10.2 has Slave_SQL_Running_State at this point)? A new feature like this shouldn't go into 10.1.
- Kristian. If you like to review , I have included a newer version of patch. This time I have tested it on
Ported the patch to 10.2. Yes you are right I am doing coding in very bad way , just following the jira task :( . pc. http://lists.askmonty.org/pipermail/commits/2017-January/010589.html Buildbot link:- https://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.2-sachin Regards sachin
Sachin, hello. I've read through your latest patch as well as did so to the current mail thread. On previous rounds there were few notes raised by Kristian. I see that they got addressed. I got few requests of myself as we spoke yesterday 1. Let's count the transactional groups as well for consistency so that the total count of all *taken* to execution groups would be gained as simple as summing of the three kinds. 2. Suggest to name them all with '_groups' suffix: DDL_groups, Non_transactiona_groups, Transactional_groups 'Event' is still defined as a sort of a statement, or the minimum indivisible piece of work by a slave applier. But the patch counts Gtids that head any of the tree group of events, so it should be the '_groups' suffix imo. Sure, check with Ian (cc:d). I see Kristian was somewhat sceptical about using 'group' as an offical term, but that's the most natural way to name the object at hand. For instace the transactional group is the same as just the transaction (provided that `mysql.gtid_slave_pos` table is of the same transactional type). 3. Make sure we document the counters are optimistic in sense they are incremented in the beginning of a group execution before knowing its outcome. 4. Always head new [test] files with comments explaining top-level of the test content. Specifcially to mention what is tested, and what are results of that. While the patch is certainly good, I would like to have another look at the final patch to approve formally. Cheers, Andrei
HI Kristian,
On Thu, Jan 26, 2017 at 2:05 PM, Kristian Nielsen
wrote: Sachin Setiya
writes: Why did you decide to put this information into a status variable? Normally, slave status is seen in SHOW SLAVE STATUS, which supports showing status for a particular connection without using @@default_master_connection.
Sorry for this , I guess It was a confusion I was looking at Slave_Running this is avaliable in show status as well as show slave status. So I thought for if I want to show some information in SHOW slave status this has to be in show status. And this is wrong. Now we can see non trans events / ddl events in show slave status. Show I remove this vars from Show Status, or it is okay ?
But what do you think? What would you prefer, as a user? How about asking on the mailing list to get the input of actual users of the database, how they would use the feature and what they would prefer?
I really worry that MariaDB development is deteriorated to the point that little thought goes into proper design anymore. It's all about "when can you push" whatever was assigned in Jira to your sprint. And little concern about _what_ is pushed. No , this is only me. Other people are doing great work.
I do not think the information should be duplicated in SHOW STATUS and SHOW SLAVE STATUS, so yes, one should be removed. SHOW SLAVE STATUS seems most appropriate, since it is naturally able to show per-master-connection information. Looking at the documentation for SHOW STATUS:
https://mariadb.com/kb/en/mariadb/show-status/
"With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. With SESSION, it displays the status values for the current connection."
Your patch makes SHOW STATUS display status for whatever is in @@default_master_connection (if I understand it correctly?). That seems inconsistent with how SHOW STATUS normally works.
Attached a newer version of patch , please review it.
diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test new file mode 100644 index 0000000..b4f60e3 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.test
+--save_master_pos + +--connection slave +--sync_with_master 0,'master2' +show slave 'master2' status like 'Slave_DDL_Events'; +show slave 'master2' status like 'Slave_Non_Transactional_Events';
I do not understand. This does not appear to be valid syntax. Your .result file does not have this, instead it has:
+set default_master_connection = 'master2'; +show status like 'Slave_DDL_Events'; +Variable_name Value +Slave_ddl_events 18 +show status like 'Slave_Non_Transactional_Events'; +Variable_name Value +Slave_non_transactional_events 36
Do I misunderstand, or did you not even run your test case before sending it to me for review? If you did not, that simply is an unacceptable waste of the reviewer's time.
Sorry for this. I run test cases in pc and sent patch from laptop. Pc was on older version , I just forgot to sync them :(. Sorry for wasting your time, next time I will be more careful.
diff --git a/sql/slave.cc b/sql/slave.cc index 1846938..0feace4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2823,6 +2823,15 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, gtid_pos_length), mem_root); } + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_DDL_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Non_Transactional_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); DBUG_VOID_RETURN; }
If I read this correctly, you seem to have put the new SHOW SLAVE STATUS fields _after_ the extra fields output with the ALL SLAVES option. Doesn't that seem a bit messy? Other new options were added _before_ those of the ALL SLAVES option. See also this mailing list discussion:
Changed. Yes you are right.
Also, this seems to be based on MariaDB-10.1 code (since 10.2 has Slave_SQL_Running_State at this point)? A new feature like this shouldn't go into 10.1.
- Kristian. If you like to review , I have included a newer version of patch. This time I have tested it on
Ported the patch to 10.2. Yes you are right I am doing coding in very bad way , just following the jira task :( . pc. http://lists.askmonty.org/pipermail/commits/2017-January/010589.html
Buildbot link:- https://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.2-sachin
Regards sachin
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
andrei.elkin@pp.inet.fi writes:
I see Kristian was somewhat sceptical about using 'group' as an offical term, but that's the most natural way to name the object at hand.
Yeah... but I cannot think of a better term to use here, and "event group" is the proper term for what is counted here, even if it is somewhat internal. It would surely be more confusing to have something like "non_transactional_transactions" and "transactional_transactions ..." - Kristian.
Hi Andrei, Kristian !
Sorry for late reply (I was on vacation , and there was very less 10.3
sprint)
On Sat, Feb 10, 2018 at 5:42 PM,
Sachin, hello.
I've read through your latest patch as well as did so to the current mail thread. On previous rounds there were few notes raised by Kristian. I see that they got addressed.
I got few requests of myself as we spoke yesterday
1. Let's count the transactional groups as well for consistency so that the total count of all *taken* to execution groups would be gained as simple as summing of the three kinds.
Done.
2. Suggest to name them all with '_groups' suffix:
DDL_groups, Non_transactiona_groups, Transactional_groups
Done, But I have added Slave as prefix.
'Event' is still defined as a sort of a statement, or the minimum indivisible piece of work by a slave applier. But the patch counts Gtids that head any of the tree group of events, so it should be the '_groups' suffix imo. Sure, check with Ian (cc:d). I see Kristian was somewhat sceptical about using 'group' as an offical term, but that's the most natural way to name the object at hand. For instace the transactional group is the same as just the transaction (provided that `mysql.gtid_slave_pos` table is of the same transactional type).
3. Make sure we document the counters are optimistic in sense they are incremented in the beginning of a group execution before knowing its outcome.
I am counting events in Gtid_log_event::do_apply_event , So counter is optimistic.
4. Always head new [test] files with comments explaining top-level of the test content. Specifcially to mention what is tested, and what are results of that.
Done.
While the patch is certainly good, I would like to have another look at the final patch to approve formally.
Cheers,
Andrei
Patch link
http://lists.askmonty.org/pipermail/commits/2018-March/012136.html Regards sachin
HI Kristian,
Sachin Setiya
writes: Why did you decide to put this information into a status variable? Normally, slave status is seen in SHOW SLAVE STATUS, which supports showing status for a particular connection without using @@default_master_connection.
Sorry for this , I guess It was a confusion I was looking at Slave_Running this is avaliable in show status as well as show slave status. So I thought for if I want to show some information in SHOW slave status this has to be in show status. And this is wrong. Now we can see non trans events / ddl events in show slave status. Show I remove this vars from Show Status, or it is okay ?
But what do you think? What would you prefer, as a user? How about asking on the mailing list to get the input of actual users of the database, how they would use the feature and what they would prefer?
I really worry that MariaDB development is deteriorated to the point
On Thu, Jan 26, 2017 at 2:05 PM, Kristian Nielsen
wrote: that little thought goes into proper design anymore. It's all about "when can you push" whatever was assigned in Jira to your sprint. And little concern about _what_ is pushed. No , this is only me. Other people are doing great work.
I do not think the information should be duplicated in SHOW STATUS and SHOW SLAVE STATUS, so yes, one should be removed. SHOW SLAVE STATUS seems most appropriate, since it is naturally able to show per-master-connection information. Looking at the documentation for SHOW STATUS:
https://mariadb.com/kb/en/mariadb/show-status/
"With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. With SESSION, it displays the status values for the current connection."
Your patch makes SHOW STATUS display status for whatever is in @@default_master_connection (if I understand it correctly?). That seems inconsistent with how SHOW STATUS normally works.
Attached a newer version of patch , please review it.
diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test new file mode 100644 index 0000000..b4f60e3 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.test
+--save_master_pos + +--connection slave +--sync_with_master 0,'master2' +show slave 'master2' status like 'Slave_DDL_Events'; +show slave 'master2' status like 'Slave_Non_Transactional_Events';
I do not understand. This does not appear to be valid syntax. Your .result file does not have this, instead it has:
+set default_master_connection = 'master2'; +show status like 'Slave_DDL_Events'; +Variable_name Value +Slave_ddl_events 18 +show status like 'Slave_Non_Transactional_Events'; +Variable_name Value +Slave_non_transactional_events 36
Do I misunderstand, or did you not even run your test case before sending it to me for review? If you did not, that simply is an unacceptable waste of the reviewer's time.
diff --git a/sql/slave.cc b/sql/slave.cc index 1846938..0feace4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2823,6 +2823,15 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, gtid_pos_length), mem_root); } + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_DDL_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Non_Transactional_Events", 20, + MYSQL_TYPE_LONGLONG), + mem_root); DBUG_VOID_RETURN; }
If I read this correctly, you seem to have put the new SHOW SLAVE STATUS fields _after_ the extra fields output with the ALL SLAVES option. Doesn't that seem a bit messy? Other new options were added _before_ those of
Sorry for this. I run test cases in pc and sent patch from laptop. Pc was on older version , I just forgot to sync them :(. Sorry for wasting your time, next time I will be more careful. the
ALL SLAVES option. See also this mailing list discussion:
Changed. Yes you are right.
Also, this seems to be based on MariaDB-10.1 code (since 10.2 has Slave_SQL_Running_State at this point)? A new feature like this shouldn't go into 10.1.
- Kristian. If you like to review , I have included a newer version of patch. This time I have tested it on
Ported the patch to 10.2. Yes you are right I am doing coding in very bad way , just following the jira task :( . pc. http://lists.askmonty.org/pipermail/commits/2017-January/010589.html
Buildbot link:- https://buildbot.askmonty.org/buildbot/grid?category=main&br anch=bb-10.2-sachin
Regards sachin
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
-- Regards Sachin Setiya Software Engineer at MariaDB
Sachin, howdy. While the latest patch is pretty I still see potential to improve it, please find A[0-9]+ prefixed annotations below. Thank you for addressing earlier comments!
Hi Andrei, Kristian !
Sorry for late reply (I was on vacation , and there was very less 10.3 sprint)
On Sat, Feb 10, 2018 at 5:42 PM,
wrote: Sachin, hello.
I've read through your latest patch as well as did so to the current mail thread. On previous rounds there were few notes raised by Kristian. I see that they got addressed.
I got few requests of myself as we spoke yesterday
1. Let's count the transactional groups as well for consistency so that the total count of all *taken* to execution groups would be gained as simple as summing of the three kinds.
Done.
2. Suggest to name them all with '_groups' suffix:
DDL_groups, Non_transactiona_groups, Transactional_groups
Done, But I have added Slave as prefix.
'Event' is still defined as a sort of a statement, or the minimum indivisible piece of work by a slave applier. But the patch counts Gtids that head any of the tree group of events, so it should be the '_groups' suffix imo. Sure, check with Ian (cc:d). I see Kristian was somewhat sceptical about using 'group' as an offical term, but that's the most natural way to name the object at hand. For instace the transactional group is the same as just the transaction (provided that `mysql.gtid_slave_pos` table is of the same transactional type).
3. Make sure we document the counters are optimistic in sense they are incremented in the beginning of a group execution before knowing its outcome.
I am counting events in Gtid_log_event::do_apply_event , So counter is optimistic.
4. Always head new [test] files with comments explaining top-level of the test content. Specifcially to mention what is tested, and what are results of that.
Done.
While the patch is certainly good, I would like to have another look at the final patch to approve formally.
Cheers,
Andrei
Patch link http://lists.askmonty.org/pipermail/commits/2018-March/012136.html
revision-id: 6b2b2a56f91b93ab2ac5e30fc32465631e0d0c47 (mariadb-10.3.5-25-g6b2b2a5)
parent(s): ad647cc84ebf331d59b24e81bffe89be2f5b1ed7
author: Sachin Setiya
committer: Sachin Setiya
timestamp: 2018-03-26 12:23:18 +0530
message:
Mdev-10664 Add statuses about optimistic parallel replication stalls
In this commit we are adding three more status variable to SHOW SLAVE
STATUS. Slave_DDL_Events and Slave_Non_Transactional_Events.
Slave_DDL_Groups:- This status variable counts the occurrence of DDL
statements
Slave_Non_Transactional_Groups:- This variable count the occurrence
of non-transnational event group.
Slave_Transactional_Groups:- This variable count the occurrence
of transnational event group.
Patch Credit:- Kristian Nielsen
---
mysql-test/include/check-testcase.test | 5 +-
mysql-test/suite/multi_source/info_logs.result | 12 +-
.../suite/multi_source/multi_parallel.result | 230 +++++++++++++++++++++
mysql-test/suite/multi_source/multi_parallel.test | 155 ++++++++++++++
mysql-test/suite/multi_source/reset_slave.result | 8 +-
mysql-test/suite/multi_source/simple.result | 23 ++-
mysql-test/suite/multi_source/syntax.result | 6 +-
sql/log_event.cc | 10 +
sql/rpl_mi.cc | 3 +-
sql/rpl_mi.h | 10 +
sql/slave.cc | 24 +++
11 files changed, 461 insertions(+), 25 deletions(-)
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index 4ca5398..3c164ee 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -70,10 +70,13 @@ if ($tmp)
--echo SQL_Delay 0
--echo SQL_Remaining_Delay NULL
--echo Slave_SQL_Running_State
+ --echo Slave_DDL_Groups #
+ --echo Slave_Non_Transactional_Groups #
+ --echo Slave_Transactional_Groups #
}
if (!$tmp) {
# Note: after WL#5177, fields 13-18 shall not be filtered-out.
- --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 #
+ --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 #
query_vertical
SHOW SLAVE STATUS;
}
diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result
index e177c98..531a617 100644
--- a/mysql-test/suite/multi_source/info_logs.result
+++ b/mysql-test/suite/multi_source/info_logs.result
@@ -89,17 +89,17 @@ MASTER 2.2
# EOF
#
show all slaves status;
-Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats
Slave_h
eartbeat_period Gtid_Slave_Pos
- Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001
Hi Andrei!
I have applied all the changes. Thanks for the review
http://lists.askmonty.org/pipermail/commits/2018-April/012421.html
On Mon, Apr 9, 2018 at 9:04 PM,
Sachin, howdy.
While the latest patch is pretty I still see potential to improve it, please find A[0-9]+ prefixed annotations below. Thank you for addressing earlier comments!
Hi Andrei, Kristian !
Sorry for late reply (I was on vacation , and there was very less 10.3 sprint)
On Sat, Feb 10, 2018 at 5:42 PM,
wrote: Sachin, hello.
I've read through your latest patch as well as did so to the current mail thread. On previous rounds there were few notes raised by Kristian. I see that they got addressed.
I got few requests of myself as we spoke yesterday
1. Let's count the transactional groups as well for consistency so that the total count of all *taken* to execution groups would be gained as simple as summing of the three kinds.
Done.
2. Suggest to name them all with '_groups' suffix:
DDL_groups, Non_transactiona_groups, Transactional_groups
Done, But I have added Slave as prefix.
'Event' is still defined as a sort of a statement, or the minimum indivisible piece of work by a slave applier. But the patch counts Gtids that head any of the tree group of events, so it should be the '_groups' suffix imo. Sure, check with Ian (cc:d). I see Kristian was somewhat sceptical about using 'group' as an offical term, but that's the most natural way to name the object at hand. For instace the transactional group is the same as just the transaction (provided that `mysql.gtid_slave_pos` table is of the same transactional type).
3. Make sure we document the counters are optimistic in sense they are incremented in the beginning of a group execution before knowing its outcome.
I am counting events in Gtid_log_event::do_apply_event , So counter is optimistic.
4. Always head new [test] files with comments explaining top-level of the test content. Specifcially to mention what is tested, and what are results of that.
Done.
While the patch is certainly good, I would like to have another look at the final patch to approve formally.
Cheers,
Andrei
Patch link http://lists.askmonty.org/pipermail/commits/2018-March/012136.html
revision-id: 6b2b2a56f91b93ab2ac5e30fc32465631e0d0c47 (mariadb-10.3.5-25-g6b2b2a5) parent(s): ad647cc84ebf331d59b24e81bffe89be2f5b1ed7 author: Sachin Setiya committer: Sachin Setiya timestamp: 2018-03-26 12:23:18 +0530 message:
Mdev-10664 Add statuses about optimistic parallel replication stalls
In this commit we are adding three more status variable to SHOW SLAVE STATUS. Slave_DDL_Events and Slave_Non_Transactional_Events.
Slave_DDL_Groups:- This status variable counts the occurrence of DDL statements
Slave_Non_Transactional_Groups:- This variable count the occurrence of non-transnational event group.
Slave_Transactional_Groups:- This variable count the occurrence of transnational event group.
Patch Credit:- Kristian Nielsen
--- mysql-test/include/check-testcase.test | 5 +- mysql-test/suite/multi_source/info_logs.result | 12 +- .../suite/multi_source/multi_parallel.result | 230 +++++++++++++++++++++ mysql-test/suite/multi_source/multi_parallel.test | 155 ++++++++++++++ mysql-test/suite/multi_source/reset_slave.result | 8 +- mysql-test/suite/multi_source/simple.result | 23 ++- mysql-test/suite/multi_source/syntax.result | 6 +- sql/log_event.cc | 10 + sql/rpl_mi.cc | 3 +- sql/rpl_mi.h | 10 + sql/slave.cc | 24 +++ 11 files changed, 461 insertions(+), 25 deletions(-)
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 4ca5398..3c164ee 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -70,10 +70,13 @@ if ($tmp) --echo SQL_Delay 0 --echo SQL_Remaining_Delay NULL --echo Slave_SQL_Running_State + --echo Slave_DDL_Groups # + --echo Slave_Non_Transactional_Groups # + --echo Slave_Transactional_Groups # } if (!$tmp) { # Note: after WL#5177, fields 13-18 shall not be filtered-out. - --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # + --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 # query_vertical SHOW SLAVE STATUS; } diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result index e177c98..531a617 100644 --- a/mysql-test/suite/multi_source/info_logs.result +++ b/mysql-test/suite/multi_source/info_logs.result @@ -89,17 +89,17 @@ MASTER 2.2 # EOF # show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001
relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master at 00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master at 00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 include/wait_for_slave_to_start.inc set default_master_connection = 'MASTER 2.2'; include/wait_for_slave_to_start.inc set default_master_connection = ''; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 6 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master at 00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 6 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 6 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master at 00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 6 0 60.000 # # List of files matching '*info*' pattern # after slave server restart diff --git a/mysql-test/suite/multi_source/multi_parallel.result b/mysql-test/suite/multi_source/multi_parallel.result new file mode 100644 index 0000000..c2f1131 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.result @@ -0,0 +1,230 @@ +connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3; +set global slave_parallel_threads=10; +change master 'master1' to +master_port=MYPORT_1, +master_host='127.0.0.1', +master_user='root'; +change master 'master2' to +master_port=MYPORT_2, +master_host='127.0.0.1', +master_user='root'; +start all slaves; +Warnings: +Note 1937 SLAVE 'master2' started +Note 1937 SLAVE 'master1' started +set default_master_connection = 'master1'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'master2'; +include/wait_for_slave_to_start.inc +## Slave status variable +set default_master_connection = 'master1'; +show status like 'slave_running'; +Variable_name Value +Slave_running ON +set default_master_connection = 'master2'; +show status like 'slave_running'; +Variable_name Value +Slave_running ON +#master 1 A1. I would turn off query logging inside two loops to avoid useless print-outs like below:
+connection master1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +create table t1(a int primary key) engine=myisam; +insert into t1 values(1); +insert into t1 values(2); +drop table t1; +connection slave; +Slave_DDL_Groups= 20; +Slave_Non_Transactional_Groups= 40; +Slave__Transactional_Groups= 0; +#master 2 +connection master2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +create table t2(a int primary key) engine=myisam; +insert into t2 values(1); +insert into t2 values(2); +drop table t2; +connection slave; +Slave_DDL_Groups= 18; +Slave_Non_Transactional_Groups= 36; +Slave_Transactional_Groups= 0; +#master 1 +connection master1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1(a int primary key) engine=innodb; +insert into t1 values(1); +insert into t1 values(2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +connection slave; +Slave_DDL_Groups= 38; +Slave_Non_Transactional_Groups= 58; +Slave_Transactional_Groups= 18; +stop all slaves; +Warnings: +Note 1938 SLAVE 'master2' stopped +Note 1938 SLAVE 'master1' stopped +set default_master_connection = 'master1'; +include/wait_for_slave_to_stop.inc +set default_master_connection = 'master2'; +include/wait_for_slave_to_stop.inc +set global slave_parallel_threads=0; +include/reset_master_slave.inc +disconnect slave; +connection master1; +include/reset_master_slave.inc +disconnect master1; +connection master2; +include/reset_master_slave.inc +disconnect master2; diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test new file mode 100644 index 0000000..9b13635
A2. The test contains two loops which are supposed to be identical requiring only different table names. But you also make the loop limit different which is a triffle thing *but* there is a bigger issue in that we are better off to reuse any piece of code. Why won't we turn the explicit loops into a macro to it twice with any number of parameters to twist (I've counted one)? (You many --{dis,en}able_query_log in the macro)
--- /dev/null +++ b/mysql-test/suite/multi_source/multi_parallel.test @@ -0,0 +1,155 @@ +# This test file tests events counter like Slave_ddl_groups, +# Slave_non_transactional_groups, Slave_transactional_groups +--source include/not_embedded.inc +--source include/have_innodb.inc +--let $rpl_server_count= 0 + +--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) +--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) + +#save state +--let $par_thd= `select @@slave_parallel_threads;` + +set global slave_parallel_threads=10; + +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'master1' to +master_port=$SERVER_MYPORT_1, +master_host='127.0.0.1', +master_user='root'; + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master 'master2' to +master_port=$SERVER_MYPORT_2, +master_host='127.0.0.1', +master_user='root'; + + +#start all slaves + +start all slaves; + +set default_master_connection = 'master1'; +--source include/wait_for_slave_to_start.inc + +set default_master_connection = 'master2'; +--source include/wait_for_slave_to_start.inc + +--echo ## Slave status variable + +set default_master_connection = 'master1'; +show status like 'slave_running'; + +set default_master_connection = 'master2'; +show status like 'slave_running'; + + +--echo #master 1 +--connection master1 + +--let $counter=10 +while ($counter) +{ + #DDL statement + create table t1(a int primary key) engine=myisam; + + #non trans update statement + insert into t1 values(1); + insert into t1 values(2); + + drop table t1; + --dec $counter +} +--save_master_pos + +--connection slave + +--sync_with_master 0,'master1' +--let $status= query_get_value(show slave 'master1' status, Slave_DDL_Groups, 1) +--echo Slave_DDL_Groups= $status; + +--let $status= query_get_value(show slave 'master1' status, Slave_Non_Transactional_Groups, 1) +--echo Slave_Non_Transactional_Groups= $status; + +--let $status= query_get_value(show slave 'master1' status, Slave_Transactional_Groups, 1) +--echo Slave__Transactional_Groups= $status; + +--echo #master 2 +--connection master2 + +--let $counter=9 +while ($counter) +{ + #DDL statement + create table t2(a int primary key) engine=myisam; + + #non trans update statement + insert into t2 values(1); + insert into t2 values(2); + + drop table t2; + --dec $counter +} +--save_master_pos + +--connection slave +--sync_with_master 0,'master2' +--let $status= query_get_value(show slave 'master2' status, Slave_DDL_Groups, 1) +--echo Slave_DDL_Groups= $status; + +--let $status= query_get_value(show slave 'master2' status, Slave_Non_Transactional_Groups, 1) +--echo Slave_Non_Transactional_Groups= $status; + +--let $status= query_get_value(show slave 'master2' status, Slave_Transactional_Groups, 1) +--echo Slave_Transactional_Groups= $status; + +--echo #master 1 +--connection master1 + +--let $counter=9 +while ($counter) +{ + #DDL statement + create table t1(a int primary key) engine=innodb; + + #non trans update statement + insert into t1 values(1); + insert into t1 values(2); + show create table t1; + drop table t1; + --dec $counter +} +--save_master_pos + +--connection slave + +--sync_with_master 0,'master1' +--let $status= query_get_value(show slave 'master1' status, Slave_DDL_Groups, 1) +--echo Slave_DDL_Groups= $status; + +--let $status= query_get_value(show slave 'master1' status, Slave_Non_Transactional_Groups, 1) +--echo Slave_Non_Transactional_Groups= $status; + +--let $status= query_get_value(show slave 'master1' status, Slave_Transactional_Groups, 1) +--echo Slave_Transactional_Groups= $status; + + +# Cleanup +stop all slaves; +set default_master_connection = 'master1'; +--source include/wait_for_slave_to_stop.inc + +set default_master_connection = 'master2'; +--source include/wait_for_slave_to_stop.inc + +--eval set global slave_parallel_threads=$par_thd + +--source include/reset_master_slave.inc +--disconnect slave +--connection master1 +--source include/reset_master_slave.inc +--disconnect master1 +--connection master2 +--source include/reset_master_slave.inc +--disconnect master2 diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result index 353970a..4f66c8f 100644 --- a/mysql-test/suite/multi_source/reset_slave.result +++ b/mysql-test/suite/multi_source/reset_slave.result @@ -13,15 +13,15 @@ insert into t1 values (1),(2); connection slave; stop slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State - 127.0.0.1 root MYPORT_1 60 master-bin.000001
mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups + 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL 2 3 0 mysqld-relay-bin-master1.000001 mysqld-relay-bin-master1.000002 mysqld-relay-bin-master1.index reset slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State - 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups + 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL 2 3 0 reset slave 'master1' all; show slave 'master1' status; ERROR HY000: There is no master connection 'master1' diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result index 419b995..93ea1c0 100644 --- a/mysql-test/suite/multi_source/simple.result +++ b/mysql-test/suite/multi_source/simple.result @@ -18,9 +18,9 @@ connection slave; connection master2; connection slave; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos -slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-slave1.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-slave1.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 start all slaves; stop slave 'slave1'; show slave 'slave1' status; @@ -74,21 +74,24 @@ Parallel_Mode conservative SQL_Delay 0 SQL_Remaining_Delay NULL Slave_SQL_Running_State +Slave_DDL_Groups 0 +Slave_Non_Transactional_Groups 0 +Slave_Transactional_Groups 0 reset slave 'slave1'; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos -slave1 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL 0 0 0 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 reset slave 'slave1' all; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 0 0 0 1073741824 7 0 60.000 stop all slaves; Warnings: Note 1938 SLAVE 'slave2' stopped show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos -slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 2 No conservative 0 NULL 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 2 No conservative 0 NULL 0 0 0 0 1073741824 7 0 60.000 stop all slaves; include/reset_master_slave.inc disconnect slave; diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result index a17a61d..35f4b30 100644 --- a/mysql-test/suite/multi_source/syntax.result +++ b/mysql-test/suite/multi_source/syntax.result @@ -1,11 +1,11 @@ include/master-slave.inc [connection master] show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups show slave '' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_h eartbeat_period Gtid_Slave_Pos +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_tra nsaction s Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos # # Check error handling # diff --git a/sql/log_event.cc b/sql/log_event.cc index cd47cbb..e552000 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -53,6 +53,7 @@ #include "rpl_constants.h" #include "sql_digest.h" #include "zlib.h" +#include "my_atomic.h" #define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
A3. Now having three options the if:s asks to converting them into a switch which is claimed to be better performing:
'The compiler doesn`t know if the order of evaluating the if-statements is important ... with the switch-statement it knows that all clauses can be evaluated at the same time'.
@@ -7973,6 +7974,15 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi) }
DBUG_ASSERT((bits & OPTION_GTID_BEGIN) == 0); + + Master_info *mi=rgi->rli->mi; + if (flags2 & FL_DDL) + my_atomic_add64_explicit(&mi->total_ddl_groups, 1, MY_MEMORY_ORDER_RELAXED); + if (!(flags2 & FL_TRANSACTIONAL)) + my_atomic_add64_explicit(&mi->total_non_trans_groups, 1, MY_MEMORY_ORDER_RELAXED); + if (flags2 & FL_TRANSACTIONAL) + my_atomic_add64_explicit(&mi->total_trans_groups, 1, MY_MEMORY_ORDER_RELAXED); + if (flags2 & FL_STANDALONE) return 0;
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 55a6671..1fc996b 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -42,7 +42,8 @@ Master_info::Master_info(LEX_CSTRING *connection_name_arg, using_gtid(USE_GTID_NO), events_queued_since_last_gtid(0), gtid_reconnect_event_skip_count(0), gtid_event_seen(false), in_start_all_slaves(0), in_stop_all_slaves(0), in_flush_all_relay_logs(0), - users(0), killed(0) + users(0), killed(0), + total_ddl_groups(0), total_non_trans_groups(0), total_trans_groups(0) { char *tmp; host[0] = 0; user[0] = 0; password[0] = 0; diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 260c35e..54d6b5b 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -327,6 +327,16 @@ class Master_info : public Slave_reporting_capability uint users; /* Active user for object */ uint killed;
+ + /* No of DDL event group */ + volatile uint64 total_ddl_groups; + + /* No of non-transactional event group*/ + volatile uint64 total_non_trans_groups; + + /* No of transactional event group*/ + volatile uint64 total_trans_groups; + /* domain-id based filter */ Domain_id_filter domain_id_filter;
diff --git a/sql/slave.cc b/sql/slave.cc index bf70db6..a2cea8a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3121,6 +3121,19 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, field_list->push_back(new (mem_root) Item_empty_string(thd, "Slave_SQL_Running_State", 20)); + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_DDL_Groups", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Non_Transactional_Groups", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + field_list->push_back(new (mem_root) + Item_return_int(thd, "Slave_Transactional_Groups", 20, + MYSQL_TYPE_LONGLONG), + mem_root); + if (full) { field_list->push_back(new (mem_root) @@ -3351,6 +3364,17 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, // Slave_SQL_Running_State protocol->store(slave_sql_running_state, &my_charset_bin);
+ uint64 events; + events= (uint64)my_atomic_load64_explicit((volatile int64 *) + &mi->total_ddl_groups, MY_MEMORY_ORDER_RELAXED); + protocol->store(events); + events= (uint64)my_atomic_load64_explicit((volatile int64 *) + &mi->total_non_trans_groups, MY_MEMORY_ORDER_RELAXED); + protocol->store(events); + events= (uint64)my_atomic_load64_explicit((volatile int64 *) + &mi->total_trans_groups, MY_MEMORY_ORDER_RELAXED); + protocol->store(events); + if (full) { protocol->store((uint32) mi->rli.retried_trans);
Cheers,
Andrei
-- Regards Sachin Setiya Software Engineer at MariaDB
participants (3)
-
andrei.elkin@pp.inet.fi
-
Kristian Nielsen
-
Sachin Setiya