Re: NDB tables with character primary key replicate only partially

Giuseppe Maxia <[email protected]> Wed, 13 Oct 2004 21:45:50 +0200
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>

Jonas Oreland wrote:
> Hi,
> 
> I've tried to reproduce you problem, but I can't.
> 
> How long time does pass between mysql1-commit and mysql2-select?
> 

just a few seconds. Only the time needed to switch from one terminal window
to the next and press the ENTER key.

Anyway, I made further inquiries, and I found out that this bug does show
ONLY if both clients had autocommit=0 before the steps I described.

Actually, if I turn autocommit ON (instead of disconnecting and restarting)
in the second client, then I can see the records correctly.

Just to be sure, I removed everything, reinstalled all the cluster
from scratch, and the problem is repeatable.


Cheers

Giuseppe


> /Jonas
> 
> Giuseppe Maxia wrote:
> 
>> I was testing transactions in NDB tables, and I came across this problem.
>>
>> Bug observed using MySQL 4.1.4-max, with the simple configuration 
>> shown in MySQL manual
>> (http://dev.mysql.com/doc/mysql/en/MySQL_Cluster_quick.html)
>>
>> Summary: With two MySQL nodes open, create one table in the first 
>> node, giving it
>> a primary key of type CHAR.
>> In the second node, the table is replicated.
>> Then open a transaction, and insert two records in the table.
>> When the transaction is committed, the second node will only see one 
>> record.
>>
>> If you close the second session and reopen it, then all the records 
>> are shown.
>>
>> To repeat, follow this timeline, issuing the commands in node1 and node2
>> in the same order they are shown.
>>
>> (NODE 1)                                 (NODE 2)
>>
>> mysql1> set autocommit = 0;              mysql2> set autocommit = 0;
>> Query OK, 0 rows affected (0.00 sec)     Query OK, 0 rows affected 
>> (0.00 sec)
>>
>> mysql1> create table uno (c char(10)
>>      -> not null primary key)
>>      -> engine=ndb;
>> Query OK, 0 rows affected (0.55 sec)
>>                                          mysql2> show create table uno\G
>>                                          ************* 1. row 
>> *************
>>                                                 Table: uno
>>                                          Create Table: CREATE TABLE 
>> `uno` (
>>                                           `c` char(10) NOT NULL 
>> default '',
>>                                            PRIMARY KEY  (`c`)
>>                                          ) ENGINE=ndbcluster
>>                                            DEFAULT CHARSET=latin1
>>                                          1 row in set (0.01 sec)
>>
>> mysql1> begin;
>> Query OK, 0 rows affected (0.00 sec)
>>
>> mysql1> insert into uno values
>>      -> ('aaa'), ('bbb');
>> Query OK, 2 rows affected (0.00 sec)
>> Records: 2  Duplicates: 0  Warnings: 0
>>
>>                                          mysql2> select * from uno;
>>                                          Empty set (0.00 sec)
>> mysql1> commit;
>> Query OK, 0 rows affected (0.00 sec)
>>
>> mysql1> select * from uno;               mysql2> select * from uno;
>> +-----+                                  +-----+
>> | c   |                                  | c   |
>> +-----+                                  +-----+
>> | bbb |                                  | bbb |
>> | aaa |                                  +-----+
>> +-----+                                  1 row in set (0.01 sec)
>> 2 rows in set (0.00 sec)
>>
>>
>>
> 
> 

-- 
Giuseppe Maxia
CTO
http://www.StarData.it
MySQL Certified Professional
        __              __     __
   ___ / /____ ________/ /__ _/ /____ _
  (_-</ __/ _ `/ __/ _  / _ `/ __/ _ `/
/___/\__/\_,_/_/  \_,_/\_,_/\__/\_,_/
        Database is our business

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]