Hi Jasonh,
Thanks for the review.
You are completely right.
I will change the patch.
Cheers.
He Zhenxing wrote:
> Hi Alfranio,
>
> Thank you for the big work!
>
> I have some comments over the main idea of this patch, Please correct me
> if I misunderstood.
>
> My understanding of this patch is that the main idea is to treat
> CREATE/DROP TEMPORARY TABLE statement as updates like INSERT/UPDATE to
> tables, and they will follow the same rule as for INSERT/UPDATE to
> transactional/non-transactional tables, and when dropping both type of
> temporary tables, they will be binlogged separately.
>
> I think this solution will not work for the following:
>
> CREATE TABLE t1 ( i INT ) ENGINE = InnoDB;
>
> CREATE TEMPORARY TABLE tmp ( i INT ) ENGINE = MyISAM;
>
> START TRANSACTION;
>
> INSERT INTO t1 VALUES (1);
>
> INSERT INTO tmp VALUES (1);
>
> INSERT INTO t1 SELECT * FROM tmp;
>
> DROP TEMPORARY TABLE tmp;
>
> COMMIT;
>
> The transaction above will be binlogged (after applied the patch) in SBR as:
>
> BEGIN
> use `test`; INSERT INTO tmp VALUES (1)
> COMMIT
> BEGIN
> use `test`; DROP TEMPORARY TABLE `tmp` /* generated by server */
> COMMIT
> BEGIN
> use `test`; INSERT INTO t1 VALUES (1)
> use `test`; INSERT INTO t1 SELECT * FROM tmp
> COMMIT /* xid=27 */
>
> This will cause error because the DROP statement of 'tmp' table will be
> binlogged before the INSERT..SELECT statement.
>
> I think the reason why we do not want to binlog changes to
> non-transactional (non-temporary) tables at the end of the transaction
> is for dependency between concurrent transactions, that is, the changes
> to non-transactional tables can be seen by concurrent transactions
> before this transaction is committed.
>
> But because temporary tables are not accessible outside current session,
> we cannot have other sessions dependent on the content of a temporary
> table from this session. And so I think we can always use the
> transactional cache for create/drop/update over temporary tables, no
> matter it is transactional or non-transactional engine.
>
> Alfranio Correia wrote:
>> #At
> file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-51894/mysql-next-mr-bugfixing/
> based on revid:alik@stripped
>>
>> 3144 Alfranio Correia 2010-03-26
>> BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
> transaction
>>
> [snip]
>
>
>