summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-04-28 18:24:46 +0200
committerunknown <guilhem@mysql.com>2004-04-28 18:24:46 +0200
commit87a93a3195c40e9964da45ae3f1b159640b3b0e3 (patch)
tree4dc6a90359310c5dfb787550d9255ad52964cc27 /sql/mysqld.cc
parentb825d9b023071039dfbda8324427102533319cb4 (diff)
downloadmariadb-git-87a93a3195c40e9964da45ae3f1b159640b3b0e3.tar.gz
A new option --replicate-same-server-id to force a slave to execute queries originating from itself
(WL#794). This can be of interest in some recovery-from-backup scenarios, and also when you have two databases in one mysqld, having a certain similarity and you want one db to be updated when the other is (some sort of trigger). Plus small fix for BUG#3568 "MySQL server crashes when built --with-debug and CHANGE MASTER +MASTER_POS_WAIT" sql/mysqld.cc: new option --replicate-same-server-id sql/slave.cc: new option replicate_same_server_id, to force a slave to execute its own queries. Small fix for BUG#3568 "MySQL server crashes when built --with-debug and CHANGE MASTER +MASTER_POS_WAIT" sql/slave.h: new option --replicate-same-server-id
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 671a78f6bfd..1bb76363d38 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2379,6 +2379,15 @@ Warning: you need to use --log-bin to make --log-slave-updates work. \
Now disabling --log-slave-updates.");
}
+ if (opt_log_slave_updates && replicate_same_server_id)
+ {
+ sql_print_error("\
+Error: using --replicate-same-server-id in conjunction with \
+--log-slave-updates is impossible, it would lead to infinite loops in this \
+server.");
+ unireg_abort(1);
+ }
+
if (opt_bootstrap)
{
int error=bootstrap(stdin);
@@ -3203,7 +3212,7 @@ enum options_mysqld {
OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE,
OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE,
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
- OPT_REPLICATE_WILD_IGNORE_TABLE,
+ OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
OPT_DISCONNECT_SLAVE_EVENT_COUNT,
OPT_ABORT_SLAVE_EVENT_COUNT,
OPT_INNODB_DATA_HOME_DIR,
@@ -3613,6 +3622,13 @@ Does nothing yet.",
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
"Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
+ "In replication, if set to 1, do not skip events having our server id. \
+Default value is 0 (to break infinite loops in circular replication). \
+Can't be set to 1 if --log-slave-updates is used.",
+ (gptr*) &replicate_same_server_id,
+ (gptr*) &replicate_same_server_id,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
// In replication, we may need to tell the other servers how to connect
{"report-host", OPT_REPORT_HOST,
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.",