summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-07-08 15:50:57 +0200
committerunknown <guilhem@mysql.com>2003-07-08 15:50:57 +0200
commiteed62d993d1355c5e84c0b0b17d417e84086c526 (patch)
treed6d1b47fdfb1347291fbac6ff6ad5ebd8659687c /sql
parentd0486f8abce9e241103acb33ac4f82f11e2b76c4 (diff)
downloadmariadb-git-eed62d993d1355c5e84c0b0b17d417e84086c526.tar.gz
Fix for
BUG#797 "If query ignored on slave (replicate-ignore-table) the slave still checks if the returned error (0) is the same as the one on the master, whereas it shouldn't test this. Plus a new test for BUG#797. include/mysqld_error.h: New error code (can be sent only to the slave thread, not to normal clients). sql/log.cc: removed comment from a previous debugging. sql/log_event.cc: ER_SLAVE_IGNORED_TABLE is an ignorable error. sql/share/czech/errmsg.txt: for BUG#797 sql/share/danish/errmsg.txt: for BUG#797 sql/share/dutch/errmsg.txt: for BUG#797 sql/share/english/errmsg.txt: for BUG#797 sql/share/estonian/errmsg.txt: for BUG#797 sql/share/french/errmsg.txt: for BUG#797 sql/share/german/errmsg.txt: for BUG#797 sql/share/greek/errmsg.txt: for BUG#797 sql/share/hungarian/errmsg.txt: for BUG#797 sql/share/italian/errmsg.txt: for BUG#797 sql/share/japanese/errmsg.txt: for BUG#797 sql/share/korean/errmsg.txt: for BUG#797 sql/share/norwegian-ny/errmsg.txt: for BUG#797 sql/share/norwegian/errmsg.txt: for BUG#797 sql/share/polish/errmsg.txt: for BUG#797 sql/share/portuguese/errmsg.txt: for BUG#797 sql/share/romanian/errmsg.txt: for BUG#797 sql/share/russian/errmsg.txt: for BUG#797 sql/share/slovak/errmsg.txt: for BUG#797 sql/share/spanish/errmsg.txt: for BUG#797 sql/share/swedish/errmsg.txt: for BUG#797 sql/share/ukrainian/errmsg.txt: for BUG#797 sql/sql_parse.cc: when in sql_parse in the slave thread we ignore the query because of replicate-do and replicate-ignore options, we return a specific error to the slave thread, so that it knows that the query has been ignored (which is different from a successful query). A small cleanup (test was done twice).
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc11
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/share/czech/errmsg.txt1
-rw-r--r--sql/share/danish/errmsg.txt1
-rw-r--r--sql/share/dutch/errmsg.txt1
-rw-r--r--sql/share/english/errmsg.txt1
-rw-r--r--sql/share/estonian/errmsg.txt1
-rw-r--r--sql/share/french/errmsg.txt1
-rw-r--r--sql/share/german/errmsg.txt1
-rw-r--r--sql/share/greek/errmsg.txt1
-rw-r--r--sql/share/hungarian/errmsg.txt1
-rw-r--r--sql/share/italian/errmsg.txt1
-rw-r--r--sql/share/japanese/errmsg.txt1
-rw-r--r--sql/share/korean/errmsg.txt1
-rw-r--r--sql/share/norwegian-ny/errmsg.txt1
-rw-r--r--sql/share/norwegian/errmsg.txt1
-rw-r--r--sql/share/polish/errmsg.txt1
-rw-r--r--sql/share/portuguese/errmsg.txt1
-rw-r--r--sql/share/romanian/errmsg.txt1
-rw-r--r--sql/share/russian/errmsg.txt1
-rw-r--r--sql/share/slovak/errmsg.txt1
-rw-r--r--sql/share/spanish/errmsg.txt1
-rw-r--r--sql/share/swedish/errmsg.txt1
-rw-r--r--sql/share/ukrainian/errmsg.txt1
-rw-r--r--sql/sql_parse.cc18
25 files changed, 38 insertions, 16 deletions
diff --git a/sql/log.cc b/sql/log.cc
index ef7cdd0dbd5..7bcdc12ddf1 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -875,14 +875,9 @@ void MYSQL_LOG::new_file(bool need_lock)
save_log_type=log_type;
name=0; // Don't free name
close();
-/*
- if (save_log_type == LOG_BIN)
- {
- printf("after close, before open; I wait for 20 seconds\n");
- sleep(20);
- printf("sleep finished, opening\n");
- }
-*/
+
+ // TODO: at this place is_open() will see the log closed, which is BUG#791.
+
open(old_name, save_log_type, new_name_ptr, index_file_name, io_cache_type,
no_auto_events, max_size);
my_free(old_name,MYF(0));
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5f3d4263642..a6d2abbf894 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -69,7 +69,8 @@ static void pretty_print_str(FILE* file, char* str, int len)
inline int ignored_error_code(int err_code)
{
- return use_slave_mask && bitmap_is_set(&slave_error_mask, err_code);
+ return ((err_code == ER_SLAVE_IGNORED_TABLE) ||
+ (use_slave_mask && bitmap_is_set(&slave_error_mask, err_code)));
}
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index f5e879679cc..72a593cf5f7 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -247,3 +247,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 13c061d50a1..f59abfeb6da 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -241,3 +241,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 45dbd663fec..974b4601ac8 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -249,3 +249,4 @@
"Foutieve toepassing/plaatsing van '%s'",
"Deze versie van MySQL ondersteunt nog geen '%s'",
"Kreeg fatale fout %d: '%-.128s' van master tijdens lezen van data uit binaire log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index b7910bd07b3..3d7ca3b28df 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -238,3 +238,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index c1b98d12b3a..38b45c1443b 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -243,3 +243,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 242343769e6..df2be2803b4 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -238,3 +238,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 10ec359abe8..cdeab579eca 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -241,3 +241,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 11534d9e11b..e3778aaac10 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -238,3 +238,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index f8c5dbcc836..85ea5c2e742 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -240,3 +240,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index a82b0cdf18f..3be8058661a 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -238,3 +238,4 @@
"Uso/posizione di '%s' sbagliato",
"Questa versione di MySQL non supporta ancora '%s'",
"Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 1b04ee5c2e4..f99d262a689 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -240,3 +240,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index c57723f81e6..2a7e03b026d 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -238,3 +238,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index e331854ff68..e6ec84e98a0 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -240,3 +240,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 817eec3058d..fe379261151 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -240,3 +240,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index e5bede3b48c..a300dc1e2ab 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -242,3 +242,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index ea4f85f6b03..f9f37bfd924 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -238,3 +238,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 7fc0c182f6a..bf1306cd332 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -242,3 +242,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index fc090205041..03964efb26b 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -240,3 +240,4 @@
"Неверное использование или в неверном месте указан '%s'",
"Эта версия MySQL пока еще не поддерживает '%s'",
"Получена неисправимая ошибка %d: '%-.128s' от головного сервера в процессе выборки данных из двоичного журнала",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 89a000db554..b9970465871 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -246,3 +246,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index c8e33325786..78b7e5ac907 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -239,3 +239,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 7ef663839c9..32eec834ed1 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -238,3 +238,4 @@
"Fel anvДnding/placering av '%s'",
"Denna version av MySQL kan Дnnu inte utfЖra '%s'",
"Fick fatalt fel %d: '%-.128s' frЕn master vid lДsning av binДrloggen"
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index a0a4a274d4b..c0931ab9f02 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -243,3 +243,4 @@
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Slave SQL thread ignored the query because of replicate-*-table rules"
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4db802ffbcc..7e2aefc493d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1324,7 +1324,11 @@ mysql_execute_command(void)
given and the table list says the query should not be replicated
*/
if (table_rules_on && tables && !tables_ok(thd,tables))
+ {
+ /* we warn the slave SQL thread */
+ my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
DBUG_VOID_RETURN;
+ }
#ifndef TO_BE_DELETED
/*
This is a workaround to deal with the shortcoming in 3.23.44-3.23.46
@@ -1339,13 +1343,7 @@ mysql_execute_command(void)
#endif
}
- /*
- Skip if we are in the slave thread, some table rules have been given
- and the table list says the query should not be replicated
- */
- if ((lex->select_lex.next && create_total_list(thd,lex,&tables)) ||
- (table_rules_on && tables && thd->slave_thread &&
- !tables_ok(thd,tables)))
+ if (lex->select_lex.next && create_total_list(thd,lex,&tables))
DBUG_VOID_RETURN;
/*
@@ -2330,7 +2328,10 @@ mysql_execute_command(void)
if (thd->slave_thread &&
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name)))
+ {
+ my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
break;
+ }
if (check_access(thd,CREATE_ACL,lex->name,0,1))
break;
@@ -2354,7 +2355,10 @@ mysql_execute_command(void)
if (thd->slave_thread &&
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name)))
+ {
+ my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
break;
+ }
if (check_access(thd,DROP_ACL,lex->name,0,1))
break;
if (thd->locked_tables || thd->active_transaction())