# ==== Purpose ====
#
# Diff the output of a statement on all configured servers (usually
# master and slave).
#
#
# ==== Usage =====
#
# --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100
# [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>]
# --source include/rpl_diff.inc
#
# Parameters:
# $rpl_diff_statement
# Statement to check. For each compared server, this script will
# start a new client and pass this statement to the client.
# Note: This string will be evaluated as a single-quote-escaped
# SQL stringand hence must be quoted as such. In particular, any
# single quotes in this string must be escaped.
#
# $rpl_diff_servers
# By default, this file compares all servers configured by
# rpl_init.inc. You can set$diff_serversto a comma-separated
# list of numbers: only the servers identified by these numbers
# will be compared.
#
# $rpl_diff_database
# By default, the statement will be executed on the database
# 'test'. If$rpl_diff_databaseisset, the statement will be
# executed on the database named $rpl_diff_database instead.
if (!$rpl_diff_statement)
{
--die ERROR IN TEST: you must set$rpl_diff_statement before you source include/rpl_diff.inc
}
# Sync.
--source include/rpl_sync.inc
# Get database name.
--let $_rpl_diff_database= $rpl_diff_database if (!$_rpl_diff_database)
{
--let $_rpl_diff_database= test
}
# Generate list of servers.
--let $_rpl_diff_servers= $rpl_diff_servers if (!$_rpl_diff_servers)
{
--let $_rpl_server_i= $rpl_server_count
--let $_rpl_diff_servers= while ($_rpl_server_i)
{
--let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers
--dec $_rpl_server_i
}
} if ($rpl_debug)
{
--echo \$rpl_diff_servers= '$_rpl_diff_servers'
}
if (!$rpl_debug)
{
--disable_query_log
}
# Generate file containing $rpl_diff_statement. We don't pass the
# statement on the command line, because it would be subject to shell
# substitutions.
--let $write_to_file= GENERATE
--let $write_var= $rpl_diff_statement
--source include/write_var_to_file.inc
--let $_rpl_diff_statement_file= $write_to_file
# Compare all servers.
--let $_rpl_diff_first= 1 while ($_rpl_diff_servers)
{
# Set$_rpl_diff_server_i to the first number in the list
--let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX('$_rpl_diff_servers', ',', 1)`
# Remove $_rpl_diff_server_i from the list
--let $_rpl_diff_servers= `SELECT SUBSTRING('$_rpl_diff_servers', LENGTH('$_rpl_diff_server_i') + 2)`
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.