1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Small improvement to alloc_root

Add support for LIMIT # OFFSET #
Changed lock handling:  Now all locks should be stored in TABLE_LIST instead of passed to functions.
Don't call query_cache_invalidate() twice in some cases
mysql_change_user() now clears states to be equal to close + connect.
Fixed a bug with multi-table-update and multi-table-delete when used with LOCK TABLES
Fixed a bug with replicate-do and UPDATE


BitKeeper/etc/ignore:
  added autom4te.cache/* bdb/dist/autom4te.cache/* innobase/autom4te.cache/*
include/my_alloc.h:
  Small improvement to alloc_root
libmysql/libmysql.c:
  Removed compiler warning
myisam/mi_page.c:
  Better DBUG message
mysql-test/r/multi_update.result:
  Added test with lock tables
mysql-test/r/rpl_replicate_do.result:
  Update results
mysql-test/r/rpl_rotate_logs.result:
  Make test independent of if t1 exists
mysql-test/t/multi_update.test:
  Added test with lock tables
mysql-test/t/rpl_rotate_logs.test:
  Make test independent of if t1 exists
mysys/my_alloc.c:
  Small imprevement to alloc_root
  (Don't free blocks less than ALLOC_MAX_BLOCK_ROOT (4K)
sql/ha_innodb.cc:
  More debug messages
sql/ha_myisam.cc:
  Safety change
sql/lex.h:
  Add support for LIMIT # OFFSET #
sql/lock.cc:
  Added assertion
sql/mysql_priv.h:
  Change of lock handling
sql/mysqld.cc:
  Added function clear_error_messages()
sql/sql_base.cc:
  Change lock handling by open_ltable() and open_and_lock_tables()
sql/sql_class.cc:
  Split THD::THD to two functions
  Move some code from cleanup() to ~THD:THD
  Add THD::change_user()
sql/sql_class.h:
  Prototype changes in class THD
sql/sql_delete.cc:
  Remove locking argument from mysql_delete()
  Locking type is now stored in TABLE_LIST
  Small code change to not call query_cache_invalidate() twice for transactional tables.
sql/sql_insert.cc:
  Remove locking argument from mysql_insert()
  Locking type is now stored in TABLE_LIST
  Small code change to not call query_cache_invalidate() twice for transactional tables.
  Don't use bulk insert if bulk_insert_buff_size is 0
sql/sql_parse.cc:
  Changes to make mysql_change_user() work as close+connect
  Changed command statistics to use statstics_increment to get more speed
  Update code to handle that locks is now stored in TABLE_LIST
sql/sql_update.cc:
  Remove locking argument from mysql_update()
  Locking type is now stored in TABLE_LIST
  Small code change to not call query_cache_invalidate() twice for transactional tables.
sql/sql_yacc.yy:
  Locking type is now stored in TABLE_LIST
  Added support for LIMIT # OFFSET # syntax
  Removed some wrong (never true) checks for SQLCOM_MULTI_UPDATE
mysql-test/t/rpl_replicate_do-slave.opt:
  Changed tables to use t1,t2,...
mysql-test/t/rpl_replicate_do.test:
  Changed tables to use t1,t2,...
This commit is contained in:
unknown
2002-11-16 20:19:10 +02:00
parent ffd1d3df2a
commit bd1c2d65c4
29 changed files with 525 additions and 264 deletions

View File

@@ -87,9 +87,6 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
host_or_ip="unknown ip";
locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password=
query_start_used=safe_to_cache_query=0;
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
pthread_mutex_unlock(&LOCK_global_system_variables);
db_length=query_length=col_access=0;
query_error=0;
next_insert_id=last_insert_id=0;
@@ -129,19 +126,12 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
server_id = ::server_id;
slave_net = 0;
log_pos = 0;
server_status= SERVER_STATUS_AUTOCOMMIT;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
TL_WRITE);
options= thd_startup_options;
sql_mode=(uint) opt_sql_mode;
open_options=ha_open_options;
session_tx_isolation= (enum_tx_isolation) variables.tx_isolation;
command=COM_CONNECT;
set_query_id=1;
db_access=NO_ACCESS;
version=refresh_version; // For boot
init();
/* Initialize sub structures */
bzero((char*) &mem_root,sizeof(mem_root));
bzero((char*) &transaction.mem_root,sizeof(transaction.mem_root));
@@ -174,6 +164,48 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
}
}
/*
Init common variables that has to be reset on start and on change_user
*/
void THD::init(void)
{
server_status= SERVER_STATUS_AUTOCOMMIT;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
TL_WRITE);
options= thd_startup_options;
sql_mode=(uint) opt_sql_mode;
open_options=ha_open_options;
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
pthread_mutex_unlock(&LOCK_global_system_variables);
session_tx_isolation= (enum_tx_isolation) variables.tx_isolation;
}
/*
Do what's needed when one invokes change user
SYNOPSIS
change_user()
IMPLEMENTATION
Reset all resources that are connection specific
*/
void THD::change_user(void)
{
cleanup();
cleanup_done=0;
init();
hash_init(&user_vars, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
(hash_free_key) free_user_var,0);
}
/* Do operations that may take a long time */
void THD::cleanup(void)
@@ -191,17 +223,21 @@ void THD::cleanup(void)
close_thread_tables(this);
}
close_temporary_tables(this);
#ifdef USING_TRANSACTIONS
if (opt_using_transactions)
hash_free(&user_vars);
if (global_read_lock)
unlock_global_read_lock(this);
if (ull)
{
close_cached_file(&transaction.trans_log);
ha_close_connection(this);
pthread_mutex_lock(&LOCK_user_locks);
item_user_lock_release(ull);
pthread_mutex_unlock(&LOCK_user_locks);
ull= 0;
}
#endif
cleanup_done=1;
DBUG_VOID_RETURN;
}
THD::~THD()
{
THD_CHECK_SENTRY(this);
@@ -218,15 +254,13 @@ THD::~THD()
}
if (!cleanup_done)
cleanup();
if (global_read_lock)
unlock_global_read_lock(this);
if (ull)
#ifdef USING_TRANSACTIONS
if (opt_using_transactions)
{
pthread_mutex_lock(&LOCK_user_locks);
item_user_lock_release(ull);
pthread_mutex_unlock(&LOCK_user_locks);
close_cached_file(&transaction.trans_log);
ha_close_connection(this);
}
hash_free(&user_vars);
#endif
DBUG_PRINT("info", ("freeing host"));
if (host != localhost) // If not pointer to constant