Commit e9067935 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

Merge heikki@work.mysql.com:/home/my/mysql

into donna.mysql.fi:/home/heikki/mysqlf
parents dc1cc4f7 b66f304f
...@@ -4741,7 +4741,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. ...@@ -4741,7 +4741,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}.
@c Added 20000925 @c Added 20000925
@image{Flags/usa} USA [ValueClick, Los Angeles CA] @ @image{Flags/usa} USA [ValueClick, Los Angeles CA] @
@uref{http://mysql.valueclick.com/, WWW} @uref{http://mysql.valueclick.com/, WWW}
@uref{ftp://mysql.valueclick.com/mysql/, FTP} @uref{ftp://mysql.valueclick.com/pub/mysql/Downloads/, FTP}
@c @item @c @item
@c Not ok 20000919; Non-existent (Matt) @c Not ok 20000919; Non-existent (Matt)
...@@ -10531,6 +10531,9 @@ Run @code{mysqld} daemon as user @code{user_name}. This option is ...@@ -10531,6 +10531,9 @@ Run @code{mysqld} daemon as user @code{user_name}. This option is
@item -V, --version @item -V, --version
Output version information and exit. Output version information and exit.
@item -W, --warnings
Print out warnings like @code{Aborted connection...} to the @code{.err} file.
@xref{Communication errors}.
@end table @end table
@cindex default options @cindex default options
...@@ -25795,8 +25798,8 @@ in its own lock table and rolls back the transaction. If you use ...@@ -25795,8 +25798,8 @@ in its own lock table and rolls back the transaction. If you use
than InnoDB in the same transaction, then a deadlock may arise which than InnoDB in the same transaction, then a deadlock may arise which
InnoDB cannot notice. In cases like this the timeout is useful to InnoDB cannot notice. In cases like this the timeout is useful to
resolve the situation. resolve the situation.
@item @code{innodb_unix_file_flush_method} @tab @item @code{innodb_flush_method} @tab
(Available from 3.23.39 up.) (Available from 3.23.40 up.)
The default value for this is @code{fdatasync}. The default value for this is @code{fdatasync}.
Another option is @code{O_DSYNC}. Another option is @code{O_DSYNC}.
Options @code{littlesync} and @code{nosync} have the Options @code{littlesync} and @code{nosync} have the
...@@ -26406,7 +26409,7 @@ In some versions of Linux and Unix, flushing files to disk with the Unix ...@@ -26406,7 +26409,7 @@ In some versions of Linux and Unix, flushing files to disk with the Unix
@code{fdatasync} and other similar methods is surprisingly slow. @code{fdatasync} and other similar methods is surprisingly slow.
The default method InnoDB uses is the @code{fdatasync} function. The default method InnoDB uses is the @code{fdatasync} function.
If you are not satisfied with the database write performance, you may If you are not satisfied with the database write performance, you may
try setting @code{innodb_unix_file_flush_method} in @file{my.cnf} try setting @code{innodb_flush_method} in @file{my.cnf}
to @code{O_DSYNC}, though O_DSYNC seems to be slower on most systems. to @code{O_DSYNC}, though O_DSYNC seems to be slower on most systems.
You can also try setting it to @code{littlesync}, which means that You can also try setting it to @code{littlesync}, which means that
InnoDB does not call the file flush for every write it does to a InnoDB does not call the file flush for every write it does to a
...@@ -38212,6 +38215,9 @@ option. ...@@ -38212,6 +38215,9 @@ option.
@node Communication errors, Full table, Packet too large, Common errors @node Communication errors, Full table, Packet too large, Common errors
@subsection Communication Errors / Aborted Connection @subsection Communication Errors / Aborted Connection
Starting with @code{MySQL 3.23.40} you only get the @code{Aborted
connection} error of you start @code{mysqld} with @code{--warnings}.
If you find errors like the following in your error log. If you find errors like the following in your error log.
@example @example
...@@ -46298,6 +46304,16 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -46298,6 +46304,16 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
Added support for symbolic links to @code{MyISAM} tables. Symlink handling is Added support for symbolic links to @code{MyISAM} tables. Symlink handling is
now enabled by default for Windows. now enabled by default for Windows.
@item @item
@code{LOAD DATA FROM MASTER} "auto-magically" sets up a slave.
@item
A new @code{HANDLER} interface to @code{MyISAM} tables.
@item
@code{COUNT(DISTINCT)} is about 30% faster.
@item
Creating full text indexes are now much faster.
@item
Searching on packed (@code{CHAR}/@code{VARCHAR}) keys are now much faster.
@item
Added @code{SQL_CALC_FOUND_ROWS} and @code{FOUND_ROWS()}. This makes it Added @code{SQL_CALC_FOUND_ROWS} and @code{FOUND_ROWS()}. This makes it
possible to know how many rows a query would have returned possible to know how many rows a query would have returned
without a @code{LIMIT} clause. without a @code{LIMIT} clause.
...@@ -46406,6 +46422,15 @@ not yet 100% confident in this code. ...@@ -46406,6 +46422,15 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.40 @appendixsubsec Changes in release 3.23.40
@itemize @bullet @itemize @bullet
@item @item
Added option @code{--warnings} to @code{mysqld}. Now @code{mysqld}
only prints the error @code{Aborted connection} if this option is used.
@item
Fixed problem with @code{SHOW CREATE TABLE} when you didn't have a
@code{PRIMARY KEY}.
@item
Fixed properly the rename of @code{innodb_unix_file_flush_method} to
@code{innodb_flush_method}.
@item
Fixed bug when converting @code{UNSIGNED BIGINT} to @code{DOUBLE}. This caused Fixed bug when converting @code{UNSIGNED BIGINT} to @code{DOUBLE}. This caused
a problem when doing comparisons with @code{BIGINT}'s outside of the a problem when doing comparisons with @code{BIGINT}'s outside of the
signed range. signed range.
...@@ -208,4 +208,6 @@ ...@@ -208,4 +208,6 @@
#define ER_LOCK_WAIT_TIMEOUT 1205 #define ER_LOCK_WAIT_TIMEOUT 1205
#define ER_LOCK_TABLE_FULL 1206 #define ER_LOCK_TABLE_FULL 1206
#define ER_READ_ONLY_TRANSACTION 1207 #define ER_READ_ONLY_TRANSACTION 1207
#define ER_ERROR_MESSAGES 208 #define ER_DROP_DB_WITH_READ_LOCK 1208
#define ER_CREATE_DB_WITH_READ_LOCK 1209
#define ER_ERROR_MESSAGES 210
n n
1 1
n
4
Database
foo
mysql
test
Database
mysql
test
...@@ -80,3 +80,13 @@ t1 CREATE TABLE `t1` ( ...@@ -80,3 +80,13 @@ t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '', `test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' `name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table' ) TYPE=MyISAM COMMENT='it''s a table'
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
UNIQUE KEY `aa` (`a`)
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) TYPE=MyISAM
...@@ -10,3 +10,34 @@ insert into t1 values(2); ...@@ -10,3 +10,34 @@ insert into t1 values(2);
create table t1(n int); create table t1(n int);
drop table t1; drop table t1;
select * from t1; select * from t1;
#now test for a bug in drop database - it is important that the name
#of the table is the same as the name of the database - in the original
#code this triggered a bug
drop database if exists foo;
create database foo;
drop database if exists foo;
create database foo;
create table foo.foo (n int);
insert into foo.foo values (4);
select * from foo.foo;
drop database if exists foo;
create database foo;
drop database foo;
# test drop/create database and FLUSH TABLES WITH READ LOCK
drop database if exists foo;
flush tables with read lock;
--error 1209
create database foo;
unlock tables;
create database foo;
show databases;
flush tables with read lock;
--error 1208
drop database foo;
unlock tables;
drop database foo;
show databases;
...@@ -33,6 +33,21 @@ unlock tables; ...@@ -33,6 +33,21 @@ unlock tables;
connection con1; connection con1;
reap; reap;
#test if drop database will wait until we release the global read lock
connection con1;
drop database if exists foo;
create database foo;
create table foo.t1(n int);
insert into foo.t1 values (23);
flush tables with read lock;
connection con2;
send drop database foo;
connection con1;
select * from foo.t1;
unlock tables;
connection con2;
reap;
# test if dirty close releases global read lock # test if dirty close releases global read lock
connection con1; connection con1;
create table t1 (n int); create table t1 (n int);
......
...@@ -65,3 +65,10 @@ create table t1 ( ...@@ -65,3 +65,10 @@ create table t1 (
) comment = 'it\'s a table' ; ) comment = 'it\'s a table' ;
show create table t1 ; show create table t1 ;
drop table t1; drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;
drop table t1;
create table t1 (a int not null, primary key (a));
show create table t1;
drop table t1;
...@@ -652,12 +652,16 @@ bool MYSQL_LOG::write(Query_log_event* event_info) ...@@ -652,12 +652,16 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
if (thd->last_insert_id_used) if (thd->last_insert_id_used)
{ {
Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id); Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id);
if(thd->server_id)
e.server_id = thd->server_id;
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
if (thd->insert_id_used) if (thd->insert_id_used)
{ {
Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id); Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id);
if(thd->server_id)
e.server_id = thd->server_id;
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
......
...@@ -533,7 +533,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, ...@@ -533,7 +533,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
binlog_cache_size, max_binlog_cache_size; binlog_cache_size, max_binlog_cache_size;
extern ulong specialflag, current_pid; extern ulong specialflag, current_pid;
extern bool low_priority_updates, using_update_log; extern bool low_priority_updates, using_update_log;
extern bool opt_sql_bin_update, opt_safe_show_db; extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings;
extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline; extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline;
extern const char **errmesg; /* Error messages */ extern const char **errmesg; /* Error messages */
extern const char *default_tx_isolation_name; extern const char *default_tx_isolation_name;
......
...@@ -210,7 +210,7 @@ static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN]; ...@@ -210,7 +210,7 @@ static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN];
static pthread_t select_thread; static pthread_t select_thread;
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl, static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0, opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_ansi_mode=0,opt_myisam_log=0, opt_ansi_mode=0,opt_myisam_log=0,
opt_large_files=sizeof(my_off_t) > 4; opt_large_files=sizeof(my_off_t) > 4;
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0; bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0;
FILE *bootstrap_file=0; FILE *bootstrap_file=0;
...@@ -275,7 +275,7 @@ ulong max_tmp_tables,max_heap_table_size; ...@@ -275,7 +275,7 @@ ulong max_tmp_tables,max_heap_table_size;
ulong bytes_sent = 0L, bytes_received = 0L; ulong bytes_sent = 0L, bytes_received = 0L;
bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory; bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory;
bool opt_using_transactions, using_update_log; bool opt_using_transactions, using_update_log, opt_warnings=0;
bool volatile abort_loop,select_thread_in_use,grant_option; bool volatile abort_loop,select_thread_in_use,grant_option;
bool volatile ready_to_exit,shutdown_in_progress; bool volatile ready_to_exit,shutdown_in_progress;
ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */
...@@ -1190,7 +1190,7 @@ Some pointers may be invalid and cause the dump to abort...\n"); ...@@ -1190,7 +1190,7 @@ Some pointers may be invalid and cause the dump to abort...\n");
fprintf(stderr, "\n fprintf(stderr, "\n
Successfully dumped variables, if you ran with --log, take a look at the\n\ Successfully dumped variables, if you ran with --log, take a look at the\n\
details of what thread %ld did to cause the crash. In some cases of really\n\ details of what thread %ld did to cause the crash. In some cases of really\n\
bad corruption, the above values may be invalid\n\n", bad corruption, the values shown above may be invalid\n\n",
thd->thread_id); thd->thread_id);
} }
fprintf(stderr, "\ fprintf(stderr, "\
...@@ -2455,7 +2455,7 @@ enum options { ...@@ -2455,7 +2455,7 @@ enum options {
OPT_INNODB_LOG_ARCH_DIR, OPT_INNODB_LOG_ARCH_DIR,
OPT_INNODB_LOG_ARCHIVE, OPT_INNODB_LOG_ARCHIVE,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD, OPT_innodb_flush_method,
OPT_SAFE_SHOW_DB, OPT_SAFE_SHOW_DB,
OPT_GEMINI_SKIP, OPT_INNODB_SKIP, OPT_GEMINI_SKIP, OPT_INNODB_SKIP,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_TX_ISOLATION,
...@@ -2516,7 +2516,7 @@ static struct option long_options[] = { ...@@ -2516,7 +2516,7 @@ static struct option long_options[] = {
OPT_INNODB_LOG_ARCHIVE}, OPT_INNODB_LOG_ARCHIVE},
{"innodb_flush_log_at_trx_commit", optional_argument, 0, {"innodb_flush_log_at_trx_commit", optional_argument, 0,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT}, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT},
{"innodb_unix_file_flush_method", required_argument, 0, {"innodb_flush_method", required_argument, 0,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD}, OPT_INNODB_UNIX_FILE_FLUSH_METHOD},
#endif #endif
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
...@@ -2603,6 +2603,7 @@ static struct option long_options[] = { ...@@ -2603,6 +2603,7 @@ static struct option long_options[] = {
#endif #endif
{"user", required_argument, 0, 'u'}, {"user", required_argument, 0, 'u'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{"warnings", no_argument, 0, 'W'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
...@@ -2796,7 +2797,7 @@ struct show_var_st init_vars[]= { ...@@ -2796,7 +2797,7 @@ struct show_var_st init_vars[]= {
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
{"innodb_unix_file_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR}, {"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
#endif #endif
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG}, {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
...@@ -3010,6 +3011,8 @@ static void usage(void) ...@@ -3010,6 +3011,8 @@ static void usage(void)
Start without grant tables. This gives all users\n\ Start without grant tables. This gives all users\n\
FULL ACCESS to all tables!\n\ FULL ACCESS to all tables!\n\
--safe-mode Skip some optimize stages (for testing)\n\ --safe-mode Skip some optimize stages (for testing)\n\
--safe-show-database Don't show databases for which the user has no\n\
privileges\n\
--skip-concurrent-insert\n\ --skip-concurrent-insert\n\
Don't use concurrent insert with MyISAM\n\ Don't use concurrent insert with MyISAM\n\
--skip-delay-key-write\n\ --skip-delay-key-write\n\
...@@ -3033,7 +3036,8 @@ static void usage(void) ...@@ -3033,7 +3036,8 @@ static void usage(void)
Default transaction isolation level\n\ Default transaction isolation level\n\
--temp-pool Use a pool of temporary files\n\ --temp-pool Use a pool of temporary files\n\
-u, --user=user_name Run mysqld daemon as user\n\ -u, --user=user_name Run mysqld daemon as user\n\
-V, --version output version information and exit"); -V, --version output version information and exit\n\
-W, --warnings Log some not critical warnings to the log file\n");
#ifdef __WIN__ #ifdef __WIN__
puts("NT and Win32 specific options:\n\ puts("NT and Win32 specific options:\n\
--console Don't remove the console window\n\ --console Don't remove the console window\n\
...@@ -3073,7 +3077,7 @@ static void usage(void) ...@@ -3073,7 +3077,7 @@ static void usage(void)
puts("\ puts("\
--innodb_data_home_dir=dir The common part for Innodb table spaces\n\ --innodb_data_home_dir=dir The common part for Innodb table spaces\n\
--innodb_data_file_path=dir Path to individual files and their sizes\n\ --innodb_data_file_path=dir Path to individual files and their sizes\n\
--innodb_unix_file_flush_method=# With which method to flush data\n\ --innodb_flush_method=# With which method to flush data\n\
--innodb_flush_log_at_trx_commit[=#]\n\ --innodb_flush_log_at_trx_commit[=#]\n\
Set to 0 if you don't want to flush logs\n\ Set to 0 if you don't want to flush logs\n\
--innodb_log_arch_dir=dir Where full logs should be archived\n\ --innodb_log_arch_dir=dir Where full logs should be archived\n\
...@@ -3167,7 +3171,7 @@ static void get_options(int argc,char **argv) ...@@ -3167,7 +3171,7 @@ static void get_options(int argc,char **argv)
int c,option_index=0; int c,option_index=0;
myisam_delay_key_write=1; // Allow use of this myisam_delay_key_write=1; // Allow use of this
while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvI?", while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvWI?",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) { switch(c) {
...@@ -3177,6 +3181,9 @@ static void get_options(int argc,char **argv) ...@@ -3177,6 +3181,9 @@ static void get_options(int argc,char **argv)
#endif #endif
opt_endinfo=1; /* unireg: memory allocation */ opt_endinfo=1; /* unireg: memory allocation */
break; break;
case 'W':
opt_warnings=1;
break;
case 'a': case 'a':
opt_ansi_mode=1; opt_ansi_mode=1;
thd_startup_options|=OPTION_ANSI_MODE; thd_startup_options|=OPTION_ANSI_MODE;
......
...@@ -218,3 +218,5 @@ ...@@ -218,3 +218,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -212,3 +212,5 @@ ...@@ -212,3 +212,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -213,3 +213,5 @@ ...@@ -213,3 +213,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -212,3 +212,5 @@ ...@@ -212,3 +212,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -211,3 +211,5 @@ ...@@ -211,3 +211,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -211,3 +211,5 @@ ...@@ -211,3 +211,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -211,3 +211,5 @@ ...@@ -211,3 +211,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -211,3 +211,5 @@ ...@@ -211,3 +211,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -213,3 +213,5 @@ ...@@ -213,3 +213,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -213,3 +213,5 @@ ...@@ -213,3 +213,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -212,3 +212,5 @@ ...@@ -212,3 +212,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -217,3 +217,5 @@ ...@@ -217,3 +217,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -210,3 +210,5 @@ ...@@ -210,3 +210,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -209,3 +209,5 @@ ...@@ -209,3 +209,5 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
...@@ -1367,7 +1367,7 @@ the slave thread with \"mysqladmin start-slave\". We stopped at log \ ...@@ -1367,7 +1367,7 @@ the slave thread with \"mysqladmin start-slave\". We stopped at log \
{ {
// show a little mercy, allow slave to read one more event // show a little mercy, allow slave to read one more event
// before cutting him off - otherwise he gets stuck // before cutting him off - otherwise he gets stuck
// on Invar events, since they do not advance the offset // on Intvar events, since they do not advance the offset
// immediately // immediately
if (++stuck_count > 2) if (++stuck_count > 2)
events_till_disconnect++; events_till_disconnect++;
......
...@@ -38,6 +38,32 @@ void mysql_create_db(THD *thd, char *db, uint create_options) ...@@ -38,6 +38,32 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
DBUG_ENTER("mysql_create_db"); DBUG_ENTER("mysql_create_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
VOID(pthread_mutex_lock(&LOCK_open));
// do not create database if another thread is holding read lock
if (global_read_lock)
{
if (thd->global_read_lock)
{
net_printf(&thd->net, ER_CREATE_DB_WITH_READ_LOCK);
VOID(pthread_mutex_unlock(&LOCK_open));
goto exit;
}
while (global_read_lock && ! thd->killed)
{
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
}
if (thd->killed)
{
net_printf(&thd->net, ER_SERVER_SHUTDOWN);
VOID(pthread_mutex_unlock(&LOCK_open));
goto exit;
}
}
VOID(pthread_mutex_unlock(&LOCK_open));
/* Check directory */ /* Check directory */
(void)sprintf(path,"%s/%s", mysql_data_home, db); (void)sprintf(path,"%s/%s", mysql_data_home, db);
...@@ -105,6 +131,26 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) ...@@ -105,6 +131,26 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
// do not drop database if another thread is holding read lock
if (global_read_lock)
{
if (thd->global_read_lock)
{
net_printf(&thd->net, ER_DROP_DB_WITH_READ_LOCK);
goto exit;
}
while (global_read_lock && ! thd->killed)
{
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
}
if (thd->killed)
{
net_printf(&thd->net, ER_SERVER_SHUTDOWN);
goto exit;
}
}
(void) sprintf(path,"%s/%s",mysql_data_home,db); (void) sprintf(path,"%s/%s",mysql_data_home,db);
unpack_dirname(path,path); // Convert if not unix unpack_dirname(path,path); // Convert if not unix
/* See if the directory exists */ /* See if the directory exists */
......
...@@ -554,6 +554,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -554,6 +554,7 @@ pthread_handler_decl(handle_one_connection,arg)
free_root(&thd->mem_root,MYF(0)); free_root(&thd->mem_root,MYF(0));
if (net->error && net->vio != 0) if (net->error && net->vio != 0)
{ {
if (!thd->killed && ! opt_warnings)
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
thd->thread_id,(thd->db ? thd->db : "unconnected"), thd->thread_id,(thd->db ? thd->db : "unconnected"),
thd->user ? thd->user : "unauthenticated", thd->user ? thd->user : "unauthenticated",
......
...@@ -839,18 +839,22 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -839,18 +839,22 @@ store_create_info(THD *thd, TABLE *table, String *packet)
for (uint i=0 ; i < table->keys ; i++,key_info++) for (uint i=0 ; i < table->keys ; i++,key_info++)
{ {
KEY_PART_INFO *key_part= key_info->key_part;
bool found_primary=0;
packet->append(",\n ", 4); packet->append(",\n ", 4);
KEY_PART_INFO *key_part= key_info->key_part; if (i == primary_key && !strcmp(key_info->name,"PRIMARY"))
if (i == primary_key) {
found_primary=1;
packet->append("PRIMARY ", 8); packet->append("PRIMARY ", 8);
}
else if (key_info->flags & HA_NOSAME) else if (key_info->flags & HA_NOSAME)
packet->append("UNIQUE ", 7); packet->append("UNIQUE ", 7);
else if (key_info->flags & HA_FULLTEXT) else if (key_info->flags & HA_FULLTEXT)
packet->append("FULLTEXT ", 9); packet->append("FULLTEXT ", 9);
packet->append("KEY ", 4); packet->append("KEY ", 4);
if (i != primary_key) if (!found_primary)
append_identifier(thd,packet,key_info->name); append_identifier(thd,packet,key_info->name);
packet->append(" (", 2); packet->append(" (", 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment