Skip to content

Commit 7fd5490

Browse files
kevgsmidenok
authored andcommitted
IB: return correct sys_trx_end in TRIGGER after UPDATE [fixes #100]
1 parent 4ebf680 commit 7fd5490

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

mysql-test/suite/versioning/r/select.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,22 @@ drop view vt1;
428428
create or replace table t1(x int) with system versioning;
429429
select * from (t1 as r left join t1 as u using (x)), t1;
430430
x x
431+
create or replace table t1 (a int) with system versioning;
432+
insert into t1 values (1);
433+
create trigger read_end after update on t1
434+
for each row set @end = old.sys_trx_end;
435+
update t1 set a=2;
436+
select @end;
437+
@end
438+
2038-01-19 03:14:07.000000
439+
create or replace table t1 (a int) with system versioning engine=innodb;
440+
insert into t1 values (1);
441+
create trigger read_end after update on t1
442+
for each row set @end = old.sys_trx_end;
443+
update t1 set a=2;
444+
select @end;
445+
@end
446+
18446744073709551615
431447
drop table t1, t2;
432448
call verify_vtq;
433449
No A B C D
@@ -440,6 +456,8 @@ No A B C D
440456
7 1 1 1 1
441457
8 1 1 1 1
442458
9 1 1 1 1
459+
10 1 1 1 1
460+
11 1 1 1 1
443461
drop procedure test_01;
444462
drop procedure test_02;
445463
drop procedure verify_vtq;

mysql-test/suite/versioning/t/select.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,22 @@ drop view vt1;
151151
create or replace table t1(x int) with system versioning;
152152
select * from (t1 as r left join t1 as u using (x)), t1;
153153

154+
# @end should be max timestamp
155+
create or replace table t1 (a int) with system versioning;
156+
insert into t1 values (1);
157+
create trigger read_end after update on t1
158+
for each row set @end = old.sys_trx_end;
159+
update t1 set a=2;
160+
select @end;
161+
162+
# @end should be max trx_id
163+
create or replace table t1 (a int) with system versioning engine=innodb;
164+
insert into t1 values (1);
165+
create trigger read_end after update on t1
166+
for each row set @end = old.sys_trx_end;
167+
update t1 set a=2;
168+
select @end;
169+
154170
drop table t1, t2;
155171

156172
call verify_vtq;

storage/innobase/row/row0mysql.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,6 @@ row_insert_for_mysql(
14971497

14981498
if (ins_mode == ROW_INS_HISTORICAL) {
14991499
set_tuple_col_8(node->row, table->vers_row_end, trx->id, node->entry_sys_heap);
1500-
int8store(&mysql_rec[t->mysql_col_offset], trx->id);
15011500
}
15021501
else {
15031502
set_tuple_col_8(node->row, table->vers_row_end, IB_UINT64_MAX, node->entry_sys_heap);

0 commit comments

Comments
 (0)