Bug #12836 Can delete data in Archive table through Federated table
Submitted: 26 Aug 2005 16:42 Modified: 30 Aug 2005 20:25
Reporter: Robin Schumacher Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.15 OS:Linux (Linux or Windows XP)
Assigned to: Brian Aker CPU Architecture:Any

[26 Aug 2005 16:42] Robin Schumacher
Description:
You can issue a DELETE command through a Federated table to remove data in an Archive table.

How to repeat:
On Linux Machine:

mysql> create table t1 (c1 int) engine=archive;
Query OK, 0 rows affected (0.00 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> insert into t1 values (1);
Query OK, 1 row affected (0.00 sec)

Now on Windows box...

mysql> create table t1 (c1 int) engine=federated
    -> comment='mysql://root:manager@192.168.0.5:3306/test/t1';
Query OK, 0 rows affected (0.13 sec)

mysql> select * from t1;
+------+
| c1   |
+------+
|    1 |
+------+
1 row in set (0.09 sec)

mysql> delete from t1;
Query OK, 1 row affected (0.01 sec)

mysql> select * from t1;
Empty set (0.00 sec)

Back on Linux box...

mysql> select * from t1;
Empty set (0.00 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
[26 Aug 2005 17:38] MySQL Verification Team
Thank you for the bug report.

Linux BOx:

miguel@hegel:~/dbs/5.0> bin/mysqladmin -uroot create fdtest
miguel@hegel:~/dbs/5.0> bin/mysql -uroot fdtest
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.13-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table t1 (c1 int) engine=archive;
Query OK, 0 rows affected (0.07 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
1 row in set (0.04 sec)

mysql> insert into t1 values (1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
Empty set (0.00 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> 

Windows box:

c:\mysql\bin>mysqladmin -uroot create fdtest

c:\mysql\bin>mysql -uroot fdtest
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.10a-beta-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table t1 (c1 int) engine=federated
    -> comment='mysql://miguel:nana@192.168.0.119:3306/fdtest/t1';
Query OK, 0 rows affected (0.20 sec)

mysql> select * from t1;
+------+
| c1   |
+------+
|    1 |
+------+
1 row in set (0.16 sec)

mysql> delete from t1;
Query OK, 1 row affected (0.06 sec)

mysql> select * from t1;
Empty set (0.05 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) default NULL
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 COMMENT='mysql://miguel:nana@192.168.0.119:3306/fdtest/t1'
1 row in set (0.00 sec)

mysql>
[30 Aug 2005 17:07] Brian Aker
Fix was pushed into 4.1 and above. TRUNCATE and DELETE should now never function with an archive table.
[30 Aug 2005 20:13] Paul DuBois
Noted in 4.1.15 changelog.