Commit 6269e4f2 authored by mats@romeo.(none)'s avatar mats@romeo.(none)

Merge romeo.(none):/home/bkroot/mysql-5.1-new-rpl

into  romeo.(none):/home/bk/b22583-mysql-5.1-new-rpl
parents 08bb33db 68cc7dde
...@@ -483,19 +483,17 @@ static int ...@@ -483,19 +483,17 @@ static int
write_event_header_and_base64(Log_event *ev, FILE *result_file, write_event_header_and_base64(Log_event *ev, FILE *result_file,
PRINT_EVENT_INFO *print_event_info) PRINT_EVENT_INFO *print_event_info)
{ {
IO_CACHE *head= &print_event_info->head_cache;
IO_CACHE *body= &print_event_info->body_cache;
DBUG_ENTER("write_event_header_and_base64"); DBUG_ENTER("write_event_header_and_base64");
/* Write header and base64 output to cache */
IO_CACHE result_cache;
if (open_cached_file(&result_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP)))
return 1;
ev->print_header(&result_cache, print_event_info, FALSE); /* Write header and base64 output to cache */
ev->print_base64(&result_cache, print_event_info, FALSE); ev->print_header(head, print_event_info, FALSE);
ev->print_base64(body, print_event_info, FALSE);
/* Read data from cache and write to result file */ /* Read data from cache and write to result file */
my_b_copy_to_file(&result_cache, result_file); DBUG_RETURN(copy_event_cache_to_file_and_reinit(head, result_file) ||
close_cached_file(&result_cache); copy_event_cache_to_file_and_reinit(body, result_file));
DBUG_RETURN(0);
} }
......
...@@ -89,12 +89,14 @@ INSERT INTO t1 VALUES (test_replication_sf()); ...@@ -89,12 +89,14 @@ INSERT INTO t1 VALUES (test_replication_sf());
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql --exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
# Cleanup # Cleanup
connection master;
--disable_warnings --disable_warnings
DROP PROCEDURE IF EXISTS test_replication_sp1; DROP PROCEDURE IF EXISTS test_replication_sp1;
DROP PROCEDURE IF EXISTS test_replication_sp2; DROP PROCEDURE IF EXISTS test_replication_sp2;
DROP FUNCTION IF EXISTS test_replication_sf; DROP FUNCTION IF EXISTS test_replication_sf;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
--sync_slave_with_master
# If all is good, when can cleanup our dump files. # If all is good, when can cleanup our dump files.
--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql --system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
......
...@@ -582,7 +582,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle, ...@@ -582,7 +582,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
goto end; goto end;
/* A temporary table does not have locks. */ /* 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; goto end;
/* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */ /* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */
...@@ -607,7 +607,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle, ...@@ -607,7 +607,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
if (haystack->placeholder()) if (haystack->placeholder())
continue; continue;
table2= haystack->table; table2= haystack->table;
if (table2->s->tmp_table == TMP_TABLE) if (table2->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
continue; continue;
/* All tables in list must be in lock. */ /* All tables in list must be in lock. */
...@@ -694,7 +694,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, ...@@ -694,7 +694,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*write_lock_used=0; *write_lock_used=0;
for (i=tables=lock_count=0 ; i < count ; i++) 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(); tables+=table_ptr[i]->file->lock_count();
lock_count++; lock_count++;
...@@ -736,7 +736,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, ...@@ -736,7 +736,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
TABLE *table; TABLE *table;
enum thr_lock_type lock_type; 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; continue;
lock_type= table->reginfo.lock_type; lock_type= table->reginfo.lock_type;
if (lock_type >= TL_WRITE_ALLOW_WRITE) if (lock_type >= TL_WRITE_ALLOW_WRITE)
......
...@@ -75,8 +75,7 @@ public: ...@@ -75,8 +75,7 @@ public:
~Write_on_release_cache() ~Write_on_release_cache()
{ {
if (!my_b_copy_to_file(m_cache, m_file)) copy_event_cache_to_file_and_reinit(m_cache, m_file);
reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE);
if (m_flags | FLUSH_F) if (m_flags | FLUSH_F)
fflush(m_file); fflush(m_file);
} }
...@@ -6333,10 +6332,8 @@ void Rows_log_event::print_helper(FILE *file, ...@@ -6333,10 +6332,8 @@ void Rows_log_event::print_helper(FILE *file,
if (get_flags(STMT_END_F)) if (get_flags(STMT_END_F))
{ {
my_b_copy_to_file(head, file); copy_event_cache_to_file_and_reinit(head, file);
my_b_copy_to_file(body, file); copy_event_cache_to_file_and_reinit(body, file);
reinit_io_cache(head, WRITE_CACHE, 0, FALSE, TRUE);
reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE);
} }
} }
#endif #endif
......
...@@ -2489,4 +2489,12 @@ private: ...@@ -2489,4 +2489,12 @@ private:
#endif #endif
}; };
static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
FILE *file)
{
return
my_b_copy_to_file(cache, file) ||
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
}
#endif /* _log_event_h */ #endif /* _log_event_h */
...@@ -6435,12 +6435,12 @@ The minimum value for this variable is 4096.", ...@@ -6435,12 +6435,12 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL, (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, {"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*) &global_system_variables.trans_alloc_block_size,
(gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, (gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0}, REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, {"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*) &global_system_variables.trans_prealloc_size,
(gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, (gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0}, REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
......
...@@ -150,7 +150,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, ...@@ -150,7 +150,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
info->file= table->file; info->file= table->file;
info->forms= &info->table; /* Only one table */ info->forms= &info->table; /* Only one table */
if (table->s->tmp_table == TMP_TABLE && !table->sort.addon_field) if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE &&
!table->sort.addon_field)
VOID(table->file->extra(HA_EXTRA_MMAP)); VOID(table->file->extra(HA_EXTRA_MMAP));
if (table->sort.addon_field) if (table->sort.addon_field)
......
...@@ -3752,7 +3752,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ...@@ -3752,7 +3752,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
tmp_table->reginfo.lock_type= TL_WRITE; // Simulate locked tmp_table->reginfo.lock_type= TL_WRITE; // Simulate locked
share->tmp_table= (tmp_table->file->has_transactions() ? share->tmp_table= (tmp_table->file->has_transactions() ?
TRANSACTIONAL_TMP_TABLE : TMP_TABLE); TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE);
if (link_in_list) if (link_in_list)
{ {
......
...@@ -179,7 +179,7 @@ exit: ...@@ -179,7 +179,7 @@ exit:
orig_table_list->table_name= table->s->table_name.str; orig_table_list->table_name= table->s->table_name.str;
orig_table_list->table_name_length= table->s->table_name.length; orig_table_list->table_name_length= table->s->table_name.length;
table->derived_select_number= first_select->select_number; 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 #ifndef NO_EMBEDDED_ACCESS_CHECKS
if (orig_table_list->referencing_view) if (orig_table_list->referencing_view)
table->grant= orig_table_list->grant; table->grant= orig_table_list->grant;
......
...@@ -58,7 +58,7 @@ typedef struct st_grant_info ...@@ -58,7 +58,7 @@ typedef struct st_grant_info
enum tmp_table_type enum tmp_table_type
{ {
NO_TMP_TABLE, TMP_TABLE, TRANSACTIONAL_TMP_TABLE, NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment