summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <lars/lthalmann@mysql.com/dl145h.mysql.com>2007-03-29 12:25:28 +0200
committerunknown <lars/lthalmann@mysql.com/dl145h.mysql.com>2007-03-29 12:25:28 +0200
commite420488ee6e3b38a0524b391a96638af7edc06ce (patch)
tree1e6d9e2f685ac0edc110cb4b215d1c1d82f25289 /sql
parent8e1d4f725663d60b7efa7d5ec4271cbd924cad80 (diff)
parentee0475bf5d5b9256d599aa6b9dcc641d4857d301 (diff)
downloadmariadb-git-e420488ee6e3b38a0524b391a96638af7edc06ce.tar.gz
Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge sql/mysqld.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/lock.cc8
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_class.cc12
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/table.h3
7 files changed, 23 insertions, 10 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index bf1512b754c..233d12d9cc4 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -544,7 +544,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
goto end;
/* A temporary table does not have locks. */
- if (table->s->tmp_table == TMP_TABLE)
+ if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
goto end;
/* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */
@@ -569,7 +569,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
if (haystack->placeholder())
continue;
table2= haystack->table;
- if (table2->s->tmp_table == TMP_TABLE)
+ if (table2->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
continue;
/* All tables in list must be in lock. */
@@ -655,7 +655,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*write_lock_used=0;
for (i=tables=lock_count=0 ; i < count ; i++)
{
- if (table_ptr[i]->s->tmp_table != TMP_TABLE)
+ if (table_ptr[i]->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE)
{
tables+=table_ptr[i]->file->lock_count();
lock_count++;
@@ -697,7 +697,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
TABLE *table;
enum thr_lock_type lock_type;
- if ((table=table_ptr[i])->s->tmp_table == TMP_TABLE)
+ if ((table=table_ptr[i])->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
continue;
lock_type= table->reginfo.lock_type;
if (lock_type >= TL_WRITE_ALLOW_WRITE)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 99d66134405..aba46261dc8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6126,12 +6126,12 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
- "Allocation block size for transactions to be stored in binary log",
+ "Allocation block size for various transaction-related structures",
(gptr*) &global_system_variables.trans_alloc_block_size,
(gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
- "Persistent buffer for transactions to be stored in binary log",
+ "Persistent buffer for various transaction-related structures",
(gptr*) &global_system_variables.trans_prealloc_size,
(gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 97cb2d00689..57d99d4e461 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2950,7 +2950,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
share= tmp_table->s;
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
share->tmp_table= (tmp_table->file->has_transactions() ?
- TRANSACTIONAL_TMP_TABLE : TMP_TABLE);
+ TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE);
share->table_cache_key= (char*) (tmp_table+1);
share->db= share->table_cache_key;
share->key_length= (uint) (strmov(((char*) (share->table_name=
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 8dea9383f34..a94f903a47b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -613,6 +613,18 @@ void THD::cleanup_after_query()
clear_next_insert_id= 0;
next_insert_id= 0;
}
+ /*
+ Reset rand_used so that detection of calls to rand() will save random
+ seeds if needed by the slave.
+
+ Do not reset rand_used if inside a stored function or trigger because
+ only the call to these operations is logged. Thus only the calling
+ statement needs to detect rand() calls made by its substatements. These
+ substatements must not set rand_used to 0 because it would remove the
+ detection of rand() by the calling statement.
+ */
+ if (!in_sub_stmt)
+ rand_used= 0;
/* Free Items that were created during this execution */
free_items();
/* Reset where. */
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index cd46f3bcc0e..84622398f6f 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -179,7 +179,7 @@ exit:
orig_table_list->table_name= (char*) table->s->table_name;
orig_table_list->table_name_length= strlen((char*)table->s->table_name);
table->derived_select_number= first_select->select_number;
- table->s->tmp_table= TMP_TABLE;
+ table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (orig_table_list->referencing_view)
table->grant= orig_table_list->grant;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 35e6a7da0aa..bfcb0d2a32d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9170,7 +9170,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s->table_name= table->s->path= tmpname;
table->s->db= "";
table->s->blob_ptr_size= mi_portable_sizeof_char_ptr;
- table->s->tmp_table= TMP_TABLE;
+ table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
table->s->db_low_byte_first=1; // True for HEAP and MyISAM
table->s->table_charset= param->table_charset;
table->s->keys_for_keyread.init();
diff --git a/sql/table.h b/sql/table.h
index e2bd5ba0a7d..5fc73b22d2d 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -55,7 +55,8 @@ typedef struct st_grant_info
ulong orig_want_privilege;
} GRANT_INFO;
-enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2,
+enum tmp_table_type {NO_TMP_TABLE=0,
+ NON_TRANSACTIONAL_TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2,
SYSTEM_TMP_TABLE=3};
enum frm_type_enum