He Zhenxing, good morning.
Just to clarify ...
>> Thanks for adding the test!
>>
>> As a comment on it, I thought the test would lists all kinds of query
>> on a temporary table and to print the content of the binlog in the
>> end.
>
> I agree to check all update querys that using temporary table would make
> the test complete, but I think the idea to print the content of the
> binlog is not good, because that would make the test dependent on the
> format of the binlog dump format, which might change from time to time.
Well, not all the binlog but only
$MYSQL_BINLOG binlog | grep 'pseudo_thread_id'
would be relevant to show in the results.
>
>> The content would prove each temp table query is accociated with a
>> pseudo_thread_id.
>>
>> === added file 'mysql-test/t/binlog_tmp_table.test'
>> --- a/mysql-test/t/binlog_tmp_table.test 1970-01-01 00:00:00 +0000
>> +++ b/mysql-test/t/binlog_tmp_table.test 2009-01-09 08:47:53 +0000
>> @@ -0,0 +1,58 @@
>> +# ==== Purpose ====
>> +#
>> +# Test if statements used temporary tables are binlogged correctly
>> +#
>> +# ==== Method ====
>> +#
>> +# Use two connections, use temporary tables on both of them, and by
>> +# switching connections between statements, the test can check if the
>> +# statements are logged with the correct thread id.
>>
>> This way is fine too, although it does not verify that tmp_table_used
>> flag in all cases (which is not a reqirement for the bug still would
>> be good to implement while we are within this problem context, imo).
>>
>
> the tmp_table_used flag is an internal member used by the code, it
> cannot be verified by the test.
sure. I mean pseudo_thread_id which can not be set only if
tmp_table_used was set.
> I think the important thing is that the
> thread_id is correctly used for each query that uses temporary table. I
> think there are only two ways to verify this, one is the method that I
> used for the test, the other is use mysqlbinlog to dump the binlog and
> check if the thread_id is printed correctly,
[ that's what i explained in the comments above too ]
> but since the second method
> would make the test dependent on binlog dump format, I choose the first
> one.
>
with grepping it'd not to be format-dependant.
cheers,
Andrei