00001 # 00002 # Simple test of the serial event log for single INSERT/DELETE statements 00003 # 00004 # We create a table and insert some records 00005 # into it then delete a record. 00006 # 00007 # We then use the transaction_reader in plugin/transaction_log/utilities to read the events. 00008 # 00009 00010 --disable_warnings 00011 DROP TABLE IF EXISTS t1; 00012 --enable_warnings 00013 00014 CREATE TABLE t1 ( 00015 id INT NOT NULL 00016 , padding VARCHAR(200) NOT NULL 00017 , PRIMARY KEY (id) 00018 ); 00019 00020 INSERT INTO t1 VALUES (1, "I love testing."); 00021 INSERT INTO t1 VALUES (2, "I hate testing."); 00022 00023 DELETE FROM t1 where id = 1; 00024 00025 DROP TABLE t1; 00026 00027 # Test the situation where no keys (WHERE clause) 00028 # are specified in a DELETE statement. In the absence 00029 # of triggers, this equates to a TRUNCATE TABLE statement, 00030 # and this is what should be written to the transaction log, 00031 # not multiple DeleteRecord events. 00032 # 00033 # However, right now this optimization does not occur. We 00034 # write individual DeleteRecord message to the log. We will 00035 # optimize this away once TableShare has been refactored 00036 00037 CREATE TABLE t1 ( 00038 id INT NOT NULL 00039 , other INT NOT NULL 00040 , PRIMARY KEY (id) 00041 ); 00042 00043 INSERT INTO t1 VALUES (1, 1); 00044 INSERT INTO t1 VALUES (2, 2); 00045 INSERT INTO t1 VALUES (3, 3); 00046 INSERT INTO t1 VALUES (4, 4); 00047 INSERT INTO t1 VALUES (5, 5); 00048 INSERT INTO t1 VALUES (6, 6); 00049 INSERT INTO t1 VALUES (7, 7); 00050 INSERT INTO t1 VALUES (8, 8); 00051 00052 # This should produce a TRUNCATE event 00053 DELETE FROM t1; 00054 00055 DROP TABLE t1; 00056 00057 # Test for LP Bug #496101: 00058 # 00059 # Delete within a transaction does not generate the correct 00060 # statements in the transaction log. We start a transaction 00061 # and issue both inserts and deletes in the same transaction. 00062 00063 --echo Start Test of LP Bug #496101 00064 00065 CREATE TABLE t1 ( 00066 id INT NOT NULL 00067 , padding VARCHAR(200) NOT NULL 00068 , PRIMARY KEY (id) 00069 ); 00070 00071 START TRANSACTION; 00072 00073 INSERT INTO t1 VALUES (1, "I love testing."); 00074 INSERT INTO t1 VALUES (2, "I hate testing."); 00075 00076 DELETE FROM t1 where id = 1; 00077 00078 COMMIT; 00079 00080 DROP TABLE t1; 00081 00082 --echo End Test of LP Bug #496101