Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mysql-5.6][PR] Range Locking support, MyRocks part, updated #1430

Open
wants to merge 1 commit into
base: fb-mysql-8.0.23
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -1995,6 +1995,9 @@ The following options may be given as the first argument:
INFORMATION_SCHEMA.ROCKSDB_COMPACTION_HISTORY table.
--rocksdb-max-latest-deadlocks=#
Maximum number of recent deadlocks to store
--rocksdb-max-lock-memory=#
Range-locking mode: Maximum amount of memory that locks
from all transactions can use at a time
--rocksdb-max-log-file-size=#
DBOptions::max_log_file_size for RocksDB
--rocksdb-max-manifest-file-size=#
Expand Down Expand Up @@ -2207,6 +2210,10 @@ The following options may be given as the first argument:
--rocksdb-use-direct-reads
DBOptions::use_direct_reads for RocksDB
--rocksdb-use-fsync DBOptions::use_fsync for RocksDB
--rocksdb-use-range-lock-manager-as-point
Use Range Lock Manager as point
--rocksdb-use-range-locking
Use Range Locking
--rocksdb-validate-tables=#
Verify all DD tables match all RocksDB tables (0 means no
verification, 1 means verify and fail on error, and 2
Expand Down Expand Up @@ -3351,6 +3358,7 @@ rocksdb-max-background-jobs 2
rocksdb-max-bottom-pri-background-compactions 0
rocksdb-max-compaction-history 64
rocksdb-max-latest-deadlocks 5
rocksdb-max-lock-memory 1073741824
rocksdb-max-log-file-size 0
rocksdb-max-manifest-file-size 1073741824
rocksdb-max-manual-compactions 10
Expand Down Expand Up @@ -3424,6 +3432,8 @@ rocksdb-use-default-sk-cf FALSE
rocksdb-use-direct-io-for-flush-and-compaction FALSE
rocksdb-use-direct-reads FALSE
rocksdb-use-fsync FALSE
rocksdb-use-range-lock-manager-as-point FALSE
rocksdb-use-range-locking FALSE
rocksdb-validate-tables 1
rocksdb-verify-row-debug-checksums FALSE
rocksdb-wal-bytes-per-sync 0
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/rocksdb/combinations
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ rocksdb_write_batch_flush_threshold=1
[write_committed_with_delete_range]
rocksdb_write_policy=write_committed
rocksdb_enable_delete_range_for_drop_index = ON

[range_locking]
rocksdb_use_range_locking=1
3 changes: 3 additions & 0 deletions mysql-test/suite/rocksdb/include/have_range_locking.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (`select count(*) = 0 from performance_schema.session_variables where variable_name = 'rocksdb_use_range_locking' and variable_value = 'ON';`) {
--skip Test requires range locking
}
5 changes: 5 additions & 0 deletions mysql-test/suite/rocksdb/include/not_range_locking.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--let $_use_range_locking= `select @@rocksdb_use_range_locking`
if ($_use_range_locking == 1)
{
--skip Test doesn't support range locking
}
99 changes: 99 additions & 0 deletions mysql-test/suite/rocksdb/include/select_from_is_rowlocks.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
--echo # select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
#
# An include to print contents of I_S.ROCKSB_LOCKS
#
# Implicit "parameters"
# - Currently it prints locks on t1.PRIMARY
#
# Explicit "parameter" variables:
# - $TRX1_ID - print this transaction as "TRX1"
# - $TRX2_ID - print this transaction as "TRX2"
#
# - $select_from_is_rowlocks_current_trx_only
# - $order_by_rowkey
#
# - $SECOND_INDEX_NAME

--disable_query_log
set @cf_id=(select column_family from information_schema.rocksdb_ddl
where table_name='t1' and index_name='PRIMARY');
set @rtrx_id=(select transaction_id from information_schema.rocksdb_trx
where thread_id=connection_id());
set @indexnr= (select lower(lpad(hex(index_number),8,'0')) from information_schema.rocksdb_ddl
where table_name='t1' and index_name='PRIMARY');

set @indexnr_next= (select lower(lpad(hex(index_number+1),8,'0'))
from information_schema.rocksdb_ddl
where table_name='t1' and index_name='PRIMARY');

let $extra_where = where 1;

if ($select_from_is_rowlocks_current_trx_only)
{
let $extra_where = where transaction_id=(select transaction_id from information_schema.rocksdb_trx where connection_id()=thread_id);
}

## transaction column

# If TRX1_ID is not specified, get the current transaction:
let $transaction_col= replace(transaction_id, @rtrx_id, "\$trx_id");
if ($TRX1_ID)
{
let $transaction_col = replace(transaction_id, '$TRX1_ID', "\$TRX1_ID");
}

if ($TRX2_ID)
{
let $transaction_col = replace($transaction_col, '$TRX2_ID', "\$TRX2_ID");
}

## CF_ID column
let $cf_id_col= column_family_id;

if ($SECOND_INDEX_NAME)
{
eval set @cf2_id=(select column_family from information_schema.rocksdb_ddl
where table_name='t1' and index_name='$SECOND_INDEX_NAME');

let $cf_id_col= replace($cf_id_col, @cf2_id, "\$cf2_id");
}
let $cf_id_col= replace($cf_id_col, @cf_id, "\$cf_id");

## KEY column
let $key_col= (`key`);
if ($SECOND_INDEX_NAME)
{
eval set @indexnr2= (select lower(lpad(hex(index_number),8,'0'))
from information_schema.rocksdb_ddl
where table_name='t1' and index_name='$SECOND_INDEX_NAME');

eval set @indexnr2_next= (select lower(lpad(hex(index_number+1),8,'0'))
from information_schema.rocksdb_ddl
where table_name='t1' and index_name='$SECOND_INDEX_NAME');

let $key_col = replace($key_col, @indexnr2, '\${indexnr2}');
let $key_col = replace($key_col, @indexnr2_next, '\${indexnr2+1}');
}

let $key_col = replace($key_col, @indexnr, '\${indexnr}');
let $key_col = replace($key_col, @indexnr_next, '\${indexnr+1}');

## ORDER BY
if ($order_by_rowkey)
{
let $extra_order_by = ORDER BY 3,2;
}

if (!$order_by_rowkey)
{
--sorted_result
}

eval select
$cf_id_col as COLUMN_FAMILY_ID,
$transaction_col as TRANSACTION_ID,
$key_col as `KEY`,
mode
from information_schema.rocksdb_locks $extra_where $extra_order_by;

--enable_query_log
Loading