diff options
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/config-win.h | 1 | ||||
-rw-r--r-- | include/my_pthread.h | 17 | ||||
-rw-r--r-- | include/my_sys.h | 11 | ||||
-rw-r--r-- | include/mysql_embed.h | 1 | ||||
-rw-r--r-- | mysql-test/r/replace.result | 4 | ||||
-rw-r--r-- | mysql-test/t/replace.test | 8 | ||||
-rw-r--r-- | mysql-test/t/xa.test | 1 | ||||
-rw-r--r-- | mysys/my_sync.c | 22 | ||||
-rw-r--r-- | sql/handler.cc | 4 | ||||
-rw-r--r-- | sql/log.cc | 53 | ||||
-rw-r--r-- | sql/mysql_priv.h | 9 | ||||
-rw-r--r-- | sql/mysqld.cc | 54 | ||||
-rw-r--r-- | sql/opt_range.cc | 3 | ||||
-rw-r--r-- | sql/set_var.cc | 12 | ||||
-rw-r--r-- | sql/sql_base.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 9 |
17 files changed, 82 insertions, 130 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 08beb4b7236..5f426843950 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ mysql_time.h $(BUILT_SOURCES) noinst_HEADERS = config-win.h config-os2.h config-netware.h \ - nisam.h heap.h merge.h my_bitmap.h\ + heap.h my_bitmap.h\ myisam.h myisampack.h myisammrg.h ft_global.h\ mysys_err.h my_base.h help_start.h help_end.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ diff --git a/include/config-win.h b/include/config-win.h index 4ef5c9323e7..df0530fbef3 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -351,7 +351,6 @@ inline double ulonglong2double(ulonglong value) #define DO_NOT_REMOVE_THREAD_WRAPPERS #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) -#define thread_safe_dec_and_test(V, L) thread_safe_decrement(V,L) /* The following is only used for statistics, so it should be good enough */ #ifdef __NT__ /* This should also work on Win98 but .. */ #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) diff --git a/include/my_pthread.h b/include/my_pthread.h index b170753913b..670a4ccf63e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -678,7 +678,6 @@ extern pthread_t shutdown_th, main_th, signal_th; #ifdef HAVE_ATOMIC_ADD #define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V) #define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V) -#define thread_safe_dec_and_test(V, L) atomic_dec_and_test((atomic_t*) &V) #define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V) #define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V) #else @@ -689,22 +688,6 @@ extern pthread_t shutdown_th, main_th, signal_th; #define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L))) #define thread_safe_sub(V,C,L) \ (pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L))) -#ifdef __cplusplus -static inline bool thread_safe_dec_and_test(ulong &V, pthread_mutex_t *L) -{ - ulong res; - pthread_mutex_lock(L); - res=--V; - pthread_mutex_unlock(L); - return res==0; -} -#else -/* - what should we do ? define it as static ? - a regular function somewhere in mysys/ ? - for now it's only used in c++ code, so there's no need to bother -*/ -#endif #endif /* HAVE_ATOMIC_ADD */ #ifdef SAFE_STATISTICS #define statistic_increment(V,L) thread_safe_increment((V),(L)) diff --git a/include/my_sys.h b/include/my_sys.h index 523c0570de7..f63743a4c6c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -54,11 +54,10 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_FAE 8 /* Fatal if any error */ #define MY_WME 16 /* Write message on error */ #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ -#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */ -#define MY_FULL_IO 512 /* For my_read - loop intil I/O - is complete - */ -#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ +#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ +#define MY_RAID 64 /* Support for RAID */ +#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ +#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ #define MY_COPYTIME 64 /* my_redel() copys time */ #define MY_DELETE_OLD 256 /* my_create_with_symlink() */ @@ -72,7 +71,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ -#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ +#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ diff --git a/include/mysql_embed.h b/include/mysql_embed.h index 603af8e83b8..311d95eda73 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -24,7 +24,6 @@ #undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_OPENSSL -#undef HAVE_ISAM #undef HAVE_SMEM /* No shared memory */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result index 83cde76215a..a7d59fcfa62 100644 --- a/mysql-test/r/replace.result +++ b/mysql-test/r/replace.result @@ -3,12 +3,10 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) engine=ISAM; +); replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 engine=myisam; -replace into t1 (gesuchnr,benutzer_id) values (1,1); alter table t1 engine=heap; replace into t1 (gesuchnr,benutzer_id) values (1,1); drop table t1; diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test index 8429d80a4ef..2b3775f4f67 100644 --- a/mysql-test/t/replace.test +++ b/mysql-test/t/replace.test @@ -1,7 +1,5 @@ --- source include/have_isam.inc - # -# Test of REPLACE with ISAM and MyISAM and HEAP +# Test of REPLACE with MyISAM and HEAP # --disable_warnings @@ -12,13 +10,11 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) engine=ISAM; +); replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 engine=myisam; -replace into t1 (gesuchnr,benutzer_id) values (1,1); alter table t1 engine=heap; replace into t1 (gesuchnr,benutzer_id) values (1,1); drop table t1; diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 1f2fb5056ed..321e5008035 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -31,6 +31,7 @@ xa end 'testa','testb'; connect (con1,localhost,,,); connection con1; +# gtrid [ , bqual [ , formatID ] ] xa start 0x7465737462, 0x2030405060, 0xb; insert t1 values (40); xa end 'testb',' 0@P`',11; diff --git a/mysys/my_sync.c b/mysys/my_sync.c index bd372f03c87..bfaf09ce402 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -27,7 +27,14 @@ my_flags Flags (now only MY_WME is supported) NOTE - If file system supports its, only file data is synced, not inode date + If file system supports its, only file data is synced, not inode data. + + MY_IGNORE_BADFD is useful when fd is "volatile" - not protected by a + mutex. In this case by the time of fsync(), fd may be already closed by + another thread, or even reassigned to a different file. With this flag - + MY_IGNORE_BADFD - such a situation will not be considered an error. + (which is correct behaviour, if we know that the other thread synced the + file before closing) RETURN 0 ok @@ -55,10 +62,15 @@ int my_sync(File fd, myf my_flags) if (res) { - if (!(my_errno= errno)) - my_errno= -1; /* Unknown error */ - if (my_flags & MY_WME) + int er= errno; + if (!(my_errno= er)) + my_errno= -1; /* Unknown error */ + if (my_flags & MY_IGNORE_BADFD && + (er == EBADF || er == EINVAL || er == EROFS)) + res= 0; + else if (my_flags & MY_WME) my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno); } DBUG_RETURN(res); -} /* my_read */ +} /* my_sync */ + diff --git a/sql/handler.cc b/sql/handler.cc index fd9ec7cf423..3181e5754de 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -25,10 +25,6 @@ #include "ha_heap.h" #include "ha_myisam.h" #include "ha_myisammrg.h" -#ifdef HAVE_ISAM -#include "ha_isam.h" -#include "ha_isammrg.h" -#endif #ifdef HAVE_BERKELEY_DB #include "ha_berkeley.h" #endif diff --git a/sql/log.cc b/sql/log.cc index 9af70a4d527..1d6bb4cdf41 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1531,18 +1531,20 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command, return 0; } - -inline bool sync_binlog(IO_CACHE *cache) +bool MYSQL_LOG::flush_and_sync() { - if (sync_binlog_period == ++sync_binlog_counter && sync_binlog_period) + int err=0, fd=log_file.file; + safe_mutex_assert_owner(&LOCK_log); + if (flush_io_cache(&log_file)) + return 1; + if (++sync_binlog_counter >= sync_binlog_period && sync_binlog_period) { sync_binlog_counter= 0; - return my_sync(cache->file, MYF(MY_WME)); + err=my_sync(fd, MYF(MY_WME)); } - return 0; + return err; } - /* Write an event to the binary log */ @@ -1675,8 +1677,8 @@ bool MYSQL_LOG::write(Log_event *event_info) } } - /* - Write the SQL command + /* + Write the SQL command */ if (event_info->write(file)) @@ -1684,8 +1686,10 @@ bool MYSQL_LOG::write(Log_event *event_info) if (file == &log_file) // we are writing to the real log (disk) { - if (flush_io_cache(file) || sync_binlog(file)) + if (flush_and_sync()) goto err; + signal_update(); + rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); } error=0; @@ -1698,15 +1702,9 @@ err: my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno); write_error=1; } - if (file == &log_file) - { - signal_update(); - rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); - } } pthread_mutex_unlock(&LOCK_log); - DBUG_RETURN(error); } @@ -1813,7 +1811,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if (commit_event->write(&log_file)) goto err; DBUG_skip_commit: - if (flush_io_cache(&log_file) || sync_binlog(&log_file)) + if (flush_and_sync()) goto err; DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); if (cache->error) // Error on read @@ -1983,26 +1981,26 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, SYNOPSIS wait_for_update() thd Thread variable - master_or_slave If 0, the caller is the Binlog_dump thread from master; + is_slave If 0, the caller is the Binlog_dump thread from master; if 1, the caller is the SQL thread from the slave. This influences only thd->proc_info. NOTES One must have a lock on LOCK_log before calling this function. - This lock will be freed before return! That's required by + This lock will be released before return! That's required by THD::enter_cond() (see NOTES in sql_class.h). */ -void MYSQL_LOG::wait_for_update(THD* thd, bool master_or_slave) +void MYSQL_LOG::wait_for_update(THD* thd, bool is_slave) { const char *old_msg; DBUG_ENTER("wait_for_update"); old_msg= thd->enter_cond(&update_cond, &LOCK_log, - master_or_slave ? + is_slave ? "Has read all relay log; waiting for the slave I/O " - "thread to update it" : + "thread to update it" : "Has sent all binlog to slave; waiting for binlog " - "to be updated"); + "to be updated"); pthread_cond_wait(&update_cond, &LOCK_log); thd->exit_cond(old_msg); DBUG_VOID_RETURN; @@ -2051,7 +2049,12 @@ void MYSQL_LOG::close(uint exiting) my_pwrite(log_file.file, &flags, 1, offset, MYF(0)); } - if (my_close(log_file.file,MYF(0)) < 0 && ! write_error) + if (my_sync(log_file.file,MYF(MY_WME)) && ! write_error) + { + write_error=1; + sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno); + } + if (my_close(log_file.file,MYF(MY_WME)) && ! write_error) { write_error=1; sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno); @@ -2945,8 +2948,10 @@ int TC_LOG_BINLOG::log(THD *thd, my_xid xid) void TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid) { - if (thread_safe_dec_and_test(prepared_xids, &LOCK_prep_xids)) + pthread_mutex_lock(&LOCK_prep_xids); + if (--prepared_xids == 0) pthread_cond_signal(&COND_prep_xids); + pthread_mutex_unlock(&LOCK_prep_xids); rotate_and_purge(0); // as ::write() did not rotate } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 7e4c6675e45..b92443f7e15 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1126,10 +1126,6 @@ extern MY_BITMAP temp_pool; extern String my_empty_string; extern const String my_null_string; extern SHOW_VAR init_vars[],status_vars[], internal_vars[]; -extern SHOW_COMP_OPTION have_isam; -extern SHOW_COMP_OPTION have_innodb; -extern SHOW_COMP_OPTION have_berkeley_db; -extern SHOW_COMP_OPTION have_ndbcluster; extern struct system_variables global_system_variables; extern struct system_variables max_system_variables; extern struct system_status_var global_status_var; @@ -1150,12 +1146,13 @@ extern struct my_option my_long_options[]; extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db; extern SHOW_COMP_OPTION have_example_db, have_archive_db, have_csv_db; extern SHOW_COMP_OPTION have_federated_db; +extern SHOW_COMP_OPTION have_blackhole_db; +extern SHOW_COMP_OPTION have_ndbcluster; extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink; -extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb; +extern SHOW_COMP_OPTION have_query_cache; extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_compress; -extern SHOW_COMP_OPTION have_blackhole_db; #ifndef __WIN__ extern pthread_t signal_thread; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 95de170b99d..ee95e00e0ee 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -30,9 +30,6 @@ #include "ha_innodb.h" #endif #include "ha_myisam.h" -#ifdef HAVE_ISAM -#include "ha_isam.h" -#endif #ifdef HAVE_NDBCLUSTER_DB #include "ha_ndbcluster.h" #endif @@ -47,11 +44,6 @@ #else #define OPT_BDB_DEFAULT 0 #endif -#ifdef HAVE_ISAM_DB -#define OPT_ISAM_DEFAULT 1 -#else -#define OPT_ISAM_DEFAULT 0 -#endif #ifdef HAVE_NDBCLUSTER_DB #define OPT_NDBCLUSTER_DEFAULT 0 #if defined(NOT_ENOUGH_TESTED) \ @@ -64,7 +56,6 @@ #define OPT_NDBCLUSTER_DEFAULT 0 #endif -#include <nisam.h> #include <thr_alarm.h> #include <ft_global.h> #include <errmsg.h> @@ -4342,7 +4333,7 @@ Disable with --skip-bdb (will save memory).", "Don't try to recover Berkeley DB tables on start.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bdb-no-sync", OPT_BDB_NOSYNC, - "Disable synchronously flushing logs. This option is deprecated, use --skip-sync-bdb-logs or sync-bdb-logs=0 instead", + "This option is deprecated, use --skip-sync-bdb-logs instead", // (gptr*) &opt_sync_bdb_logs, (gptr*) &opt_sync_bdb_logs, 0, GET_BOOL, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bdb-shared-data", OPT_BDB_SHARED, @@ -4551,9 +4542,8 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, (gptr*) &global_system_variables.innodb_support_xa, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, #endif /* End HAVE_INNOBASE_DB */ - {"isam", OPT_ISAM, "Enable ISAM (if this version of MySQL supports it). \ -Disable with --skip-isam.", - (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, OPT_ISAM_DEFAULT, 0, 0, + {"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.", + (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"language", 'L', "Client error messages in given language. May be given as a full path.", @@ -5469,36 +5459,35 @@ The minimum value for this variable is 4096.", 1, 0}, #ifdef HAVE_BERKELEY_DB {"sync-bdb-logs", OPT_BDB_SYNC, - "Synchronously flush logs. Enabled by default", + "Synchronously flush Berkeley DB logs. Enabled by default", (gptr*) &opt_sync_bdb_logs, (gptr*) &opt_sync_bdb_logs, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #endif /* HAVE_BERKELEY_DB */ {"sync-binlog", OPT_SYNC_BINLOG, - "Sync the binlog to disk after every #th event. \ -#=0 (the default) does no sync. Syncing slows MySQL down", - (gptr*) &sync_binlog_period, - (gptr*) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, - 0}, + "Synchronously flush binary log to disk after every #th event. " + "Use 0 (default) to disable synchronous flushing.", + (gptr*) &sync_binlog_period, (gptr*) &sync_binlog_period, 0, GET_ULONG, + REQUIRED_ARG, 1, 0, ~0L, 0, 1, 0}, + {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", + (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, + 0, 0, 0, 0}, #ifdef DOES_NOTHING_YET {"sync-replication", OPT_SYNC_REPLICATION, - "Enable synchronous replication", + "Enable synchronous replication.", (gptr*) &global_system_variables.sync_replication, (gptr*) &global_system_variables.sync_replication, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 1, 0}, {"sync-replication-slave-id", OPT_SYNC_REPLICATION_SLAVE_ID, - "Synchronous replication is wished for this slave", + "Synchronous replication is wished for this slave.", (gptr*) &global_system_variables.sync_replication_slave_id, (gptr*) &global_system_variables.sync_replication_slave_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0}, {"sync-replication-timeout", OPT_SYNC_REPLICATION_TIMEOUT, - "Synchronous replication timeout", + "Synchronous replication timeout.", (gptr*) &global_system_variables.sync_replication_timeout, (gptr*) &global_system_variables.sync_replication_timeout, 0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0}, #endif - {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default", - (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, - 0, 0, 0, 0}, {"table_cache", OPT_TABLE_CACHE, "The number of open tables for all threads.", (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L, @@ -5962,11 +5951,7 @@ static void mysql_init_variables(void) #else have_innodb=SHOW_OPTION_NO; #endif -#ifdef HAVE_ISAM - have_isam=SHOW_OPTION_YES; -#else have_isam=SHOW_OPTION_NO; -#endif #ifdef HAVE_EXAMPLE_DB have_example_db= SHOW_OPTION_YES; #else @@ -6375,9 +6360,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_error_log= 0; // Force logs to stdout break; case (int) OPT_FLUSH: -#ifdef HAVE_ISAM - nisam_flush=1; -#endif myisam_flush=1; flush_time=0; // No auto flush break; @@ -6484,14 +6466,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), have_berkeley_db= SHOW_OPTION_DISABLED; #endif break; - case OPT_ISAM: -#ifdef HAVE_ISAM - if (opt_isam) - have_isam= SHOW_OPTION_YES; - else - have_isam= SHOW_OPTION_DISABLED; -#endif - break; case OPT_NDBCLUSTER: #ifdef HAVE_NDBCLUSTER_DB if (opt_ndbcluster) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 44e2f5ee9f2..9920d89519e 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -42,7 +42,6 @@ #include "mysql_priv.h" #include <m_ctype.h> -#include <nisam.h> #include "sql_select.h" #ifndef EXTRA_DEBUG @@ -51,7 +50,7 @@ #endif /* - Convert double value to #rows. Currently this does floor(), and we + Convert double value to #rows. Currently this does floor(), and we might consider using round() instead. */ #define double2rows(x) ((ha_rows)(x)) diff --git a/sql/set_var.cc b/sql/set_var.cc index 457df3f2947..3523e444216 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -954,10 +954,12 @@ struct show_var_st init_vars[]= { {"sql_warnings", (char*) &sys_sql_warnings, SHOW_BOOL}, #ifdef HAVE_REPLICATION {sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS}, +#ifdef DOES_NOTHING_YET {sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS}, {sys_sync_replication_slave_id.name, (char*) &sys_sync_replication_slave_id,SHOW_SYS}, {sys_sync_replication_timeout.name, (char*) &sys_sync_replication_timeout,SHOW_SYS}, #endif +#endif {sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS}, #ifdef HAVE_TZNAME {"system_time_zone", system_time_zone, SHOW_CHAR}, @@ -2495,14 +2497,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var) { pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock(); sync_binlog_period= (ulong) var->save_result.ulonglong_value; - /* - Must reset the counter otherwise it may already be beyond the new period - and so the new period will not be taken into account. Need mutex otherwise - might be cancelled by a simultanate ++ in MYSQL_LOG::write(). - */ - pthread_mutex_lock(lock_log); - sync_binlog_counter= 0; - pthread_mutex_unlock(lock_log); return 0; } #endif /* HAVE_REPLICATION */ @@ -2522,7 +2516,7 @@ bool sys_var_rand_seed2::update(THD *thd, set_var *var) bool sys_var_thd_time_zone::check(THD *thd, set_var *var) { - char buff[MAX_TIME_ZONE_NAME_LENGTH]; + char buff[MAX_TIME_ZONE_NAME_LENGTH]; String str(buff, sizeof(buff), &my_charset_latin1); String *res= var->value->val_str(&str); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4750fe1386f..b0f2930758e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -25,7 +25,6 @@ #include <m_ctype.h> #include <my_dir.h> #include <hash.h> -#include <nisam.h> #ifdef __WIN__ #include <io.h> #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index 6d6ac810fbf..123ecdfaa89 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -327,6 +327,7 @@ public: bool is_active(const char* log_file_name); int update_log_index(LOG_INFO* linfo, bool need_update_threads); void rotate_and_purge(uint flags); + bool flush_and_sync(); int purge_logs(const char *to_log, bool included, bool need_mutex, bool need_update_threads, ulonglong *decrease_log_space); @@ -1283,18 +1284,18 @@ public: pthread_mutex_unlock(&LOCK_delete); } void close_active_vio(); -#endif +#endif void awake(THD::killed_state state_to_set); /* For enter_cond() / exit_cond() to work the mutex must be got before - enter_cond() (in 4.1 an assertion will soon ensure this); this mutex is - then released by exit_cond(). Use must be: - lock mutex; enter_cond(); your code; exit_cond(). + enter_cond(); this mutex is then released by exit_cond(). + Usage must be: lock mutex; enter_cond(); your code; exit_cond(). */ inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg) { const char* old_msg = proc_info; + safe_mutex_assert_owner(mutex); mysys_var->current_mutex = mutex; mysys_var->current_cond = cond; proc_info = msg; |