diff options
author | unknown <cps@outpost.site> | 2006-01-19 05:56:06 +0300 |
---|---|---|
committer | unknown <cps@outpost.site> | 2006-01-19 05:56:06 +0300 |
commit | 41536fcefe62a3997e8829fb3ccb0f4ff3316fb2 (patch) | |
tree | 7c4ed26ee5f9b700099b772510ed9aa085bad459 /mysql-test/t/log_tables.test | |
parent | 471314df6a01f5f8e3f8054a8af4caac9aa0fb10 (diff) | |
download | mariadb-git-41536fcefe62a3997e8829fb3ccb0f4ff3316fb2.tar.gz |
WL1019: complete patch. Reapplied patch to the clean
tree to get rid of multiple typos in CS comments and
unify the patch.
configure.in:
CSV is compiled in by default now
include/my_base.h:
add new ha_extra flag for the log tables
mysql-test/include/im_check_os.inc:
we should only run im tests if csv is on for now: im relies
on mysqld options available only in csv build.
mysql-test/include/system_db_struct.inc:
check log tables structure
mysql-test/lib/init_db.sql:
create log tables when running tests.
mysql-test/mysql-test-run.pl:
Add old logs flag to IM tests. As IM could only deal with
old logs (this feature is not needed with log tables)
mysql-test/r/connect.result:
update result
mysql-test/r/csv.result:
update result
mysql-test/r/im_utils.result:
update result
mysql-test/r/information_schema.result:
update result
mysql-test/r/mysqlcheck.result:
update result
mysql-test/r/show_check.result:
update result
mysql-test/r/system_mysql_db.result:
update result
mysql-test/t/connect.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
mysql-test/t/csv.test:
add tests for concurrent insert (the functionality is added
to CSV in this patch)
mysql-test/t/information_schema.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
mysql-test/t/mysqlcheck.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
mysql-test/t/show_check.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
mysql-test/t/system_mysql_db.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
mysql-test/t/system_mysql_db_fix.test:
disable test if CSV engine is not in: result depends on the
presence of CSV-based log tables
scripts/mysql_create_system_tables.sh:
new system tables: slow_log and general_log
scripts/mysql_fix_privilege_tables.sql:
add new log tables: use an SP to create them for
non-csv build to work fine.
sql/ha_myisam.cc:
move locking-related checks to the hanlder
sql/ha_myisam.h:
new function declared
sql/handler.h:
new virtual function is added: we should check for handler-related
locking issues in the handler
sql/lock.cc:
from now on we check for handler-related locking issues
in the handler itself rather then in lock.cc
sql/log.cc:
Add log tables support, refactoring: there are log event
handlers with common interface. They are used by the LOGGER
class, which is responsible for their initialization, cleanup
and managment. Logging to the tables provided by one of the
log event handler types.
sql/log.h:
declare new log classes
sql/log_event.cc:
convert old logging routines calls to use new API
sql/mysql_priv.h:
define common log routines and objects
sql/mysqld.cc:
Add support for the log tables. Their initalization, cleanup
and specific options.
sql/share/errmsg.txt:
add new error messages for the log tables
sql/slave.cc:
convert old logging routines calls to use new API
sql/sql_base.cc:
TABLE objects used by the logger should be skipped
during refreshes (as log tables are always opened
and locked). fix table_is_used to skip them. This
is needed for FLUSH LOGS to work
sql/sql_db.cc:
convert old logging routines calls to use new API
sql/sql_delete.cc:
fix TRUNCATE to work with log tables
sql/sql_parse.cc:
command_name is now an array of LEX_STRINGs
sql/sql_prepare.cc:
convert old logging routines calls to use new API
sql/sql_show.cc:
convert old logging routines calls to use new API
sql/sql_table.cc:
don't reoped the log tables for admin purposes
sql/table.cc:
mark log tables as such during the open
sql/table.h:
add log-related info
storage/csv/ha_tina.cc:
add support for concurrent insert (see bk commit - 5.1 tree
(petr:1.1910) for standalone patch), add log tables-specific
csv table handling.
storage/csv/ha_tina.h:
enable concurrent insert for CSV, add log table flag
mysql-test/r/log_tables.result:
New BitKeeper file ``mysql-test/r/log_tables.result''
mysql-test/t/log_tables.test:
New BitKeeper file ``mysql-test/t/log_tables.test''
Diffstat (limited to 'mysql-test/t/log_tables.test')
-rw-r--r-- | mysql-test/t/log_tables.test | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test new file mode 100644 index 00000000000..a9e161f644c --- /dev/null +++ b/mysql-test/t/log_tables.test @@ -0,0 +1,146 @@ +# +# Basic log tables test +# + +# check that CSV engine was compiled in +--source include/have_csv.inc + +use mysql; + +# +# Check that log tables work and we can do basic selects. This also +# tests truncate, which works in a special mode with the log tables +# + +truncate table general_log; +--replace_column 1 TIMESTAMP +select * from general_log; +truncate table slow_log; +--replace_column 1 TIMESTAMP +select * from slow_log; + +# +# We want to check that a record newly written to a log table shows up for +# the query: since log tables use concurrent insert machinery and log tables +# are always locked by artificial THD, this feature requires additional +# check in ha_tina::write_row. This simple test should prove that the +# log table flag in the table handler is triggered and working. +# + +truncate table general_log; +--replace_column 1 TIMESTAMP +select * from general_log where argument like '%general_log%'; + + +# +# Check some basic queries interfering with the log tables. +# In our test we'll use a tbale with verbose comments to the short +# command type names, used in the tables +# + +create table join_test (verbose_comment varchar (80), command_type varchar(64)); + +insert into join_test values ("User performed a usual SQL query", "Query"); +insert into join_test values ("New DB connection was registered", "Connect"); +insert into join_test values ("Get the table info", "Field List"); + +select verbose_comment, user_host, argument + from mysql.general_log join join_test + on (mysql.general_log.command_type = join_test.command_type); + +drop table join_test; + +# +# check that flush of the log table work fine +# + +flush logs; + +# +# check locking of the log tables +# + +--error 1532 +lock tables mysql.general_log WRITE; + +--error 1532 +lock tables mysql.slow_log WRITE; + +# +# This attemts to get TL_READ_NO_INSERT lock, which is incompatible with +# TL_WRITE_CONCURRENT_INSERT. This should fail. We issue this error as log +# tables are always opened and locked by the logger. +# + +--error 1533 +lock tables mysql.general_log READ; + +--error 1533 +lock tables mysql.slow_log READ; + +# +# This call should result in TL_READ lock on the log table. This is ok and +# should pass. +# + +lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL; + +unlock tables; + +# +# check that FLUSH LOGS waits for all readers of the log table to vanish +# + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; + +lock tables mysql.general_log READ LOCAL; + +connection con2; + +# this should wait for log tables to unlock +send flush logs; + +connection con1; + +unlock tables; + +# this connection should be alive by the time +connection con2; + +reap; + +select "Mark that we woke up from flush logs in the test" + as "test passed"; + +# +# perform the same check for TRUNCATE: it should also wait for readers +# to disappear +# + +connection con1; + +lock tables mysql.general_log READ LOCAL; + +connection con2; + +# this should wait for log tables to unlock +send truncate mysql.general_log; + +connection con1; + +unlock tables; + +# this connection should be alive by the time +connection con2; + +reap; + +select "Mark that we woke up from TRUNCATE in the test" + as "test passed"; + +disconnect con2; +disconnect con1; + |