|
50 | 50 | #include "sql_plugin.h" // opt_plugin_dir_ptr
|
51 | 51 | #include "transaction.h" // trans_begin
|
52 | 52 | #include "tztime.h" // Time_zone
|
| 53 | +#include "rpl_group_replication.h" |
53 | 54 |
|
54 | 55 | // Sic: Must be after mysqld.h to get the right ER macro.
|
55 | 56 | #include "errmsg.h" // CR_*
|
@@ -690,6 +691,19 @@ bool start_slave_cmd(THD *thd)
|
690 | 691 | {
|
691 | 692 | mi= msr_map.get_mi(lex->mi.channel);
|
692 | 693 |
|
| 694 | + /* |
| 695 | + If the channel being used is a group replication channel we need to |
| 696 | + disable the START SLAVE [IO_THREAD] command as group replication does |
| 697 | + not support the command. |
| 698 | + */ |
| 699 | + if (mi && msr_map.is_group_replication_channel_name(mi->get_channel(), true) |
| 700 | + && (!thd->lex->slave_thd_opt || (thd->lex->slave_thd_opt & SLAVE_IO))) |
| 701 | + { |
| 702 | + my_error(ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED, MYF(0), |
| 703 | + "START SLAVE [IO_THREAD] FOR CHANNEL", mi->get_channel()); |
| 704 | + goto err; |
| 705 | + } |
| 706 | + |
693 | 707 | if (mi)
|
694 | 708 | res= start_slave(thd, &thd->lex->slave_connection,
|
695 | 709 | &thd->lex->mi, thd->lex->slave_thd_opt, mi, true);
|
@@ -740,6 +754,20 @@ bool stop_slave_cmd(THD *thd)
|
740 | 754 | {
|
741 | 755 | mi= msr_map.get_mi(lex->mi.channel);
|
742 | 756 |
|
| 757 | + /* |
| 758 | + If the channel being used is a group replication channel we need to |
| 759 | + disable the STOP SLAVE [IO_THREAD] command as group replication does |
| 760 | + not support the command. |
| 761 | + */ |
| 762 | + if (mi && msr_map.is_group_replication_channel_name(mi->get_channel(), true) |
| 763 | + && (!thd->lex->slave_thd_opt || (thd->lex->slave_thd_opt & SLAVE_IO))) |
| 764 | + { |
| 765 | + my_error(ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED, MYF(0), |
| 766 | + "STOP SLAVE [IO_THREAD] FOR CHANNEL", mi->get_channel()); |
| 767 | + mysql_mutex_unlock(&LOCK_msr_map); |
| 768 | + DBUG_RETURN(true); |
| 769 | + } |
| 770 | + |
743 | 771 | if (mi)
|
744 | 772 | res= stop_slave(thd, mi, 1 /*net report */);
|
745 | 773 | else if (strcmp(msr_map.get_default_channel(), lex->mi.channel))
|
@@ -3860,6 +3888,21 @@ bool show_slave_status_cmd(THD *thd)
|
3860 | 3888 | {
|
3861 | 3889 | /* when mi is 0, i.e mi doesn't exist, SSS will return an empty set */
|
3862 | 3890 | mi= msr_map.get_mi(lex->mi.channel);
|
| 3891 | + |
| 3892 | + /* |
| 3893 | + If the channel being used is a group replication applier channel we |
| 3894 | + need to disable the SHOW SLAVE STATUS commannd as its output is not |
| 3895 | + compatible with this command. |
| 3896 | + */ |
| 3897 | + if (mi && msr_map.is_group_replication_channel_name(mi->get_channel(), |
| 3898 | + true)) |
| 3899 | + { |
| 3900 | + my_error(ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED, MYF(0), |
| 3901 | + "SHOW SLAVE STATUS", mi->get_channel()); |
| 3902 | + mysql_mutex_unlock(&LOCK_msr_map); |
| 3903 | + DBUG_RETURN(true); |
| 3904 | + } |
| 3905 | + |
3863 | 3906 | res= show_slave_status(thd, mi);
|
3864 | 3907 | }
|
3865 | 3908 |
|
@@ -7710,6 +7753,13 @@ bool queue_event(Master_info* mi,const char* buf, ulong event_len)
|
7710 | 7753 | DBUG_ASSERT(lock_count == 0);
|
7711 | 7754 | lock_count= 1;
|
7712 | 7755 |
|
| 7756 | + if (mi->get_mi_description_event() == NULL) |
| 7757 | + { |
| 7758 | + sql_print_error("The queue event failed for channel '%s' as its " |
| 7759 | + "configuration is invalid.", mi->get_channel()); |
| 7760 | + goto err; |
| 7761 | + } |
| 7762 | + |
7713 | 7763 | /*
|
7714 | 7764 | Simulate an unknown ignorable log event by rewriting a Xid
|
7715 | 7765 | log event before queuing it into relay log.
|
@@ -9985,6 +10035,19 @@ bool reset_slave_cmd(THD *thd)
|
9985 | 10035 | else
|
9986 | 10036 | {
|
9987 | 10037 | mi= msr_map.get_mi(lex->mi.channel);
|
| 10038 | + /* |
| 10039 | + If the channel being used is a group replication channel and |
| 10040 | + group_replication is still running we need to disable RESET SLAVE [ALL] |
| 10041 | + command. |
| 10042 | + */ |
| 10043 | + if (mi && msr_map.is_group_replication_channel_name(mi->get_channel(), true) |
| 10044 | + && is_group_replication_running()) |
| 10045 | + { |
| 10046 | + my_error(ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED, MYF(0), |
| 10047 | + "RESET SLAVE [ALL] FOR CHANNEL", mi->get_channel()); |
| 10048 | + mysql_mutex_unlock(&LOCK_msr_map); |
| 10049 | + DBUG_RETURN(true); |
| 10050 | + } |
9988 | 10051 |
|
9989 | 10052 | if (mi)
|
9990 | 10053 | res= reset_slave(thd, mi, thd->lex->reset_slave_info.all);
|
|
0 commit comments