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 /sql/sql_base.cc | |
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 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index c695fe40d7f..44b3a22ec52 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -835,7 +835,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, bool found=0; for (TABLE_LIST *table= tables; table; table= table->next_local) { - if (remove_table_from_cache(thd, table->db, table->table_name, + if ((!table->table || !table->table->s->log_table) && + remove_table_from_cache(thd, table->db, table->table_name, RTFC_OWNED_BY_THD_FLAG)) found=1; } @@ -869,7 +870,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, for (uint idx=0 ; idx < open_cache.records ; idx++) { TABLE *table=(TABLE*) hash_element(&open_cache,idx); - if ((table->s->version) < refresh_version && table->db_stat) + if (!table->s->log_table && + ((table->s->version) < refresh_version && table->db_stat)) { found=1; pthread_cond_wait(&COND_refresh,&LOCK_open); @@ -1852,7 +1854,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (!thd->open_tables) thd->version=refresh_version; else if ((thd->version != refresh_version) && - ! (flags & MYSQL_LOCK_IGNORE_FLUSH)) + ! (flags & MYSQL_LOCK_IGNORE_FLUSH) && !table->s->log_table) { /* Someone did a refresh while thread was opening tables */ if (refresh) @@ -1873,7 +1875,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, { if (table->s->version != refresh_version) { - if (flags & MYSQL_LOCK_IGNORE_FLUSH) + /* + Don't close tables if we are working with a log table or were + asked not to close the table explicitly + */ + if (flags & MYSQL_LOCK_IGNORE_FLUSH || table->s->log_table) { /* Force close at once after usage */ thd->version= table->s->version; @@ -2236,6 +2242,10 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, Wait until all threads has closed the tables in the list We have also to wait if there is thread that has a lock on this table even if the table is closed + NOTE: log tables are handled differently by the logging routines. + E.g. general_log is always opened and locked by the logger + and the table handler used by the logger, will be skipped by + this check. */ bool table_is_used(TABLE *table, bool wait_for_name_lock) @@ -2254,9 +2264,10 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) search= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, &state)) { - DBUG_PRINT("info", ("share: 0x%lx locked_by_flush: %d " - "locked_by_name: %d db_stat: %u version: %u", - (ulong) search->s, + DBUG_PRINT("info", ("share: 0x%lx locked_by_logger: %d " + "locked_by_flush: %d locked_by_name: %d " + "db_stat: %u version: %u", + (ulong) search->s, search->locked_by_logger, search->locked_by_flush, search->locked_by_name, search->db_stat, search->s->version)); @@ -2267,12 +2278,15 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) - There is an name lock on it (Table is to be deleted or altered) - If we are in flush table and we didn't execute the flush - If the table engine is open and it's an old version - (We must wait until all engines are shut down to use the table) + (We must wait until all engines are shut down to use the table) + However we fo not wait if we encountered a table, locked by the logger. + Log tables are managed separately by logging routines. */ - if (search->locked_by_name && wait_for_name_lock || - search->locked_by_flush || - (search->db_stat && search->s->version < refresh_version)) - return 1; + if (!search->locked_by_logger && + (search->locked_by_name && wait_for_name_lock || + search->locked_by_flush || + (search->db_stat && search->s->version < refresh_version))) + return 1; } } while ((table=table->next)); DBUG_RETURN(0); @@ -5867,6 +5881,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, &state)) { THD *in_use; + table->s->version=0L; /* Free when thread is ready */ if (!(in_use=table->in_use)) { |