Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

Conflicts:
	mysql-test/r/func_json.result
	mysql-test/r/win.result
	mysql-test/t/func_json.test
	mysql-test/t/win.test
	sql/share/errmsg-utf8.txt
	storage/rocksdb/ha_rocksdb.cc
	storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result
This commit is contained in:
Alexander Barkov 2017-08-07 21:35:34 +04:00
commit 988a9daa94
250 changed files with 14356 additions and 2704 deletions

View File

@ -8,8 +8,8 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
case ${GCC_VERSION} in
5) CXX=clang++-3.9 ;;
6) CXX=clang++-4.0 ;;
5) CXX=clang++-4.0 ;;
6) CXX=clang++-5.0 ;;
esac
export CXX CC=${CXX/++/}
elif [[ "${CXX}" == 'g++' ]]; then

View File

@ -136,18 +136,17 @@ addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
- llvm-toolchain-trusty-3.9
- llvm-toolchain-trusty-4.0
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main'
packages: # make sure these match the build requirements
- gcc-5
- g++-5
- gcc-6
- g++-6
- clang-3.9
- llvm-3.9-dev
- clang-4.0
- llvm-4.0-dev
- clang-5.0
- llvm-5.0-dev
- libasan0
- bison
- chrpath

View File

@ -10,6 +10,7 @@ usr/share/mysql/estonian
usr/share/mysql/french
usr/share/mysql/german
usr/share/mysql/greek
usr/share/mysql/hindi
usr/share/mysql/hungarian
usr/share/mysql/italian
usr/share/mysql/japanese

View File

@ -230,7 +230,7 @@ insert into t2 (a) values (1023);
do (f2(23));
Warnings:
Error 1062 Duplicate entry '23' for key 'a'
Note 4070 At line 4 in test.f2
Note 4091 At line 4 in test.f2
select * from t2;
a
1023

View File

@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER

View File

@ -55,5 +55,5 @@ id
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
DROP TABLE t1;

View File

@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
Note 4068 Unknown VIEW: 'test.view1'
Note 4068 Unknown VIEW: 'test.view2'
Note 4068 Unknown VIEW: 'test.view3'
Note 4068 Unknown VIEW: 'test.view4'
Note 4089 Unknown VIEW: 'test.view1'
Note 4089 Unknown VIEW: 'test.view2'
Note 4089 Unknown VIEW: 'test.view3'
Note 4089 Unknown VIEW: 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);

View File

@ -642,6 +642,12 @@ SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' )
NULL
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
NULL
#
# Start of 10.3 tests
#

View File

@ -590,7 +590,7 @@ DROP PROCEDURE p1;
SHOW WARNINGS;
Level Code Message
Error 54321 MESSAGE_TEXT text
Note 4070 At line 16 in test.p1
Note 4091 At line 16 in test.p1
CREATE PROCEDURE p1()
BEGIN
DECLARE var INT;

View File

@ -61,6 +61,34 @@ POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
GEOMETRYCOLLECTION(POINT(102 0.5))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
ERROR HY000: Incorrect option value: '5' for function ST_GeometryFromJSON
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
ERROR 22023: Invalid GIS data provided to function ST_GeometryFromJSON.
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3))
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
POINT(5.3 15)
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
{"type": "Point", "coordinates": [5.36, 7.27]}
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1)
{"type": "Point", "coordinates": [5.4, 7.3]}
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10)
{"type": "Point", "coordinates": [5.363, 7.266]}
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
#
# End of 10.2 tests
#

View File

@ -1428,7 +1428,7 @@ Warnings:
Note 1305 FUNCTION test.test_function does not exist
drop view if exists v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin

View File

@ -415,7 +415,7 @@ select @@profiling;
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;

View File

@ -1715,7 +1715,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to not found
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1740,7 +1740,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to error
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1789,7 +1789,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to not found
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1814,7 +1814,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to error
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1863,7 +1863,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to not found
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1888,7 +1888,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to error
Note 4070 At line 9 in test.test_resignal
Note 4091 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1931,7 +1931,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to a not found
Note 4070 At line 8 in test.test_resignal
Note 4091 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1953,7 +1953,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to an error
Note 4070 At line 8 in test.test_resignal
Note 4091 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2004,7 +2004,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to a not found
Note 4070 At line 10 in test.test_resignal
Note 4091 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2030,7 +2030,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to an error
Note 4070 At line 10 in test.test_resignal
Note 4091 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2073,7 +2073,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to a not found
Note 4070 At line 8 in test.test_resignal
Note 4091 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2095,7 +2095,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to an error
Note 4070 At line 8 in test.test_resignal
Note 4091 At line 8 in test.test_resignal
drop procedure test_resignal $$
#
# More complex cases
@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 9999 Hi, I am a useless error message
Note 4070 At line 7 in test.peter_p2
Note 4091 At line 7 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
CREATE PROCEDURE peter_p1 ()
@ -2198,16 +2198,16 @@ Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Note 4070 At line 8 in test.peter_p1
Note 4091 At line 8 in test.peter_p1
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Note 4070 At line 8 in test.peter_p1
Note 4091 At line 8 in test.peter_p1
Error 9999 Hi, I am a useless error message
Note 4070 At line 10 in test.peter_p2
Note 4091 At line 10 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
drop procedure if exists peter_p3 $$
@ -2225,7 +2225,7 @@ show warnings $$
Level Code Message
Error 1 Original
Error 2 Original
Note 4070 At line 4 in test.peter_p3
Note 4091 At line 4 in test.peter_p3
drop procedure peter_p3 $$
drop table t_warn;
drop table t_cursor;

View File

@ -79,23 +79,23 @@ show warnings;
Level Code Message
Error 1051 Unknown table 'demo.oops_it_is_not_here'
Error 1644 Oops in proc_9
Note 4070 At line 4 in demo.proc_9
Note 4091 At line 4 in demo.proc_9
Error 1644 Oops in proc_8
Note 4070 At line 4 in demo.proc_8
Note 4091 At line 4 in demo.proc_8
Error 1644 Oops in proc_7
Note 4070 At line 4 in demo.proc_7
Note 4091 At line 4 in demo.proc_7
Error 1644 Oops in proc_6
Note 4070 At line 4 in demo.proc_6
Note 4091 At line 4 in demo.proc_6
Error 1644 Oops in proc_5
Note 4070 At line 4 in demo.proc_5
Note 4091 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
Note 4070 At line 4 in demo.proc_4
Note 4091 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4070 At line 4 in demo.proc_3
Note 4091 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4070 At line 4 in demo.proc_2
Note 4091 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4070 At line 4 in demo.proc_1
Note 4091 At line 4 in demo.proc_1
SET @@session.max_error_count = 5;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -104,11 +104,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4070 At line 4 in demo.proc_3
Note 4091 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4070 At line 4 in demo.proc_2
Note 4091 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4070 At line 4 in demo.proc_1
Note 4091 At line 4 in demo.proc_1
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -117,13 +117,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4070 At line 4 in demo.proc_4
Note 4091 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4070 At line 4 in demo.proc_3
Note 4091 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4070 At line 4 in demo.proc_2
Note 4091 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4070 At line 4 in demo.proc_1
Note 4091 At line 4 in demo.proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -132,15 +132,15 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4070 At line 4 in demo.proc_5
Note 4091 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
Note 4070 At line 4 in demo.proc_4
Note 4091 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4070 At line 4 in demo.proc_3
Note 4091 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4070 At line 4 in demo.proc_2
Note 4091 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4070 At line 4 in demo.proc_1
Note 4091 At line 4 in demo.proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;

View File

@ -1990,8 +1990,8 @@ Warning 1264 Out of range value for column 'a' at row 1
Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
Note 4070 At line 6 in test.t1_bi
Note 4070 At line 2 in test.p1
Note 4091 At line 6 in test.t1_bi
Note 4091 At line 2 in test.p1
DROP TABLE t1;
DROP TABLE t2;

View File

@ -3,7 +3,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
drop view if exists view_t1;
Warnings:
Note 4068 Unknown VIEW: 'test.view_t1'
Note 4089 Unknown VIEW: 'test.view_t1'
SET sql_mode=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (
pk INT,

View File

@ -3211,7 +3211,7 @@ drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
Note 4068 Unknown VIEW: 'test.tv'
Note 4089 Unknown VIEW: 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'test.tt1'
@ -7823,7 +7823,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show warnings;
Level Code Message
Error 1062 Duplicate entry '2' for key 'PRIMARY'
Note 4070 At line 5 in test.p1
Note 4091 At line 5 in test.p1
select * from t1;
id
1

View File

@ -5236,7 +5236,7 @@ CREATE TABLE t4 (i4 INT);
INSERT INTO t4 VALUES (1),(2);
DROP VIEW IF EXISTS v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
CREATE VIEW v2 AS select v1_field1 from t4 join v1;
prepare my_stmt from "select v1_field1 from v2";

View File

@ -353,7 +353,7 @@ ERROR 23000: Duplicate entry '11' for key 'a'
SHOW WARNINGS;
Level Code Message
Note 4070 At line 4 in test.f1
Note 4091 At line 4 in test.f1
Error 1062 Duplicate entry '11' for key 'a'
DROP TABLE t1;

View File

@ -3174,6 +3174,18 @@ Nth_value(i,1) OVER()
1
DROP TABLE t1;
#
# A regression after MDEV-13351:
# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
# upon UNION with aggregate function
#
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
fld
1
2
DROP TABLE t1;
#
# Start of 10.3 tests
#
#

View File

@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4068 Unknown VIEW: 'test.v2'
Note 4089 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7566,7 +7566,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View File

@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4068 Unknown VIEW: 'test.v2'
Note 4089 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7567,7 +7567,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4068 Unknown VIEW: 'test.v1'
Note 4089 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
22 gl_ES Galician - Galician 8 8 , english
23 gu_IN Gujarati - India 10 8 . , english
24 he_IL Hebrew - Israel 7 5 . , english
25 hi_IN Hindi - India 7 9 . , english
25 hi_IN Hindi - India 7 9 . , hindi
26 hr_HR Croatian - Croatia 8 11 , english
27 hu_HU Hungarian - Hungary 10 9 , . hungarian
28 id_ID Indonesian - Indonesia 9 6 , . english
@ -138,7 +138,7 @@ Id Name Description Error_Message_Language
22 gl_ES Galician - Galician english
23 gu_IN Gujarati - India english
24 he_IL Hebrew - Israel english
25 hi_IN Hindi - India english
25 hi_IN Hindi - India hindi
26 hr_HR Croatian - Croatia english
27 hu_HU Hungarian - Hungary hungarian
28 id_ID Indonesian - Indonesia english

View File

@ -99,7 +99,7 @@ DROP VIEW v1;
ERROR 42S02: Unknown VIEW: 'test.v1'
DROP VIEW IF EXISTS v2;
Warnings:
Note 4068 Unknown VIEW: 'test.v2'
Note 4089 Unknown VIEW: 'test.v2'
# Syncing slave with master
connection slave;
SELECT * FROM v1;

View File

@ -128,7 +128,7 @@ show warnings;
Level Code Message
Error 1062 Duplicate entry '20' for key 'a'
Warning 1196 Some non-transactional changed tables couldn't be rolled back
Note 4070 At line 4 in mysqltest1.foo4
Note 4091 At line 4 in mysqltest1.foo4
select * from t2;
a
20
@ -291,7 +291,7 @@ end|
do fn1(100);
Warnings:
Error 1062 Duplicate entry '100' for key 'a'
Note 4070 At line 3 in mysqltest1.fn1
Note 4091 At line 3 in mysqltest1.fn1
Warning 1196 Some non-transactional changed tables couldn't be rolled back
select fn1(20);
ERROR 23000: Duplicate entry '20' for key 'a'

View File

@ -212,7 +212,7 @@ ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table t1;
alter sequence if exists t1 minvalue=100;
Warnings:
Note 4067 Unknown SEQUENCE: 'test.t1'
Note 4088 Unknown SEQUENCE: 'test.t1'
alter sequence t1 minvalue=100;
ERROR 42S02: Table 'test.t1' doesn't exist
create sequence t1;

View File

@ -165,7 +165,7 @@ drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
Warnings:
Note 4067 Unknown SEQUENCE: 'test.t1'
Note 4088 Unknown SEQUENCE: 'test.t1'
create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' values are conflicting
create sequence t1 minvalue= 100 maxvalue=10;
@ -377,7 +377,7 @@ key key1 (next_not_cached_value)
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
drop sequence if exists t1;
Warnings:
Note 4067 Unknown SEQUENCE: 'test.t1'
Note 4088 Unknown SEQUENCE: 'test.t1'
create sequence t1;
create sequence t2;
create table t3 (a int) engine=myisam;
@ -387,8 +387,8 @@ CREATE SEQUENCE s1;
drop sequence s1;
drop sequence if exists t1,t2,t3,t4;
Warnings:
Note 4067 Unknown SEQUENCE: 'test.t3'
Note 4067 Unknown SEQUENCE: 'test.t4'
Note 4088 Unknown SEQUENCE: 'test.t3'
Note 4088 Unknown SEQUENCE: 'test.t4'
drop table if exists t1,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t1'
@ -414,9 +414,9 @@ CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence if exists t1,t2,s1,s2;
Warnings:
Note 4067 Unknown SEQUENCE: 'test.t1'
Note 4067 Unknown SEQUENCE: 'test.t2'
Note 4067 Unknown SEQUENCE: 'test.s2'
Note 4088 Unknown SEQUENCE: 'test.t1'
Note 4088 Unknown SEQUENCE: 'test.t2'
Note 4088 Unknown SEQUENCE: 'test.s2'
drop table if exists t1,t2;
CREATE TEMPORARY SEQUENCE s1;
DROP SEQUENCE s1;

View File

@ -296,6 +296,12 @@ INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
DROP TABLE t1;
#
# MDEV-12324 Wrong result (phantom array value) on JSON_EXTRACT.
#
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
--echo #
--echo # Start of 10.3 tests
--echo #

View File

@ -23,6 +23,23 @@ SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
--error ER_WRONG_VALUE_FOR_TYPE
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
--error ER_GIS_INVALID_DATA
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1954,6 +1954,17 @@ UNION ALL
;
DROP TABLE t1;
--echo #
--echo # A regression after MDEV-13351:
--echo # MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
--echo # upon UNION with aggregate function
--echo #
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
DROP TABLE t1;
--echo #
--echo # Start of 10.3 tests
--echo #

View File

@ -3501,10 +3501,17 @@ void handler::print_error(int error, myf errflag)
textno=ER_LOCK_TABLE_FULL;
break;
case HA_ERR_LOCK_DEADLOCK:
textno=ER_LOCK_DEADLOCK;
{
String str, full_err_msg(ER_DEFAULT(ER_LOCK_DEADLOCK), system_charset_info);
/* cannot continue. the statement was already aborted in the engine */
SET_FATAL_ERROR;
break;
get_error_message(error, &str);
full_err_msg.append(str);
my_printf_error(ER_LOCK_DEADLOCK, "%s", errflag, full_err_msg.c_ptr_safe());
DBUG_VOID_RETURN;
}
case HA_ERR_READ_ONLY_TRANSACTION:
textno=ER_READ_ONLY_TRANSACTION;
break;

View File

@ -122,13 +122,27 @@ String *Item_func_geometry_from_json::val_str(String *str)
Geometry_buffer buffer;
String *js= args[0]->val_str_ascii(&tmp_js);
uint32 srid= 0;
longlong options= 0;
json_engine_t je;
if ((null_value= args[0]->null_value))
return 0;
if ((arg_count == 2) && !args[1]->null_value)
srid= (uint32)args[1]->val_int();
if (arg_count > 1 && !args[1]->null_value)
{
options= args[1]->val_int();
if (options > 4 || options < 1)
{
String *sv= args[1]->val_str(&tmp_js);
my_error(ER_WRONG_VALUE_FOR_TYPE, MYF(0),
"option", sv->c_ptr(), "ST_GeometryFromJSON");
null_value= 1;
return 0;
}
}
if ((arg_count == 3) && !args[2]->null_value)
srid= (uint32)args[2]->val_int();
str->set_charset(&my_charset_bin);
if (str->reserve(SRID_SIZE, 512))
@ -139,7 +153,7 @@ String *Item_func_geometry_from_json::val_str(String *str)
json_scan_start(&je, js->charset(), (const uchar *) js->ptr(),
(const uchar *) js->end());
if ((null_value= !Geometry::create_from_json(&buffer, &je, str)))
if ((null_value= !Geometry::create_from_json(&buffer, &je, options==1, str)))
{
int code= 0;
@ -154,6 +168,9 @@ String *Item_func_geometry_from_json::val_str(String *str)
case Geometry::GEOJ_POLYGON_NOT_CLOSED:
code= ER_GEOJSON_NOT_CLOSED;
break;
case Geometry::GEOJ_DIMENSION_NOT_SUPPORTED:
my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_GeometryFromJSON");
break;
default:
report_json_error_ex(js, &je, func_name(), 0, Sql_condition::WARN_LEVEL_WARN);
return NULL;
@ -233,6 +250,8 @@ String *Item_func_as_geojson::val_str_ascii(String *str)
DBUG_ASSERT(fixed == 1);
String arg_val;
String *swkb= args[0]->val_str(&arg_val);
uint max_dec= FLOATING_POINT_DECIMALS;
longlong options= 0;
Geometry_buffer buffer;
Geometry *geom= NULL;
const char *dummy;
@ -242,12 +261,41 @@ String *Item_func_as_geojson::val_str_ascii(String *str)
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
if (arg_count > 1)
{
max_dec= (uint) args[1]->val_int();
if (args[1]->null_value)
max_dec= FLOATING_POINT_DECIMALS;
if (arg_count > 2)
{
options= args[2]->val_int();
if (args[2]->null_value)
options= 0;
}
}
str->length(0);
str->set_charset(&my_charset_latin1);
if ((null_value= geom->as_json(str, FLOATING_POINT_DECIMALS, &dummy)))
if (str->reserve(1, 512))
return 0;
str->qs_append('{');
if (options & 1)
{
if (geom->bbox_as_json(str) || str->append(", ", 2))
goto error;
}
if ((geom->as_json(str, max_dec, &dummy) || str->append("}", 1)))
goto error;
return str;
error:
null_value= 1;
return 0;
}

View File

@ -38,6 +38,7 @@ russian
czech
french
serbian
hindi
)
SET(files

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,10 @@
#include "gstream.h" // Gis_read_stream
#include "sql_string.h" // String
/* This is from item_func.h. Didn't want to #include the whole file. */
double my_double_round(double value, longlong dec, bool dec_unsigned,
bool truncate);
#ifdef HAVE_SPATIAL
/*
@ -250,6 +254,8 @@ static const uchar feature_type[]= "feature";
static const int feature_type_len= 7;
static const uchar feature_coll_type[]= "featurecollection";
static const int feature_coll_type_len= 17;
static const uchar bbox_keyname[]= "bbox";
static const int bbox_keyname_len= 4;
int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
@ -258,7 +264,7 @@ int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
if (wkt->reserve(4 + type_keyname_len + 2 + len + 2 + 2 +
coord_keyname_len + 4, 512))
return 1;
wkt->qs_append("{\"", 2);
wkt->qs_append("\"", 1);
wkt->qs_append((const char *) type_keyname, type_keyname_len);
wkt->qs_append("\": \"", 4);
wkt->qs_append(get_class_info()->m_geojson_name.str, len);
@ -269,10 +275,35 @@ int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
wkt->qs_append((const char *) coord_keyname, coord_keyname_len);
wkt->qs_append("\": ", 3);
if (get_data_as_json(wkt, max_dec_digits, end) ||
wkt->reserve(1))
if (get_data_as_json(wkt, max_dec_digits, end))
return 1;
wkt->qs_append('}');
return 0;
}
int Geometry::bbox_as_json(String *wkt)
{
MBR mbr;
const char *end;
if (wkt->reserve(5 + bbox_keyname_len + (FLOATING_POINT_DECIMALS+2)*4, 512))
return 1;
wkt->qs_append("\"", 1);
wkt->qs_append((const char *) bbox_keyname, bbox_keyname_len);
wkt->qs_append("\": [", 4);
if (get_mbr(&mbr, &end))
return 1;
wkt->qs_append(mbr.xmin);
wkt->qs_append(", ", 2);
wkt->qs_append(mbr.ymin);
wkt->qs_append(", ", 2);
wkt->qs_append(mbr.xmax);
wkt->qs_append(", ", 2);
wkt->qs_append(mbr.ymax);
wkt->qs_append("]", 1);
return 0;
}
@ -339,7 +370,7 @@ Geometry *Geometry::create_from_wkb(Geometry_buffer *buffer,
Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
json_engine_t *je, String *res)
json_engine_t *je, bool er_on_3D, String *res)
{
Class_info *ci= NULL;
const uchar *coord_start= NULL, *geom_start= NULL,
@ -514,14 +545,14 @@ create_geom:
result= (*ci->m_create_func)(buffer->data);
res->q_append((char) wkb_ndr);
res->q_append((uint32) result->get_class_info()->m_type_id);
if (result->init_from_json(je, res))
if (result->init_from_json(je, er_on_3D, res))
goto err_return;
return result;
handle_geometry_key:
json_scan_start(je, je->s.cs, geometry_start, je->s.str_end);
return create_from_json(buffer, je, res);
return create_from_json(buffer, je, er_on_3D, res);
err_return:
return NULL;
@ -670,6 +701,11 @@ static void append_json_point(String *txt, uint max_dec, const char *data)
{
double x,y;
get_point(&x, &y, data);
if (max_dec < FLOATING_POINT_DECIMALS)
{
x= my_double_round(x, max_dec, FALSE, FALSE);
y= my_double_round(y, max_dec, FALSE, FALSE);
}
txt->qs_append('[');
txt->qs_append(x);
txt->qs_append(", ", 2);
@ -780,7 +816,8 @@ uint Gis_point::init_from_wkb(const char *wkb, uint len,
}
static int read_point_from_json(json_engine_t *je, double *x, double *y)
static int read_point_from_json(json_engine_t *je, bool er_on_3D,
double *x, double *y)
{
int n_coord= 0, err;
double tmp, *d;
@ -803,14 +840,17 @@ static int read_point_from_json(json_engine_t *je, double *x, double *y)
n_coord++;
}
return 0;
if (n_coord <= 2 || !er_on_3D)
return 0;
je->s.error= Geometry::GEOJ_DIMENSION_NOT_SUPPORTED;
return 1;
bad_coordinates:
je->s.error= Geometry::GEOJ_INCORRECT_GEOJSON;
return 1;
}
bool Gis_point::init_from_json(json_engine_t *je, String *wkb)
bool Gis_point::init_from_json(json_engine_t *je, bool er_on_3D, String *wkb)
{
double x, y;
if (json_read_value(je))
@ -822,7 +862,7 @@ bool Gis_point::init_from_json(json_engine_t *je, String *wkb)
return TRUE;
}
if (read_point_from_json(je, &x, &y) ||
if (read_point_from_json(je, er_on_3D, &x, &y) ||
wkb->reserve(POINT_DATA_SIZE))
return TRUE;
@ -971,7 +1011,8 @@ uint Gis_line_string::init_from_wkb(const char *wkb, uint len,
}
bool Gis_line_string::init_from_json(json_engine_t *je, String *wkb)
bool Gis_line_string::init_from_json(json_engine_t *je, bool er_on_3D,
String *wkb)
{
uint32 n_points= 0;
uint32 np_pos= wkb->length();
@ -994,7 +1035,7 @@ bool Gis_line_string::init_from_json(json_engine_t *je, String *wkb)
{
DBUG_ASSERT(je->state == JST_VALUE);
if (p.init_from_json(je, wkb))
if (p.init_from_json(je, er_on_3D, wkb))
return TRUE;
n_points++;
}
@ -1364,7 +1405,7 @@ uint Gis_polygon::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
}
bool Gis_polygon::init_from_json(json_engine_t *je, String *wkb)
bool Gis_polygon::init_from_json(json_engine_t *je, bool er_on_3D, String *wkb)
{
uint32 n_linear_rings= 0;
uint32 lr_pos= wkb->length();
@ -1389,7 +1430,7 @@ bool Gis_polygon::init_from_json(json_engine_t *je, String *wkb)
DBUG_ASSERT(je->state == JST_VALUE);
uint32 ls_pos=wkb->length();
if (ls.init_from_json(je, wkb))
if (ls.init_from_json(je, er_on_3D, wkb))
return TRUE;
ls.set_data_ptr(wkb->ptr() + ls_pos, wkb->length() - ls_pos);
if (ls.is_closed(&closed) || !closed)
@ -1855,7 +1896,8 @@ uint Gis_multi_point::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
}
bool Gis_multi_point::init_from_json(json_engine_t *je, String *wkb)
bool Gis_multi_point::init_from_json(json_engine_t *je, bool er_on_3D,
String *wkb)
{
uint32 n_points= 0;
uint32 np_pos= wkb->length();
@ -1883,7 +1925,7 @@ bool Gis_multi_point::init_from_json(json_engine_t *je, String *wkb)
wkb->q_append((char) wkb_ndr);
wkb->q_append((uint32) wkb_point);
if (p.init_from_json(je, wkb))
if (p.init_from_json(je, er_on_3D, wkb))
return TRUE;
n_points++;
}
@ -2123,7 +2165,8 @@ uint Gis_multi_line_string::init_from_wkb(const char *wkb, uint len,
}
bool Gis_multi_line_string::init_from_json(json_engine_t *je, String *wkb)
bool Gis_multi_line_string::init_from_json(json_engine_t *je, bool er_on_3D,
String *wkb)
{
uint32 n_line_strings= 0;
uint32 ls_pos= wkb->length();
@ -2151,7 +2194,7 @@ bool Gis_multi_line_string::init_from_json(json_engine_t *je, String *wkb)
wkb->q_append((char) wkb_ndr);
wkb->q_append((uint32) wkb_linestring);
if (ls.init_from_json(je, wkb))
if (ls.init_from_json(je, er_on_3D, wkb))
return TRUE;
n_line_strings++;
@ -2511,7 +2554,8 @@ uint Gis_multi_polygon::init_from_opresult(String *bin,
}
bool Gis_multi_polygon::init_from_json(json_engine_t *je, String *wkb)
bool Gis_multi_polygon::init_from_json(json_engine_t *je, bool er_on_3D,
String *wkb)
{
uint32 n_polygons= 0;
int np_pos= wkb->length();
@ -2539,7 +2583,7 @@ bool Gis_multi_polygon::init_from_json(json_engine_t *je, String *wkb)
wkb->q_append((char) wkb_ndr);
wkb->q_append((uint32) wkb_polygon);
if (p.init_from_json(je, wkb))
if (p.init_from_json(je, er_on_3D, wkb))
return TRUE;
n_polygons++;
@ -2986,7 +3030,8 @@ uint Gis_geometry_collection::init_from_wkb(const char *wkb, uint len,
}
bool Gis_geometry_collection::init_from_json(json_engine_t *je, String *wkb)
bool Gis_geometry_collection::init_from_json(json_engine_t *je, bool er_on_3D,
String *wkb)
{
uint32 n_objects= 0;
uint32 no_pos= wkb->length();
@ -3012,7 +3057,7 @@ bool Gis_geometry_collection::init_from_json(json_engine_t *je, String *wkb)
DBUG_ASSERT(je->state == JST_VALUE);
if (!(g= create_from_json(&buffer, je, wkb)))
if (!(g= create_from_json(&buffer, je, er_on_3D, wkb)))
return TRUE;
*je= sav_je;
@ -3097,12 +3142,14 @@ bool Gis_geometry_collection::get_data_as_json(String *txt, uint max_dec_digits,
if (!(geom= create_by_typeid(&buffer, wkb_type)))
return 1;
geom->set_data_ptr(data, (uint) (m_data_end - data));
if (geom->as_json(txt, max_dec_digits, &data) ||
txt->append(STRING_WITH_LEN(", "), 512))
if (txt->append("{", 1) ||
geom->as_json(txt, max_dec_digits, &data) ||
txt->append(STRING_WITH_LEN("}, "), 512))
return 1;
}
txt->length(txt->length() - 2);
txt->qs_append(']');
if (txt->append("]", 1))
return 1;
*end= data;
return 0;

View File

@ -255,6 +255,7 @@ public:
GEOJ_INCORRECT_GEOJSON= 1,
GEOJ_TOO_FEW_POINTS= 2,
GEOJ_POLYGON_NOT_CLOSED= 3,
GEOJ_DIMENSION_NOT_SUPPORTED= 4,
};
@ -281,7 +282,8 @@ public:
virtual uint init_from_opresult(String *bin,
const char *opres, uint res_len)
{ return init_from_wkb(opres + 4, UINT_MAX32, wkb_ndr, bin) + 4; }
virtual bool init_from_json(json_engine_t *je, String *wkb) {return true;}
virtual bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb)
{ return true; }
virtual bool get_data_as_wkt(String *txt, const char **end) const=0;
virtual bool get_data_as_json(String *txt, uint max_dec_digits,
@ -315,12 +317,13 @@ public:
bool init_stream=1);
static Geometry *create_from_wkb(Geometry_buffer *buffer,
const char *wkb, uint32 len, String *res);
static Geometry *create_from_json(Geometry_buffer *buffer,
json_engine_t *je, String *res);
static Geometry *create_from_json(Geometry_buffer *buffer, json_engine_t *je,
bool er_on_3D, String *res);
static Geometry *create_from_opresult(Geometry_buffer *g_buf,
String *res, Gcalc_result_receiver &rr);
int as_wkt(String *wkt, const char **end);
int as_json(String *wkt, uint max_dec_digits, const char **end);
int bbox_as_json(String *wkt);
inline void set_data_ptr(const char *data, uint32 data_len)
{
@ -395,7 +398,7 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -450,7 +453,7 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -484,7 +487,7 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -521,7 +524,7 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -550,7 +553,7 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -580,7 +583,7 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;
@ -612,7 +615,7 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
bool init_from_json(json_engine_t *je, String *wkb);
bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_data_as_json(String *txt, uint max_dec_digits,
const char **end) const;

View File

@ -32,7 +32,7 @@ enum err_msgs_index
{
en_US= 0, cs_CZ, da_DK, nl_NL, et_EE, fr_FR, de_DE, el_GR, hu_HU, it_IT,
ja_JP, ko_KR, no_NO, nn_NO, pl_PL, pt_PT, ro_RO, ru_RU, sr_RS, sk_SK,
es_ES, sv_SE, uk_UA
es_ES, sv_SE, uk_UA, hi_IN
} ERR_MSGS_INDEX;
@ -61,6 +61,7 @@ MY_LOCALE_ERRMSGS global_errmsgs[]=
{"spanish", NULL},
{"swedish", NULL},
{"ukrainian", NULL},
{"hindi", NULL},
{NULL, NULL}
};
@ -889,7 +890,7 @@ MY_LOCALE my_locale_hi_IN
'.', /* decimal point hi_IN */
',', /* thousands_sep hi_IN */
"\x03", /* grouping hi_IN */
&global_errmsgs[en_US]
&global_errmsgs[hi_IN]
);
/***** LOCALE END hi_IN *****/

View File

@ -4999,7 +4999,8 @@ end_with_restore_list:
goto error;
if (!(res= sql_set_variables(thd, lex_var_list, true)))
{
my_ok(thd);
if (!thd->is_error())
my_ok(thd);
}
else
{

View File

@ -8634,7 +8634,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
JOIN_TAB *tab= join->join_tab;
if (const_tbls == WITHOUT_CONST_TABLES)
{
if (join->const_tables == join->table_count)
if (join->const_tables == join->table_count || !tab)
return NULL;
tab += join->const_tables;
}
@ -8657,6 +8657,10 @@ JOIN_TAB *first_linear_tab(JOIN *join,
enum enum_with_const_tables const_tbls)
{
JOIN_TAB *first= join->join_tab;
if (!first)
return NULL;
if (const_tbls == WITHOUT_CONST_TABLES)
first+= join->const_tables;
@ -8743,7 +8747,7 @@ JOIN_TAB *first_depth_first_tab(JOIN* join)
{
JOIN_TAB* tab;
/* This means we're starting the enumeration */
if (join->const_tables == join->top_join_tab_count)
if (join->const_tables == join->top_join_tab_count || !join->join_tab)
return NULL;
tab= join->join_tab + join->const_tables;

View File

@ -534,7 +534,6 @@ ibuf_init_at_db_start(void)
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
&n_used, &mtr);
ibuf_enter(&mtr);
ut_ad(n_used >= 2);
@ -556,7 +555,7 @@ ibuf_init_at_db_start(void)
mutex_exit(&ibuf_mutex);
ibuf->empty = page_is_empty(root);
ibuf_mtr_commit(&mtr);
mtr.commit();
ibuf->index = dict_mem_index_create(
"innodb_change_buffer", "CLUST_IND",

View File

@ -359,7 +359,6 @@ log_reserve_and_open(
loop:
ut_ad(log_mutex_own());
ut_ad(!recv_no_log_write);
if (log_sys->is_extending) {
log_mutex_exit();
@ -416,7 +415,6 @@ log_write_low(
ut_ad(log_mutex_own());
part_loop:
ut_ad(!recv_no_log_write);
/* Calculate a part length */
data_len = (log->buf_free % OS_FILE_LOG_BLOCK_SIZE) + str_len;
@ -2291,6 +2289,7 @@ log_pad_current_log_block(void)
ulint i;
lsn_t lsn;
ut_ad(!recv_no_log_write);
/* We retrieve lsn only because otherwise gcc crashed on HP-UX */
lsn = log_reserve_and_open(OS_FILE_LOG_BLOCK_SIZE);

View File

@ -478,6 +478,7 @@ mtr_write_log(
const ulint len = log->size();
mtr_write_log_t write_log;
ut_ad(!recv_no_log_write);
DBUG_PRINT("ib_log",
(ULINTPF " extra bytes written at " LSN_PF,
len, log_sys->lsn));
@ -799,6 +800,8 @@ mtr_t::release_page(const void* ptr, mtr_memo_type_t type)
ulint
mtr_t::Command::prepare_write()
{
ut_ad(!recv_no_log_write);
switch (m_impl->m_log_mode) {
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);

View File

@ -16,6 +16,11 @@ IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile")
SKIP_ROCKSDB_PLUGIN("Missing Makefile in rocksdb directory. Try \"git submodule update\".")
ENDIF()
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(HAVE_SCHED_GETCPU)
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1 -DROCKSDB_SCHED_GETCPU_PRESENT)
ENDIF()
# We've had our builders hang during the build process. This prevents MariaRocks
# to be built on 32 bit intel OS kernels.
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86")
@ -106,6 +111,19 @@ IF(HAVE_FALLOCATE)
ADD_DEFINITIONS(-DROCKSDB_FALLOCATE_PRESENT)
ENDIF()
CHECK_CXX_SOURCE_COMPILES("
#if defined(_MSC_VER) && !defined(__thread)
#define __thread __declspec(thread)
#endif
int main() {
static __thread int tls;
}
" HAVE_THREAD_LOCAL)
if(HAVE_THREAD_LOCAL)
ADD_DEFINITIONS(-DROCKSDB_SUPPORT_THREAD_LOCAL)
endif()
INCLUDE(build_rocksdb.cmake)
ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
@ -120,13 +138,16 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
rdb_perf_context.h
rdb_sst_info.cc
rdb_sst_info.h
rdb_io_watchdog.cc rdb_io_watchdog.h
rdb_buff.h
rdb_mariadb_port.h
)
ADD_DEPENDENCIES(rocksdb_aux_lib GenError)
TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
# MARIAROCKS-TODO: how to properly depend on -lrt ?
TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY} -lrt)
TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@ -161,6 +182,8 @@ ENDIF()
# ADD_SUBDIRECTORY(unittest)
#ENDIF()
SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt")
ADD_LIBRARY(rocksdb_tools STATIC
rocksdb/tools/ldb_tool.cc
rocksdb/tools/ldb_cmd.cc

View File

@ -1,12 +1,20 @@
== Summary ==
This directory contains RocksDB-based Storage Engine (RDBSE) for MySQL = "MyRocks".
This directory contains RocksDB-based Storage Engine (RDBSE) for MySQL,
also known as "MyRocks".
== Resources ==
See https://github.com/facebook/mysql-5.6/wiki/Getting-Started-with-MyRocks
Facebook group: https://www.facebook.com/groups/mysqlonrocksdb/
https://github.com/facebook/mysql-5.6/wiki/Getting-Started-with-MyRocks
https://www.facebook.com/groups/MyRocks/
== Coding Conventions ==
The baseline for MyRocks coding conventions is the MySQL set, available at
The baseline for MyRocks coding conventions for the code in storage/rocksdb/
is based on the default clang format with a few minor changes. The file
storage/rocksdb/.clang-format describes conventions and can be integrated
with Vim or Emacs as described here:
http://releases.llvm.org/3.6.0/tools/clang/docs/ClangFormat.html#vim-integration
All code outside of storage/rocksdb/ should conform to the MySQL coding
conventions:
http://dev.mysql.com/doc/internals/en/coding-guidelines.html.
Several refinements:
@ -34,5 +42,9 @@ Several refinements:
"_vect" for a std::vector etc.
== Running Tests ==
To run tests from rocksdb, rocksd_rpl or rocksdb_sys_vars packages, use the following parameters:
--mysqld=--default-storage-engine=rocksdb --mysqld=--skip-innodb --mysqld=--default-tmp-storage-engine=MyISAM --mysqld=--rocksdb
To run tests from rocksdb, rocksdb_rpl or other rocksdb_* packages, use the
following parameters:
--default-storage-engine=rocksdb
--skip-innodb
--default-tmp-storage-engine=MyISAM
--rocksdb

View File

@ -178,6 +178,7 @@ set(ROCKSDB_SOURCES
db/internal_stats.cc
db/log_reader.cc
db/log_writer.cc
db/malloc_stats.cc
db/managed_iterator.cc
db/memtable.cc
db/memtable_list.cc
@ -200,13 +201,14 @@ set(ROCKSDB_SOURCES
env/env.cc
env/env_chroot.cc
env/env_hdfs.cc
env/memenv.cc
env/mock_env.cc
memtable/alloc_tracker.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/memtable_allocator.cc
memtable/skiplistrep.cc
memtable/vectorrep.cc
memtable/write_buffer_manager.cc
monitoring/histogram.cc
monitoring/histogram_windowing.cc
monitoring/instrumented_mutex.cc
@ -216,6 +218,7 @@ set(ROCKSDB_SOURCES
monitoring/statistics.cc
monitoring/thread_status_impl.cc
monitoring/thread_status_updater.cc
monitoring/thread_status_updater_debug.cc
monitoring/thread_status_util.cc
monitoring/thread_status_util_debug.cc
options/cf_options.cc
@ -245,6 +248,7 @@ set(ROCKSDB_SOURCES
table/iterator.cc
table/merging_iterator.cc
table/meta_blocks.cc
table/mock_table.cc
table/partitioned_filter_block.cc
table/persistent_cache_helper.cc
table/plain_table_builder.cc
@ -293,12 +297,20 @@ set(ROCKSDB_SOURCES
util/xxhash.cc
utilities/backupable/backupable_db.cc
utilities/blob_db/blob_db.cc
utilities/blob_db/blob_db_impl.cc
utilities/blob_db/blob_db_options_impl.cc
utilities/blob_db/blob_dump_tool.cc
utilities/blob_db/blob_file.cc
utilities/blob_db/blob_log_format.cc
utilities/blob_db/blob_log_reader.cc
utilities/blob_db/blob_log_writer.cc
utilities/checkpoint/checkpoint_impl.cc
utilities/col_buf_decoder.cc
utilities/col_buf_encoder.cc
utilities/column_aware_encoding_util.cc
utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc
utilities/date_tiered/date_tiered_db_impl.cc
utilities/debug.cc
utilities/document/document_db.cc
utilities/document/json_document.cc
utilities/document/json_document_builder.cc

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@
/* RocksDB header files */
#include "rocksdb/cache.h"
#include "rocksdb/perf_context.h"
#include "rocksdb/sst_file_manager.h"
#include "rocksdb/statistics.h"
#include "rocksdb/utilities/options_util.h"
#include "rocksdb/utilities/transaction_db.h"
@ -49,6 +50,7 @@
/* MyRocks header files */
#include "./rdb_comparator.h"
#include "./rdb_index_merge.h"
#include "./rdb_io_watchdog.h"
#include "./rdb_perf_context.h"
#include "./rdb_sst_info.h"
#include "./rdb_utils.h"
@ -96,12 +98,12 @@ std::vector<Rdb_trx_info> rdb_get_all_trx_info();
- the name used to set the default column family parameter for per-cf
arguments.
*/
const char *const DEFAULT_CF_NAME = "default";
extern const std::string DEFAULT_CF_NAME;
/*
This is the name of the Column Family used for storing the data dictionary.
*/
const char *const DEFAULT_SYSTEM_CF_NAME = "__system__";
extern const std::string DEFAULT_SYSTEM_CF_NAME;
/*
This is the name of the hidden primary key for tables with no pk.
@ -110,9 +112,9 @@ const char *const HIDDEN_PK_NAME = "HIDDEN_PK_ID";
/*
Column family name which means "put this index into its own column family".
See Rdb_cf_manager::get_per_index_cf_name().
DEPRECATED!!!
*/
const char *const PER_INDEX_CF_NAME = "$per_index_cf";
extern const std::string PER_INDEX_CF_NAME;
/*
Name for the background thread.
@ -138,7 +140,7 @@ const char RDB_PER_PARTITION_QUALIFIER_NAME_SEP = '_';
- p0_cfname=foo
- p3_tts_col=bar
*/
const char RDB_PER_PARTITION_QUALIFIER_VALUE_SEP = '=';
const char RDB_QUALIFIER_VALUE_SEP = '=';
/*
Separator between multiple qualifier assignments. Sample usage:
@ -152,6 +154,16 @@ const char RDB_QUALIFIER_SEP = ';';
*/
const char *const RDB_CF_NAME_QUALIFIER = "cfname";
/*
Qualifier name for a custom per partition ttl duration.
*/
const char *const RDB_TTL_DURATION_QUALIFIER = "ttl_duration";
/*
Qualifier name for a custom per partition ttl duration.
*/
const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
/*
Default, minimal valid, and maximum valid sampling rate values when collecting
statistics about table.
@ -180,12 +192,16 @@ const char *const RDB_CF_NAME_QUALIFIER = "cfname";
CPU-s and derive the values from there. This however has its own set of
problems and we'll choose simplicity for now.
*/
#define MAX_BACKGROUND_COMPACTIONS 64
#define MAX_BACKGROUND_FLUSHES 64
#define MAX_BACKGROUND_JOBS 64
#define DEFAULT_SUBCOMPACTIONS 1
#define MAX_SUBCOMPACTIONS 64
/*
Default value for rocksdb_sst_mgr_rate_bytes_per_sec = 0 (disabled).
*/
#define DEFAULT_SST_MGR_RATE_BYTES_PER_SEC 0
/*
Defines the field sizes for serializing XID object to a string representation.
string byte format: [field_size: field_value, ...]
@ -228,19 +244,50 @@ enum collations_used {
#define ROCKSDB_SIZEOF_HIDDEN_PK_COLUMN sizeof(longlong)
/*
MyRocks specific error codes. NB! Please make sure that you will update
HA_ERR_ROCKSDB_LAST when adding new ones.
Bytes used to store TTL, in the beginning of all records for tables with TTL
enabled.
*/
#define HA_ERR_ROCKSDB_UNIQUE_NOT_SUPPORTED (HA_ERR_LAST + 1)
#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_LAST + 2)
#define HA_ERR_ROCKSDB_TOO_MANY_LOCKS (HA_ERR_LAST + 3)
#define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED (HA_ERR_LAST + 4)
#define HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED (HA_ERR_LAST + 5)
#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED
#define ROCKSDB_SIZEOF_TTL_RECORD sizeof(longlong)
inline bool looks_like_per_index_cf_typo(const char *const name) {
return (name && name[0] == '$' && strcmp(name, PER_INDEX_CF_NAME));
}
/*
MyRocks specific error codes. NB! Please make sure that you will update
HA_ERR_ROCKSDB_LAST when adding new ones. Also update the strings in
rdb_error_messages to include any new error messages.
*/
#define HA_ERR_ROCKSDB_FIRST (HA_ERR_LAST + 1)
#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_ROCKSDB_FIRST + 0)
#define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 1)
#define HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 2)
#define HA_ERR_ROCKSDB_COMMIT_FAILED (HA_ERR_ROCKSDB_FIRST + 3)
#define HA_ERR_ROCKSDB_BULK_LOAD (HA_ERR_ROCKSDB_FIRST + 4)
#define HA_ERR_ROCKSDB_CORRUPT_DATA (HA_ERR_ROCKSDB_FIRST + 5)
#define HA_ERR_ROCKSDB_CHECKSUM_MISMATCH (HA_ERR_ROCKSDB_FIRST + 6)
#define HA_ERR_ROCKSDB_INVALID_TABLE (HA_ERR_ROCKSDB_FIRST + 7)
#define HA_ERR_ROCKSDB_PROPERTIES (HA_ERR_ROCKSDB_FIRST + 8)
#define HA_ERR_ROCKSDB_MERGE_FILE_ERR (HA_ERR_ROCKSDB_FIRST + 9)
/*
Each error code below maps to a RocksDB status code found in:
rocksdb/include/rocksdb/status.h
*/
#define HA_ERR_ROCKSDB_STATUS_NOT_FOUND (HA_ERR_LAST + 10)
#define HA_ERR_ROCKSDB_STATUS_CORRUPTION (HA_ERR_LAST + 11)
#define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED (HA_ERR_LAST + 12)
#define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_LAST + 13)
#define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_LAST + 14)
#define HA_ERR_ROCKSDB_STATUS_NO_SPACE (HA_ERR_LAST + 15)
#define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_LAST + 16)
#define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_LAST + 17)
#define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_LAST + 18)
#define HA_ERR_ROCKSDB_STATUS_TIMED_OUT (HA_ERR_LAST + 19)
#define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_LAST + 20)
#define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT (HA_ERR_LAST + 21)
#define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_LAST + 22)
#define HA_ERR_ROCKSDB_STATUS_DEADLOCK (HA_ERR_LAST + 23)
#define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_LAST + 24)
#define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_LAST + 25)
#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_STATUS_TRY_AGAIN
/**
@brief
@ -253,6 +300,8 @@ struct Rdb_table_handler {
char *m_table_name;
uint m_table_name_length;
int m_ref_count;
atomic_stat<int> m_lock_wait_timeout_counter;
atomic_stat<int> m_deadlock_counter;
my_core::THR_LOCK m_thr_lock; ///< MySQL latch needed by m_db_lock
@ -297,15 +346,19 @@ typedef struct _gl_index_id_s {
}
} GL_INDEX_ID;
enum operation_type {
enum operation_type : int {
ROWS_DELETED = 0,
ROWS_INSERTED,
ROWS_READ,
ROWS_UPDATED,
ROWS_DELETED_BLIND,
ROWS_EXPIRED,
ROWS_HIDDEN_NO_SNAPSHOT,
ROWS_MAX
};
enum query_type : int { QUERIES_POINT = 0, QUERIES_RANGE, QUERIES_MAX };
#if defined(HAVE_SCHED_GETCPU)
#define RDB_INDEXER get_sched_indexer_t
#else
@ -319,6 +372,8 @@ struct st_global_stats {
// system_rows_ stats are only for system
// tables. They are not counted in rows_* stats.
ib_counter_t<ulonglong, 64, RDB_INDEXER> system_rows[ROWS_MAX];
ib_counter_t<ulonglong, 64, RDB_INDEXER> queries[QUERIES_MAX];
};
/* Struct used for exporting status to MySQL */
@ -328,11 +383,22 @@ struct st_export_stats {
ulonglong rows_read;
ulonglong rows_updated;
ulonglong rows_deleted_blind;
ulonglong rows_expired;
ulonglong rows_hidden_no_snapshot;
ulonglong system_rows_deleted;
ulonglong system_rows_inserted;
ulonglong system_rows_read;
ulonglong system_rows_updated;
ulonglong queries_point;
ulonglong queries_range;
};
/* Struct used for exporting RocksDB memory status */
struct st_memory_stats {
ulonglong memtable_total;
ulonglong memtable_unflushed;
};
} // namespace myrocks
@ -439,6 +505,11 @@ class ha_rocksdb : public my_core::handler {
*/
uchar *m_pack_buffer;
/*
Pointer to the original TTL timestamp value (8 bytes) during UPDATE.
*/
char m_ttl_bytes[ROCKSDB_SIZEOF_TTL_RECORD];
/* rowkey of the last record we've read, in StorageFormat. */
String m_last_rowkey;
@ -504,14 +575,14 @@ class ha_rocksdb : public my_core::handler {
void setup_iterator_for_rnd_scan();
void setup_scan_iterator(const Rdb_key_def &kd, rocksdb::Slice *const slice)
MY_ATTRIBUTE((__nonnull__)) {
setup_scan_iterator(kd, slice, false, false, 0);
setup_scan_iterator(kd, slice, false, 0);
}
bool is_ascending(const Rdb_key_def &keydef,
enum ha_rkey_function find_flag) const
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void setup_scan_iterator(const Rdb_key_def &kd, rocksdb::Slice *slice,
const bool use_all_keys, const bool is_ascending,
const uint eq_cond_len) MY_ATTRIBUTE((__nonnull__));
const bool use_all_keys, const uint eq_cond_len)
MY_ATTRIBUTE((__nonnull__));
void release_scan_iterator(void);
rocksdb::Status
@ -520,13 +591,15 @@ class ha_rocksdb : public my_core::handler {
const rocksdb::Slice &key, std::string *const value) const;
int get_row_by_rowid(uchar *const buf, const char *const rowid,
const uint rowid_size, const bool skip_lookup = false)
const uint rowid_size, const bool skip_lookup = false,
const bool skip_ttl_check = true)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int get_row_by_rowid(uchar *const buf, const uchar *const rowid,
const uint rowid_size, const bool skip_lookup = false)
const uint rowid_size, const bool skip_lookup = false,
const bool skip_ttl_check = true)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__)) {
return get_row_by_rowid(buf, reinterpret_cast<const char *>(rowid),
rowid_size, skip_lookup);
rowid_size, skip_lookup, skip_ttl_check);
}
void update_auto_incr_val();
@ -759,14 +832,6 @@ public:
uchar *const buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void convert_record_to_storage_format(const rocksdb::Slice &pk_packed_slice,
Rdb_string_writer *const pk_unpack_info,
rocksdb::Slice *const packed_rec)
MY_ATTRIBUTE((__nonnull__));
static const std::string gen_cf_name_qualifier_for_partition(
const std::string &s);
static const std::vector<std::string> parse_into_tokens(const std::string &s,
const char delim);
@ -785,6 +850,9 @@ public:
const Rdb_tbl_def *const tbl_def_arg)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
static const std::string get_table_comment(const TABLE *const table_arg)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
static bool is_hidden_pk(const uint index, const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
@ -916,7 +984,6 @@ private:
struct key_def_cf_info {
rocksdb::ColumnFamilyHandle *cf_handle;
bool is_reverse_cf;
bool is_auto_cf;
bool is_per_partition_cf;
};
@ -926,12 +993,23 @@ private:
const uchar *old_data;
rocksdb::Slice new_pk_slice;
rocksdb::Slice old_pk_slice;
rocksdb::Slice old_pk_rec;
// "unpack_info" data for the new PK value
Rdb_string_writer *new_pk_unpack_info;
longlong hidden_pk_id;
bool skip_unique_check;
// In certain cases, TTL is enabled on a table, as well as an explicit TTL
// column. The TTL column can be part of either the key or the value part
// of the record. If it is part of the key, we store the offset here.
//
// Later on, we use this offset to store the TTL in the value part of the
// record, which we can then access in the compaction filter.
//
// Set to UINT_MAX by default to indicate that the TTL is not in key.
uint ttl_pk_offset = UINT_MAX;
};
/*
@ -987,6 +1065,17 @@ private:
const KEY *const new_key) const;
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int compare_keys(const KEY *const old_key, const KEY *const new_key) const
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_record_to_storage_format(const struct update_row_info &row_info,
rocksdb::Slice *const packed_rec)
MY_ATTRIBUTE((__nonnull__));
bool should_hide_ttl_rec(const rocksdb::Slice &ttl_rec_val,
const int64_t curr_ts)
MY_ATTRIBUTE((__warn_unused_result__));
int index_first_intern(uchar *buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int index_last_intern(uchar *buf)
@ -1006,7 +1095,7 @@ private:
MY_ATTRIBUTE((__warn_unused_result__));
int check_and_lock_sk(const uint &key_id,
const struct update_row_info &row_info,
bool *const found) const
bool *const found)
MY_ATTRIBUTE((__warn_unused_result__));
int check_uniqueness_and_lock(const struct update_row_info &row_info,
bool *const pk_changed)
@ -1031,18 +1120,22 @@ private:
int read_key_exact(const Rdb_key_def &kd, rocksdb::Iterator *const iter,
const bool &using_full_key,
const rocksdb::Slice &key_slice) const
const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int read_before_key(const Rdb_key_def &kd, const bool &using_full_key,
const rocksdb::Slice &key_slice)
const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int read_after_key(const Rdb_key_def &kd, const rocksdb::Slice &key_slice)
int read_after_key(const Rdb_key_def &kd, const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int position_to_correct_key(
const Rdb_key_def &kd, const enum ha_rkey_function &find_flag,
const bool &full_key_match, const uchar *const key,
const key_part_map &keypart_map, const rocksdb::Slice &key_slice,
bool *const move_forward) MY_ATTRIBUTE((__warn_unused_result__));
bool *const move_forward, const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__warn_unused_result__));
int read_row_from_primary_key(uchar *const buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
@ -1122,7 +1215,7 @@ public:
int check(THD *const thd, HA_CHECK_OPT *const check_opt) override
MY_ATTRIBUTE((__warn_unused_result__));
void remove_rows(Rdb_tbl_def *const tbl);
int remove_rows(Rdb_tbl_def *const tbl);
ha_rows records_in_range(uint inx, key_range *const min_key,
key_range *const max_key) override
MY_ATTRIBUTE((__warn_unused_result__));
@ -1152,6 +1245,10 @@ public:
bool get_error_message(const int error, String *const buf) override
MY_ATTRIBUTE((__nonnull__));
static int rdb_error_to_mysql(const rocksdb::Status &s,
const char *msg = nullptr)
MY_ATTRIBUTE((__warn_unused_result__));
void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *const first_value,
@ -1258,5 +1355,4 @@ private:
Rdb_inplace_alter_ctx(const Rdb_inplace_alter_ctx &);
Rdb_inplace_alter_ctx &operator=(const Rdb_inplace_alter_ctx &);
};
} // namespace myrocks

View File

@ -70,7 +70,18 @@ rocksdb::TransactionDB *rdb_get_rocksdb_db();
class Rdb_cf_manager;
Rdb_cf_manager &rdb_get_cf_manager();
rocksdb::BlockBasedTableOptions &rdb_get_table_options();
const rocksdb::BlockBasedTableOptions &rdb_get_table_options();
bool rdb_is_ttl_enabled();
bool rdb_is_ttl_read_filtering_enabled();
#ifndef NDEBUG
int rdb_dbug_set_ttl_rec_ts();
int rdb_dbug_set_ttl_snapshot_ts();
int rdb_dbug_set_ttl_read_filter_ts();
#endif
enum operation_type : int;
void rdb_update_global_stats(const operation_type &type, uint count,
bool is_system_table = false);
class Rdb_dict_manager;
Rdb_dict_manager *rdb_get_dict_manager(void)
@ -83,5 +94,4 @@ Rdb_ddl_manager *rdb_get_ddl_manager(void)
class Rdb_binlog_manager;
Rdb_binlog_manager *rdb_get_binlog_manager(void)
MY_ATTRIBUTE((__warn_unused_result__));
} // namespace myrocks

View File

@ -0,0 +1,52 @@
let $prior_set_lwt = `select concat('set @prior_lock_wait_timeout = @@',
'$engine', '_lock_wait_timeout;')`;
let $prior_set_dld = `select concat('set @prior_deadlock_detect = @@',
'$engine', '_deadlock_detect;')`;
let $global_dld = `select concat('set global ', '$engine',
'_deadlock_detect = on;')`;
let $global_lwt = `select concat('set global ', '$engine',
'_lock_wait_timeout = 100000;')`;
eval $prior_set_lwt $prior_set_dld $global_dld $global_lwt;
--source include/count_sessions.inc
connect (con1,localhost,root,,);
let $con1= `SELECT CONNECTION_ID()`;
connect (con2,localhost,root,,);
let $con2= `SELECT CONNECTION_ID()`;
connection default;
eval create table t (i int primary key) engine=$engine;
insert into t values (1), (2), (3);
--echo #
--echo # The following is disabled due:
--echo # MDEV-13404: MyRocks upstream uses I_S.table_statistics.row_lock_deadlocks, should we import?
--echo #
--disable_parsing
--source include/simple_deadlock.inc
connection default;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
--source include/simple_deadlock.inc
connection default;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
--enable_parsing
disconnect con1;
disconnect con2;
let $restore_lwt = `select concat('set global ', '$engine',
'_lock_wait_timeout = @prior_lock_wait_timeout;')`;
let $restore_dld = `select concat('set global ', '$engine',
'_deadlock_detect = @prior_deadlock_detect;')`;
eval $restore_lwt $restore_dld;
drop table t;
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,31 @@
if ($rpl_inited)
{
if (!$allow_rpl_inited)
{
--die ERROR IN TEST: This script does not support replication
}
}
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--let $_server_id= `SELECT @@server_id`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--exec echo "wait" > $_expect_file_name
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart:$_mysqld_option" > $_expect_file_name
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect

View File

@ -0,0 +1,29 @@
connection con1;
begin;
select * from t where i=1 for update;
connection con2;
begin;
select * from t where i=2 for update;
connection con1;
--send select * from t where i=2 for update
connection con2;
if ($engine == "rocksdb"){
let $wait_condition = select count(*) = 1 from information_schema.rocksdb_trx
where thread_id = $con1 and waiting_key != "";
}
if ($engine == "innodb"){
let $wait_condition = select count(*) = 1 from information_schema.innodb_trx
where trx_mysql_thread_id = $con1 and trx_state="LOCK WAIT";
}
--source include/wait_condition.inc
--error ER_LOCK_DEADLOCK
select * from t where i=1 for update;
rollback;
connection con1;
--reap
rollback;

View File

@ -408,3 +408,46 @@ select 1300 < 1300 * 1.5 as "same";
same
1
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT,
c INT,
KEY kbc(b,c)) ENGINE = ROCKSDB;
INSERT INTO t1 (a,b,c) VALUES (1,1,1);
INSERT INTO t1 (a,b,c) VALUES (2,2,2);
INSERT INTO t1 (a,b,c) VALUES (3,3,3);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `kbc` (`b`,`c`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP INDEX kbc, ADD INDEX kbc(b,c), ALGORITHM=INPLACE;
ALTER TABLE t1 DROP INDEX kbc;
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b varchar(10),
index kb(b(5))
) ENGINE = ROCKSDB charset utf8 collate utf8_bin;
INSERT INTO t1 (a,b) VALUES (1,'1111122222');
INSERT INTO t1 (a,b) VALUES (2,'2222233333');
INSERT INTO t1 (a,b) VALUES (3,'3333344444');
ALTER TABLE t1 DROP INDEX kb, ADD INDEX kb(b(8)), ALGORITHM=INPLACE;
SELECT * FROM t1 FORCE INDEX(kb);
a b
1 1111122222
2 2222233333
3 3333344444
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(10) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `kb` (`b`(8))
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
DROP TABLE t1;

View File

@ -79,11 +79,25 @@ INSERT INTO t1 (a, b) VALUES (1, 5);
INSERT INTO t1 (a, b) VALUES (2, 6);
INSERT INTO t1 (a, b) VALUES (3, 7);
ALTER TABLE t1 ADD UNIQUE INDEX kb(b);
ERROR HY000: Unique index support is disabled when the table has no primary key.
INSERT INTO t1 (a, b) VALUES (4, 8);
INSERT INTO t1 (a, b) VALUES (5, 5);
ERROR 23000: Duplicate entry '5' for key 'kb'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
`b` int(11) DEFAULT NULL,
UNIQUE KEY `kb` (`b`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT,
c INT,
KEY kbc(b,c)) ENGINE = ROCKSDB;
INSERT INTO t1 (a,b,c) VALUES (1,1,1);
INSERT INTO t1 (a,b,c) VALUES (2,2,2);
INSERT INTO t1 (a,b,c) VALUES (3,2,2);
ALTER TABLE t1 DROP INDEX kbc, ADD UNIQUE INDEX kbc(b,c), ALGORITHM=INPLACE;
ERROR 23000: Duplicate entry '2-2' for key 'kbc'
DROP TABLE t1;

View File

@ -229,7 +229,20 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b CHAR(8), UNIQUE INDEX(a)) ENGINE=rocksdb;
ERROR HY000: Unique index support is disabled when the table has no primary key.
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
INSERT INTO t1 (a,b) VALUES (1,'c');
ERROR 23000: Duplicate entry '1' for key 'a'
SELECT * FROM t1;
a b
1 a
2 b
SELECT * FROM t1 WHERE a = 2;
a b
2 b
EXPLAIN SELECT * FROM t1 WHERE a = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const a a 5 const 1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=rocksdb;
SHOW CREATE TABLE t1;
Table Create Table

View File

@ -815,6 +815,406 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'rev:cf_short_prefix',
index id2 (id2) COMMENT 'rev:cf_short_prefix',
index id2_id1 (id2, id1) COMMENT 'rev:cf_short_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_short_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_short_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'rev:cf_short_prefix',
index id3_id2 (id3, id2) COMMENT 'rev:cf_short_prefix'
) engine=ROCKSDB;
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4) COMMENT 'rev:cf_short_prefix',
index id2 (id2) COMMENT 'rev:cf_short_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_short_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_short_prefix',
index id2_id4_id5 (id2, id4, id5) COMMENT 'rev:cf_short_prefix',
index id3_id4 (id3, id4) COMMENT 'rev:cf_short_prefix',
index id3_id5 (id3, id5) COMMENT 'rev:cf_short_prefix'
) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start();
select count(*) from t1;
count(*)
10000
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2;
count(*)
10000
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(PRIMARY) where id1 >= 1;
count(*)
10000
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2 >= 1;
count(*)
10000
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index(id3_id4) where id3 >= '1';
count(*)
10000
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=2 and id1=1;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=24 and id1=12;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=88 and id1=44;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=100 and id1=50;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=428 and id1=214;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=1 and id4=1 and id5=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=23 and id4=115 and id5=115;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=500 and id4=2500 and id5=2500;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=601 and id4=3005 and id5=3005;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=23;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=345;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=456;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=1;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=23;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=345;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=456;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=1 and id3='1' and id1=1 order by id4;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36 and id3='36' and id1=18 order by id4;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124' and id1=62 order by id4;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=888 and id3='888' and id1=444 order by id4;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124';
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1 and id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=12 and id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=1;
count(*)
10
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=12;
count(*)
10
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=23;
count(*)
10
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=100;
count(*)
10
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=234;
count(*)
10
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=234;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=1 and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=23 and id4=115;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=500 and id4=2500;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=601 and id4=3005;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2) where id2=1;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2) where id2=23;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2) where id2=345;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2) where id2=456;
count(*)
5
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='100' and id5=500;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='240' and id5=1200;
count(*)
1
call bloom_end();
checked
true
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'cf_long_prefix',
index id2 (id2) COMMENT 'cf_long_prefix',
index id2_id1 (id2, id1) COMMENT 'cf_long_prefix',
@ -1207,6 +1607,406 @@ count(*)
call bloom_end();
checked
false
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'rev:cf_long_prefix',
index id2 (id2) COMMENT 'rev:cf_long_prefix',
index id2_id1 (id2, id1) COMMENT 'rev:cf_long_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_long_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_long_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'rev:cf_long_prefix',
index id3_id2 (id3, id2) COMMENT 'rev:cf_long_prefix'
) engine=ROCKSDB;
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4) COMMENT 'rev:cf_long_prefix',
index id2 (id2) COMMENT 'rev:cf_long_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_long_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_long_prefix',
index id2_id4_id5 (id2, id4, id5) COMMENT 'rev:cf_long_prefix',
index id3_id4 (id3, id4) COMMENT 'rev:cf_long_prefix',
index id3_id5 (id3, id5) COMMENT 'rev:cf_long_prefix'
) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start();
select count(*) from t1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(PRIMARY) where id1 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index(id3_id4) where id3 >= '1';
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=2 and id1=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=24 and id1=12;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=88 and id1=44;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=100 and id1=50;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=428 and id1=214;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=1 and id4=1 and id5=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=23 and id4=115 and id5=115;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=500 and id4=2500 and id5=2500;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=601 and id4=3005 and id5=3005;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=1 and id3='1' and id1=1 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36 and id3='36' and id1=18 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124' and id1=62 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=888 and id3='888' and id1=444 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1 and id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=12 and id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=1;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=12;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=23;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=100;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=234;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=234;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=1 and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=23 and id4=115;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=500 and id4=2500;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id2) where id2=601 and id4=3005;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
true
call bloom_start();
select count(*) from t1 force index (id2) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='100' and id5=500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='240' and id5=1200;
count(*)
1
call bloom_end();
checked
false
create table r1 (id1 bigint, id2 bigint, id3 bigint, v1 int, v2 text, primary key (id1, id2, id3)) engine=rocksdb DEFAULT CHARSET=latin1 collate latin1_bin;
call bloom_start();
select * from r1 where id1=1 and id2 in (1) order by id3 asc;

View File

@ -815,6 +815,406 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'rev:cf_short_prefix',
index id2 (id2) COMMENT 'rev:cf_short_prefix',
index id2_id1 (id2, id1) COMMENT 'rev:cf_short_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_short_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_short_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'rev:cf_short_prefix',
index id3_id2 (id3, id2) COMMENT 'rev:cf_short_prefix'
) engine=ROCKSDB;
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4) COMMENT 'rev:cf_short_prefix',
index id2 (id2) COMMENT 'rev:cf_short_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_short_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_short_prefix',
index id2_id4_id5 (id2, id4, id5) COMMENT 'rev:cf_short_prefix',
index id3_id4 (id3, id4) COMMENT 'rev:cf_short_prefix',
index id3_id5 (id3, id5) COMMENT 'rev:cf_short_prefix'
) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start();
select count(*) from t1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(PRIMARY) where id1 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index(id3_id4) where id3 >= '1';
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=2 and id1=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=24 and id1=12;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=88 and id1=44;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=100 and id1=50;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=428 and id1=214;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=1 and id4=1 and id5=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=23 and id4=115 and id5=115;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=500 and id4=2500 and id5=2500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=601 and id4=3005 and id5=3005;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=1 and id3='1' and id1=1 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36 and id3='36' and id1=18 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124' and id1=62 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=888 and id3='888' and id1=444 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1 and id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=12 and id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=1;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=12;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=23;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=100;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=234;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=234;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=1 and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=23 and id4=115;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=500 and id4=2500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=601 and id4=3005;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='100' and id5=500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='240' and id5=1200;
count(*)
1
call bloom_end();
checked
false
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'cf_long_prefix',
index id2 (id2) COMMENT 'cf_long_prefix',
index id2_id1 (id2, id1) COMMENT 'cf_long_prefix',
@ -1207,6 +1607,406 @@ count(*)
call bloom_end();
checked
false
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4) COMMENT 'rev:cf_long_prefix',
index id2 (id2) COMMENT 'rev:cf_long_prefix',
index id2_id1 (id2, id1) COMMENT 'rev:cf_long_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_long_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_long_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'rev:cf_long_prefix',
index id3_id2 (id3, id2) COMMENT 'rev:cf_long_prefix'
) engine=ROCKSDB;
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4) COMMENT 'rev:cf_long_prefix',
index id2 (id2) COMMENT 'rev:cf_long_prefix',
index id2_id3 (id2, id3) COMMENT 'rev:cf_long_prefix',
index id2_id4 (id2, id4) COMMENT 'rev:cf_long_prefix',
index id2_id4_id5 (id2, id4, id5) COMMENT 'rev:cf_long_prefix',
index id3_id4 (id3, id4) COMMENT 'rev:cf_long_prefix',
index id3_id5 (id3, id5) COMMENT 'rev:cf_long_prefix'
) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start();
select count(*) from t1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(PRIMARY) where id1 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2 >= 1;
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index(id3_id4) where id3 >= '1';
count(*)
10000
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=2 and id1=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=24 and id1=12;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=88 and id1=44;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=100 and id1=50;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index(id2_id1) where id2=428 and id1=214;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=1 and id4=1 and id5=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=23 and id4=115 and id5=115;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=500 and id4=2500 and id5=2500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4_id5) where id2=601 and id4=3005 and id5=3005;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id4) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=1 and id3='1' and id1=1 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36 and id3='36' and id1=18 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124' and id1=62 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=888 and id3='888' and id1=444 order by id4;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=124 and id3='124';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=1 and id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2_id3) where id2=12 and id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=1 and id3='1';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id3_id2) where id2=23 and id3='23';
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=1;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=12;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=23;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=100;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (PRIMARY) where id1=234;
count(*)
10
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=36;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2_id3_id1_id4) where id2=234;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=1 and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=23 and id4=115;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=500 and id4=2500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id2) where id2=601 and id4=3005;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='1' and id4=1;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id4) where id3='12' and id4=60;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=1;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=23;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=345;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t1 force index (id2) where id2=456;
count(*)
5
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='100' and id5=500;
count(*)
1
call bloom_end();
checked
false
call bloom_start();
select count(*) from t2 force index (id3_id5) where id3='240' and id5=1200;
count(*)
1
call bloom_end();
checked
false
create table r1 (id1 bigint, id2 bigint, id3 bigint, v1 int, v2 text, primary key (id1, id2, id3)) engine=rocksdb DEFAULT CHARSET=latin1 collate latin1_bin;
call bloom_start();
select * from r1 where id1=1 and id2 in (1) order by id3 asc;

View File

@ -1,9 +1,26 @@
DROP TABLE IF EXISTS t1, t2, t3;
CREATE TABLE t1(pk CHAR(5) PRIMARY KEY, a char(30), b char(30), key(a)) COLLATE 'latin1_bin';
CREATE TABLE t2(pk CHAR(5) PRIMARY KEY, a char(30), b char(30), key(a)) COLLATE 'latin1_bin';
CREATE TABLE t3(pk CHAR(5) PRIMARY KEY, a char(30), b char(30), key(a)) COLLATE 'latin1_bin'
PARTITION BY KEY() PARTITIONS 4;
connect other,localhost,root,,;
Data will be ordered in ascending order
CREATE TABLE t1(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t2(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t3(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4;
set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE

View File

@ -0,0 +1,29 @@
CREATE TABLE t1(pk INT, PRIMARY KEY(pk));
SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES(10);
INSERT INTO t1 VALUES(11);
INSERT INTO t1 VALUES(9);
ERROR HY000: Rows must be inserted in primary key order during bulk load operation
SET rocksdb_bulk_load=0;
SELECT * FROM t1;
pk
10
11
SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(20);
INSERT INTO t1 VALUES(21);
#
# In MyRocks, the following statement will intentionally crash the server.
# In MariaDB, it will cause an error
SET rocksdb_bulk_load=0;
ERROR HY000: Rows inserted during bulk load must not overlap existing rows
#
# Despite the error, bulk load operation is over so the variable value
# will be 0:
select @@rocksdb_bulk_load;
@@rocksdb_bulk_load
0
call mtr.add_suppression('finalizing last SST file while setting bulk loading variable');
DROP TABLE t1;

View File

@ -0,0 +1,82 @@
DROP TABLE IF EXISTS t1, t2, t3;
Data will be ordered in ascending order
CREATE TABLE t1(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t2(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t3(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4;
set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 0
start transaction with consistent snapshot;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 1
set rocksdb_bulk_load=1;
set rocksdb_bulk_load_size=100000;
LOAD DATA INFILE <input_file> INTO TABLE t1;
LOAD DATA INFILE <input_file> INTO TABLE t2;
LOAD DATA INFILE <input_file> INTO TABLE t3;
set rocksdb_bulk_load=0;
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status OK
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
select count(pk) from t1;
count(pk)
5000000
select count(a) from t1;
count(a)
5000000
select count(b) from t1;
count(b)
5000000
select count(pk) from t2;
count(pk)
5000000
select count(a) from t2;
count(a)
5000000
select count(b) from t2;
count(b)
5000000
select count(pk) from t3;
count(pk)
5000000
select count(a) from t3;
count(a)
5000000
select count(b) from t3;
count(b)
5000000
longfilenamethatvalidatesthatthiswillgetdeleted.bulk_load.tmp
test.bulk_load.tmp
DROP TABLE t1, t2, t3;

View File

@ -0,0 +1,82 @@
DROP TABLE IF EXISTS t1, t2, t3;
Data will be ordered in descending order
CREATE TABLE t1(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t2(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t3(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "rev:cf1",
KEY(a)
) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4;
set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 0
start transaction with consistent snapshot;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 1
set rocksdb_bulk_load=1;
set rocksdb_bulk_load_size=100000;
LOAD DATA INFILE <input_file> INTO TABLE t1;
LOAD DATA INFILE <input_file> INTO TABLE t2;
LOAD DATA INFILE <input_file> INTO TABLE t3;
set rocksdb_bulk_load=0;
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status OK
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
select count(pk) from t1;
count(pk)
5000000
select count(a) from t1;
count(a)
5000000
select count(b) from t1;
count(b)
5000000
select count(pk) from t2;
count(pk)
5000000
select count(a) from t2;
count(a)
5000000
select count(b) from t2;
count(b)
5000000
select count(pk) from t3;
count(pk)
5000000
select count(a) from t3;
count(a)
5000000
select count(b) from t3;
count(b)
5000000
longfilenamethatvalidatesthatthiswillgetdeleted.bulk_load.tmp
test.bulk_load.tmp
DROP TABLE t1, t2, t3;

View File

@ -0,0 +1,82 @@
DROP TABLE IF EXISTS t1, t2, t3;
Data will be ordered in descending order
CREATE TABLE t1(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t2(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin';
CREATE TABLE t3(
pk CHAR(5),
a CHAR(30),
b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4;
set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 0
start transaction with consistent snapshot;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 1
set rocksdb_bulk_load=1;
set rocksdb_bulk_load_size=100000;
LOAD DATA INFILE <input_file> INTO TABLE t1;
LOAD DATA INFILE <input_file> INTO TABLE t2;
LOAD DATA INFILE <input_file> INTO TABLE t3;
set rocksdb_bulk_load=0;
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status OK
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned
select count(pk) from t1;
count(pk)
5000000
select count(a) from t1;
count(a)
5000000
select count(b) from t1;
count(b)
5000000
select count(pk) from t2;
count(pk)
5000000
select count(a) from t2;
count(a)
5000000
select count(b) from t2;
count(b)
5000000
select count(pk) from t3;
count(pk)
5000000
select count(a) from t3;
count(a)
5000000
select count(b) from t3;
count(b)
5000000
longfilenamethatvalidatesthatthiswillgetdeleted.bulk_load.tmp
test.bulk_load.tmp
DROP TABLE t1, t2, t3;

View File

@ -5,7 +5,7 @@ connection con1;
CREATE TABLE t1 (a INT, pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=ROCKSDB;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
connection con2;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
@ -18,7 +18,7 @@ STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 0
connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
connection con2;
INSERT INTO t1 (a) VALUES (1);
connection con1;
@ -69,7 +69,7 @@ id value value2
5 5 5
6 6 6
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
connection con2;
INSERT INTO r1 values (7,7,7);
connection con1;
@ -107,12 +107,12 @@ id value value2
7 7 7
8 8 8
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
connection con2;
INSERT INTO r1 values (9,9,9);
connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
connection con2;
INSERT INTO r1 values (10,10,10);
connection con1;
@ -129,7 +129,7 @@ id value value2
9 9 9
10 10 10
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105
ERROR: 4062
INSERT INTO r1 values (11,11,11);
ERROR: 0
SELECT * FROM r1;

View File

@ -125,7 +125,7 @@ id value value2
START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 0
INSERT INTO r1 values (11,11,11);
ERROR: 1105
ERROR: 4059
SELECT * FROM r1;
id value value2
1 1 1

View File

@ -20,7 +20,7 @@ set @tmp1=@@rocksdb_verify_row_debug_checksums;
set rocksdb_verify_row_debug_checksums=1;
set session debug_dbug= "+d,myrocks_simulate_bad_row_read1";
select * from t1 where pk=1;
ERROR HY000: Got error 122 "Internal (unspecified) error in handler" from storage engine ROCKSDB
ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read1";
set rocksdb_verify_row_debug_checksums=@tmp1;
select * from t1 where pk=1;
@ -28,11 +28,11 @@ pk col1
1 1
set session debug_dbug= "+d,myrocks_simulate_bad_row_read2";
select * from t1 where pk=1;
ERROR HY000: Got error 122 "Internal (unspecified) error in handler" from storage engine ROCKSDB
ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read2";
set session debug_dbug= "+d,myrocks_simulate_bad_row_read3";
select * from t1 where pk=1;
ERROR HY000: Got error 122 "Internal (unspecified) error in handler" from storage engine ROCKSDB
ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read3";
insert into t1 values(4,'0123456789');
select * from t1;
@ -56,7 +56,7 @@ pk col1
ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2;
ERROR HY000: Got error 122 "Internal (unspecified) error in handler" from storage engine ROCKSDB
ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2;
create table t2 (
@ -69,6 +69,6 @@ pk col1
ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2;
ERROR HY000: Got error 122 "Internal (unspecified) error in handler" from storage engine ROCKSDB
ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2;

View File

@ -0,0 +1,14 @@
set @prior_lock_wait_timeout = @@rocksdb_lock_wait_timeout; set @prior_deadlock_detect = @@rocksdb_deadlock_detect; set global rocksdb_deadlock_detect = on; set global rocksdb_lock_wait_timeout = 100000;;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection default;
create table t (i int primary key) engine=rocksdb;
insert into t values (1), (2), (3);
#
# The following is disabled due:
# MDEV-13404: MyRocks upstream uses I_S.table_statistics.row_lock_deadlocks, should we import?
#
disconnect con1;
disconnect con2;
set global rocksdb_lock_wait_timeout = @prior_lock_wait_timeout; set global rocksdb_deadlock_detect = @prior_deadlock_detect;;
drop table t;

View File

@ -54,20 +54,4 @@ drop table t5;
set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1;
Begin filtering dropped index+ 0
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Begin filtering dropped index+ 1
Finished filtering dropped index+ 0
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
Finished filtering dropped index+ 1
drop table t1;

View File

@ -47,9 +47,15 @@ primary key (a,b) comment 'cf1',
key (b) comment 'rev:cf2'
) ENGINE=RocksDB;
DELETE FROM t5;
set @@global.rocksdb_compact_cf = 'cf1';
set @@global.rocksdb_compact_cf = 'rev:cf2';
set @@global.rocksdb_compact_cf = 'default';
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;
set @@global.rocksdb_compact_cf = 'cf1';
set @@global.rocksdb_compact_cf = 'rev:cf2';
set @@global.rocksdb_compact_cf = 'default';
Compacted

View File

@ -1,16 +1,16 @@
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (b INT PRIMARY KEY);
CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, FOREIGN KEY (b) REFERENCES t1(b));
ERROR 42000: MyRocks does not currently support foreign key constraints
ERROR 42000: This version of MariaDB doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
CREATE TABLE t2 (a INT NOT NULL, bforeign INT NOT NULL);
DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL, foreignkey INT NOT NULL);
DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL, bforeign INT not null, FOREIGN KEY (bforeign) REFERENCES t1(b));
ERROR 42000: MyRocks does not currently support foreign key constraints
ERROR 42000: This version of MariaDB doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL);
ALTER TABLE t2 ADD FOREIGN KEY (b) REFERENCES t1(b);
ERROR 42000: MyRocks does not currently support foreign key constraints
ERROR 42000: This version of MariaDB doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL);
ALTER TABLE t2 ADD bforeign INT NOT NULL;
@ -20,6 +20,6 @@ ALTER TABLE t2 ADD foreignkey INT NOT NULL;
DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL);
ALTER TABLE t2 ADD bforeign INT NOT NULL, ADD FOREIGN KEY (bforeign) REFERENCES t1(b);
ERROR 42000: MyRocks does not currently support foreign key constraints
ERROR 42000: This version of MariaDB doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
DROP TABLE t2;
DROP TABLE t1;

View File

@ -483,7 +483,7 @@ delete from test where value = 20;
connection con1;
commit;
connection con2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction (snapshot conflict)
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors';
variable_value-@a
1
@ -511,7 +511,7 @@ update test set value = 12 where id = 1;
connection con1;
commit;
connection con2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction (snapshot conflict)
commit;
connection con1;
truncate table test;
@ -582,7 +582,7 @@ update test set value = 18 where id = 2;
commit;
connection con1;
delete from test where value = 20;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction (snapshot conflict)
commit;
connection con1;
truncate table test;

View File

@ -8,10 +8,10 @@ PRIMARY KEY (z, y) COMMENT 'zy_cf',
KEY (x)) ENGINE = ROCKSDB;
SELECT TABLE_SCHEMA,TABLE_NAME,PARTITION_NAME,INDEX_NAME,INDEX_TYPE,KV_FORMAT_VERSION,CF FROM INFORMATION_SCHEMA.ROCKSDB_DDL WHERE TABLE_NAME like 'is_ddl_t%';
TABLE_SCHEMA TABLE_NAME PARTITION_NAME INDEX_NAME INDEX_TYPE KV_FORMAT_VERSION CF
test is_ddl_t1 NULL PRIMARY 1 11 default
test is_ddl_t1 NULL j 2 11 default
test is_ddl_t1 NULL k 2 11 kl_cf
test is_ddl_t2 NULL PRIMARY 1 11 zy_cf
test is_ddl_t2 NULL x 2 11 default
test is_ddl_t1 NULL PRIMARY 1 13 default
test is_ddl_t1 NULL j 2 12 default
test is_ddl_t1 NULL k 2 12 kl_cf
test is_ddl_t2 NULL PRIMARY 1 13 zy_cf
test is_ddl_t2 NULL x 2 12 default
DROP TABLE is_ddl_t1;
DROP TABLE is_ddl_t2;

View File

@ -0,0 +1,48 @@
CREATE TABLE t1
(
/* fields/keys for row retrieval tests */
key1 INT,
key2 INT,
key3 INT,
key4 INT,
/* make rows much bigger then keys */
filler1 CHAR(200),
KEY(key1),
KEY(key2)
) ENGINE=ROCKSDB;
CREATE TABLE t0 AS SELECT * FROM t1;
# Printing of many insert into t0 values (....) disabled.
# Printing of many insert into t1 select .... from t0 disabled.
# Printing of many insert into t1 (...) values (....) disabled.
SELECT COUNT(*) FROM t1;
COUNT(*)
7201
SET GLOBAL rocksdb_force_flush_memtable_now = 1;
EXPLAIN UPDATE t1 SET filler1='to be deleted' WHERE key1=100 AND key2=100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using intersect(key1,key2); Using where
UPDATE t1 SET filler1='to be deleted' WHERE key1=100 and key2=100;
DROP TABLE t0, t1;
create table t1 (key1 int, key2 int, key3 int, key (key1), key (key2), key(key3)) engine=rocksdb;
insert into t1 values (1, 100, 100), (1, 200, 200), (1, 300, 300);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
set global rocksdb_force_flush_memtable_now=1;
explain select * from t1 where key1 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1 key1 5 const #
explain select key1,key2 from t1 where key1 = 1 or key2 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using union(key1,key2); Using where
select * from t1 where key1 = 1;
key1 key2 key3
1 100 100
1 200 200
1 300 300
select key1,key2 from t1 where key1 = 1 or key2 = 1;
key1 key2
1 100
1 200
1 300
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -39,12 +39,10 @@ a int,
b int,
c int,
d int,
e int,
PRIMARY KEY (a) COMMENT "cf_a",
KEY (b) COMMENT "cf_b",
KEY (c) COMMENT "cf_c",
KEY (d) COMMENT "$per_index_cf",
KEY (e) COMMENT "rev:cf_d") ENGINE=ROCKSDB;
KEY (d) COMMENT "rev:cf_d") ENGINE=ROCKSDB;
select * from INFORMATION_SCHEMA.ROCKSDB_GLOBAL_INFO where TYPE = 'CF_FLAGS';
TYPE NAME VALUE
CF_FLAGS 0 default [0]
@ -52,8 +50,7 @@ CF_FLAGS 1 __system__ [0]
CF_FLAGS 2 cf_a [0]
CF_FLAGS 3 cf_b [0]
CF_FLAGS 4 cf_c [0]
CF_FLAGS 5 test.t2.d [2]
CF_FLAGS 6 rev:cf_d [1]
CF_FLAGS 5 rev:cf_d [1]
CREATE TABLE t3 (a INT, PRIMARY KEY (a)) ENGINE=ROCKSDB;
insert into t3 (a) values (1), (2), (3);
SET @ORIG_ROCKSDB_PAUSE_BACKGROUND_WORK = @@GLOBAL.ROCKSDB_PAUSE_BACKGROUND_WORK;
@ -69,7 +66,7 @@ SHOW GLOBAL VARIABLES LIKE 'ROCKSDB_PAUSE_BACKGROUND_WORK';
Variable_name Value
rocksdb_pause_background_work ON
DROP TABLE t3;
cf_id:0,index_id:268
cf_id:0,index_id:267
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK=0;
SHOW GLOBAL VARIABLES LIKE 'ROCKSDB_PAUSE_BACKGROUND_WORK';
Variable_name Value

View File

@ -32,6 +32,6 @@ update t1 set col2=123456 where pk=0;
commit;
connection default;
update t1 set col2=col2+1 where col1 < 10 limit 5;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction (snapshot conflict)
disconnect con2;
drop table t1, ten, one_k;

View File

@ -0,0 +1,155 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id INT,
val1 INT,
val2 INT,
PRIMARY KEY (id)
) ENGINE=rocksdb;
INSERT INTO t1 VALUES(1,1,1),(2,1,2);
SELECT * FROM t1;
id val1 val2
1 1 1
2 1 2
UPDATE t1 SET val1=2 WHERE id=2;
SELECT * FROM t1;
id val1 val2
1 1 1
2 2 2
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
SET AUTOCOMMIT=0;
START TRANSACTION;
INSERT INTO t1 VALUES(20,1,1),(30,30,30);
SELECT * FROM t1;
id val1 val2
1 1 1
2 2 2
20 1 1
30 30 30
UPDATE t1 SET val1=20, val2=20 WHERE id=20;
SELECT * FROM t1;
id val1 val2
1 1 1
2 2 2
20 20 20
30 30 30
DELETE FROM t1 WHERE id=30;
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
---SNAPSHOT, ACTIVE NUM sec
MySQL thread id TID, OS thread handle PTR, query id QID localhost root ACTION
SHOW ENGINE rocksdb TRANSACTION STATUS
lock count 8, write count 4
insert count 2, update count 1, delete count 1
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
ROLLBACK;
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
START TRANSACTION;
INSERT INTO t1 VALUES(40,40,40);
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
---SNAPSHOT, ACTIVE NUM sec
MySQL thread id TID, OS thread handle PTR, query id QID localhost root ACTION
SHOW ENGINE rocksdb TRANSACTION STATUS
lock count 2, write count 1
insert count 1, update count 0, delete count 0
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
COMMIT;
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
SET AUTOCOMMIT=1;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (
id1 INT,
id2 INT,
value INT,
PRIMARY KEY (id1),
KEY (id2)
) ENGINE=rocksdb;
SET AUTOCOMMIT=0;
START TRANSACTION;
INSERT INTO t2 VALUES(1,2,0),(10,20,30);
UPDATE t2 SET value=3 WHERE id2=2;
DELETE FROM t2 WHERE id1=10;
SHOW ENGINE rocksdb TRANSACTION STATUS;
Type Name Status
SNAPSHOTS rocksdb
============================================================
TIMESTAMP ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
---SNAPSHOT, ACTIVE NUM sec
MySQL thread id TID, OS thread handle PTR, query id QID localhost root ACTION
SHOW ENGINE rocksdb TRANSACTION STATUS
lock count 9, write count 7
insert count 2, update count 1, delete count 1
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
ROLLBACK;
SET AUTOCOMMIT=1;
DROP TABLE t2;

View File

@ -0,0 +1,21 @@
CREATE TABLE t1 (pk BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT);
INSERT INTO t1 VALUES (5);
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB # Fixed 1 # # # # # 6 NULL NULL NULL latin1_swedish_ci NULL
INSERT INTO t1 VALUES ('538647864786478647864');
Warnings:
Warning 1264 Out of range value for column 'pk' at row 1
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB # Fixed 2 # # # # # 9223372036854775807 NULL NULL NULL latin1_swedish_ci NULL
INSERT INTO t1 VALUES ();
ERROR 23000: Duplicate entry '9223372036854775807' for key 'PRIMARY'
SELECT * FROM t1;
pk
5
9223372036854775807
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ROCKSDB # Fixed 2 # # # # # 9223372036854775807 NULL NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;

View File

@ -0,0 +1,27 @@
create table t (a int primary key) engine=rocksdb;
begin;
insert into t values (0);
set @@rocksdb_lock_wait_timeout=1;
select ROW_LOCK_WAIT_TIMEOUTS from information_schema.table_statistics where table_name="t";
ROW_LOCK_WAIT_TIMEOUTS
0
begin;
set @@rocksdb_lock_wait_timeout=1;
begin;
insert into t values(0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction: Timeout on index: test.t.PRIMARY
select ROW_LOCK_WAIT_TIMEOUTS from information_schema.table_statistics where table_name="t";
ROW_LOCK_WAIT_TIMEOUTS
1
select ROW_LOCK_WAIT_TIMEOUTS from information_schema.table_statistics where table_name="t";
ROW_LOCK_WAIT_TIMEOUTS
1
insert into t values(0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction: Timeout on index: test.t.PRIMARY
select ROW_LOCK_WAIT_TIMEOUTS from information_schema.table_statistics where table_name="t";
ROW_LOCK_WAIT_TIMEOUTS
2
select ROW_LOCK_WAIT_TIMEOUTS from information_schema.table_statistics where table_name="t";
ROW_LOCK_WAIT_TIMEOUTS
2
drop table t;

View File

@ -0,0 +1,397 @@
create database linkdb;
use linkdb;
create table linktable (
id1 bigint(20) unsigned NOT NULL DEFAULT '0',
id2 bigint(20) unsigned NOT NULL DEFAULT '0',
link_type bigint(20) unsigned NOT NULL DEFAULT '0',
visibility tinyint(3) NOT NULL DEFAULT '0',
data varchar(255) NOT NULL DEFAULT '',
time bigint(20) unsigned NOT NULL DEFAULT '0',
version int(11) unsigned NOT NULL DEFAULT '0',
primary key (id1,id2,link_type) COMMENT 'cf_link_pk',
KEY id1_type (id1,link_type,visibility,time,version,data)
COMMENT 'rev:cf_link_id1_type') ENGINE=rocksdb DEFAULT COLLATE=latin1_bin;
create table counttable (
id bigint(20) unsigned NOT NULL DEFAULT '0',
link_type bigint(20) unsigned NOT NULL DEFAULT '0',
count int(10) unsigned NOT NULL DEFAULT '0',
time bigint(20) unsigned NOT NULL DEFAULT '0',
version bigint(20) unsigned NOT NULL DEFAULT '0',
primary key (id,link_type) COMMENT 'cf_count_pk')
ENGINE=rocksdb DEFAULT COLLATE=latin1_bin;
create table nodetable (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
type int(10) unsigned NOT NULL,
version bigint(20) unsigned NOT NULL,
time int(10) unsigned NOT NULL,
data mediumtext NOT NULL,
primary key(id) COMMENT 'cf_node_pk')
ENGINE=rocksdb DEFAULT COLLATE=latin1_bin;
#
# Test nodeGet function
#
create native procedure nodeGet soname "NP_EXAMPLE_LIB";
%nodeGet 1;
id type version time data
1 1 1 1000 data
%nodeGet 50 anything can go here;
id type version time data
50 1 1 50000 data
%nodeGet 39;
id type version time data
39 1 1 39000 data
%nodeGet 98;
id type version time data
98 1 1 98000 data
%nodeGet 1000;
id type version time data
%nodeGet -1;
ERROR HY000: Native procedure failed. (code: 7, msg: 'Invalid arguments: Conversion failed for field id.', query 'nodeGet -1')
%nodeGet asdf;
ERROR HY000: Native procedure failed. (code: 7, msg: 'Invalid arguments: Conversion failed for field id.', query 'nodeGet asdf')
#
# Test linkGetRange/linkGetId2s function
#
create native procedure linkGetRange soname "NP_EXAMPLE_LIB";
create native procedure linkGetId2s soname "NP_EXAMPLE_LIB";
%linkGetRange 1 1 1000 2000 0 1000;
id1 id2 link_type visibility data time version
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%linkGetRange 1 2 1000 2000 0 1000;
id1 id2 link_type visibility data time version
%linkGetRange 1 1 5000 2000 0 1000;
id1 id2 link_type visibility data time version
%linkGetRange 1 2 1000 6000 0 5;
id1 id2 link_type visibility data time version
1 5 2 1 data 2005 1
1 4 2 1 data 2004 1
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
%linkGetRange 1 2 1000 6000 0 2;
id1 id2 link_type visibility data time version
1 5 2 1 data 2005 1
1 4 2 1 data 2004 1
%linkGetRange 1 2 1000 6000 2 2;
id1 id2 link_type visibility data time version
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
%linkGetId2s 1 3 3 1 2 3;
id1 id2 link_type visibility data time version
1 1 3 1 data 3001 1
1 2 3 1 data 3002 1
1 3 3 1 data 3003 1
%linkGetId2s 1 3 3 3 2 1;
id1 id2 link_type visibility data time version
1 3 3 1 data 3003 1
1 2 3 1 data 3002 1
1 1 3 1 data 3001 1
%linkGetId2s 1 3 3 3 2 10;
id1 id2 link_type visibility data time version
1 3 3 1 data 3003 1
1 2 3 1 data 3002 1
%linkGetId2s 1 3 3 3 2 1 asdf;
id1 id2 link_type visibility data time version
1 3 3 1 data 3003 1
1 2 3 1 data 3002 1
1 1 3 1 data 3001 1
%linkGetId2s 1 3 0;
id1 id2 link_type visibility data time version
%linkGetId2s 1 3 4 2;
ERROR HY000: Incorrect arguments to native procedure. (query 'linkGetId2s 1 3 4 2')
#
# Test rangeQuery function
#
create native procedure rangeQuery soname "NP_EXAMPLE_LIB";
%rangeQuery 1 0 0 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 1 1 1 data 1001 1
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
1 5 1 1 data 1005 1
%rangeQuery 1 0 1 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 1 1 1 data 1001 1
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
%rangeQuery 1 1 0 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
1 5 1 1 data 1005 1
%rangeQuery 1 1 1 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
%rangeQuery 0 0 0 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 0 1 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 1 0 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
%rangeQuery 0 1 1 4 id1 1 link_type 1 visibility 1 time 1001 4 id1 1 link_type 1 visibility 1 time 1005;
id1 id2 link_type visibility data time version
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
%rangeQuery 1 0 0 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 1 1 1 data 1001 1
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
1 5 1 1 data 1005 1
1 1 2 1 data 2001 1
1 2 2 1 data 2002 1
1 3 2 1 data 2003 1
1 4 2 1 data 2004 1
1 5 2 1 data 2005 1
%rangeQuery 1 0 1 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 1 1 1 data 1001 1
1 2 1 1 data 1002 1
1 3 1 1 data 1003 1
1 4 1 1 data 1004 1
1 5 1 1 data 1005 1
%rangeQuery 1 1 0 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 1 2 1 data 2001 1
1 2 2 1 data 2002 1
1 3 2 1 data 2003 1
1 4 2 1 data 2004 1
1 5 2 1 data 2005 1
%rangeQuery 1 1 1 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
%rangeQuery 0 0 0 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 5 2 1 data 2005 1
1 4 2 1 data 2004 1
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 0 1 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 1 0 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
1 5 2 1 data 2005 1
1 4 2 1 data 2004 1
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
%rangeQuery 0 1 1 2 id1 1 link_type 1 2 id1 1 link_type 2;
id1 id2 link_type visibility data time version
%rangeQuery 0 0 0 2 id1 1 link_type 1 4 id1 1 link_type 2 visibility 1 time 2004;
id1 id2 link_type visibility data time version
1 4 2 1 data 2004 1
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 0 1 2 id1 1 link_type 1 4 id1 1 link_type 2 visibility 1 time 2004;
id1 id2 link_type visibility data time version
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
%rangeQuery 0 1 0 2 id1 1 link_type 1 4 id1 1 link_type 2 visibility 1 time 2004;
id1 id2 link_type visibility data time version
1 4 2 1 data 2004 1
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
%rangeQuery 0 1 1 2 id1 1 link_type 1 4 id1 1 link_type 2 visibility 1 time 2004;
id1 id2 link_type visibility data time version
1 3 2 1 data 2003 1
1 2 2 1 data 2002 1
1 1 2 1 data 2001 1
#
# Test countGet function
#
create native procedure countGet soname "NP_EXAMPLE_LIB";
%countGet 1 1;
count
2
%countGet 10 1;
count
20
%countGet 111 1;
count
%countGet 1 111;
count
%countGet -1 1 1;
ERROR HY000: Native procedure failed. (code: 7, msg: 'Invalid arguments: Conversion failed for field id.', query 'countGet -1 1 1')
%countGet -1 1 2;
ERROR HY000: Native procedure failed. (code: 7, msg: 'Invalid arguments: Conversion failed for field id.', query 'countGet -1 1 2')
%countGet;
ERROR HY000: Incorrect arguments to native procedure. (query 'countGet')
#
# Check that DDL locks are respected.
#
create native procedure sleepRange soname "NP_EXAMPLE_LIB";
%sleepRange 1;
set @start_lock_wait_timeout = @@session.lock_wait_timeout;
set lock_wait_timeout = 1;
drop table counttable;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction: Timeout on table metadata: linkdb.counttable
set lock_wait_timeout = @start_lock_wait_timeout;
count
2
4
6
8
10
12
14
16
18
20
#
# Check that queries can be killed.
#
%sleepRange 0;
kill query ID;
ERROR 70100: Query execution was interrupted
#
# Check that native procedures work properly with transactions.
#
use linkdb;
set session transaction isolation level repeatable read;
%countGet 1 1;
count
2
begin;
select count from counttable where id = 1 and link_type = 1;
count
2
%countGet 1 1;
count
2
# Before update
%countGet 1 1;
count
2
update counttable set count = count + 1 where id = 1 and link_type = 1;
# After update
%countGet 1 1;
count
3
# Unchanged due to consistent reads
%countGet 1 1;
count
2
#
# Check index reads on prefixed data.
#
alter table linktable drop index id1_type;
alter table linktable
add index id1_type (id1,link_type,visibility,time,version,data(1))
COMMENT 'rev:cf_link_id1_type';
%linkGetRange 1 1 1000 2000 0 1000;
id1 id2 link_type visibility data time version
1 5 1 1 data 1005 1
1 4 1 1 data 1004 1
1 3 1 1 data 1003 1
1 2 1 1 data 1002 1
1 1 1 1 data 1001 1
#
# Check correct error handling for various scenarios.
#
create native procedure invalidKey1 soname "NP_EXAMPLE_LIB";
%invalidKey1;
ERROR HY000: Native procedure failed. (code: 6, msg: 'Not found: ', query 'invalidKey1')
create native procedure invalidOpen1 soname "NP_EXAMPLE_LIB";
%invalidOpen1;
ERROR HY000: Native procedure failed. (code: 5, msg: 'Cannot reinitialize: ', query 'invalidOpen1')
create native procedure invalidOpen2 soname "NP_EXAMPLE_LIB";
%invalidOpen2;
ERROR HY000: Native procedure failed. (code: 5, msg: 'Cannot reinitialize: ', query 'invalidOpen2')
create native procedure invalidOpen3 soname "NP_EXAMPLE_LIB";
%invalidOpen3;
ERROR HY000: Native procedure failed. (code: 5, msg: 'Cannot reinitialize: ', query 'invalidOpen3')
create native procedure invalidOpen4 soname "NP_EXAMPLE_LIB";
%invalidOpen4;
ERROR HY000: Native procedure failed. (code: 5, msg: 'Cannot reinitialize: ', query 'invalidOpen4')
%invalidProcedure;
ERROR HY000: Unknown native procedure. 'invalidProcedure'
create native procedure invalidProcedure soname "invalid.so";
ERROR HY000: Can't open shared library
create native procedure invalidProcedure soname "NP_EXAMPLE_LIB";
ERROR HY000: Can't find symbol 'invalidProcedure' in library
#
# Check that our functions are reloaded after restart.
#
select * from mysql.native_proc order by name;
name type dl lua
countGet native np_example.so
invalidKey1 native np_example.so
invalidOpen1 native np_example.so
invalidOpen2 native np_example.so
invalidOpen3 native np_example.so
invalidOpen4 native np_example.so
linkGetId2s native np_example.so
linkGetRange native np_example.so
nodeGet native np_example.so
rangeQuery native np_example.so
sleepRange native np_example.so
drop native procedure nodeGet;
create native procedure nodeGet soname "NP_EXAMPLE_LIB";
ERROR HY000: Native procedure 'nodeGet' exists.
drop native procedure linkGetRange;
drop native procedure linkGetId2s;
drop native procedure countGet;
drop native procedure sleepRange;
drop native procedure rangeQuery;
drop native procedure invalidKey1;
drop native procedure invalidOpen1;
drop native procedure invalidOpen2;
drop native procedure invalidOpen3;
drop native procedure invalidOpen4;
%nodeGet 1;
ERROR HY000: Unknown native procedure. 'nodeGet'
#
# Check that our functions are unloaded after restart.
#
select * from mysql.native_proc order by name;
name type dl lua
%nodeGet 1;
ERROR HY000: Unknown native procedure. 'nodeGet'
drop database linkdb;

View File

@ -0,0 +1,76 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id1 BIGINT, id2 BIGINT, id3 BIGINT, id4 BIGINT, PRIMARY KEY (id1, id2, id3, id4) comment 'cf1') ENGINE=rocksdb collate latin1_bin;
set global rocksdb_force_flush_memtable_now = 1;
Original Prefix Extractor:
SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%';
CF_NAME OPTION_TYPE VALUE
__system__ PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
cf1 PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
default PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1;
COUNT(*)
1
select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
variable_value-@u
1
Prefix Extractor (after override_cf_options set, should not be changed):
SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%';
CF_NAME OPTION_TYPE VALUE
__system__ PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
cf1 PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
default PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
Restarting with new Prefix Extractor...
Changed Prefix Extractor (after restart):
SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%';
CF_NAME OPTION_TYPE VALUE
__system__ PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
cf1 PREFIX_EXTRACTOR rocksdb.CappedPrefix.26
default PREFIX_EXTRACTOR rocksdb.CappedPrefix.24
select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1;
COUNT(*)
1
select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
variable_value-@u
0
set global rocksdb_force_flush_memtable_now = 1;
select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1;
COUNT(*)
1
select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
variable_value-@u
1
SELECT COUNT(*) FROM information_schema.rocksdb_index_file_map WHERE COLUMN_FAMILY != 1;
COUNT(*)
2
UPDATE t1 SET id1=1,id2 = 30,id3 = 30 WHERE id4 >= 0 AND id4 <=10;
set global rocksdb_force_flush_memtable_now = 1;
SELECT COUNT(*) FROM information_schema.rocksdb_index_file_map WHERE COLUMN_FAMILY != 1;
COUNT(*)
3
select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1;
COUNT(*)
0
select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
variable_value-@u
2
set global rocksdb_compact_cf='cf1';
select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=30 AND id3=30;
COUNT(*)
11
select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
variable_value-@u
1
DROP TABLE t1;

View File

@ -875,8 +875,6 @@ rocksdb_advise_random_on_open ON
rocksdb_allow_concurrent_memtable_write OFF
rocksdb_allow_mmap_reads OFF
rocksdb_allow_mmap_writes OFF
rocksdb_background_sync OFF
rocksdb_base_background_compactions 1
rocksdb_blind_delete_primary_key OFF
rocksdb_block_cache_size 536870912
rocksdb_block_restart_interval 16
@ -902,22 +900,29 @@ rocksdb_datadir ./.rocksdb
rocksdb_db_write_buffer_size 0
rocksdb_deadlock_detect OFF
rocksdb_debug_optimizer_no_zero_cardinality ON
rocksdb_debug_ttl_read_filter_ts 0
rocksdb_debug_ttl_rec_ts 0
rocksdb_debug_ttl_snapshot_ts 0
rocksdb_default_cf_options
rocksdb_delayed_write_rate 16777216
rocksdb_delayed_write_rate 0
rocksdb_delete_obsolete_files_period_micros 21600000000
rocksdb_enable_2pc ON
rocksdb_enable_bulk_load_api ON
rocksdb_enable_thread_tracking OFF
rocksdb_enable_thread_tracking ON
rocksdb_enable_ttl ON
rocksdb_enable_ttl_read_filtering ON
rocksdb_enable_write_thread_adaptive_yield OFF
rocksdb_error_if_exists OFF
rocksdb_flush_log_at_trx_commit 0
rocksdb_flush_memtable_on_analyze ON
rocksdb_force_compute_memtable_stats ON
rocksdb_force_flush_memtable_and_lzero_now OFF
rocksdb_force_flush_memtable_now OFF
rocksdb_force_index_records_in_range 0
rocksdb_hash_index_allow_collision ON
rocksdb_index_type kBinarySearch
rocksdb_info_log_level error_level
rocksdb_io_write_timeout 0
rocksdb_is_fd_close_on_exec ON
rocksdb_keep_log_file_num 1000
rocksdb_lock_scanned_rows OFF
@ -925,8 +930,7 @@ rocksdb_lock_wait_timeout 1
rocksdb_log_file_time_to_roll 0
rocksdb_manifest_preallocation_size 4194304
rocksdb_master_skip_tx_api OFF
rocksdb_max_background_compactions 1
rocksdb_max_background_flushes 1
rocksdb_max_background_jobs 2
rocksdb_max_log_file_size 0
rocksdb_max_manifest_file_size 18446744073709551615
rocksdb_max_open_files -1
@ -948,11 +952,13 @@ rocksdb_print_snapshot_conflict_queries OFF
rocksdb_rate_limiter_bytes_per_sec 0
rocksdb_read_free_rpl_tables
rocksdb_records_in_range 50
rocksdb_reset_stats OFF
rocksdb_seconds_between_stat_computes 3600
rocksdb_signal_drop_index_thread OFF
rocksdb_skip_bloom_filter_on_read OFF
rocksdb_skip_fill_cache OFF
rocksdb_skip_unique_check_tables .*
rocksdb_sst_mgr_rate_bytes_per_sec 0
rocksdb_stats_dump_period_sec 600
rocksdb_store_row_debug_checksums OFF
rocksdb_strict_collation_check OFF
@ -962,9 +968,10 @@ rocksdb_table_stats_sampling_pct 10
rocksdb_tmpdir
rocksdb_trace_sst_api OFF
rocksdb_unsafe_for_binlog OFF
rocksdb_update_cf_options
rocksdb_use_adaptive_mutex OFF
rocksdb_use_direct_io_for_flush_and_compaction OFF
rocksdb_use_direct_reads OFF
rocksdb_use_direct_writes OFF
rocksdb_use_fsync OFF
rocksdb_validate_tables 1
rocksdb_verify_row_debug_checksums OFF
@ -974,6 +981,7 @@ rocksdb_wal_recovery_mode 1
rocksdb_wal_size_limit_mb 0
rocksdb_wal_ttl_seconds 0
rocksdb_whole_key_filtering ON
rocksdb_write_batch_max_bytes 0
rocksdb_write_disable_wal OFF
rocksdb_write_ignore_missing_column_families OFF
create table t47 (pk int primary key, col1 varchar(12)) engine=rocksdb;
@ -1332,7 +1340,7 @@ insert into t1 select (@a:=@a+1), 1234 from information_schema.session_variables
set @tmp1= @@rocksdb_max_row_locks;
set rocksdb_max_row_locks= 20;
update t1 set a=a+10;
ERROR HY000: Got error 197 'Number of locks held reached @@rocksdb_max_row_locks.' from ROCKSDB
ERROR HY000: Status error 10 received from RocksDB: Operation aborted: Failed to acquire lock due to max_num_locks limit
DROP TABLE t1;
#
# Test AUTO_INCREMENT behavior problem,
@ -1443,15 +1451,16 @@ Rocksdb_rows_inserted #
Rocksdb_rows_read #
Rocksdb_rows_updated #
Rocksdb_rows_deleted_blind #
rocksdb_rows_expired #
Rocksdb_system_rows_deleted #
Rocksdb_system_rows_inserted #
Rocksdb_system_rows_read #
Rocksdb_system_rows_updated #
Rocksdb_block_cache_add #
Rocksdb_block_cache_data_hit #
Rocksdb_block_cache_data_miss #
Rocksdb_block_cache_filter_hit #
Rocksdb_block_cache_filter_miss #
rocksdb_memtable_total #
rocksdb_memtable_unflushed #
rocksdb_queries_point #
rocksdb_queries_range #
Rocksdb_block_cache_hit #
Rocksdb_block_cache_index_hit #
Rocksdb_block_cache_index_miss #
@ -1477,9 +1486,6 @@ Rocksdb_memtable_hit #
Rocksdb_memtable_miss #
Rocksdb_no_file_closes #
Rocksdb_no_file_errors #
Rocksdb_no_file_opens #
Rocksdb_num_iterators #
Rocksdb_number_block_not_compressed #
Rocksdb_number_deletes_filtered #
Rocksdb_number_keys_read #
Rocksdb_number_keys_updated #
@ -1507,6 +1513,7 @@ Rocksdb_write_other #
Rocksdb_write_self #
Rocksdb_write_timedout #
Rocksdb_write_wal #
rocksdb_stall_micros #
select VARIABLE_NAME from INFORMATION_SCHEMA.global_status where VARIABLE_NAME LIKE 'rocksdb%';
VARIABLE_NAME
ROCKSDB_ROWS_DELETED
@ -1514,10 +1521,15 @@ ROCKSDB_ROWS_INSERTED
ROCKSDB_ROWS_READ
ROCKSDB_ROWS_UPDATED
ROCKSDB_ROWS_DELETED_BLIND
ROCKSDB_ROWS_EXPIRED
ROCKSDB_SYSTEM_ROWS_DELETED
ROCKSDB_SYSTEM_ROWS_INSERTED
ROCKSDB_SYSTEM_ROWS_READ
ROCKSDB_SYSTEM_ROWS_UPDATED
ROCKSDB_MEMTABLE_TOTAL
ROCKSDB_MEMTABLE_UNFLUSHED
ROCKSDB_QUERIES_POINT
ROCKSDB_QUERIES_RANGE
ROCKSDB_BLOCK_CACHE_ADD
ROCKSDB_BLOCK_CACHE_DATA_HIT
ROCKSDB_BLOCK_CACHE_DATA_MISS
@ -1541,9 +1553,6 @@ ROCKSDB_COMPACTION_KEY_DROP_OBSOLETE
ROCKSDB_COMPACTION_KEY_DROP_USER
ROCKSDB_FLUSH_WRITE_BYTES
ROCKSDB_GETUPDATESSINCE_CALLS
ROCKSDB_L0_NUM_FILES_STALL_MICROS
ROCKSDB_L0_SLOWDOWN_MICROS
ROCKSDB_MEMTABLE_COMPACTION_MICROS
ROCKSDB_MEMTABLE_HIT
ROCKSDB_MEMTABLE_MISS
ROCKSDB_NO_FILE_CLOSES
@ -1571,6 +1580,7 @@ ROCKSDB_NUMBER_SUPERVERSION_CLEANUPS
ROCKSDB_NUMBER_SUPERVERSION_RELEASES
ROCKSDB_RATE_LIMIT_DELAY_MILLIS
ROCKSDB_SNAPSHOT_CONFLICT_ERRORS
ROCKSDB_STALL_MICROS
ROCKSDB_WAL_BYTES
ROCKSDB_WAL_GROUP_SYNCS
ROCKSDB_WAL_SYNCED
@ -1587,10 +1597,15 @@ ROCKSDB_ROWS_INSERTED
ROCKSDB_ROWS_READ
ROCKSDB_ROWS_UPDATED
ROCKSDB_ROWS_DELETED_BLIND
ROCKSDB_ROWS_EXPIRED
ROCKSDB_SYSTEM_ROWS_DELETED
ROCKSDB_SYSTEM_ROWS_INSERTED
ROCKSDB_SYSTEM_ROWS_READ
ROCKSDB_SYSTEM_ROWS_UPDATED
ROCKSDB_MEMTABLE_TOTAL
ROCKSDB_MEMTABLE_UNFLUSHED
ROCKSDB_QUERIES_POINT
ROCKSDB_QUERIES_RANGE
ROCKSDB_BLOCK_CACHE_ADD
ROCKSDB_BLOCK_CACHE_DATA_HIT
ROCKSDB_BLOCK_CACHE_DATA_MISS
@ -1614,9 +1629,6 @@ ROCKSDB_COMPACTION_KEY_DROP_OBSOLETE
ROCKSDB_COMPACTION_KEY_DROP_USER
ROCKSDB_FLUSH_WRITE_BYTES
ROCKSDB_GETUPDATESSINCE_CALLS
ROCKSDB_L0_NUM_FILES_STALL_MICROS
ROCKSDB_L0_SLOWDOWN_MICROS
ROCKSDB_MEMTABLE_COMPACTION_MICROS
ROCKSDB_MEMTABLE_HIT
ROCKSDB_MEMTABLE_MISS
ROCKSDB_NO_FILE_CLOSES
@ -1644,6 +1656,7 @@ ROCKSDB_NUMBER_SUPERVERSION_CLEANUPS
ROCKSDB_NUMBER_SUPERVERSION_RELEASES
ROCKSDB_RATE_LIMIT_DELAY_MILLIS
ROCKSDB_SNAPSHOT_CONFLICT_ERRORS
ROCKSDB_STALL_MICROS
ROCKSDB_WAL_BYTES
ROCKSDB_WAL_GROUP_SYNCS
ROCKSDB_WAL_SYNCED
@ -1752,6 +1765,7 @@ INSERT INTO t1 SET id=123, blob_col='' ON DUPLICATE KEY UPDATE bl
DROP TABLE t1;
#
# Issue #17: Automatic per-index column families
# (Now deprecated)
#
create table t1 (
id int not null,
@ -1759,40 +1773,7 @@ key1 int,
PRIMARY KEY (id),
index (key1) comment '$per_index_cf'
) engine=rocksdb;
#Same CF ids with different CF flags
create table t1_err (
id int not null,
key1 int,
PRIMARY KEY (id),
index (key1) comment 'test.t1.key1'
) engine=rocksdb;
ERROR HY000: Column family ('test.t1.key1') flag (0) is different from an existing flag (2). Assign a new CF flag, or do not change existing CF flag.
create table t1_err (
id int not null,
key1 int,
PRIMARY KEY (id),
index (key1) comment 'test.t1.key2'
) engine=rocksdb;
drop table t1_err;
# Unfortunately there is no way to check which column family everything goes to
insert into t1 values (1,1);
select * from t1;
id key1
1 1
# Check that ALTER and RENAME are disallowed
alter table t1 add col2 int;
ERROR 42000: This version of MariaDB doesn't yet support 'ALTER TABLE on table with per-index CF'
rename table t1 to t2;
ERROR 42000: This version of MariaDB doesn't yet support 'ALTER TABLE on table with per-index CF'
drop table t1;
# Check detection of typos in $per_index_cf
create table t1 (
id int not null,
key1 int,
PRIMARY KEY (id),
index (key1) comment '$per_idnex_cf'
)engine=rocksdb;
ERROR 42000: This version of MariaDB doesn't yet support 'column family name looks like a typo of $per_index_cf.'
ERROR HY000: The per-index column family option has been deprecated
#
# Issue #22: SELECT ... FOR UPDATE takes a long time
#
@ -2268,6 +2249,7 @@ INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(1, 3);
SELECT * FROM t1;
id value
1 3
REPLACE INTO t1 VALUES(4, 4);
ERROR HY000: When unique checking is disabled in MyRocks, INSERT,UPDATE,LOAD statements with clauses that update or replace the key (i.e. INSERT ON DUPLICATE KEY UPDATE, REPLACE) are not allowed. Query: REPLACE INTO t1 VALUES(4, 4)
INSERT INTO t1 VALUES(5, 5) ON DUPLICATE KEY UPDATE value=value+1;

View File

@ -348,6 +348,9 @@ ALTER TABLE t2 ADD KEY (`col3`, `col4`) COMMENT 'custom_p5_cfname=another_cf_for
SELECT DISTINCT(cf_name) FROM information_schema.rocksdb_cfstats WHERE cf_name='another_cf_for_p5';
cf_name
another_cf_for_p5
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
EXPLAIN PARTITIONS SELECT * FROM t2 WHERE col3 = 0x4 AND col2 = 0x34567;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 custom_p2 ref col3 col3 258 const 1 Using where
@ -407,3 +410,14 @@ cf_name
notsharedcf
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
a INT NOT NULL,
PRIMARY KEY (a) COMMENT 'p1_cfname=foo;'
) ENGINE=ROCKSDB
PARTITION BY LIST COLUMNS(a)
(PARTITION p1 VALUES IN (1) ENGINE = ROCKSDB);
INSERT INTO t1 values (1);
TRUNCATE TABLE t1;
SELECT * FROM t1;
a
DROP TABLE t1;

View File

@ -240,12 +240,12 @@ A.a+10*B.a+100*C.a,
from t0 A, t0 B, t0 C;
set @count=0;
explain
select * from t1 where key1=1;
select * from t1 force index(key1) where key1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1 key1 9 const #
set @count_diff =(select (value - @count) from information_schema.rocksdb_perf_context
where table_schema=database() and table_name='t1' and stat_type='INTERNAL_KEY_SKIPPED_COUNT');
select * from t1 where key1=1;
select * from t1 force index(key1) where key1=1;
pk key1 col1
1 1 1234
set @count_diff =(select (value - @count) from information_schema.rocksdb_perf_context

View File

@ -57,7 +57,7 @@ UPDATE t1 SET value=30 WHERE id=3;
COMMIT;
connection con1;
SELECT * FROM t1 WHERE id=3 FOR UPDATE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction (snapshot conflict)
ROLLBACK;
disconnect con1;
connection default;

View File

@ -94,7 +94,7 @@ drop table t1, t2;
CREATE TABLE t1 (c1 INT NOT NULL, c2 CHAR(5)) PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t1 VALUES(1,'a');
RENAME TABLE t1 TO db3.t3;
ERROR HY000: Error on rename of './test/t1' to './db3/t3' (errno: 122 "Internal (unspecified) error in handler")
ERROR HY000: Error on rename of './test/t1' to './db3/t3' (errno: -1 "Internal error < 0 (Not system error)")
SELECT * FROM t1;
c1 c2
1 a

View File

@ -1,5 +1,6 @@
call mtr.add_suppression("Did not write failed ");
call mtr.add_suppression("Can't open and lock privilege tables");
call mtr.add_suppression("Attempt to delete the trigger file");
SET @ORIG_EVENT_SCHEDULER = @@EVENT_SCHEDULER;
CREATE TABLE mysql.user_temp LIKE mysql.user;
INSERT mysql.user_temp SELECT * FROM mysql.user;

View File

@ -7,14 +7,17 @@ CREATE TABLE t2 (j INT, PRIMARY KEY (j) COMMENT 'rev:cf_t2') ENGINE = ROCKSDB;
CREATE TABLE t3 (k INT, PRIMARY KEY (k) COMMENT 'cf_t1') ENGINE = ROCKSDB;
CREATE TABLE t4 (l INT, PRIMARY KEY (l) COMMENT 'cf_t4') ENGINE = ROCKSDB
PARTITION BY KEY(l) PARTITIONS 4;
SET GLOBAL rocksdb_force_flush_memtable_now=1;
SHOW ENGINE rocksdb STATUS;
Type Name Status
DBSTATS rocksdb #
CF_COMPACTION __system__ #
CF_COMPACTION cf_t1 #
CF_COMPACTION default #
CF_COMPACTION rev:cf_t2 #
Memory_Stats rocksdb #
STATISTICS # #
DBSTATS # #
CF_COMPACTION # #
CF_COMPACTION # #
CF_COMPACTION # #
CF_COMPACTION # #
MEMORY_STATS # #
BG_THREADS # #
INSERT INTO t1 VALUES (1), (2), (3);
SELECT COUNT(*) FROM t1;
COUNT(*)
@ -125,19 +128,30 @@ __system__ PREFIX_EXTRACTOR #
__system__ COMPACTION_STYLE #
__system__ COMPACTION_OPTIONS_UNIVERSAL #
__system__ COMPACTION_OPTION_FIFO::MAX_TABLE_FILES_SIZE #
__system__ BLOCK_BASED_TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
__system__ BLOCK_BASED_TABLE_FACTORY::INDEX_TYPE #
__system__ BLOCK_BASED_TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
__system__ BLOCK_BASED_TABLE_FACTORY::CHECKSUM #
__system__ BLOCK_BASED_TABLE_FACTORY::NO_BLOCK_CACHE #
__system__ BLOCK_BASED_TABLE_FACTORY::FILTER_POLICY #
__system__ BLOCK_BASED_TABLE_FACTORY::WHOLE_KEY_FILTERING #
__system__ BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE #
__system__ BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
__system__ BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE #
__system__ BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
__system__ BLOCK_BASED_TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
__system__ BLOCK_BASED_TABLE_FACTORY::FORMAT_VERSION #
__system__ TABLE_FACTORY::FLUSH_BLOCK_POLICY_FACTORY #
__system__ TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
__system__ TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS_WITH_HIGH_PRIORITY #
__system__ TABLE_FACTORY::PIN_L0_FILTER_AND_INDEX_BLOCKS_IN_CACHE #
__system__ TABLE_FACTORY::INDEX_TYPE #
__system__ TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
__system__ TABLE_FACTORY::CHECKSUM #
__system__ TABLE_FACTORY::NO_BLOCK_CACHE #
__system__ TABLE_FACTORY::BLOCK_CACHE #
__system__ TABLE_FACTORY::BLOCK_CACHE_NAME #
__system__ TABLE_FACTORY::BLOCK_CACHE_OPTIONS #
__system__ TABLE_FACTORY::CAPACITY #
__system__ TABLE_FACTORY::NUM_SHARD_BITS #
__system__ TABLE_FACTORY::STRICT_CAPACITY_LIMIT #
__system__ TABLE_FACTORY::HIGH_PRI_POOL_RATIO #
__system__ TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
__system__ TABLE_FACTORY::PERSISTENT_CACHE #
__system__ TABLE_FACTORY::BLOCK_SIZE #
__system__ TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
__system__ TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
__system__ TABLE_FACTORY::INDEX_BLOCK_RESTART_INTERVAL #
__system__ TABLE_FACTORY::FILTER_POLICY #
__system__ TABLE_FACTORY::WHOLE_KEY_FILTERING #
__system__ TABLE_FACTORY::FORMAT_VERSION #
cf_t1 COMPARATOR #
cf_t1 MERGE_OPERATOR #
cf_t1 COMPACTION_FILTER #
@ -179,19 +193,30 @@ cf_t1 PREFIX_EXTRACTOR #
cf_t1 COMPACTION_STYLE #
cf_t1 COMPACTION_OPTIONS_UNIVERSAL #
cf_t1 COMPACTION_OPTION_FIFO::MAX_TABLE_FILES_SIZE #
cf_t1 BLOCK_BASED_TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
cf_t1 BLOCK_BASED_TABLE_FACTORY::INDEX_TYPE #
cf_t1 BLOCK_BASED_TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
cf_t1 BLOCK_BASED_TABLE_FACTORY::CHECKSUM #
cf_t1 BLOCK_BASED_TABLE_FACTORY::NO_BLOCK_CACHE #
cf_t1 BLOCK_BASED_TABLE_FACTORY::FILTER_POLICY #
cf_t1 BLOCK_BASED_TABLE_FACTORY::WHOLE_KEY_FILTERING #
cf_t1 BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE #
cf_t1 BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
cf_t1 BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE #
cf_t1 BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
cf_t1 BLOCK_BASED_TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
cf_t1 BLOCK_BASED_TABLE_FACTORY::FORMAT_VERSION #
cf_t1 TABLE_FACTORY::FLUSH_BLOCK_POLICY_FACTORY #
cf_t1 TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
cf_t1 TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS_WITH_HIGH_PRIORITY #
cf_t1 TABLE_FACTORY::PIN_L0_FILTER_AND_INDEX_BLOCKS_IN_CACHE #
cf_t1 TABLE_FACTORY::INDEX_TYPE #
cf_t1 TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
cf_t1 TABLE_FACTORY::CHECKSUM #
cf_t1 TABLE_FACTORY::NO_BLOCK_CACHE #
cf_t1 TABLE_FACTORY::BLOCK_CACHE #
cf_t1 TABLE_FACTORY::BLOCK_CACHE_NAME #
cf_t1 TABLE_FACTORY::BLOCK_CACHE_OPTIONS #
cf_t1 TABLE_FACTORY::CAPACITY #
cf_t1 TABLE_FACTORY::NUM_SHARD_BITS #
cf_t1 TABLE_FACTORY::STRICT_CAPACITY_LIMIT #
cf_t1 TABLE_FACTORY::HIGH_PRI_POOL_RATIO #
cf_t1 TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
cf_t1 TABLE_FACTORY::PERSISTENT_CACHE #
cf_t1 TABLE_FACTORY::BLOCK_SIZE #
cf_t1 TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
cf_t1 TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
cf_t1 TABLE_FACTORY::INDEX_BLOCK_RESTART_INTERVAL #
cf_t1 TABLE_FACTORY::FILTER_POLICY #
cf_t1 TABLE_FACTORY::WHOLE_KEY_FILTERING #
cf_t1 TABLE_FACTORY::FORMAT_VERSION #
default COMPARATOR #
default MERGE_OPERATOR #
default COMPACTION_FILTER #
@ -233,19 +258,30 @@ default PREFIX_EXTRACTOR #
default COMPACTION_STYLE #
default COMPACTION_OPTIONS_UNIVERSAL #
default COMPACTION_OPTION_FIFO::MAX_TABLE_FILES_SIZE #
default BLOCK_BASED_TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
default BLOCK_BASED_TABLE_FACTORY::INDEX_TYPE #
default BLOCK_BASED_TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
default BLOCK_BASED_TABLE_FACTORY::CHECKSUM #
default BLOCK_BASED_TABLE_FACTORY::NO_BLOCK_CACHE #
default BLOCK_BASED_TABLE_FACTORY::FILTER_POLICY #
default BLOCK_BASED_TABLE_FACTORY::WHOLE_KEY_FILTERING #
default BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE #
default BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
default BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE #
default BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
default BLOCK_BASED_TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
default BLOCK_BASED_TABLE_FACTORY::FORMAT_VERSION #
default TABLE_FACTORY::FLUSH_BLOCK_POLICY_FACTORY #
default TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
default TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS_WITH_HIGH_PRIORITY #
default TABLE_FACTORY::PIN_L0_FILTER_AND_INDEX_BLOCKS_IN_CACHE #
default TABLE_FACTORY::INDEX_TYPE #
default TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
default TABLE_FACTORY::CHECKSUM #
default TABLE_FACTORY::NO_BLOCK_CACHE #
default TABLE_FACTORY::BLOCK_CACHE #
default TABLE_FACTORY::BLOCK_CACHE_NAME #
default TABLE_FACTORY::BLOCK_CACHE_OPTIONS #
default TABLE_FACTORY::CAPACITY #
default TABLE_FACTORY::NUM_SHARD_BITS #
default TABLE_FACTORY::STRICT_CAPACITY_LIMIT #
default TABLE_FACTORY::HIGH_PRI_POOL_RATIO #
default TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
default TABLE_FACTORY::PERSISTENT_CACHE #
default TABLE_FACTORY::BLOCK_SIZE #
default TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
default TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
default TABLE_FACTORY::INDEX_BLOCK_RESTART_INTERVAL #
default TABLE_FACTORY::FILTER_POLICY #
default TABLE_FACTORY::WHOLE_KEY_FILTERING #
default TABLE_FACTORY::FORMAT_VERSION #
rev:cf_t2 COMPARATOR #
rev:cf_t2 MERGE_OPERATOR #
rev:cf_t2 COMPACTION_FILTER #
@ -287,19 +323,30 @@ rev:cf_t2 PREFIX_EXTRACTOR #
rev:cf_t2 COMPACTION_STYLE #
rev:cf_t2 COMPACTION_OPTIONS_UNIVERSAL #
rev:cf_t2 COMPACTION_OPTION_FIFO::MAX_TABLE_FILES_SIZE #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::INDEX_TYPE #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::CHECKSUM #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::NO_BLOCK_CACHE #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::FILTER_POLICY #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::WHOLE_KEY_FILTERING #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
rev:cf_t2 BLOCK_BASED_TABLE_FACTORY::FORMAT_VERSION #
rev:cf_t2 TABLE_FACTORY::FLUSH_BLOCK_POLICY_FACTORY #
rev:cf_t2 TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS #
rev:cf_t2 TABLE_FACTORY::CACHE_INDEX_AND_FILTER_BLOCKS_WITH_HIGH_PRIORITY #
rev:cf_t2 TABLE_FACTORY::PIN_L0_FILTER_AND_INDEX_BLOCKS_IN_CACHE #
rev:cf_t2 TABLE_FACTORY::INDEX_TYPE #
rev:cf_t2 TABLE_FACTORY::HASH_INDEX_ALLOW_COLLISION #
rev:cf_t2 TABLE_FACTORY::CHECKSUM #
rev:cf_t2 TABLE_FACTORY::NO_BLOCK_CACHE #
rev:cf_t2 TABLE_FACTORY::BLOCK_CACHE #
rev:cf_t2 TABLE_FACTORY::BLOCK_CACHE_NAME #
rev:cf_t2 TABLE_FACTORY::BLOCK_CACHE_OPTIONS #
rev:cf_t2 TABLE_FACTORY::CAPACITY #
rev:cf_t2 TABLE_FACTORY::NUM_SHARD_BITS #
rev:cf_t2 TABLE_FACTORY::STRICT_CAPACITY_LIMIT #
rev:cf_t2 TABLE_FACTORY::HIGH_PRI_POOL_RATIO #
rev:cf_t2 TABLE_FACTORY::BLOCK_CACHE_COMPRESSED #
rev:cf_t2 TABLE_FACTORY::PERSISTENT_CACHE #
rev:cf_t2 TABLE_FACTORY::BLOCK_SIZE #
rev:cf_t2 TABLE_FACTORY::BLOCK_SIZE_DEVIATION #
rev:cf_t2 TABLE_FACTORY::BLOCK_RESTART_INTERVAL #
rev:cf_t2 TABLE_FACTORY::INDEX_BLOCK_RESTART_INTERVAL #
rev:cf_t2 TABLE_FACTORY::FILTER_POLICY #
rev:cf_t2 TABLE_FACTORY::WHOLE_KEY_FILTERING #
rev:cf_t2 TABLE_FACTORY::FORMAT_VERSION #
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
@ -336,6 +383,7 @@ LIST OF SNAPSHOTS FOR EACH SESSION:
MySQL thread id TID, OS thread handle PTR, query id QID localhost root ACTION
SHOW ENGINE rocksdb TRANSACTION STATUS
lock count 0, write count 0
insert count 0, update count 0, delete count 0
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================

View File

@ -63,4 +63,24 @@ true
select case when variable_value-@d < 10 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete';
case when variable_value-@d < 10 then 'true' else 'false' end
true
DROP TABLE t1, t2, t3, t4, t5;
CREATE TABLE t6 (
pk VARCHAR(64) COLLATE latin1_swedish_ci PRIMARY KEY
) ENGINE=RocksDB;
INSERT INTO t6 VALUES ('a');
SET GLOBAL rocksdb_force_flush_memtable_now=1;
SELECT * FROM t6;
pk
a
UPDATE t6 SET pk='A' WHERE pk='a';
SELECT * FROM t6;
pk
A
DELETE FROM t6 where pk='A';
SELECT should return nothing;
SELECT * FROM t6;
pk
SET GLOBAL rocksdb_force_flush_memtable_now=1;
SELECT should return nothing;
SELECT * FROM t6;
pk
DROP TABLE t1, t2, t3, t4, t5, t6;

View File

@ -3,14 +3,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 1296 Got error 200 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB
Warning 1296 Got error 198 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine ROCKSDB
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index';
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 1296 Got error 201 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB
Warning 1296 Got error 199 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine ROCKSDB
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id)

View File

@ -0,0 +1,491 @@
CREATE TABLE t1 (
`a` binary(8) NOT NULL,
`b` varbinary(64) NOT NULL,
`c` varbinary(256) NOT NULL,
`ts` bigint(20) UNSIGNED NOT NULL,
`value` mediumblob NOT NULL,
PRIMARY KEY (`b`,`a`,`c`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values ('a', 'b', 'c', UNIX_TIMESTAMP(), 'd');
INSERT INTO t1 values ('d', 'e', 'f', UNIX_TIMESTAMP(), 'g');
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int NOT NULL,
ts bigint(20) UNSIGNED NOT NULL,
c int NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, 3, UNIX_TIMESTAMP(), 5);
INSERT INTO t1 values (2, 4, UNIX_TIMESTAMP(), 6);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int NOT NULL,
c int NOT NULL,
ts bigint(20) UNSIGNED NOT NULL,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, 3, 5, UNIX_TIMESTAMP());
INSERT INTO t1 values (2, 4, 6, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int NOT NULL,
c int NOT NULL,
ts bigint(20) UNSIGNED NOT NULL,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, 3, 5, UNIX_TIMESTAMP());
INSERT INTO t1 values (2, 4, 6, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int,
c int,
ts bigint(20) UNSIGNED NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, NULL, NULL, UNIX_TIMESTAMP());
INSERT INTO t1 values (2, NULL, NULL, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
`a` binary(8) NOT NULL,
`b` varbinary(64),
`c` varbinary(256),
`ts` bigint(20) UNSIGNED NOT NULL,
`value` mediumblob NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values ('a', NULL, 'bc', UNIX_TIMESTAMP(), 'd');
INSERT INTO t1 values ('d', 'efghijk', NULL, UNIX_TIMESTAMP(), 'l');
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int NOT NULL,
c int NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, 3, 5);
INSERT INTO t1 values (2, 4, 6);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a int,
ts bigint(20) UNSIGNED NOT NULL,
PRIMARY KEY (a, ts)
) ENGINE=rocksdb
COMMENT='ttl_duration=5;ttl_col=ts;';
INSERT INTO t1 values (1, UNIX_TIMESTAMP());
INSERT INTO t1 values (2, UNIX_TIMESTAMP());
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_debug_ttl_snapshot_ts = -10;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_debug_ttl_snapshot_ts = 10;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
b int NOT NULL,
ts bigint(20) UNSIGNED NOT NULL,
c int NOT NULL,
PRIMARY KEY (a, ts)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1, 3, UNIX_TIMESTAMP(), 5);
INSERT INTO t1 values (2, 4, UNIX_TIMESTAMP(), 6);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
`a` binary(8) NOT NULL,
`b` varbinary(64),
`c` varbinary(256),
`ts` bigint(20) UNSIGNED NOT NULL,
`value` mediumblob NOT NULL,
PRIMARY KEY (`a`, `ts`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
COMMENT='ttl_duration=1;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values ('a', NULL, 'bc', UNIX_TIMESTAMP(), 'd');
INSERT INTO t1 values ('de', 'fghijk', NULL, UNIX_TIMESTAMP(), 'l');
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a INT NOT NULL,
b varbinary(64) NOT NULL,
c varbinary(256) NOT NULL,
ts bigint(20) UNSIGNED NOT NULL,
value mediumblob NOT NULL,
PRIMARY KEY (b,a,c)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
COMMENT='ttl_duration=10;ttl_col=ts;';
set global rocksdb_debug_ttl_rec_ts = -300;
INSERT INTO t1 values (1, 'b', 'c', UNIX_TIMESTAMP(), 'd');
INSERT INTO t1 values (2, 'e', 'f', UNIX_TIMESTAMP(), 'g');
set global rocksdb_debug_ttl_rec_ts = 300;
INSERT INTO t1 values (3, 'i', 'j', UNIX_TIMESTAMP(), 'k');
INSERT INTO t1 values (4, 'm', 'n', UNIX_TIMESTAMP(), 'o');
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_debug_ttl_snapshot_ts = -3600;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT a FROM t1;
a
1
2
3
4
set global rocksdb_compact_cf='default';
SELECT a FROM t1;
a
3
4
set global rocksdb_debug_ttl_snapshot_ts = 3600;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT a FROM t1;
a
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int NOT NULL,
c int NOT NULL,
ts bigint(20),
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
ERROR HY000: TTL column (ts) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration.
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int NOT NULL,
c int NOT NULL,
ts int,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=ts;';
ERROR HY000: TTL column (ts) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration.
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int NOT NULL,
c int NOT NULL,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=abc;';
ERROR HY000: TTL duration (abc) in MyRocks must be an unsigned non-null 64-bit integer.
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int NOT NULL,
c int NOT NULL,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;ttl_col=abc;';
ERROR HY000: TTL column (abc) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration.
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int NOT NULL,
c int NOT NULL,
PRIMARY KEY (a,c)
) ENGINE=rocksdb
COMMENT='ttl_col=abc;';
ERROR HY000: TTL column (abc) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration.
CREATE TABLE t1 (
a bigint(20) NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=500;';
INSERT INTO t1 values (1);
SELECT COUNT(*) FROM t1;
COUNT(*)
1
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
1
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=100;';
INSERT INTO t1 values (1);
SELECT * FROM t1;
a
1
set global rocksdb_debug_ttl_rec_ts = -300;
ALTER TABLE t1 COMMENT = 'ttl_duration=1';
set global rocksdb_debug_ttl_rec_ts = 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='ttl_duration=1'
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT
) ENGINE=rocksdb
COMMENT='ttl_duration=100;';
ALTER TABLE t1 DROP PRIMARY KEY;
ERROR HY000: TTL support is currently disabled when table has secondary indexes or hidden PK.
ALTER TABLE t1 ADD INDEX kb(b), ALGORITHM=INPLACE;
ERROR HY000: TTL support is currently disabled when table has secondary indexes or hidden PK.
DROP TABLE t1;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT
) ENGINE=rocksdb
COMMENT='ttl_duration=5;';
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,2);
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(b);
set global rocksdb_debug_ttl_snapshot_ts = -3600;
set global rocksdb_force_flush_memtable_now=1;
set @@global.rocksdb_compact_cf = 'default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
2
set global rocksdb_debug_ttl_snapshot_ts = 3600;
set @@global.rocksdb_compact_cf = 'default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) UNSIGNED NOT NULL,
b int,
PRIMARY KEY (a,b)
) ENGINE=rocksdb
COMMENT='asdadfasdfsadfadf ;ttl_duration=1; asfasdfasdfadfa';
INSERT INTO t1 values (UNIX_TIMESTAMP(), 1);
SELECT COUNT(*) FROM t1;
COUNT(*)
1
set global rocksdb_debug_ttl_snapshot_ts = 3600;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
ALTER TABLE t1 COMMENT = 'adsf;;ttl_duration=5;asfasdfa;ttl_col=a;asdfasdf;';
set global rocksdb_debug_ttl_rec_ts = 300;
INSERT INTO t1 values (UNIX_TIMESTAMP(), 2);
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT COUNT(*) FROM t1;
COUNT(*)
1
set global rocksdb_debug_ttl_snapshot_ts = 3600;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=5;';
set global rocksdb_debug_ttl_rec_ts = -300;
INSERT INTO t1 values (1);
INSERT INTO t1 values (3);
INSERT INTO t1 values (5);
set global rocksdb_debug_ttl_rec_ts = 300;
INSERT INTO t1 values (7);
INSERT INTO t1 values (9);
set global rocksdb_debug_ttl_rec_ts = 0;
UPDATE t1 SET a=a+1;
SELECT * FROM t1;
a
10
2
4
6
8
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT * FROM t1;
a
10
8
DROP TABLE t1;
CREATE TABLE t1 (
a INT,
b bigint(20) UNSIGNED NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=5;ttl_col=b;';
set global rocksdb_debug_ttl_rec_ts = -300;
INSERT INTO t1 values (1, UNIX_TIMESTAMP());
INSERT INTO t1 values (3, UNIX_TIMESTAMP());
INSERT INTO t1 values (5, UNIX_TIMESTAMP());
INSERT INTO t1 values (7, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 300;
UPDATE t1 SET b=UNIX_TIMESTAMP() WHERE a < 4;
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT a FROM t1;
a
1
3
5
7
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT a FROM t1;
a
1
3
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1);
INSERT INTO t1 values (2);
INSERT INTO t1 values (3);
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_enable_ttl=0;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired';
set global rocksdb_enable_ttl=1;
set global rocksdb_compact_cf='default';
select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired';
variable_value-@c
3
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
CREATE TABLE t1 (
a bigint(20) NOT NULL,
PRIMARY KEY (a)
) ENGINE=rocksdb
COMMENT='ttl_duration=100;';
INSERT INTO t1 values (1);
INSERT INTO t1 values (2);
INSERT INTO t1 values (3);
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired';
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired';
variable_value-@c
0
DROP TABLE t1;

View File

@ -0,0 +1,254 @@
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1);
INSERT INTO t1 values (2);
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_force_flush_memtable_now=1;
SELECT * FROM t1;
a
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired';
set global rocksdb_compact_cf='default';
select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired';
variable_value-@c
2
DROP TABLE t1;
CREATE TABLE t1 (
a int PRIMARY KEY,
b BIGINT UNSIGNED NOT NULL
) ENGINE=rocksdb
COMMENT='ttl_duration=10;';
set global rocksdb_debug_ttl_rec_ts = -300;
INSERT INTO t1 values (1, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 300;
INSERT INTO t1 values (2, UNIX_TIMESTAMP());
INSERT INTO t1 values (3, UNIX_TIMESTAMP());
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_force_flush_memtable_now=1;
SELECT a FROM t1;
a
2
3
set global rocksdb_compact_cf='default';
SELECT a FROM t1;
a
2
3
set global rocksdb_debug_ttl_read_filter_ts = -310;
SELECT a FROM t1;
a
set global rocksdb_debug_ttl_read_filter_ts = 0;
DROP TABLE t1;
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1);
INSERT INTO t1 values (3);
INSERT INTO t1 values (5);
INSERT INTO t1 values (7);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT * FROM t1;
a
set global rocksdb_enable_ttl_read_filtering=0;
SELECT * FROM t1;
a
1
3
5
7
set global rocksdb_enable_ttl_read_filtering=1;
SELECT * FROM t1;
a
DROP TABLE t1;
CREATE TABLE t1 (
a int,
b int,
c int,
PRIMARY KEY (a,b,c)
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (0,0,0);
INSERT INTO t1 values (0,0,1);
INSERT INTO t1 values (0,1,0);
INSERT INTO t1 values (0,1,1);
INSERT INTO t1 values (1,1,2);
INSERT INTO t1 values (1,2,1);
INSERT INTO t1 values (1,2,2);
INSERT INTO t1 values (1,2,3);
set global rocksdb_debug_ttl_rec_ts = 0;
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired';
set global rocksdb_force_flush_memtable_now=1;
SELECT * FROM t1 WHERE a=1 AND b=2 AND c=2;
a b c
SELECT * FROM t1 WHERE a = 1;
a b c
SELECT max(a) from t1 where a < 3;
max(a)
NULL
SELECT max(a) from t1 where a < 2 AND b = 1 AND c < 3;
max(a)
NULL
SELECT min(a) from t1 where a >= 1;
min(a)
NULL
SELECT min(a) from t1 where a > 1;
min(a)
NULL
select * from t1 where a=1 and b in (1) order by c desc;
a b c
select max(a) from t1 where a <=10;
max(a)
NULL
select a from t1 where a > 0 and a <= 2;
a
select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired';
variable_value-@c
0
set global rocksdb_compact_cf='default';
select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired';
variable_value-@c
8
DROP TABLE t1;
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=100;';
set global rocksdb_debug_ttl_rec_ts = -110;
INSERT INTO t1 values (1);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT * FROM t1;
a
INSERT INTO t1 values (1);
SELECT * FROM t1;
a
1
DROP TABLE t1;
set global rocksdb_force_flush_memtable_now=1;
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
set global rocksdb_debug_ttl_rec_ts = -100;
INSERT INTO t1 values (1);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT * FROM t1;
a
UPDATE t1 set a = 1;
DROP TABLE t1;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
CREATE TABLE t1 (
a int PRIMARY KEY,
b int
) ENGINE=rocksdb
COMMENT='ttl_duration=100;';
set global rocksdb_debug_ttl_rec_ts = -110;
INSERT INTO t1 values (1,1);
INSERT INTO t1 values (3,3);
set global rocksdb_debug_ttl_rec_ts = 0;
INSERT INTO t1 values (5,5);
UPDATE t1 set a = 1;
SELECT * FROM t1;
a b
1 5
set global rocksdb_enable_ttl_read_filtering=0;
SELECT * FROM t1;
a b
1 5
3 3
set global rocksdb_enable_ttl_read_filtering=1;
UPDATE t1 set a = 999 where a = 1;
SELECT * FROM t1;
a b
999 5
UPDATE t1 set a = a - 1;
SELECT * FROM t1;
a b
998 5
DROP TABLE t1;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=5;';
INSERT INTO t1 values (1);
connection con1;
# Creating Snapshot (start transaction)
BEGIN;
SELECT * FROM t1;
a
1
SELECT * FROM t1;
a
1
# Switching to connection 2
connection con2;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT * FROM t1;
a
# Switching to connection 1
connection con1;
SELECT * FROM t1;
a
1
UPDATE t1 set a = a + 1;
SELECT * FROM t1;
a
2
COMMIT;
SELECT * FROM t1;
a
DROP TABLE t1;
disconnect con1;
disconnect con2;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
CREATE TABLE t1 (
a int PRIMARY KEY
) ENGINE=rocksdb
COMMENT='ttl_duration=1;';
# On Connection 1
connection con1;
# Creating Snapshot (start transaction)
BEGIN;
SELECT * FROM t1;
a
# On Connection 2
connection con2;
set global rocksdb_debug_ttl_rec_ts = -2;
INSERT INTO t1 values (1);
INSERT INTO t1 values (3);
INSERT INTO t1 values (5);
INSERT INTO t1 values (7);
set global rocksdb_debug_ttl_rec_ts = 0;
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
# On Connection 1
connection con1;
SELECT * FROM t1;
a
# On Connection 2
connection con2;
SELECT * FROM t1;
a
set global rocksdb_enable_ttl_read_filtering=0;
SELECT * FROM t1;
a
1
3
5
7
set global rocksdb_enable_ttl_read_filtering=1;
disconnect con2;
disconnect con1;
connection default;
DROP TABLE t1;

View File

@ -0,0 +1,256 @@
CREATE TABLE t1 (
c1 INT,
PRIMARY KEY (`c1`)
) ENGINE=ROCKSDB
COMMENT="custom_p0_ttl_duration=1;"
PARTITION BY LIST(c1) (
PARTITION custom_p0 VALUES IN (1, 4, 7),
PARTITION custom_p1 VALUES IN (2, 5, 8),
PARTITION custom_p2 VALUES IN (3, 6, 9)
);
set global rocksdb_debug_ttl_rec_ts = -3600;
INSERT INTO t1 values (1);
INSERT INTO t1 values (2);
INSERT INTO t1 values (3);
INSERT INTO t1 values (4);
INSERT INTO t1 values (5);
INSERT INTO t1 values (6);
INSERT INTO t1 values (7);
INSERT INTO t1 values (8);
INSERT INTO t1 values (9);
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT * FROM t1;
c1
1
2
3
4
5
6
7
8
9
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT * FROM t1;
c1
2
3
5
6
8
9
DROP TABLE t1;
CREATE TABLE t1 (
c1 INT,
c2 INT,
name VARCHAR(25) NOT NULL,
PRIMARY KEY (`c1`, `c2`) COMMENT 'custom_p0_cfname=foo;custom_p1_cfname=my_custom_cf;custom_p2_cfname=baz'
) ENGINE=ROCKSDB
COMMENT="custom_p0_ttl_duration=1;custom_p1_ttl_duration=7;"
PARTITION BY LIST(c1) (
PARTITION custom_p0 VALUES IN (1, 4, 7),
PARTITION custom_p1 VALUES IN (2, 5, 8),
PARTITION custom_p2 VALUES IN (3, 6, 9)
);
set global rocksdb_debug_ttl_rec_ts = -1200;
INSERT INTO t1 values (1,1,'a');
INSERT INTO t1 values (4,4,'aaaa');
INSERT INTO t1 values (7,7,'aaaaaaa');
set global rocksdb_debug_ttl_rec_ts = 1200;
INSERT INTO t1 values (2,2,'aa');
INSERT INTO t1 values (3,3,'aaa');
INSERT INTO t1 values (5,5,'aaaaa');
INSERT INTO t1 values (6,6,'aaaaaa');
INSERT INTO t1 values (8,8,'aaaaaaaa');
INSERT INTO t1 values (9,9,'aaaaaaaaa');
set global rocksdb_debug_ttl_rec_ts = 0;
SELECT * FROM t1;
c1 c2 name
1 1 a
2 2 aa
3 3 aaa
4 4 aaaa
5 5 aaaaa
6 6 aaaaaa
7 7 aaaaaaa
8 8 aaaaaaaa
9 9 aaaaaaaaa
set global rocksdb_force_flush_memtable_now=1;
set @@global.rocksdb_compact_cf = 'foo';
set @@global.rocksdb_compact_cf = 'my_custom_cf';
SELECT * FROM t1;
c1 c2 name
2 2 aa
3 3 aaa
5 5 aaaaa
6 6 aaaaaa
8 8 aaaaaaaa
9 9 aaaaaaaaa
set global rocksdb_debug_ttl_snapshot_ts = 3600;
set @@global.rocksdb_compact_cf = 'foo';
SELECT * FROM t1;
c1 c2 name
2 2 aa
3 3 aaa
5 5 aaaaa
6 6 aaaaaa
8 8 aaaaaaaa
9 9 aaaaaaaaa
set @@global.rocksdb_compact_cf = 'my_custom_cf';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT * FROM t1;
c1 c2 name
3 3 aaa
6 6 aaaaaa
9 9 aaaaaaaaa
DROP TABLE t1;
CREATE TABLE t1 (
c1 INT,
c2 INT,
name VARCHAR(25) NOT NULL,
event DATE,
PRIMARY KEY (`c1`, `c2`) COMMENT 'custom_p0_cfname=foo;custom_p1_cfname=bar;custom_p2_cfname=baz;'
) ENGINE=ROCKSDB
COMMENT="custom_p0_ttl_duration=9999;custom_p2_ttl_duration=5;"
PARTITION BY LIST(c1) (
PARTITION custom_p0 VALUES IN (1, 2, 3),
PARTITION custom_p1 VALUES IN (4, 5, 6),
PARTITION custom_p2 VALUES IN (7, 8, 9)
);
INSERT INTO t1 VALUES (1, 1, "one", null);
INSERT INTO t1 VALUES (2, 2, "two", null);
INSERT INTO t1 VALUES (3, 3, "three", null);
INSERT INTO t1 VALUES (4, 4, "four", null);
INSERT INTO t1 VALUES (5, 5, "five", null);
INSERT INTO t1 VALUES (6, 6, "six", null);
INSERT INTO t1 VALUES (7, 7, "seven", null);
INSERT INTO t1 VALUES (8, 8, "eight", null);
INSERT INTO t1 VALUES (9, 9, "nine", null);
SELECT * FROM t1;
c1 c2 name event
1 1 one NULL
2 2 two NULL
3 3 three NULL
4 4 four NULL
5 5 five NULL
6 6 six NULL
7 7 seven NULL
8 8 eight NULL
9 9 nine NULL
set global rocksdb_debug_ttl_rec_ts = 600;
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(`c2`,`c1`) COMMENT 'custom_p0_cfname=foo;custom_p1_cfname=bar;custom_p2_cfname=baz;';
set global rocksdb_debug_ttl_rec_ts = 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
`name` varchar(25) NOT NULL,
`event` date DEFAULT NULL,
PRIMARY KEY (`c2`,`c1`) COMMENT 'custom_p0_cfname=foo;custom_p1_cfname=bar;custom_p2_cfname=baz;'
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='custom_p0_ttl_duration=9999;custom_p2_ttl_duration=5;'
PARTITION BY LIST (`c1`)
(PARTITION `custom_p0` VALUES IN (1,2,3) ENGINE = ROCKSDB,
PARTITION `custom_p1` VALUES IN (4,5,6) ENGINE = ROCKSDB,
PARTITION `custom_p2` VALUES IN (7,8,9) ENGINE = ROCKSDB)
set global rocksdb_debug_ttl_snapshot_ts = 100;
set global rocksdb_force_flush_memtable_now=1;
set @@global.rocksdb_compact_cf = 'baz';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT * FROM t1;
c1 c2 name event
1 1 one NULL
2 2 two NULL
3 3 three NULL
4 4 four NULL
5 5 five NULL
6 6 six NULL
7 7 seven NULL
8 8 eight NULL
9 9 nine NULL
set global rocksdb_debug_ttl_snapshot_ts = 1200;
set @@global.rocksdb_compact_cf = 'foo';
set @@global.rocksdb_compact_cf = 'baz';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT * FROM t1;
c1 c2 name event
1 1 one NULL
2 2 two NULL
3 3 three NULL
4 4 four NULL
5 5 five NULL
6 6 six NULL
DROP TABLE t1;
CREATE TABLE t1 (
c1 BIGINT,
c2 BIGINT UNSIGNED NOT NULL,
name VARCHAR(25) NOT NULL,
event DATE,
PRIMARY KEY (`c1`) COMMENT 'custom_p0_cfname=foo;custom_p1_cfname=bar;custom_p2_cfname=baz;'
) ENGINE=ROCKSDB
COMMENT="ttl_duration=1;custom_p1_ttl_duration=100;custom_p1_ttl_col=c2;custom_p2_ttl_duration=5000;"
PARTITION BY LIST(c1) (
PARTITION custom_p0 VALUES IN (1, 2, 3),
PARTITION custom_p1 VALUES IN (4, 5, 6),
PARTITION custom_p2 VALUES IN (7, 8, 9)
);
set global rocksdb_debug_ttl_rec_ts = -300;
INSERT INTO t1 VALUES (1, UNIX_TIMESTAMP(), "one", null);
INSERT INTO t1 VALUES (2, UNIX_TIMESTAMP(), "two", null);
INSERT INTO t1 VALUES (3, UNIX_TIMESTAMP(), "three", null);
set global rocksdb_debug_ttl_rec_ts = 0;
INSERT INTO t1 VALUES (4, UNIX_TIMESTAMP(), "four", null);
INSERT INTO t1 VALUES (5, UNIX_TIMESTAMP(), "five", null);
INSERT INTO t1 VALUES (6, UNIX_TIMESTAMP(), "six", null);
INSERT INTO t1 VALUES (7, UNIX_TIMESTAMP(), "seven", null);
INSERT INTO t1 VALUES (8, UNIX_TIMESTAMP(), "eight", null);
INSERT INTO t1 VALUES (9, UNIX_TIMESTAMP(), "nine", null);
set global rocksdb_force_flush_memtable_now=1;
set @@global.rocksdb_compact_cf = 'foo';
set @@global.rocksdb_compact_cf = 'baz';
set @@global.rocksdb_compact_cf = 'bar';
SELECT c1 FROM t1;
c1
4
5
6
7
8
9
set global rocksdb_debug_ttl_snapshot_ts = 600;
set @@global.rocksdb_compact_cf = 'bar';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT c1 FROM t1;
c1
7
8
9
DROP TABLE t1;
CREATE TABLE t1 (
c1 BIGINT,
c2 BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`c1`, `c2`)
) ENGINE=ROCKSDB
COMMENT="ttl_duration=100;ttl_col=c2;"
PARTITION BY LIST(c1) (
PARTITION custom_p0 VALUES IN (1),
PARTITION custom_p1 VALUES IN (2),
PARTITION custom_p2 VALUES IN (3)
);
INSERT INTO t1 values (1, UNIX_TIMESTAMP());
INSERT INTO t1 values (2, UNIX_TIMESTAMP());
INSERT INTO t1 values (3, UNIX_TIMESTAMP());
set global rocksdb_force_flush_memtable_now=1;
set global rocksdb_compact_cf='default';
SELECT c1 FROM t1;
c1
1
2
3
set global rocksdb_debug_ttl_snapshot_ts = 300;
set global rocksdb_compact_cf='default';
set global rocksdb_debug_ttl_snapshot_ts = 0;
SELECT c1 FROM t1;
c1
DROP TABLE t1;

View File

@ -77,4 +77,39 @@ a
Africa,Europe,Asia
S.America,Europe
DROP TABLE t1;
CREATE TABLE t1 (
a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia'),
b SET('test1','test2','test3','test4','test5'),
c SET('01','22','23','33','34','39','40','44','50','63','64'),
pk SET('1','2','3','4','5','6','7','8','9') PRIMARY KEY,
UNIQUE INDEX b_a (b,a)
) ENGINE=rocksdb;
SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk A 1000 NULL NULL LSMTREE
t1 0 b_a 1 b A 500 NULL NULL YES LSMTREE
t1 0 b_a 2 a A 1000 NULL NULL YES LSMTREE
INSERT INTO t1 (a,b,c,pk) VALUES
('','test2,test3','01,34,44,23',1),
('',5,2,2),
('N.America,Asia','test4,test2','',3),
('Africa,Europe,Asia','test2,test3','01',4),
('Antarctica','test3','34,44',5),
('Asia','test5','50',6),
('Europe,S.America','test1,','39',7);
Warnings:
Warning 1265 Data truncated for column 'b' at row 7
EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using temporary; Using filesort
SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
a b
test1,test3
test2,test3
Africa,Europe,Asia test2,test3
Antarctica test3
Asia test5
N.America,Asia test2,test4
S.America,Europe test1
DROP TABLE t1;
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK;

View File

@ -190,6 +190,9 @@ insert into t1 values (0, 'ab', 'a-b');
insert into t1 values (1, 'a ', 'a-space');
insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1;
@ -203,10 +206,10 @@ a 61
ab 6162
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 # col1 col1 67 NULL # Using where; Using index
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
col1 hex(col1)
a 61202009
a 6120
@ -302,6 +305,9 @@ insert into t1 values (0, 'ab', 'a-b');
insert into t1 values (1, 'a ', 'a-space');
insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1;
@ -315,10 +321,10 @@ a 61
ab 6162
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 # col1 col1 195 NULL # Using where; Using index
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
col1 hex(col1)
a 61202009
a 6120
@ -414,6 +420,9 @@ insert into t1 values (0, 'ab', 'a-b');
insert into t1 values (1, 'a ', 'a-space');
insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1;
@ -427,10 +436,10 @@ a 0061
a 0061002000200009
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 # col1 col1 131 NULL # Using where
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
col1 hex(col1)
a 0061002000200009
a 00610020
@ -526,6 +535,9 @@ insert into t1 values (0, 'ab', 'a-b');
insert into t1 values (1, 'a ', 'a-space');
insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1;
@ -539,10 +551,10 @@ a 61
a 61202009
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 # col1 col1 259 NULL # Using where
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
col1 hex(col1)
a 61202009
a 6120
@ -638,6 +650,9 @@ insert into t1 values (0, 'ab', 'a-b');
insert into t1 values (1, 'a ', 'a-space');
insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1;
@ -651,10 +666,10 @@ a 0061
a 0061002000200009
# Must show 'using index' for latin1_bin and utf8_bin:
explain
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 # col1 col1 259 NULL # Using where
select col1, hex(col1) from t1 where col1 < 'b';
select col1, hex(col1) from t1 force index(col1) where col1 < 'b';
col1 hex(col1)
a 0061002000200009
a 00610020

View File

@ -0,0 +1,260 @@
CREATE TABLE t1(
vb VARBINARY(64) primary key
) ENGINE=rocksdb;
INSERT INTO t1 values(0x00);
INSERT INTO t1 values(0x0000);
INSERT INTO t1 values(0x0000000000000000);
INSERT INTO t1 values(0x000000);
INSERT INTO t1 values(0x000000000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x00000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x0000000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x00000000);
INSERT INTO t1 values(0x0000000000);
INSERT INTO t1 values(0x00000000000000000000);
INSERT INTO t1 values(0x000000000000);
INSERT INTO t1 values(0x00000000000000);
INSERT INTO t1 values(0x000000000000000000);
SELECT hex(vb) FROM t1;
hex(vb)
00
0000
000000
00000000
0000000000
000000000000
00000000000000
0000000000000000
000000000000000000
00000000000000000000
00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
BEGIN;
SELECT hex(vb) FROM t1 FOR UPDATE;
hex(vb)
00
0000
000000
00000000
0000000000
000000000000
00000000000000
0000000000000000
000000000000000000
00000000000000000000
00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
SELECT SUBSTRING(a.key,9) FROM information_schema.rocksdb_locks AS a ORDER BY a.key;
SUBSTRING(a.key,9)
000000000000000001
000000000000000002
000000000000000003
000000000000000004
000000000000000005
000000000000000006
000000000000000007
000000000000000008
000000000000000009000000000000000001
000000000000000009000000000000000002
000000000000000009000000000000000009000000000000000009000000000000000007
000000000000000009000000000000000009000000000000000009000000000000000008
000000000000000009000000000000000009000000000000000009000000000000000009000000000000000001
ROLLBACK;
DROP TABLE t1;
set session debug_dbug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
CREATE TABLE t1(
vb VARBINARY(64) primary key
) ENGINE=rocksdb;
set session debug_dbug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
INSERT INTO t1 values(0x00);
INSERT INTO t1 values(0x0000);
INSERT INTO t1 values(0x0000000000000000);
INSERT INTO t1 values(0x000000);
INSERT INTO t1 values(0x000000000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x00000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x0000000000000000000000000000000000000000000000000000000000000000);
INSERT INTO t1 values(0x00000000);
INSERT INTO t1 values(0x0000000000);
INSERT INTO t1 values(0x00000000000000000000);
INSERT INTO t1 values(0x000000000000);
INSERT INTO t1 values(0x00000000000000);
INSERT INTO t1 values(0x000000000000000000);
SELECT hex(vb) FROM t1;
hex(vb)
00
0000
000000
00000000
0000000000
000000000000
00000000000000
0000000000000000
000000000000000000
00000000000000000000
00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
BEGIN;
SELECT hex(vb) FROM t1 FOR UPDATE;
hex(vb)
00
0000
000000
00000000
0000000000
000000000000
00000000000000
0000000000000000
000000000000000000
00000000000000000000
00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
SELECT SUBSTRING(a.key,9) FROM information_schema.rocksdb_locks AS a ORDER BY a.key;
SUBSTRING(a.key,9)
0000000000000000f8
0000000000000000f9
0000000000000000fa
0000000000000000fb
0000000000000000fc
0000000000000000fd
0000000000000000fe
0000000000000000ff0000000000000000f7
0000000000000000ff0000000000000000f8
0000000000000000ff0000000000000000f9
0000000000000000ff0000000000000000ff0000000000000000ff0000000000000000fe
0000000000000000ff0000000000000000ff0000000000000000ff0000000000000000ff0000000000000000f7
0000000000000000ff0000000000000000ff0000000000000000ff0000000000000000ff0000000000000000f8
ROLLBACK;
DROP TABLE t1;
CREATE TABLE t1(
vc VARCHAR(64) collate 'binary' primary key
) ENGINE=rocksdb;
INSERT INTO t1 values('a');
INSERT INTO t1 values('aa');
INSERT INTO t1 values('aaaaaaaa');
INSERT INTO t1 values('aaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaa');
INSERT INTO t1 values('aaaaa');
INSERT INTO t1 values('aaaaaaaaaa');
INSERT INTO t1 values('aaaaaa');
INSERT INTO t1 values('aaaaaaa');
INSERT INTO t1 values('aaaaaaaaa');
SELECT * FROM t1;
vc
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
BEGIN;
SELECT * FROM t1 FOR UPDATE;
vc
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SELECT SUBSTRING(a.key,9) FROM information_schema.rocksdb_locks AS a ORDER BY a.key;
SUBSTRING(a.key,9)
610000000000000001
616100000000000002
616161000000000003
616161610000000004
616161616100000005
616161616161000006
616161616161610007
616161616161616108
616161616161616109610000000000000001
616161616161616109616100000000000002
616161616161616109616161616161616109616161616161616109616161616161610007
616161616161616109616161616161616109616161616161616109616161616161616108
616161616161616109616161616161616109616161616161616109616161616161616109610000000000000001
ROLLBACK;
DROP TABLE t1;
set session debug_dbug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
CREATE TABLE t1(
vc VARCHAR(64) collate 'binary' primary key
) ENGINE=rocksdb;
set session debug_dbug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
INSERT INTO t1 values('a');
INSERT INTO t1 values('aa');
INSERT INTO t1 values('aaaaaaaa');
INSERT INTO t1 values('aaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
INSERT INTO t1 values('aaaa');
INSERT INTO t1 values('aaaaa');
INSERT INTO t1 values('aaaaaaaaaa');
INSERT INTO t1 values('aaaaaa');
INSERT INTO t1 values('aaaaaaa');
INSERT INTO t1 values('aaaaaaaaa');
SELECT * FROM t1;
vc
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
BEGIN;
SELECT * FROM t1 FOR UPDATE;
vc
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SELECT SUBSTRING(a.key,9) FROM information_schema.rocksdb_locks AS a ORDER BY a.key;
SUBSTRING(a.key,9)
6100000000000000f8
6161000000000000f9
6161610000000000fa
6161616100000000fb
6161616161000000fc
6161616161610000fd
6161616161616100fe
6161616161616161ff0000000000000000f7
6161616161616161ff6100000000000000f8
6161616161616161ff6161000000000000f9
6161616161616161ff6161616161616161ff6161616161616161ff6161616161616100fe
6161616161616161ff6161616161616161ff6161616161616161ff6161616161616161ff0000000000000000f7
6161616161616161ff6161616161616161ff6161616161616161ff6161616161616161ff6100000000000000f8
ROLLBACK;
DROP TABLE t1;

View File

@ -1,8 +1,8 @@
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_ignore_missing_column_families=true;
create table aaa (id int primary key, i int) engine rocksdb;
set @save_rocksdb_flush_log_at_trx_commit= @@global.rocksdb_flush_log_at_trx_commit;
SET LOCAL rocksdb_flush_log_at_trx_commit=0;
set @save_rocksdb_flush_log_at_trx_commit=@@global.rocksdb_flush_log_at_trx_commit;
SET GLOBAL rocksdb_flush_log_at_trx_commit=0;
select variable_value into @a from information_schema.global_status where variable_name='rocksdb_wal_synced';
insert aaa(id, i) values(1,1);
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced';
@ -16,7 +16,7 @@ insert aaa(id, i) values(3,1);
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced';
variable_value-@a
0
SET LOCAL rocksdb_flush_log_at_trx_commit=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
insert aaa(id, i) values(4,1);
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced';
variable_value-@a
@ -29,12 +29,10 @@ insert aaa(id, i) values(6,1);
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced';
variable_value-@a
3
SET GLOBAL rocksdb_background_sync=on;
SET LOCAL rocksdb_flush_log_at_trx_commit=0;
SET GLOBAL rocksdb_flush_log_at_trx_commit=2;
insert aaa(id, i) values(7,1);
truncate table aaa;
drop table aaa;
SET GLOBAL rocksdb_flush_log_at_trx_commit=@save_rocksdb_flush_log_at_trx_commit;
set @@global.rocksdb_flush_log_at_trx_commit=@save_rocksdb_flush_log_at_trx_commit;
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_ignore_missing_column_families=false;
SET GLOBAL rocksdb_background_sync=off;

View File

@ -173,7 +173,7 @@ set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
set global rocksdb_strict_collation_check=1;
CREATE TABLE t1 (a INT, b TEXT);
--error 1105
--error ER_UNSUPPORTED_COLLATION
ALTER TABLE t1 ADD KEY kb(b(10));
ALTER TABLE t1 ADD PRIMARY KEY(a);
DROP TABLE t1;
@ -345,3 +345,48 @@ while ($i <= $max) {
#SHOW TABLE STATUS WHERE name LIKE 't1';
DROP TABLE t1;
# https://github.com/facebook/mysql-5.6/issues/602
# Add then drop same index should be optimized out.
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT,
c INT,
KEY kbc(b,c)) ENGINE = ROCKSDB;
INSERT INTO t1 (a,b,c) VALUES (1,1,1);
INSERT INTO t1 (a,b,c) VALUES (2,2,2);
INSERT INTO t1 (a,b,c) VALUES (3,3,3);
SHOW CREATE TABLE t1;
ALTER TABLE t1 DROP INDEX kbc, ADD INDEX kbc(b,c), ALGORITHM=INPLACE;
ALTER TABLE t1 DROP INDEX kbc;
DROP TABLE t1;
# Make sure changing key part prefix length causes index rebuild as well.
CREATE TABLE t1 (
a INT PRIMARY KEY,
b varchar(10),
index kb(b(5))
) ENGINE = ROCKSDB charset utf8 collate utf8_bin;
INSERT INTO t1 (a,b) VALUES (1,'1111122222');
INSERT INTO t1 (a,b) VALUES (2,'2222233333');
INSERT INTO t1 (a,b) VALUES (3,'3333344444');
--let $start_max_index_id = query_get_value(SELECT * from INFORMATION_SCHEMA.ROCKSDB_GLOBAL_INFO where type = 'MAX_INDEX_ID', VALUE, 1)
ALTER TABLE t1 DROP INDEX kb, ADD INDEX kb(b(8)), ALGORITHM=INPLACE;
SELECT * FROM t1 FORCE INDEX(kb);
--let $end_max_index_id = query_get_value(SELECT * from INFORMATION_SCHEMA.ROCKSDB_GLOBAL_INFO where type = 'MAX_INDEX_ID', VALUE, 1)
if ($end_max_index_id <= $start_max_index_id) {
echo Max index ID did not increase;
}
SHOW CREATE TABLE t1;
DROP TABLE t1;

View File

@ -72,11 +72,30 @@ INSERT INTO t1 (a, b) VALUES (1, 5);
INSERT INTO t1 (a, b) VALUES (2, 6);
INSERT INTO t1 (a, b) VALUES (3, 7);
# should fail, can't add unique index on table w/ no pk
--error 1105
# should succeed, we can add unique index on table w/ no pk
ALTER TABLE t1 ADD UNIQUE INDEX kb(b);
INSERT INTO t1 (a, b) VALUES (4, 8);
--error ER_DUP_ENTRY
INSERT INTO t1 (a, b) VALUES (5, 5);
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test changing key with same name and parts from not unique to unique, should
# fail.
CREATE TABLE t1 (
a INT PRIMARY KEY,
b INT,
c INT,
KEY kbc(b,c)) ENGINE = ROCKSDB;
INSERT INTO t1 (a,b,c) VALUES (1,1,1);
INSERT INTO t1 (a,b,c) VALUES (2,2,2);
INSERT INTO t1 (a,b,c) VALUES (3,2,2);
# should cause error here, duplicate value 2-2
--error 1062
ALTER TABLE t1 DROP INDEX kbc, ADD UNIQUE INDEX kbc(b,c), ALGORITHM=INPLACE;
DROP TABLE t1;

View File

@ -71,9 +71,16 @@ CHECK TABLE t1 CHANGED;
DROP TABLE t1, t2;
# test disabling unique keys
--error 1105
# test unique keys with no primary key
CREATE TABLE t1 (a INT, b CHAR(8), UNIQUE INDEX(a)) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
--error ER_DUP_ENTRY
INSERT INTO t1 (a,b) VALUES (1,'c');
SELECT * FROM t1;
SELECT * FROM t1 WHERE a = 2;
EXPLAIN SELECT * FROM t1 WHERE a = 2;
DROP TABLE t1;
## test restarting a table that has no data
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=rocksdb;

View File

@ -1,2 +1,2 @@
--rocksdb_default_cf_options=write_buffer_size=256k;block_based_table_factory={filter_policy=bloomfilter:10:false;whole_key_filtering=0;};prefix_extractor=capped:20
--rocksdb_override_cf_options=cf_short_prefix={prefix_extractor=capped:4};cf_long_prefix={prefix_extractor=capped:240}
--rocksdb_override_cf_options=cf_short_prefix={prefix_extractor=capped:4};rev:cf_short_prefix={prefix_extractor=capped:4};cf_long_prefix={prefix_extractor=capped:240};rev:cf_long_prefix={prefix_extractor=capped:240}

View File

@ -23,12 +23,20 @@ DELIMITER ;//
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
--let $CF=COMMENT 'rev:cf_short_prefix'
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
#BF is most of the time invoked and useful
--let $CF=COMMENT 'cf_long_prefix'
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
--let $CF=COMMENT 'rev:cf_long_prefix'
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
# BUG: Prev() with prefix lookup should not use prefix bloom filter
create table r1 (id1 bigint, id2 bigint, id3 bigint, v1 int, v2 text, primary key (id1, id2, id3)) engine=rocksdb DEFAULT CHARSET=latin1 collate latin1_bin;
--disable_query_log

Some files were not shown because too many files have changed in this diff Show More