Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -571,21 +571,23 @@ CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)

# Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is
# available, but should be repeated on each "make" just in case someone
# does "cmake ; make ; git pull ; make".
CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
ADD_CUSTOM_TARGET(INFO_SRC ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
# Build flags: This must be postponed to the make phase.
ADD_CUSTOM_TARGET(INFO_BIN ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_bin.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
IF (NOT WITHOUT_ABI_CHECK)
# Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is
# available, but should be repeated on each "make" just in case someone
# does "cmake ; make ; git pull ; make".
CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
ADD_CUSTOM_TARGET(INFO_SRC ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
# Build flags: This must be postponed to the make phase.
ADD_CUSTOM_TARGET(INFO_BIN ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_bin.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
ENDIF()
Comment thread
midenok marked this conversation as resolved.

INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY COMPONENT Readme)

Expand Down
77 changes: 77 additions & 0 deletions mysql-test/suite/versioning/r/trx_id,scan.rdiff
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
--- trx_id.result
+++ trx_id,scan.reject
@@ -134,30 +134,42 @@
1
2
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of timestamp @ts1;
x
100
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of transaction @trx_id2;
x
100
2
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of timestamp @ts2;
x
100
2
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of transaction @trx_id3;
x
100
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of timestamp @ts3;
x
100
1
2
3
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
#
# MDEV-15427 IB: TRX_ID based operations inside transaction generate history
#
@@ -264,6 +276,8 @@
delete from t1;
select * from t1 for system_time as of timestamp'1990-1-1 00:00';
x
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of NULL;
x
# MDEV-16024 transaction_registry.begin_timestamp is wrong for explicit transactions
@@ -419,6 +433,9 @@
#
SELECT * FROM t1 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
x
+1
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
x
DROP TABLE t1, t2;
@@ -642,8 +659,12 @@
select * from t1 for system_time as of '2000-01-01 00:00:09';
x
1
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
select * from t1 for system_time as of '2000-01-01 00:00:10';
x
+Warnings:
+Warning 4193 mysql.transaction_registry has unexpected index definitions; using slow scan.
# Timestamp result
select * from t2 for system_time all;
x
48 changes: 46 additions & 2 deletions mysql-test/suite/versioning/r/trx_id.result
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ ERROR HY000: Transaction-precise system versioning for `t2` is not supported
#
SELECT * FROM t1 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
x
1
SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
x
DROP TABLE t1, t2;
Expand Down Expand Up @@ -552,7 +551,7 @@ COUNT(*)
1
DROP TABLE t;
SET @@SYSTEM_VERSIONING_ALTER_HISTORY=ERROR;
SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp;
SELECT count(*) from mysql.transaction_registry where begin_timestamp > commit_timestamp;
count(*)
0
# MDEV-18875 Assertion `thd->transaction.stmt.ha_list == __null ||
Expand Down Expand Up @@ -611,3 +610,48 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
drop table t1;
#
# MDEV-39384 Wrong result when selecting from precise-versioned table
#
create or replace table t1 (
x int primary key,
sys_trx_start bigint(20) unsigned as row start invisible,
sys_trx_end bigint(20) unsigned as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;
create or replace table t2 (
x int primary key,
sys_trx_start timestamp(6) as row start invisible,
sys_trx_end timestamp(6) as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;
set timestamp= unix_timestamp('2000-01-01 00:00:00');
insert into t1 values (1);
insert into t2 values (1);
set timestamp= unix_timestamp('2000-01-01 00:00:10');
delete from t1;
delete from t2;
set timestamp= unix_timestamp('2000-01-01 00:00:20');
insert into t1 values (2);
insert into t2 values (2);
# TRX result
select * from t1 for system_time all;
x
1
2
select * from t1 for system_time as of '2000-01-01 00:00:09';
x
1
select * from t1 for system_time as of '2000-01-01 00:00:10';
x
# Timestamp result
select * from t2 for system_time all;
x
1
2
select * from t2 for system_time as of '2000-01-01 00:00:09';
x
1
select * from t2 for system_time as of '2000-01-01 00:00:10';
x
drop tables t1, t2;
2 changes: 2 additions & 0 deletions mysql-test/suite/versioning/t/trx_id.combinations
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[scan]
[lookup]
65 changes: 64 additions & 1 deletion mysql-test/suite/versioning/t/trx_id.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,24 @@ if (!$TEST_VERSIONING_SO)
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/default_charset.inc
--source include/maybe_debug.inc

--disable_query_log
--error 0,ER_PLUGIN_INSTALLED
--eval install plugin test_versioning soname '$TEST_VERSIONING_SO'
--enable_query_log

if ($MTR_COMBINATION_SCAN)
{
if (!$have_debug)
{
--skip Requires debug build
}
--disable_query_log
set debug_dbug= '+d,vers_trt_scan';
--enable_query_log
}

set default_storage_engine= innodb;

create or replace table t1 (
Expand Down Expand Up @@ -280,7 +293,10 @@ commit;
--disable_cursor_protocol
select row_start from t1 into @trx_id;
--enable_cursor_protocol
# --ps does not produce warning in scan combination
--disable_warnings
select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD;
--enable_warnings

drop table t1;

Expand Down Expand Up @@ -573,7 +589,7 @@ SELECT COUNT(*) FROM t FOR SYSTEM_TIME ALL;
DROP TABLE t;
SET @@SYSTEM_VERSIONING_ALTER_HISTORY=ERROR;

SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp;
SELECT count(*) from mysql.transaction_registry where begin_timestamp > commit_timestamp;

--echo # MDEV-18875 Assertion `thd->transaction.stmt.ha_list == __null ||
--echo # trans == &thd->transaction.stmt' failed or bogus ER_DUP_ENTRY upon
Expand Down Expand Up @@ -643,3 +659,50 @@ alter table xx;
--disconnect con1
--connection default
drop table t1;

--echo #
--echo # MDEV-39384 Wrong result when selecting from precise-versioned table
--echo #
create or replace table t1 (
x int primary key,
sys_trx_start bigint(20) unsigned as row start invisible,
sys_trx_end bigint(20) unsigned as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;

create or replace table t2 (
x int primary key,
sys_trx_start timestamp(6) as row start invisible,
sys_trx_end timestamp(6) as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;

set timestamp= unix_timestamp('2000-01-01 00:00:00');
insert into t1 values (1);
insert into t2 values (1);
set timestamp= unix_timestamp('2000-01-01 00:00:10');
delete from t1;
delete from t2;
set timestamp= unix_timestamp('2000-01-01 00:00:20');
insert into t1 values (2);
insert into t2 values (2);

--echo # TRX result
select * from t1 for system_time all;
select * from t1 for system_time as of '2000-01-01 00:00:09';
select * from t1 for system_time as of '2000-01-01 00:00:10';

--echo # Timestamp result
select * from t2 for system_time all;
select * from t2 for system_time as of '2000-01-01 00:00:09';
select * from t2 for system_time as of '2000-01-01 00:00:10';

drop tables t1, t2;

if ($MTR_COMBINATION_SCAN)
{
# Don't use @old_dbug pattern as truncates command-line --debug=O file!
--disable_query_log
set debug_dbug= '-d,vers_trt_scan';
--enable_query_log
}
8 changes: 4 additions & 4 deletions sql/filesort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ String dbug_format_row(TABLE *table, const uchar *rec, bool print_names)
Example usage:
(gdb) p dbug_print_row(table, table->record[1])
Comment thread
midenok marked this conversation as resolved.
*/
const char *dbug_print_row(TABLE *table, const uchar *rec)
const char *dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
{
String row= dbug_format_row(table, table->record[0]);
String row= dbug_format_row(table, rec, print_names);
if (row.length() > sizeof dbug_row_print_buf - 1)
return "Couldn't fit into buffer";
memcpy(dbug_row_print_buf, row.c_ptr(), row.length());
Expand All @@ -743,9 +743,9 @@ const char *dbug_print_row(TABLE *table, const uchar *rec)

Only columns in table->read_set are printed
*/
const char* dbug_print_table_row(TABLE *table)
const char* dbug_print_table_row(TABLE *table, bool print_names)
{
return dbug_print_row(table, table->record[0]);
return dbug_print_row(table, table->record[0], print_names);
Comment thread
midenok marked this conversation as resolved.
}


Expand Down
5 changes: 4 additions & 1 deletion sql/item_vers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ bool
Item_func_trt_trx_sees::val_bool()
{
THD *thd= current_thd;
DBUG_ENTER("trans_sees");
DBUG_ASSERT(thd);

DBUG_ASSERT(arg_count > 1);
Expand All @@ -192,5 +193,7 @@ Item_func_trt_trx_sees::val_bool()

TR_table trt(thd);
null_value= trt.query_sees(result, trx_id1, trx_id0);
return result;
DBUG_PRINT("vers_trx_id", ("%llu %s %llu, null_value: %d, accept_eq: %d",
trx_id1, (result ? "sees" : "sees NOT"), trx_id0, null_value, accept_eq));
DBUG_RETURN(result);
}
2 changes: 2 additions & 0 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10758,3 +10758,5 @@ ER_CM_OPTION_MISSING_REQUIREMENT
eng "CHANGE MASTER TO option '%s=%s' is missing requirement %s"
ER_SLAVE_STATEMENT_TIMEOUT 70100
eng "Slave log event execution was interrupted (slave_max_statement_time exceeded)"
WARN_VERS_TRT_DEFINITION
eng "mysql.transaction_registry has unexpected index definitions; using slow scan."
4 changes: 2 additions & 2 deletions sql/sql_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const char *dbug_print(SELECT_LEX *x);
const char *dbug_print(SELECT_LEX_UNIT *x);

/* Print current table row */
const char* dbug_print_table_row(TABLE *table);
const char *dbug_print_row(TABLE *table, const uchar *rec);
const char* dbug_print_table_row(TABLE *table, bool print_names= false);
const char *dbug_print_row(TABLE *table, const uchar *rec, bool print_names= false);

/* Check which MEM_ROOT the data is on */
bool dbug_is_mem_on_mem_root(const MEM_ROOT *mem_root, void *ptr);
Expand Down
Loading