summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-25 22:38:53 +0200
committerunknown <monty@donna.mysql.com>2001-01-25 22:38:53 +0200
commit002b51000fcec9ff8c45afe12ddd3728f6035ff0 (patch)
treee4dc09a7c816c372ba7388b1bece80f8b7d0e815 /sql
parentc6a67ce9dc3b3ec5b9055d158c7c41d35db4fb50 (diff)
parentb302ee39bc8e5f26f3fe95b47a3f42ad11cc5f40 (diff)
downloadmariadb-git-002b51000fcec9ff8c45afe12ddd3728f6035ff0.tar.gz
Merge work:/my/mysql into donna.mysql.com:/home/my/bk/mysql
Docs/manual.texi: Auto merged sql/slave.cc: Auto merged sql/sql_repl.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/gen_lex_hash.cc4
-rw-r--r--sql/lex.h1
-rw-r--r--sql/log.cc18
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/share/czech/errmsg.txt5
-rw-r--r--sql/share/danish/errmsg.txt5
-rw-r--r--sql/share/dutch/errmsg.txt5
-rw-r--r--sql/share/english/errmsg.txt7
-rw-r--r--sql/share/estonian/errmsg.txt5
-rw-r--r--sql/share/french/errmsg.txt5
-rw-r--r--sql/share/german/errmsg.txt5
-rw-r--r--sql/share/greek/errmsg.txt5
-rw-r--r--sql/share/hungarian/errmsg.txt5
-rw-r--r--sql/share/italian/errmsg.txt5
-rw-r--r--sql/share/japanese/errmsg.txt5
-rw-r--r--sql/share/korean/errmsg.txt5
-rw-r--r--sql/share/norwegian-ny/errmsg.txt5
-rw-r--r--sql/share/norwegian/errmsg.txt5
-rw-r--r--sql/share/polish/errmsg.txt5
-rw-r--r--sql/share/portuguese/errmsg.txt5
-rw-r--r--sql/share/romanian/errmsg.txt5
-rw-r--r--sql/share/russian/errmsg.txt23
-rw-r--r--sql/share/slovak/errmsg.txt5
-rw-r--r--sql/share/spanish/errmsg.txt5
-rw-r--r--sql/share/swedish/errmsg.txt5
-rw-r--r--sql/slave.cc45
-rw-r--r--sql/slave.h5
-rw-r--r--sql/sql_repl.cc24
-rw-r--r--sql/sql_yacc.yy11
29 files changed, 200 insertions, 40 deletions
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index efaf7411c55..78ffb266366 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -472,8 +472,8 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
- start_value=4424889L; best_t1=3207460L; best_t2=481534L; best_type=0; /* mode=4451 add=8 type: 0 */
- if (get_options(argc,(char **) argv))
+ start_value=5315771L; best_t1=6916833L; best_t2=3813748L; best_type=3; /* mode=5839 add=5 type: 0 */
+ if (get_options(argc,(char **) argv))
exit(1);
make_max_length_table();
diff --git a/sql/lex.h b/sql/lex.h
index 946cba49bce..6f030aa524d 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -283,6 +283,7 @@ static SYMBOL symbols[] = {
{ "SQL_QUOTE_SHOW_CREATE",SYM(SQL_QUOTE_SHOW_CREATE), 0, 0},
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
+ { "SQL_SLAVE_SKIP_COUNTER", SYM(SQL_SLAVE_SKIP_COUNTER),0,0},
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
{ "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
diff --git a/sql/log.cc b/sql/log.cc
index 5ce9a7a4deb..80001acacd2 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -28,6 +28,7 @@
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
+extern ulong max_binlog_size;
static bool test_if_number(const char *str,
long *res, bool allow_wildcards);
@@ -609,6 +610,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
{
/* In most cases this is only called if 'is_open()' is true */
bool error=0;
+ bool should_rotate = 0;
+
if (!inited) // Can't use mutex if not init
return 0;
VOID(pthread_mutex_lock(&LOCK_log));
@@ -655,7 +658,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
file == &log_file && flush_io_cache(file))
goto err;
error=0;
-
+ should_rotate = (file == &log_file && my_b_tell(file) >= max_binlog_size);
err:
if (error)
{
@@ -669,6 +672,8 @@ err:
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
VOID(pthread_mutex_unlock(&LOCK_log));
+ if(should_rotate)
+ new_file();
return error;
}
@@ -682,6 +687,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
{
VOID(pthread_mutex_lock(&LOCK_log));
bool error=1;
+
if (is_open())
{
uint length;
@@ -722,7 +728,8 @@ err:
else
VOID(pthread_cond_broadcast(&COND_binlog_update));
- VOID(pthread_mutex_unlock(&LOCK_log));
+ VOID(pthread_mutex_unlock(&LOCK_log));
+
return error;
}
@@ -730,6 +737,8 @@ err:
bool MYSQL_LOG::write(Load_log_event* event_info)
{
bool error=0;
+ bool should_rotate = 0;
+
if (inited)
{
VOID(pthread_mutex_lock(&LOCK_log));
@@ -745,11 +754,16 @@ bool MYSQL_LOG::write(Load_log_event* event_info)
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
error=write_error=1;
}
+ should_rotate = (my_b_tell(&log_file) >= max_binlog_size);
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
}
VOID(pthread_mutex_unlock(&LOCK_log));
}
+
+ if(should_rotate)
+ new_file();
+
return error;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 62ee256b9da..0033c795f0f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -238,7 +238,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
query_buff_size, lower_case_table_names, mysqld_net_retry_count,
net_interactive_timeout, slow_launch_time = 2L,
net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
- open_files_limit=0;
+ open_files_limit=0, max_binlog_size;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
volatile ulong cached_thread_count=0;
@@ -2571,6 +2571,8 @@ CHANGEABLE_VAR changeable_vars[] = {
1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
+ { "max_binlog_size", (long*) &max_binlog_size,
+ 1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1 },
{ "max_connections", (long*) &max_connections,
100, 1, 16384, 0, 1 },
{ "max_connect_errors", (long*) &max_connect_errors,
@@ -2672,7 +2674,8 @@ struct show_var_st init_vars[]= {
{"low_priority_updates", (char*) &low_priority_updates, SHOW_BOOL},
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG},
{"max_allowed_packet", (char*) &max_allowed_packet, SHOW_LONG},
- {"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
+ {"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
+ {"max_binlog_size", (char*) &max_binlog_size, SHOW_LONG},
{"max_connections", (char*) &max_connections, SHOW_LONG},
{"max_connect_errors", (char*) &max_connect_errors, SHOW_LONG},
{"max_delayed_threads", (char*) &max_insert_delayed_threads, SHOW_LONG},
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index c10d59dc21c..319d8a88149 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -208,3 +208,8 @@
"Tabulka '%-.64s' je ozna-BХena jako poru╧enА a poslednМ (automatickА?) oprava se nezdaЬila",-A
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 79d7ae5efc4..43aad2f71e4 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -202,3 +202,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 1cfdbee8d43..86d8e095d20 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 4900e4bd7ad..e11a182c6b7 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -187,7 +187,7 @@
"Got error %d during CHECKPOINT",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",
"The handler for the table does not support binary table dump",
-"Binlog closed while trying to FLUSH MASTER",
+"Binlog closed, cannot RESET MASTER",
"Failed rebuilding the index of dumped table '%-.64s'",
"Error from master: '%-.64s'",
"Net error reading from master",
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index cb609f66432..227b6336562 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 0e1b9cf8e01..594da49c32e 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 4d36544fedc..621cef7affa 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -202,3 +202,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index eb43678ddcf..0be996a0e8a 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index eacc8a967a9..20e1af723fa 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index f5e333696cf..699ab815e2a 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -199,3 +199,8 @@
"La tabella '%-.64s' e' segnalata come rovinata e l'ultima ricostruzione (automatica?) e' fallita",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 4b7a3fd30e1..04b411239ae 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index d772f8c46d5..e1efb0c15ae 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index d6c29026c0b..5484b58425e 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 4d0c1ef87f0..4db4af5457f 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index a77f64b8b37..5e90cf05b8e 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 946a64df5d0..1cd257e9ab1 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 7c325b9c662..cc453ff4dfc 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index 7a83573e0ff..d3564e5ef5b 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -179,7 +179,7 @@
"Результат содержит больше одной строки",
"Таблица этого типа обязана иметь PRIMARY KEY",
"Эта копия MySQL скомпилирована без поддержки RAID",
-"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column",
+"MySQL работает в режиме защиты от дураков (safe_mode) - не могу UPDATE без WHERE с каким-небудь KEY",
"Индекс '%-.64s' не найден в таблице '%-.64s'",
"Не могу открыть таблицу",
"Данный тип таблиц не поддерживает check/repair",
@@ -190,15 +190,20 @@
"Ошибка %d во время CHECKPOINT",
"Прерванное соединение %ld к базе данных: '%-.64s' пользователь: '%-.32s' хост: `%-.64s' (%-.64s)",
"Этот тип таблиц не поддерживает binary table dump",
-"Binlog closed while trying to FLUSH MASTER",
-"Failed rebuilding the index of dumped table '%-.64s'",
-"Error from master: '%-.64s'",
-"Net error reading from master",
-"Net error writing to master",
+"Репликационный лог закрыт, не могу сделать RESET MASTER",
+"Ошибка при восстановлении индекса перекачанной таблицы '%-.64s'",
+"Ошибка на мастере: '%-.64s'",
+"Сетевая ошибка при чтении с мастера",
+"Сетевая ошибка при писании мастеру",
"FULLTEXT индекс, соответствующий заданному списку столбцов, не найден",
-"Can't execute the given command because you have active locked tables or an active transaction",
+"Не могу выполнить комманду из-за активных locked таблиц или активной транзакции",
"Неизвестная системная переменная '%-.64'",
"Таблица '%-.64s' помечена как испорченная и должна быть исправлена",
"Таблица '%-.64s' помечена как испорченная и последняя попытка исправления (автоматическая?) не удалась",
-"Warning: Some non-transactional changed tables couldn't be rolled back",
-"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"Предупреждение: некоторые нетранзакционные таблицы не подчиняются ROLLBACK",
+"Многозапросная транзакция требует увеличения 'max_binlog_cache_size' - увеличте эту переменную и попробуйте еще раз",
+"Эта операция невозможна с активным slave, надо SLAVE STOP",
+"Эта операция невозможна с пассивным slave, надо SLAVE START",
+"Этот сервер не slave, исправьте в конфигурационном файле или коммандой CHANGE MASTER TO",
+"Не получилось инициализировать структуру master info, проверте persmissions на файле master.info",
+"Не могу создать процесс SLAVE, проверьте системные ресурсы",
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 774047be656..47d51506019 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -207,3 +207,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 0003e435183..6fc6451c0da 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -200,3 +200,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index ee3d913e51a..a47bdf7428e 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -199,3 +199,8 @@
"Tabell '%-.64s' Дr crashad och senast (automatiska?) reparation misslyckades",
"Warning: NЕgra icke transaktionella tabeller kunde inte ЕterstДllas vid ROLLBACK",
"Transaktionen krДvde mera Дn 'max_binlog_cache_size' minne. UtЖka denna mysqld variabel och fЖrsЖk pЕ nytt",
+"This operation cannot be performed with a running slave, run SLAVE STOP first",
+"This operation requires a running slave, configure slave and do SLAVE START",
+"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
+"Could not initialize master info structure, check permisions on master.info",
+"Could not create slave thread, check system resources",
diff --git a/sql/slave.cc b/sql/slave.cc
index 38c0b5afb9f..22d76c54ecd 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -34,10 +34,13 @@ DYNAMIC_ARRAY replicate_wild_do_table, replicate_wild_ignore_table;
bool do_table_inited = 0, ignore_table_inited = 0;
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
bool table_rules_on = 0;
-
+uint32 slave_skip_counter = 0;
+static TABLE* save_temporary_tables = 0;
// when slave thread exits, we need to remember the temporary tables so we
// can re-use them on slave start
-static TABLE* save_temporary_tables = 0;
+
+static int last_slave_errno = 0;
+static char last_slave_error[1024] = "";
#ifndef DBUG_OFF
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
static int events_till_disconnect = -1, events_till_abort = -1;
@@ -506,14 +509,14 @@ int init_master_info(MASTER_INFO* mi)
return 1;
}
- if (!(length=my_b_gets(&mi->file, mi->log_file_name,
- sizeof(mi->log_file_name))))
+ if ((length=my_b_gets(&mi->file, mi->log_file_name,
+ sizeof(mi->log_file_name))) < 1)
{
msg="Error reading log file name from master info file ";
goto error;
}
- mi->log_file_name[length]= 0; // kill \n
+ mi->log_file_name[length-1]= 0; // kill \n
char buf[FN_REFLEN];
if(!my_b_gets(&mi->file, buf, sizeof(buf)))
{
@@ -570,6 +573,9 @@ int show_master_info(THD* thd)
field_list.push_back(new Item_empty_string("Slave_Running", 3));
field_list.push_back(new Item_empty_string("Replicate_do_db", 20));
field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20));
+ field_list.push_back(new Item_empty_string("Last_errno", 4));
+ field_list.push_back(new Item_empty_string("Last_error", 20));
+ field_list.push_back(new Item_empty_string("Skip_counter", 12));
if(send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
@@ -589,6 +595,9 @@ int show_master_info(THD* thd)
pthread_mutex_unlock(&LOCK_slave);
net_store_data(packet, &replicate_do_db);
net_store_data(packet, &replicate_ignore_db);
+ net_store_data(packet, (uint32)last_slave_errno);
+ net_store_data(packet, last_slave_error);
+ net_store_data(packet, slave_skip_counter);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
@@ -833,13 +842,14 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
if (ev)
{
int type_code = ev->get_type_code();
- if (ev->server_id == ::server_id)
+ if (ev->server_id == ::server_id || slave_skip_counter)
{
if(type_code == LOAD_EVENT)
skip_load_data_infile(net);
mi->inc_pos(event_len);
flush_master_info(mi);
+ --slave_skip_counter;
delete ev;
return 0; // avoid infinite update loops
}
@@ -853,6 +863,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
Query_log_event* qev = (Query_log_event*)ev;
int q_len = qev->q_len;
+ int expected_error,actual_error = 0;
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)qev->db);
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
@@ -869,19 +880,22 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->net.last_error[0] = 0;
thd->slave_proxy_id = qev->thread_id; // for temp tables
mysql_parse(thd, thd->query, q_len);
- int expected_error,actual_error;
if ((expected_error = qev->error_code) !=
(actual_error = thd->net.last_errno) && expected_error)
{
- sql_print_error("Slave: did not get the expected error\
- running query from master - expected: '%s', got '%s'",
- ER(expected_error),
- actual_error ? ER(actual_error):"no error"
+ const char* errmsg = "Slave: did not get the expected error\
+ running query from master - expected: '%s', got '%s'";
+ sql_print_error(errmsg, ER(expected_error),
+ actual_error ? thd->net.last_error:"no error"
);
thd->query_error = 1;
}
else if (expected_error == actual_error)
- thd->query_error = 0;
+ {
+ thd->query_error = 0;
+ *last_slave_error = 0;
+ last_slave_errno = 0;
+ }
}
thd->db = 0; // prevent db from being freed
thd->query = 0; // just to be sure
@@ -893,6 +907,13 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
sql_print_error("Slave: error running query '%s' ",
qev->query);
+ last_slave_errno = actual_error ? actual_error : -1;
+ my_snprintf(last_slave_error, sizeof(last_slave_error),
+ "error '%s' on query '%s'",
+ actual_error ? thd->net.last_error :
+ "unexpected success or fatal error",
+ qev->query
+ );
free_root(&thd->mem_root,0);
delete ev;
return 1;
diff --git a/sql/slave.h b/sql/slave.h
index b7e2d783749..11c01a9fa03 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -93,6 +93,11 @@ extern bool opt_log_slave_updates ;
pthread_handler_decl(handle_slave,arg);
extern bool volatile abort_loop, abort_slave;
extern bool slave_running;
+extern uint32 slave_skip_counter;
+// needed for problems when slave stops and
+// we want to restart it skipping one or more events in the master log that
+// have caused errors, and have been manually applied by DBA already
+
extern pthread_t slave_real_id;
extern MASTER_INFO glob_mi;
extern HASH replicate_do_table, replicate_ignore_table;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index be2a8a7111e..4f0112bac26 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -519,34 +519,34 @@ int start_slave(THD* thd , bool net_report)
{
if(!thd) thd = current_thd;
NET* net = &thd->net;
- const char* err = 0;
+ int slave_errno = 0;
if (check_access(thd, PROCESS_ACL, any_db))
return 1;
pthread_mutex_lock(&LOCK_slave);
if(!slave_running)
{
if(init_master_info(&glob_mi))
- err = "Could not initialize master info";
+ slave_errno = ER_MASTER_INFO;
else if(server_id_supplied && *glob_mi.host)
{
pthread_t hThread;
if(pthread_create(&hThread, &connection_attrib, handle_slave, 0))
{
- err = "cannot create slave thread";
+ slave_errno = ER_SLAVE_THREAD;
}
while(!slave_running) // slave might already be running by now
pthread_cond_wait(&COND_slave_start, &LOCK_slave);
}
else
- err = "Master host not set, or server id not configured";
+ slave_errno = ER_BAD_SLAVE;
}
else
- err = "Slave already running";
+ slave_errno = ER_SLAVE_MUST_STOP;
pthread_mutex_unlock(&LOCK_slave);
- if(err)
+ if(slave_errno)
{
- if(net_report) send_error(net, 0, err);
+ if(net_report) send_error(net, slave_errno);
return 1;
}
else if(net_report)
@@ -559,8 +559,8 @@ int stop_slave(THD* thd, bool net_report )
{
if(!thd) thd = current_thd;
NET* net = &thd->net;
- const char* err = 0;
-
+ int slave_errno = 0;
+
if (check_access(thd, PROCESS_ACL, any_db))
return 1;
@@ -576,14 +576,14 @@ int stop_slave(THD* thd, bool net_report )
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
}
else
- err = "Slave is not running";
+ slave_errno = ER_SLAVE_NOT_RUNNING;
pthread_mutex_unlock(&LOCK_slave);
thd->proc_info = 0;
- if(err)
+ if(slave_errno)
{
- if(net_report) send_error(net, 0, err);
+ if(net_report) send_error(net, slave_errno);
return 1;
}
else if(net_report)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index dd1fb916bad..fa4edf23a5f 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -22,6 +22,7 @@
#define YYMAXDEPTH 3200 /* Because of 64K stack */
#define Lex current_lex
#include "mysql_priv.h"
+#include "slave.h"
#include "sql_acl.h"
#include "lex_symbol.h"
#include <myisam.h>
@@ -408,6 +409,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SQL_AUTO_IS_NULL
%token SQL_SAFE_UPDATES
%token SQL_QUOTE_SHOW_CREATE
+%token SQL_SLAVE_SKIP_COUNTER
%left SET_VAR
%left OR_OR_CONCAT OR
@@ -2662,6 +2664,15 @@ option_value:
if (item->fix_fields(current_thd,0) || item->update())
YYABORT;
}
+ | SQL_SLAVE_SKIP_COUNTER equal ULONG_NUM
+ {
+ pthread_mutex_lock(&LOCK_slave);
+ if(slave_running)
+ send_error(&current_thd->net, ER_SLAVE_MUST_STOP);
+ else
+ slave_skip_counter = $3;
+ pthread_mutex_unlock(&LOCK_slave);
+ }
text_or_password:
TEXT_STRING { $$=$1.str;}