summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi16
-rw-r--r--client/mysql.cc8
-rw-r--r--client/mysqladmin.c3
-rw-r--r--client/mysqlimport.c6
-rw-r--r--mysql-test/r/rpl000016.result25
-rw-r--r--mysql-test/t/rpl000016.test51
-rw-r--r--sql/log.cc1
-rw-r--r--sql/sql_class.h3
8 files changed, 93 insertions, 20 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 574a424f641..543370f9062 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -14373,6 +14373,10 @@ If this is enabled, a user can't create new users with the GRANT
command, if the user doesn't have @code{INSERT} privilege to the
@code{mysql.user} table or any column in this table.
+@item --skip-bdb
+Disable usage of BDB tables. This will save memory and may speed up some
+things.
+
@item --skip-concurrent-insert
Turn off the ability to select and insert at the same time on @code{MyISAM}
tables. (This is only to be used if you think you have found a bug in this
@@ -14392,6 +14396,10 @@ flush-privileges} or @code{mysqladmin reload}.)
Never use host name cache for faster name-ip resolution, but query DNS server
on every connect instead. @xref{DNS}.
+@item --skip-innodb
+Disable usage of Innodb tables. This will save memory and disk space and
+speed up some things.
+
@item --skip-external-locking (was --skip-locking)
Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must
shut down the server. @xref{Stability}. Note that in MySQL Version
@@ -38620,6 +38628,9 @@ an auto-extending 10 MB file @file{ibdata1} to the @code{datadir}
of MySQL. (In MySQL-4.0.0 and 4.0.1 the datafile is 64 MB and not
auto-extending.)
+If you don't want to use @code{InnoDB} tables, you can add the
+@code{skip-innodb} option to your MySQL option file.
+
But to get good performance you MUST explicitly set the InnoDB parameters
listed in the following examples.
@@ -40571,13 +40582,14 @@ BDB tables:
@item @code{--bdb-no-recover} @tab Don't start Berkeley DB in recover mode.
@item @code{--bdb-shared-data} @tab Start Berkeley DB in multi-process mode (Don't use @code{DB_PRIVATE} when initialising Berkeley DB)
@item @code{--bdb-tmpdir=directory} @tab Berkeley DB tempfile name.
-@item @code{--skip-bdb} @tab Don't use berkeley db.
+@item @code{--skip-bdb} @tab Disable usage of BDB tables.
@item @code{-O bdb_max_lock=1000} @tab Set the maximum number of locks possible. @xref{SHOW VARIABLES}.
@end multitable
If you use @code{--skip-bdb}, MySQL will not initialise the
Berkeley DB library and this will save a lot of memory. Of course,
-you cannot use @code{BDB} tables if you are using this option.
+you cannot use @code{BDB} tables if you are using this option. If you try
+to create an BDB table, MySQL will instead create a MyISAM table.
Normally you should start @code{mysqld} without @code{--bdb-no-recover} if you
intend to use BDB tables. This may, however, give you problems when you
diff --git a/client/mysql.cc b/client/mysql.cc
index 77823b1087f..66df47bc934 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -112,6 +112,7 @@ typedef struct st_status
static HashTable ht;
+static char **defaults_argv;
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE;
@@ -317,15 +318,19 @@ int main(int argc,char *argv[])
status.add_to_history=1;
status.exit_status=1;
load_defaults("my",load_default_groups,&argc,&argv);
+ defaults_argv=argv;
if (get_options(argc, (char **) argv))
{
+ free_defaults(defaults_argv);
my_end(0);
exit(1);
}
- free_defaults(argv);
if (status.batch && !status.line_buff &&
!(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
+ {
+ free_defaults(defaults_argv);
exit(1);
+ }
glob_buffer.realloc(512);
mysql_server_init(0, NULL, (char**) server_default_groups);
completion_hash_init(&ht, 128);
@@ -420,6 +425,7 @@ sig_handler mysql_end(int sig)
my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
mysql_server_end();
+ free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(status.exit_status);
}
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 4da995fa224..cdca59574f7 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -254,7 +254,10 @@ int main(int argc,char *argv[])
load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv; /* Save for free_defaults */
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ {
+ free_defaults(save_argv);
exit(ho_error);
+ }
if (argc == 0)
{
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index e7af106abbb..603e9036106 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -471,9 +471,15 @@ int main(int argc, char **argv)
/* argv is changed in the program */
argv_to_free= argv;
if (get_options(&argc, &argv))
+ {
+ free_defaults(argv_to_free);
return(1);
+ }
if (!(sock= db_connect(current_host,current_db,current_user,opt_password)))
+ {
+ free_defaults(argv_to_free);
return(1); /* purecov: deadcode */
+ }
if (lock_tables)
lock_table(sock, argc, argv);
for (; *argv != NULL; argv++)
diff --git a/mysql-test/r/rpl000016.result b/mysql-test/r/rpl000016.result
index ccd584bfcdc..01e6d2c3a48 100644
--- a/mysql-test/r/rpl000016.result
+++ b/mysql-test/r/rpl000016.result
@@ -10,12 +10,14 @@ change master to master_host='127.0.0.1',master_port=MASTER_PORT,
master_user='root';
reset master;
slave start;
-drop table if exists t1;
+drop table if exists t1, t2, t3, t4;
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.001 234 slave-relay-bin.001 275 master-bin.001 Yes Yes 0 0 234 275
+127.0.0.1 root MASTER_PORT 60 master-bin.001 417 slave-relay-bin.001 458 master-bin.001 Yes Yes 0 0 417 458
select * from t1;
s
Could not break slave
@@ -30,6 +32,11 @@ Log_name
master-bin.001
master-bin.002
master-bin.003
+create table t3 select * from temp_table;
+select * from t3;
+a
+testing temporary tables
+drop table temp_table, t3;
insert into t2 values(1234);
set insert_id=1234;
insert into t2 values(NULL);
@@ -42,7 +49,7 @@ master-bin.003
insert into t2 values (65);
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.003 155 slave-relay-bin.001 755 master-bin.003 Yes Yes 0 0 155 755
+127.0.0.1 root MASTER_PORT 60 master-bin.003 290 slave-relay-bin.001 1073 master-bin.003 Yes Yes 0 0 290 1073
select * from t2;
m
34
@@ -50,8 +57,11 @@ m
67
123
1234
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables part 2");
drop table if exists t3;
create table t3 (n int);
+create table t4 select * from temp_table;
show master logs;
Log_name
master-bin.003
@@ -60,12 +70,13 @@ master-bin.005
master-bin.006
show master status;
File Position Binlog_do_db Binlog_ignore_db
-master-bin.006 445
-slave stop;
-slave start;
+master-bin.006 838
+select * from t4;
+a
+testing temporary tables part 2
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.006 445 slave-relay-bin.004 1229 master-bin.006 Yes Yes 0 0 445 1229
+127.0.0.1 root MASTER_PORT 60 master-bin.006 838 slave-relay-bin.004 1816 master-bin.006 Yes Yes 0 0 838 1816
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test
index b830d0b8d91..fa0c38ae993 100644
--- a/mysql-test/t/rpl000016.test
+++ b/mysql-test/t/rpl000016.test
@@ -1,3 +1,14 @@
+#
+# Test are run with max_binlog_size=2048 to force automatic rotation of the
+# binary log
+# Tests done:
+# - Check that slaves reports correct failures if master.info has strange
+# modes/information
+# - Automatic binary log rotation
+# - Ensure that temporary tables works over flush logs and binary log
+# changes
+# - Test creating a duplicate key error and recover from it
+#
connect (master,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,slave.sock);
system cat /dev/null > var/slave-data/master.info;
@@ -18,7 +29,14 @@ reset master;
connection slave;
slave start;
connection master;
-drop table if exists t1;
+
+drop table if exists t1, t2, t3, t4;
+
+#
+# Test FLUSH LOGS
+#
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos;
@@ -32,15 +50,24 @@ flush logs;
drop table if exists t2;
create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123);
-save_master_pos;
flush logs;
show master logs;
+create table t3 select * from temp_table;
-#now lets make some duplicate key mess and see if we can recover from it
-
-#first insert a value on the slave
+save_master_pos;
connection slave;
sync_with_master;
+
+select * from t3;
+connection master;
+drop table temp_table, t3;
+
+#
+# Now lets make some duplicate key mess and see if we can recover from it
+#
+
+# First insert a value on the slave
+connection slave;
insert into t2 values(1234);
#same value on the master
@@ -73,7 +100,14 @@ sync_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
select * from t2;
+
+#
+# Test forcing the replication log to rotate
+#
+
connection master;
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables part 2");
let $1=100;
drop table if exists t3;
create table t3 (n int);
@@ -85,13 +119,16 @@ while ($1)
dec $1;
}
enable_query_log;
+create table t4 select * from temp_table;
show master logs;
show master status;
save_master_pos;
connection slave;
-slave stop;
-slave start;
+#slave stop;
+#slave start;
sync_with_master;
+select * from t4;
+
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
# because of concurrent insert, the table may not be up to date
diff --git a/sql/log.cc b/sql/log.cc
index 55bcc80c166..9194d3f7c07 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -33,7 +33,6 @@
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);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f0aa3f09555..5b35b4e7ea0 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -477,13 +477,12 @@ public:
}
inline void close_active_vio()
{
- pthread_mutex_lock(&LOCK_delete);
+ safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
- pthread_mutex_unlock(&LOCK_delete);
}
#endif
void awake(bool prepare_to_die);