mariadb/storage/myisam
unknown 9438b98519 Fix for Bug #17544 "Cannot do atomic log rotate",
Bug #21785 "Server crashes after rename of the log table" and
Bug #21966 "Strange warnings on create like/repair of the log
            tables"

According to the patch, from now on, one should use RENAME to
perform a log table rotation (this should also be reflected in
the manual).

Here is a sample:

use mysql;
CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;

The rules for Rename of the log tables are following:
      IF   1. Log tables are enabled
      AND  2. Rename operates on the log table and nothing is being
              renamed to the log table.
      DO   3. Throw an error message.
      ELSE 4. Perform rename.
 
The very RENAME query will go the the old (backup) table. This is
consistent with the behavoiur we have with binlog ROTATE LOGS
statement.

Other problems, which are solved by the patch are:

1) Now REPAIR of the log table is exclusive operation (as it should be), this
   also eliminates lock-related warnings. and
2) CREATE LIKE TABLE now usese usual read lock on the source table rather
   then name lock, which is too restrictive. This way we get rid of another
   log table-related warning, which occured because of the above fact
   (as a side-effect, name lock resulted in a warning).


mysql-test/r/log_tables.result:
  update result file
mysql-test/t/log_tables.test:
  Add tests for the bugs
sql/handler.cc:
  update comment
sql/handler.h:
  update function to reflect changes in log tables
  locking logic.
sql/lock.cc:
  Now we allow locking of the log tables for "privileged" threads
  Privileged thread must explicitly close and lock log tables. This
  is required for admin operations such as REPAIR.
sql/log.cc:
  Changes to the file:
  1) Add checks for table schema. It's more important now,
     as we allow rename of the log tables. Since we should
     check for schema when writing to a log table.
     E.g. if one created a table with one-only comlumn and
     renamed it to general_log, the server should cope with
     it.
  2) refactor LOGGER::flush(), so that we can now use the same
     machinery as we use in FLUSH LOGS in other statements:
     whenever we have to perform  a serious operation on the log
     tables, we have to
     (a) lock logger, which blocks other concurrent statements (such 
     as selects) (b) close logs. Then perform an
     exclusive operation, c) reenable logs and d) unlock logger.
  3) Add a function to check if a given table is a log table.
  4) Add support for "privileged" thread
  5) merge is_[general/slow]_log_table_enabled() into one function.
  6) Add new function: reopen _log_tables, which reopens the tables,
     which were enabled (after temporary close, required for admin
     operation)
sql/log.h:
  1) add a new call close_n_lock_tables(). Now we use it instead of
     LOGGER::flush() in FLUSH LOGS implementation.
  2) add a prototype for the function to check if a given
     table is a log table;
  3) add privileged table flag to table logger
  4) merge is_[general/slow]_log_table_enabled()
     into one function.
sql/mysql_priv.h:
  move log table defines to log.h
sql/sql_delete.cc:
  use new function check_if_log_table() instead of direct strcmp
sql/sql_rename.cc:
  Traverse the list of tables in mysql_rename_tables
  to make sure that log tables are processed correctly
  (that is, according to the rules specified in the
  main CS comment)
sql/sql_table.cc:
  1) mysql_admin_table() should disable logs if it performs
     exclusive admin operation on a log table. This way we
     also eliminate warning on REPAIR of the log table.
  2) mysql_create_like_table should read-lock the source table
     instead getting name lock on it. Name lock is too restrictive
     in this case.
sql/share/errmsg.txt:
  Add a new error message for rename of the log tables
sql/table.cc:
  use new function instead of direct strcmp.
  change my_strcasecmp() -> strcmp(), when
  comparing system db and table names
storage/csv/ha_tina.cc:
  update function to reflect changes in log tables
  locking logic.
storage/myisam/ha_myisam.cc:
  update function to reflect changes in log tables
  locking logic.
2006-10-13 17:26:46 +04:00
..
ftbench Fixed warning message breakage. 2006-08-13 22:28:41 -07:00
.cvsignore
ChangeLog
CMakeLists.txt This changeset moves the ha_myisam files to their storage directories. It also includes updates for all engines include patch for windows builds. 2006-08-19 17:38:42 -07:00
ft_boolean_search.c Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new 2006-06-04 21:05:22 +03:00
ft_eval.c
ft_eval.h
ft_nlq_search.c Now ftparser does not need to bother about memory management - 2006-05-30 18:15:18 +02:00
ft_parser.c Removed warnings for Windows build issues. Edited Windows README to remove reference to BDB. 2006-08-14 14:45:48 -07:00
ft_static.c Incompatible ftparser plugin API change. 2006-05-28 17:02:50 +02:00
ft_stem.c
ft_stopwords.c
ft_test1.c
ft_test1.h
ft_update.c Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.1-engines 2006-06-14 15:17:47 +05:00
ftdefs.h Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.1-engines 2006-06-14 15:17:47 +05:00
fulltext.h
ha_myisam.cc Fix for Bug #17544 "Cannot do atomic log rotate", 2006-10-13 17:26:46 +04:00
ha_myisam.h This changeset moves the ha_myisam files to their storage directories. It also includes updates for all engines include patch for windows builds. 2006-08-19 17:38:42 -07:00
make-ccc
Makefile.am This changest: 2006-08-22 16:24:12 -07:00
mi_cache.c
mi_changed.c
mi_check.c Merge chilla.local:/home/mydev/mysql-5.0-ateam 2006-07-06 13:18:00 +02:00
mi_checksum.c
mi_close.c
mi_create.c Post-merge fixes. 2006-07-27 14:12:41 +04:00
mi_dbug.c
mi_delete.c
mi_delete_all.c Removed warnings for Windows build issues. Edited Windows README to remove reference to BDB. 2006-08-14 14:45:48 -07:00
mi_delete_table.c Merge chilla.local:/home/mydev/mysql-5.0-ateam 2006-07-06 13:18:00 +02:00
mi_dynrec.c Merge chilla.local:/home/mydev/mysql-5.0-bug20719 2006-07-30 06:20:32 +02:00
mi_extra.c Fix Bug #18559 "log tables cannot change engine, and 2006-08-03 21:28:15 +04:00
mi_info.c
mi_key.c Merge mysql.com:/home/mydev/mysql-5.0-bug19604 2006-05-31 10:27:53 +02:00
mi_keycache.c
mi_locking.c
mi_log.c
mi_open.c Fix Bug #18559 "log tables cannot change engine, and 2006-08-03 21:28:15 +04:00
mi_packrec.c Removed warnings for Windows build issues. Edited Windows README to remove reference to BDB. 2006-08-14 14:45:48 -07:00
mi_page.c
mi_panic.c
mi_preload.c
mi_range.c
mi_rename.c
mi_rfirst.c
mi_rkey.c Merge chilla.local:/home/mydev/mysql-5.0-ateam 2006-07-06 13:18:00 +02:00
mi_rlast.c
mi_rnext.c
mi_rnext_same.c
mi_rprev.c
mi_rrnd.c
mi_rsame.c
mi_rsamepos.c unsigned char -> uchar 2006-06-19 12:45:34 +03:00
mi_scan.c
mi_search.c This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes 2006-06-04 18:52:22 +03:00
mi_static.c
mi_statrec.c
mi_test1.c
mi_test2.c This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes 2006-06-04 18:52:22 +03:00
mi_test3.c
mi_test_all.res
mi_test_all.sh
mi_unique.c
mi_update.c Merge zim.(none):/home/brian/mysql/dep-5.0 2006-08-14 15:24:29 -07:00
mi_write.c Fix Bug #18559 "log tables cannot change engine, and 2006-08-03 21:28:15 +04:00
myisam_ftdump.c Bug #17122: myisam_ftdump requires write access to files although only reads from them 2006-07-21 13:59:59 -07:00
myisamchk.c
myisamdef.h Fix Bug #18559 "log tables cannot change engine, and 2006-08-03 21:28:15 +04:00
myisamlog.c Merge mysql.com:/home/my/mysql-5.0 2006-05-04 15:58:30 +03:00
myisampack.c This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes 2006-06-04 18:52:22 +03:00
NEWS
plug.in Major changes are plug.in files created for almost all storage engines. A few stray BDB references removed. 2006-08-18 21:19:19 -07:00
rt_index.c Merge chilla.local:/home/mydev/mysql-5.0-ateam 2006-07-06 13:18:00 +02:00
rt_index.h
rt_key.c
rt_key.h
rt_mbr.c Merge chilla.local:/home/mydev/mysql-5.0-ateam 2006-07-06 13:18:00 +02:00
rt_mbr.h
rt_split.c
rt_test.c
sort.c Merge zim.(none):/home/brian/mysql/dep-5.0 2006-08-14 15:24:29 -07:00
sp_defs.h
sp_key.c
sp_test.c
test_pack
TODO