Transaction log does not appear to be collecting all information for multi-row REPLACE statements
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
Medium
|
David Shrewsbury | ||
Dexter |
Fix Released
|
Medium
|
David Shrewsbury |
Bug Description
The transaction log does not appear to be capturing all relevant data for multi-row REPLACE statements:
What we see below is a multi-row REPLACE (it touches 3 rows). However, the transaction log is missing any data for the row with pk=2 (column a). The log output below has us DELETE'ing row pk=1, UPDATE'ing row pk=4, but no mention of row pk=2.
For this sequence of queries:
CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL, c CHAR(100), d CHAR(20), PRIMARY KEY(a), UNIQUE KEY(b), UNIQUE KEY(c));
INSERT INTO t1 (b,c,d) VALUES (10,'a'
SELECT * FROM t1;
REPLACE INTO t1 VALUES (1, 20, 'd','x');
SELECT * FROM t1;
DROP TABLE t1;
We get this transaction_log output (via print_transacti
+SELECT PRINT_TRANSACTI
+PRINT_
+transaction_
+ server_id: 1
+ transaction_id: 4
+ START_TIMESTAMP
+ END_TIMESTAMP
+}
+statement {
+ type: DELETE
+ START_TIMESTAMP
+ END_TIMESTAMP
+ delete_header {
+ table_metadata {
+ schema_name: "test"
+ table_name: "t1"
+ }
+ key_field_metadata {
+ type: INTEGER
+ name: "a"
+ }
+ }
+ delete_data {
+ segment_id: 1
+ end_segment: true
+ record {
+ key_value: "1"
+ }
+ }
+}
+statement {
+ type: DELETE
+ start_timestamp: 1277762315337862
+ end_timestamp: 1277762315337872
+ delete_header {
+ table_metadata {
+ schema_name: "test"
+ table_name: "t1"
+ }
+ key_field_metadata {
+ type: INTEGER
+ name: "a"
+ }
+ }
+ delete_data {
+ segment_id: 1
+ end_segment: true
+ record {
+ key_value: "1"
+ }
+ }
+}
+statement {
+ type: UPDATE
+ start_timestamp: 1277762315338263
+ end_timestamp: 1277762315370096
+ update_header {
+ table_metadata {
+ schema_name: "test"
+ table_name: "t1"
+ }
+ key_field_metadata {
+ type: INTEGER
+ name: "a"
+ }
+ set_field_metadata {
+ type: INTEGER
+ name: "a"
+ }
+ set_field_metadata {
+ type: INTEGER
+ name: "b"
+ }
+ set_field_metadata {
+ type: VARCHAR
+ name: "c"
+ }
+ set_field_metadata {
+ type: VARCHAR
+ name: "d"
+ }
+ }
+ update_data {
+ segment_id: 1
+ end_segment: true
+ record {
+ key_value: "4"
+ after_value: "1"
+ after_value: "20"
+ after_value: "d"
+ after_value: "x"
+ }
+ }
Related branches
- Jay Pipes (community): Approve
- Drizzle Merge Team: Pending requested
-
Diff: 297 lines (+215/-10)5 files modifieddrizzled/cursor.cc (+7/-2)
drizzled/transaction_services.cc (+22/-5)
drizzled/transaction_services.h (+4/-3)
plugin/transaction_log/tests/r/replace.result (+138/-0)
plugin/transaction_log/tests/t/replace.inc (+44/-0)
Changed in drizzle: | |
assignee: | nobody → David Shrewsbury (dshrews) |
Changed in drizzle: | |
status: | Confirmed → In Progress |
Changed in drizzle: | |
status: | In Progress → Confirmed |
./test-run --suite= transaction_ log transaction_ log_replace
It is the last test case in that test.