Bug #35244 TE_ALTER event not raised when ALTER TABLE ADD COLUMN is executed.
Submitted: 12 Mar 2008 12:06 Modified: 1 Nov 2009 13:24
Reporter: Massimo Brignoli Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Linux
Assigned to: Assigned Account CPU Architecture:Any
Tags: CGE 6.3.6

[12 Mar 2008 12:06] Massimo Brignoli
Description:
Seems that the TE_ALTER event is not raised when a ALTER TABLE ADD COLUMN is executed in a mysql sqlserver. Other ALTER TABLE commands work properly (like modify column)

How to repeat:
In attach I've done a simple application that remains in listening for changes on tables after it has created the event TE_ALTER on the tables of a specified database.

Executing a alter table modify column in a separate mysql client, the TE_ALTER is raised. But executing a alter table add column the event is not raised.
[12 Mar 2008 14:44] Massimo Brignoli
Listener for table changes

Attachment: mydemo.cpp (, text), 6.55 KiB.

[12 Mar 2008 17:51] Massimo Brignoli
To use the test application.

create a database test.

create at least one table in the database before launching the application

create table test (field1 int(10)) engine=ndb;

now launch the application. you'll see this output:

Connection with cluster...
done.
Loading ... 
<dict>
test(   field1 ,$PK)
        Status = Retrieved
</dict>
Dictionary::Table:test
Listining for changes ...

Now execute an alter table modify column, for example

alter table test modify column  field1  int(12);

the TE_ALTER event is raised and catch by the application that prints:

TE_ALTER: <dict>
#sql2-1858-3(   field1 ,$PK)
        Status = Retrieved
test(   field1 ,$PK)
        Status = Altered
</dict>
Attempt to refresh .... 
Flushing test
<dict>
#sql2-1858-3(   field1 ,$PK)
        Status = Retrieved
test(   field1 ,$PK)
        Status = Retrieved
</dict>

now try an alter table add column:

alter table test add column  field2  int(12);

the application does nothing, the TE_ALTER event is not raised.
[1 Oct 2009 12:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85367

3011 Martin Skold	2009-10-01
      bug#35244  TE_ALTER event not raised when ALTER TABLE ADD COLUMN is executed: added event type printout to test tool listen_event
      modified:
        storage/ndb/test/tools/listen.cpp
[1 Oct 2009 13:18] Martin Skold
Testing with new listen_event:

mysql> CREATE TABLE t1 ( id INT AUTO_INCREMENT, PRIMARY KEY(id) ) ENGINE=NDBCLUSTER;
Query OK, 0 rows affected (0.28 sec)

mysql-5.1-telco-6.3/storage/ndb/test$ tools/listen_event -d test t1

mysql> insert into t1 values (NULL),(NULL);
Query OK, 2 rows affected (0.04 sec)

Received event: TE_INSERT
Received event: TE_INSERT
GCI: 22/2 events: 2(I) 0(U) 0(D)

mysql> alter online table t1 add column x int;
Query OK, 0 rows affected, 1 warning (0.52 sec)
Records: 0  Duplicates: 0  Warnings: 0

Received event: TE_ALTER
GCI: 25/24 events: 0(I) 0(U) 0(D)

mysql> alter online table t1 add column y text;
ERROR 1235 (42000): This version of MySQL doesn't yet support 'alter online table t1 add column y text'
mysql> alter table t1 add column y text;
Query OK, 2 rows affected (1.30 sec)
Records: 2  Duplicates: 0  Warnings: 0

Received event: TE_ALTER
GCI: 65/18 events: 0(I) 0(U) 0(D)
Received event: TE_DROP
GCI: 65/24 events: 0(I) 0(U) 0(D)

So the TE_ALTER event is received both for ONLINE and OFFLINE ALTER, but
please notice that after an OFFLINE ALTER the table id has changed and
the events have to be monitored from the new table, i.e. listen_event needs
to be restarted.
[1 Oct 2009 13:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85375

3082 Martin Skold	2009-10-01 [merge]
      Merge
      modified:
        storage/ndb/test/tools/listen.cpp
[1 Oct 2009 15:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85409

3064 Martin Skold	2009-10-01 [merge]
      Merge
      modified:
        storage/ndb/test/tools/listen.cpp
[1 Oct 2009 15:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85413

3047 Martin Skold	2009-10-01 [merge]
      Merge
      modified:
        storage/ndb/test/tools/listen.cpp
[2 Nov 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".