Commit 8df04fb8 authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Sergei Golubchik

MDEV-15412 For any non-existing transaction ID, AS OF provides the current...

MDEV-15412 For any non-existing transaction ID, AS OF provides the current table contents without a warning

Fail with error on non-existing TRX_ID.

Closes #832
parent 5c0bb076
...@@ -334,18 +334,16 @@ x ...@@ -334,18 +334,16 @@ x
# #
# HEX hybrids resolve to TRANSACTION # HEX hybrids resolve to TRANSACTION
# #
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0x60); SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
x ERROR HY000: TRX_ID 4294967295 not found in `mysql.transaction_registry`
1 SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0x60);
ERROR HY000: Transaction system versioning for `t2` is not supported ERROR HY000: Transaction system versioning for `t2` is not supported
# #
# BIT literals resolve to TRANSACTION # BIT literals resolve to TRANSACTION
# #
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'1100000'); SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
x ERROR HY000: TRX_ID 4294967295 not found in `mysql.transaction_registry`
1 SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'1100000');
ERROR HY000: Transaction system versioning for `t2` is not supported ERROR HY000: Transaction system versioning for `t2` is not supported
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
......
...@@ -361,18 +361,20 @@ SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00'; ...@@ -361,18 +361,20 @@ SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
--echo # HEX hybrids resolve to TRANSACTION --echo # HEX hybrids resolve to TRANSACTION
--echo # --echo #
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0x60); --error ER_VERS_NO_TRX_ID
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
--error ER_VERS_ENGINE_UNSUPPORTED --error ER_VERS_ENGINE_UNSUPPORTED
SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0x60); SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
--echo # --echo #
--echo # BIT literals resolve to TRANSACTION --echo # BIT literals resolve to TRANSACTION
--echo # --echo #
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'1100000'); --error ER_VERS_NO_TRX_ID
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
--error ER_VERS_ENGINE_UNSUPPORTED --error ER_VERS_ENGINE_UNSUPPORTED
SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'1100000'); SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
DROP TABLE t1, t2; DROP TABLE t1, t2;
......
...@@ -62,10 +62,7 @@ Item_func_trt_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date) ...@@ -62,10 +62,7 @@ Item_func_trt_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date)
null_value= !trt.query(trx_id); null_value= !trt.query(trx_id);
if (null_value) if (null_value)
{
my_error(ER_VERS_NO_TRX_ID, MYF(0), (longlong) trx_id);
return true; return true;
}
return trt[trt_field]->get_date(res, fuzzy_date); return trt[trt_field]->get_date(res, fuzzy_date);
} }
......
...@@ -8822,7 +8822,10 @@ bool TR_table::query(ulonglong trx_id) ...@@ -8822,7 +8822,10 @@ bool TR_table::query(ulonglong trx_id)
return false; return false;
select= make_select(table, 0, 0, conds, NULL, 0, &error); select= make_select(table, 0, 0, conds, NULL, 0, &error);
if (unlikely(error || !select)) if (unlikely(error || !select))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return false; return false;
}
// FIXME: (performance) force index 'transaction_id' // FIXME: (performance) force index 'transaction_id'
error= init_read_record(&info, thd, table, select, NULL, error= init_read_record(&info, thd, table, select, NULL,
1 /* use_record_cache */, true /* print_error */, 1 /* use_record_cache */, true /* print_error */,
...@@ -8832,6 +8835,7 @@ bool TR_table::query(ulonglong trx_id) ...@@ -8832,6 +8835,7 @@ bool TR_table::query(ulonglong trx_id)
if (select->skip_record(thd) > 0) if (select->skip_record(thd) > 0)
return true; return true;
} }
my_error(ER_VERS_NO_TRX_ID, MYF(0), (longlong) trx_id);
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment