Commit ba3209e2 authored by Sergei Petrunia's avatar Sergei Petrunia

Merge mergetrees/merge-myrocks into bb-10.2-mariarocks-merge

Upstream cset we are merging from:

    commit 184a4a2d82f4f6f3cbcb1015bcdb32bebe73315c
    Author: Abhinav Sharma <abhinavsharma@fb.com>
    Date:   Thu Sep 14 11:40:08 2017 -0700

        Bump rocksdb submodule

        Summary:
        Bump rocksdb to include the fix for rocksdb.trx_info_rpl

Lots of conflicts, got the code to compile but tests are likely to
be broken
parents 5ccaabe9 3fae64b1
...@@ -7455,3 +7455,64 @@ ER_SLAVE_SAME_ID ...@@ -7455,3 +7455,64 @@ ER_SLAVE_SAME_ID
eng "A slave with the same server_uuid/server_id as this slave has connected to the master" eng "A slave with the same server_uuid/server_id as this slave has connected to the master"
ER_FLASHBACK_NOT_SUPPORTED ER_FLASHBACK_NOT_SUPPORTED
eng "Flashback does not support %s %s" eng "Flashback does not support %s %s"
ER_ROLLBACK_ONLY
eng "This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction."
ER_ROLLBACK_TO_SAVEPOINT
eng "MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows."
ER_KEYS_OUT_OF_ORDER
eng "Keys are out order during bulk load"
ER_OVERLAPPING_KEYS
eng "Bulk load rows overlap existing rows"
ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT
eng "Only REPEATABLE READ isolation level is supported for START TRANSACTION WITH CONSISTENT SNAPSHOT in RocksDB Storage Engine."
ER_CF_DIFFERENT
eng "Column family ('%s') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag."
ER_RDB_TTL_DURATION_FORMAT
eng "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer."
ER_RDB_STATUS_GENERAL
eng "Status error %d received from RocksDB: %s"
ER_RDB_STATUS_MSG
eng "%s, Status error %d received from RocksDB: %s"
ER_RDB_TTL_UNSUPPORTED
eng "TTL support is currently disabled when table has a hidden PK."
ER_RDB_TTL_COL_FORMAT
eng "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration."
ER_PER_INDEX_CF_DEPRECATED
eng "The per-index column family option has been deprecated"
ER_UNSUPPORTED_COLLATION
eng "Unsupported collation on string indexed column %s.%s Use binary collation (%s)."
ER_METADATA_INCONSISTENCY
eng "Table '%s' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if '%s.frm' exists, and try to restore it if it does not exist."
ER_ISOLATION_MODE_NOT_SUPPORTED
eng "MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level %s"
ER_REQUIRE_ROW_BINLOG_FORMAT
eng "Can't execute updates on master with binlog_format != ROW."
ER_ON_DUPLICATE_DISABLED
eng "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: %s"
ER_UPDATES_WITH_CONSISTENT_SNAPSHOT
eng "Can't execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT."
ER_KEY_CREATE_DURING_ALTER
eng "MyRocks failed creating new key definitions during alter."
ER_SK_POPULATE_DURING_ALTER
eng "MyRocks failed populating secondary key during alter."
...@@ -16,6 +16,12 @@ IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile") ...@@ -16,6 +16,12 @@ IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile")
SKIP_ROCKSDB_PLUGIN("Missing Makefile in rocksdb directory. Try \"git submodule update\".") SKIP_ROCKSDB_PLUGIN("Missing Makefile in rocksdb directory. Try \"git submodule update\".")
ENDIF() 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 # We've had our builders hang during the build process. This prevents MariaRocks
# to be built on 32 bit intel OS kernels. # to be built on 32 bit intel OS kernels.
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86")
...@@ -84,6 +90,9 @@ SET(ROCKSDB_SE_SOURCES ...@@ -84,6 +90,9 @@ SET(ROCKSDB_SE_SOURCES
rdb_psi.cc rdb_psi.cc
) )
# This is a strong requirement coming from RocksDB. No conditional checks here.
ADD_DEFINITIONS(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX
)
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} STORAGE_ENGINE MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_rocksdb MODULE_OUTPUT_NAME ha_rocksdb
COMPONENT rocksdb-engine) COMPONENT rocksdb-engine)
...@@ -93,12 +102,32 @@ IF(NOT TARGET rocksdb) ...@@ -93,12 +102,32 @@ IF(NOT TARGET rocksdb)
RETURN() RETURN()
ENDIF() ENDIF()
# MARIAROCKS-TODO: ??? IF(UNIX)
CHECK_FUNCTION_EXISTS(fallocate HAVE_FALLOCATE) IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(HAVE_FALLOCATE) ADD_DEFINITIONS(-DOS_LINUX)
CHECK_INCLUDE_FILES(linux/falloc.h HAVE_LINUX_FALLOC_H)
CHECK_FUNCTION_EXISTS(fallocate HAVE_FALLOCATE)
IF(HAVE_FALLOCATE AND HAVE_LINUX_FALLOC_H)
ADD_DEFINITIONS(-DROCKSDB_FALLOCATE_PRESENT) ADD_DEFINITIONS(-DROCKSDB_FALLOCATE_PRESENT)
ENDIF()
ENDIF()
ENDIF() 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) INCLUDE(build_rocksdb.cmake)
ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
...@@ -147,6 +176,12 @@ IF(HAVE_SCHED_GETCPU) ...@@ -147,6 +176,12 @@ IF(HAVE_SCHED_GETCPU)
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1) ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
ENDIF() ENDIF()
IF (NOT "$ENV{WITH_TBB}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs}
$ENV{WITH_TBB}/libtbb${PIC_EXT}.a)
ADD_DEFINITIONS(-DTBB)
ENDIF()
# #
# MariaDB: Dynamic plugin build is not suitable with unittest ATM # MariaDB: Dynamic plugin build is not suitable with unittest ATM
# #
...@@ -154,6 +189,15 @@ ENDIF() ...@@ -154,6 +189,15 @@ ENDIF()
# ADD_SUBDIRECTORY(unittest) # ADD_SUBDIRECTORY(unittest)
#ENDIF() #ENDIF()
CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H)
IF (HAVE_ZLIB_H)
ADD_DEFINITIONS(-DZLIB)
SET(rocksdb_static_libs ${rocksdb_static_libs} ${ZLIB_LIBRARY})
ENDIF()
SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt")
ADD_LIBRARY(rocksdb_tools STATIC ADD_LIBRARY(rocksdb_tools STATIC
rocksdb/tools/ldb_tool.cc rocksdb/tools/ldb_tool.cc
rocksdb/tools/ldb_cmd.cc rocksdb/tools/ldb_cmd.cc
......
== Summary == == 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 == == Resources ==
See https://github.com/facebook/mysql-5.6/wiki/Getting-Started-with-MyRocks https://github.com/facebook/mysql-5.6/wiki/Getting-Started-with-MyRocks
Facebook group: https://www.facebook.com/groups/mysqlonrocksdb/ https://www.facebook.com/groups/MyRocks/
== Coding Conventions == == 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. http://dev.mysql.com/doc/internals/en/coding-guidelines.html.
Several refinements: Several refinements:
...@@ -34,5 +42,9 @@ Several refinements: ...@@ -34,5 +42,9 @@ Several refinements:
"_vect" for a std::vector etc. "_vect" for a std::vector etc.
== Running Tests == == Running Tests ==
To run tests from rocksdb, rocksd_rpl or rocksdb_sys_vars packages, use the following parameters: To run tests from rocksdb, rocksdb_rpl or other rocksdb_* packages, use the
--mysqld=--default-storage-engine=rocksdb --mysqld=--skip-innodb --mysqld=--default-tmp-storage-engine=MyISAM --mysqld=--rocksdb following parameters:
\ No newline at end of file --default-storage-engine=rocksdb
--skip-innodb
--default-tmp-storage-engine=MyISAM
--rocksdb
...@@ -143,7 +143,8 @@ set(LIBS ${ROCKSDB_LIBS} ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) ...@@ -143,7 +143,8 @@ set(LIBS ${ROCKSDB_LIBS} ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
# Main library source code # Main library source code
set(ROCKSDB_SOURCES set(ROCKSDB_SOURCES
db/auto_roll_logger.cc cache/lru_cache.cc
cache/sharded_cache.cc
db/builder.cc db/builder.cc
db/c.cc db/c.cc
db/column_family.cc db/column_family.cc
...@@ -152,19 +153,23 @@ set(ROCKSDB_SOURCES ...@@ -152,19 +153,23 @@ set(ROCKSDB_SOURCES
db/compaction_iterator.cc db/compaction_iterator.cc
db/compaction_job.cc db/compaction_job.cc
db/compaction_picker.cc db/compaction_picker.cc
db/compaction_picker_universal.cc
db/convenience.cc db/convenience.cc
db/dbformat.cc
db/db_filesnapshot.cc db/db_filesnapshot.cc
db/db_impl.cc db/db_impl.cc
db/db_impl_compaction_flush.cc
db/db_impl_debug.cc db/db_impl_debug.cc
db/db_impl_experimental.cc db/db_impl_experimental.cc
db/db_impl_files.cc
db/db_impl_open.cc
db/db_impl_readonly.cc db/db_impl_readonly.cc
db/db_impl_write.cc
db/db_info_dumper.cc db/db_info_dumper.cc
db/db_iter.cc db/db_iter.cc
db/dbformat.cc
db/event_helpers.cc db/event_helpers.cc
db/external_sst_file_ingestion_job.cc
db/experimental.cc db/experimental.cc
db/filename.cc db/external_sst_file_ingestion_job.cc
db/file_indexer.cc db/file_indexer.cc
db/flush_job.cc db/flush_job.cc
db/flush_scheduler.cc db/flush_scheduler.cc
...@@ -172,9 +177,9 @@ set(ROCKSDB_SOURCES ...@@ -172,9 +177,9 @@ set(ROCKSDB_SOURCES
db/internal_stats.cc db/internal_stats.cc
db/log_reader.cc db/log_reader.cc
db/log_writer.cc db/log_writer.cc
db/malloc_stats.cc
db/managed_iterator.cc db/managed_iterator.cc
db/memtable.cc db/memtable.cc
db/memtable_allocator.cc
db/memtable_list.cc db/memtable_list.cc
db/merge_helper.cc db/merge_helper.cc
db/merge_operator.cc db/merge_operator.cc
...@@ -192,11 +197,39 @@ set(ROCKSDB_SOURCES ...@@ -192,11 +197,39 @@ set(ROCKSDB_SOURCES
db/write_batch_base.cc db/write_batch_base.cc
db/write_controller.cc db/write_controller.cc
db/write_thread.cc db/write_thread.cc
env/env.cc
env/env_chroot.cc
env/env_hdfs.cc
env/mock_env.cc
memtable/alloc_tracker.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_cuckoo_rep.cc memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc memtable/hash_linklist_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/hash_skiplist_rep.cc memtable/hash_skiplist_rep.cc
memtable/skiplistrep.cc memtable/skiplistrep.cc
memtable/skiplistrep.cc
memtable/vectorrep.cc
memtable/vectorrep.cc memtable/vectorrep.cc
memtable/write_buffer_manager.cc
monitoring/histogram.cc
monitoring/histogram_windowing.cc
monitoring/instrumented_mutex.cc
monitoring/iostats_context.cc
monitoring/perf_context.cc
monitoring/perf_level.cc
monitoring/statistics.cc
monitoring/thread_status_impl.cc
monitoring/thread_status_updater.cc
monitoring/thread_status_util.cc
monitoring/thread_status_util_debug.cc
options/cf_options.cc
options/db_options.cc
options/options.cc
options/options_helper.cc
options/options_parser.cc
options/options_sanity_check.cc
port/stack_trace.cc port/stack_trace.cc
table/adaptive_table_factory.cc table/adaptive_table_factory.cc
table/block.cc table/block.cc
...@@ -214,65 +247,47 @@ set(ROCKSDB_SOURCES ...@@ -214,65 +247,47 @@ set(ROCKSDB_SOURCES
table/format.cc table/format.cc
table/full_filter_block.cc table/full_filter_block.cc
table/get_context.cc table/get_context.cc
table/index_builder.cc
table/iterator.cc table/iterator.cc
table/merging_iterator.cc table/merging_iterator.cc
table/sst_file_writer.cc
table/meta_blocks.cc table/meta_blocks.cc
table/partitioned_filter_block.cc
table/persistent_cache_helper.cc
table/plain_table_builder.cc table/plain_table_builder.cc
table/plain_table_factory.cc table/plain_table_factory.cc
table/plain_table_index.cc table/plain_table_index.cc
table/plain_table_key_coding.cc table/plain_table_key_coding.cc
table/plain_table_reader.cc table/plain_table_reader.cc
table/persistent_cache_helper.cc table/sst_file_writer.cc
table/table_properties.cc table/table_properties.cc
table/two_level_iterator.cc table/two_level_iterator.cc
tools/sst_dump_tool.cc
tools/db_bench_tool.cc tools/db_bench_tool.cc
tools/dump/db_dump_tool.cc tools/dump/db_dump_tool.cc
tools/ldb_cmd.cc
tools/ldb_tool.cc
tools/sst_dump_tool.cc
util/arena.cc util/arena.cc
util/auto_roll_logger.cc
util/bloom.cc util/bloom.cc
util/cf_options.cc
util/clock_cache.cc
util/coding.cc util/coding.cc
util/compaction_job_stats_impl.cc util/compaction_job_stats_impl.cc
util/comparator.cc util/comparator.cc
util/concurrent_arena.cc util/concurrent_arena.cc
util/crc32c.cc util/crc32c.cc
util/db_options.cc
util/delete_scheduler.cc util/delete_scheduler.cc
util/dynamic_bloom.cc util/dynamic_bloom.cc
util/env.cc
util/env_chroot.cc
util/env_hdfs.cc
util/event_logger.cc util/event_logger.cc
util/file_util.cc
util/file_reader_writer.cc util/file_reader_writer.cc
util/sst_file_manager_impl.cc util/file_util.cc
util/filename.cc
util/filter_policy.cc util/filter_policy.cc
util/hash.cc util/hash.cc
util/histogram.cc
util/histogram_windowing.cc
util/instrumented_mutex.cc
util/iostats_context.cc
util/lru_cache.cc
tools/ldb_cmd.cc
tools/ldb_tool.cc
util/logging.cc
util/log_buffer.cc util/log_buffer.cc
util/memenv.cc
util/murmurhash.cc util/murmurhash.cc
util/options.cc
util/options_helper.cc
util/options_parser.cc
util/options_sanity_check.cc
util/perf_context.cc
util/perf_level.cc
util/random.cc util/random.cc
util/rate_limiter.cc util/rate_limiter.cc
util/sharded_cache.cc
util/slice.cc util/slice.cc
util/statistics.cc util/sst_file_manager_impl.cc
util/status.cc util/status.cc
util/status_message.cc util/status_message.cc
util/string_util.cc util/string_util.cc
...@@ -280,17 +295,17 @@ set(ROCKSDB_SOURCES ...@@ -280,17 +295,17 @@ set(ROCKSDB_SOURCES
util/testutil.cc util/testutil.cc
util/thread_local.cc util/thread_local.cc
util/threadpool_imp.cc util/threadpool_imp.cc
util/thread_status_impl.cc
util/thread_status_updater.cc
util/thread_status_util.cc
util/thread_status_util_debug.cc
util/transaction_test_util.cc util/transaction_test_util.cc
util/xxhash.cc util/xxhash.cc
utilities/backupable/backupable_db.cc utilities/backupable/backupable_db.cc
utilities/blob_db/blob_db.cc utilities/blob_db/blob_db.cc
utilities/checkpoint/checkpoint.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/compaction_filters/remove_emptyvalue_compactionfilter.cc
utilities/date_tiered/date_tiered_db_impl.cc utilities/date_tiered/date_tiered_db_impl.cc
utilities/debug.cc
utilities/document/document_db.cc utilities/document/document_db.cc
utilities/document/json_document.cc utilities/document/json_document.cc
utilities/document/json_document_builder.cc utilities/document/json_document_builder.cc
...@@ -299,10 +314,10 @@ set(ROCKSDB_SOURCES ...@@ -299,10 +314,10 @@ set(ROCKSDB_SOURCES
utilities/leveldb_options/leveldb_options.cc utilities/leveldb_options/leveldb_options.cc
utilities/lua/rocks_lua_compaction_filter.cc utilities/lua/rocks_lua_compaction_filter.cc
utilities/memory/memory_util.cc utilities/memory/memory_util.cc
utilities/merge_operators/max.cc
utilities/merge_operators/put.cc
utilities/merge_operators/string_append/stringappend.cc utilities/merge_operators/string_append/stringappend.cc
utilities/merge_operators/string_append/stringappend2.cc utilities/merge_operators/string_append/stringappend2.cc
utilities/merge_operators/put.cc
utilities/merge_operators/max.cc
utilities/merge_operators/uint64add.cc utilities/merge_operators/uint64add.cc
utilities/option_change_migration/option_change_migration.cc utilities/option_change_migration/option_change_migration.cc
utilities/options/options_util.cc utilities/options/options_util.cc
...@@ -315,20 +330,15 @@ set(ROCKSDB_SOURCES ...@@ -315,20 +330,15 @@ set(ROCKSDB_SOURCES
utilities/simulator_cache/sim_cache.cc utilities/simulator_cache/sim_cache.cc
utilities/spatialdb/spatial_db.cc utilities/spatialdb/spatial_db.cc
utilities/table_properties_collectors/compact_on_deletion_collector.cc utilities/table_properties_collectors/compact_on_deletion_collector.cc
utilities/transactions/optimistic_transaction_impl.cc
utilities/transactions/optimistic_transaction_db_impl.cc utilities/transactions/optimistic_transaction_db_impl.cc
utilities/transactions/pessimistic_transaction_db.cc
utilities/transactions/transaction_base.cc utilities/transactions/transaction_base.cc
utilities/transactions/transaction_impl.cc
utilities/transactions/transaction_db_impl.cc
utilities/transactions/transaction_db_mutex_impl.cc utilities/transactions/transaction_db_mutex_impl.cc
utilities/transactions/transaction_lock_mgr.cc utilities/transactions/transaction_lock_mgr.cc
utilities/transactions/transaction_util.cc utilities/transactions/transaction_util.cc
utilities/ttl/db_ttl_impl.cc utilities/ttl/db_ttl_impl.cc
utilities/write_batch_with_index/write_batch_with_index.cc utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc utilities/write_batch_with_index/write_batch_with_index_internal.cc
utilities/col_buf_encoder.cc
utilities/col_buf_decoder.cc
utilities/column_aware_encoding_util.cc
) )
if(WIN32) if(WIN32)
...@@ -343,8 +353,8 @@ if(WIN32) ...@@ -343,8 +353,8 @@ if(WIN32)
else() else()
list(APPEND ROCKSDB_SOURCES list(APPEND ROCKSDB_SOURCES
port/port_posix.cc port/port_posix.cc
util/env_posix.cc env/env_posix.cc
util/io_posix.cc) env/io_posix.cc)
endif() endif()
SET(SOURCES) SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES}) FOREACH(s ${ROCKSDB_SOURCES})
...@@ -364,3 +374,4 @@ target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) ...@@ -364,3 +374,4 @@ target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -frtti") set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -frtti")
endif() endif()
This diff is collapsed.
This diff is collapsed.
...@@ -70,7 +70,19 @@ rocksdb::TransactionDB *rdb_get_rocksdb_db(); ...@@ -70,7 +70,19 @@ rocksdb::TransactionDB *rdb_get_rocksdb_db();
class Rdb_cf_manager; class Rdb_cf_manager;
Rdb_cf_manager &rdb_get_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();
bool rdb_dbug_set_ttl_ignore_pk();
#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; class Rdb_dict_manager;
Rdb_dict_manager *rdb_get_dict_manager(void) Rdb_dict_manager *rdb_get_dict_manager(void)
...@@ -83,5 +95,4 @@ Rdb_ddl_manager *rdb_get_ddl_manager(void) ...@@ -83,5 +95,4 @@ Rdb_ddl_manager *rdb_get_ddl_manager(void)
class Rdb_binlog_manager; class Rdb_binlog_manager;
Rdb_binlog_manager *rdb_get_binlog_manager(void) Rdb_binlog_manager *rdb_get_binlog_manager(void)
MY_ATTRIBUTE((__warn_unused_result__)); MY_ATTRIBUTE((__warn_unused_result__));
} // namespace myrocks } // namespace myrocks
#
# A helper include file for prefix index index-only query tests
#
# Parameters:
# $prefix_index_check_title - title of the test
# $prefix_index_check_query - test query
# $prefix_index_check_read_avoided_delta - expected change of
# 'rocksdb_covered_secondary_key_lookups' status variable
# value after running the query
--let $show_count_statement = show status like 'rocksdb_covered_secondary_key_lookups'
--echo # $prefix_index_check_title
--let $base_count = query_get_value($show_count_statement, Value, 1)
--eval $prefix_index_check_query
--let $count = query_get_value($show_count_statement, Value, 1)
--let $assert_text= $prefix_index_check_title: $prefix_index_check_read_avoided_delta rocksdb_covered_secondary_key_lookups
--let $assert_cond= $count - $base_count = $prefix_index_check_read_avoided_delta
--source include/assert.inc
...@@ -10,8 +10,11 @@ explicit-defaults-for-timestamp=1 ...@@ -10,8 +10,11 @@ explicit-defaults-for-timestamp=1
loose-rocksdb_lock_wait_timeout=1 loose-rocksdb_lock_wait_timeout=1
loose-rocksdb_strict_collation_check=0 loose-rocksdb_strict_collation_check=0
# MariaDB: speed up the tests:
loose-rocksdb-flush-log-at-trx-commit=0 loose-rocksdb-flush-log-at-trx-commit=0
loose-rocksdb_force_compute_memtable_stats_cachetime=0
# The following is to get rid of the harmless # The following is to get rid of the harmless
# "Deadlock found when trying to get lock" errors, see MDEV-12285. # "Deadlock found when trying to get lock" errors, see MDEV-12285.
log-warnings=1 log-warnings=1
...@@ -4,20 +4,20 @@ CREATE DATABASE mysqlslap; ...@@ -4,20 +4,20 @@ CREATE DATABASE mysqlslap;
USE mysqlslap; USE mysqlslap;
CREATE TABLE t1(id BIGINT AUTO_INCREMENT, value BIGINT, PRIMARY KEY(id)) ENGINE=rocksdb; CREATE TABLE t1(id BIGINT AUTO_INCREMENT, value BIGINT, PRIMARY KEY(id)) ENGINE=rocksdb;
# 2PC enabled, MyRocks durability enabled # 2PC enabled, MyRocks durability enabled
SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_enable_2pc=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
## 2PC + durability + single thread ## 2PC + durability + single thread
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
select case when variable_value-@c = 1000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select case when variable_value-@c = 1000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
case when variable_value-@c = 1000 then 'true' else 'false' end case when variable_value-@c = 1000 then 'true' else 'false' end
false true
## 2PC + durability + group commit ## 2PC + durability + group commit
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
select case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end
false true
# 2PC enabled, MyRocks durability disabled # 2PC enabled, MyRocks durability disabled
SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_enable_2pc=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=0; SET GLOBAL rocksdb_flush_log_at_trx_commit=0;
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
...@@ -28,16 +28,16 @@ select case when variable_value-@c = 0 then 'true' else 'false' end from informa ...@@ -28,16 +28,16 @@ select case when variable_value-@c = 0 then 'true' else 'false' end from informa
case when variable_value-@c = 0 then 'true' else 'false' end case when variable_value-@c = 0 then 'true' else 'false' end
true true
# 2PC disabled, MyRocks durability enabled # 2PC disabled, MyRocks durability enabled
SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_enable_2pc=0;
SET GLOBAL rocksdb_flush_log_at_trx_commit=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
case when variable_value-@c = 0 then 'true' else 'false' end case when variable_value-@c = 0 then 'true' else 'false' end
false true
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs'; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
case when variable_value-@c = 0 then 'true' else 'false' end case when variable_value-@c = 0 then 'true' else 'false' end
false true
SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_enable_2pc=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -289,12 +289,16 @@ set global rocksdb_bulk_load=1; ...@@ -289,12 +289,16 @@ set global rocksdb_bulk_load=1;
connect con1,localhost,root,,; connect con1,localhost,root,,;
# Switch to connection con1 # Switch to connection con1
connection con1; connection con1;
show global variables like 'rocksdb_bulk_load'; show global variables like 'rocksdb_bulk_load%';
Variable_name Value Variable_name Value
rocksdb_bulk_load ON rocksdb_bulk_load ON
show session variables like 'rocksdb_bulk_load'; rocksdb_bulk_load_allow_unsorted OFF
rocksdb_bulk_load_size 1000
show session variables like 'rocksdb_bulk_load%';
Variable_name Value Variable_name Value
rocksdb_bulk_load ON rocksdb_bulk_load ON
rocksdb_bulk_load_allow_unsorted OFF
rocksdb_bulk_load_size 1000
CREATE TABLE t1 (i INT, j INT, PRIMARY KEY (i)) ENGINE = ROCKSDB; CREATE TABLE t1 (i INT, j INT, PRIMARY KEY (i)) ENGINE = ROCKSDB;
INSERT INTO t1 VALUES (1,1); INSERT INTO t1 VALUES (1,1);
# Disconnecting on con1 # Disconnecting on con1
...@@ -341,10 +345,11 @@ SET @prior_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check; ...@@ -341,10 +345,11 @@ SET @prior_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
SET @prior_rocksdb_merge_buf_size = @@rocksdb_merge_buf_size; SET @prior_rocksdb_merge_buf_size = @@rocksdb_merge_buf_size;
SET global rocksdb_strict_collation_check = off; SET global rocksdb_strict_collation_check = off;
SET session rocksdb_merge_combine_read_size = 566; SET session rocksdb_merge_combine_read_size = 566;
SET session rocksdb_merge_buf_size = 336; SET session rocksdb_merge_buf_size = 340;
show variables like '%rocksdb_bulk_load%'; show variables like 'rocksdb_bulk_load%';
Variable_name Value Variable_name Value
rocksdb_bulk_load OFF rocksdb_bulk_load OFF
rocksdb_bulk_load_allow_unsorted OFF
rocksdb_bulk_load_size 1000 rocksdb_bulk_load_size 1000
CREATE TABLE t1 (a VARCHAR(80)) ENGINE=RocksDB; CREATE TABLE t1 (a VARCHAR(80)) ENGINE=RocksDB;
INSERT INTO t1 (a) VALUES (REPEAT("a", 80)); INSERT INTO t1 (a) VALUES (REPEAT("a", 80));
...@@ -408,3 +413,46 @@ select 1300 < 1300 * 1.5 as "same"; ...@@ -408,3 +413,46 @@ select 1300 < 1300 * 1.5 as "same";
same same
1 1
DROP TABLE t1; 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;
...@@ -79,11 +79,25 @@ INSERT INTO t1 (a, b) VALUES (1, 5); ...@@ -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 (2, 6);
INSERT INTO t1 (a, b) VALUES (3, 7); INSERT INTO t1 (a, b) VALUES (3, 7);
ALTER TABLE t1 ADD UNIQUE INDEX kb(b); 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; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL,
UNIQUE KEY `kb` (`b`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 ) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
DROP TABLE t1; 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;
...@@ -229,7 +229,20 @@ Table Op Msg_type Msg_text ...@@ -229,7 +229,20 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b CHAR(8), UNIQUE INDEX(a)) ENGINE=rocksdb; 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 NULL
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=rocksdb; CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=rocksdb;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
......
DROP TABLE IF EXISTS t1, t2, t3; 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'; Data will be ordered in ascending order
CREATE TABLE t2(pk CHAR(5) PRIMARY KEY, a char(30), b char(30), key(a)) COLLATE 'latin1_bin'; CREATE TABLE t1(
CREATE TABLE t3(pk CHAR(5) PRIMARY KEY, a char(30), b char(30), key(a)) COLLATE 'latin1_bin' pk CHAR(5),
PARTITION BY KEY() PARTITIONS 4; a CHAR(30),
connect other,localhost,root,,; 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;
connect other,localhost,root,,
set session transaction isolation level repeatable read; set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS'; select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE STAT_TYPE VALUE
......
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);
SET rocksdb_bulk_load=0;
ERROR HY000: Lost connection to MySQL server during query
TRUNCATE TABLE t1;
SET rocksdb_bulk_load_allow_unsorted=1;
SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES(100);
INSERT INTO t1 VALUES(101);
INSERT INTO t1 VALUES(99);
SET rocksdb_bulk_load=0;
SELECT * FROM t1;
pk
99
100
101
TRUNCATE TABLE t1;
SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES(201);
INSERT INTO t1 VALUES(200);
INSERT INTO t1 VALUES(202);
INSERT INTO t1 VALUES(201);
ERROR 23000: Failed to insert the record: the key already exists
SET rocksdb_bulk_load=0;
SELECT * FROM t1;
pk
200
201
202
SET rocksdb_bulk_load_allow_unsorted=DEFAULT;
DROP TABLE t1;
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;
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;
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;
DROP TABLE IF EXISTS t1;
SET rocksdb_bulk_load_size=3;
SET rocksdb_bulk_load_allow_unsorted=1;
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1");
SET rocksdb_bulk_load=1;
SELECT * FROM t1;
a b
SET rocksdb_bulk_load=0;
SELECT * FROM t1;
a b
-3 5
-1 3
2 0
4 -2
6 -4
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1", KEY(b));
SET rocksdb_bulk_load=1;
SELECT * FROM t1;
a b
6 -4
4 -2
2 0
-1 3
-3 5
SET rocksdb_bulk_load=0;
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1");
CREATE TABLE t2(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1");
SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES (1,1);
INSERT INTO t2 VALUES (1,1);
SELECT * FROM t1;
a b
1 1
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t2;
a b
1 1
SELECT * FROM t1;
a b
1 1
SET rocksdb_bulk_load=0;
SELECT * FROM t1;
a b
1 1
2 2
DROP TABLE t1, t2;
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1");
CREATE TABLE t2(a INT, b INT, PRIMARY KEY(b) COMMENT "cf1");
CREATE TABLE t3(a INT, b INT, PRIMARY KEY(a) COMMENT "cf1")
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_swedish_ci NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci 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_swedish_ci NULL
t2 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 ROCKSDB 10 Fixed 5000000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
select count(a) from t1;
count(a)
5000000
select count(b) from t1;
count(b)
5000000
select count(a) from t2;
count(a)
5000000
select count(b) from t2;
count(b)
5000000
select count(a) from t3;
count(a)
5000000
select count(b) from t3;
count(b)
5000000
DROP TABLE t1, t2, t3;
SET rocksdb_bulk_load_allow_unsorted=0;
SET rocksdb_bulk_load=1;
SET rocksdb_bulk_load_allow_unsorted=1;
ERROR HY000: Error when executing command SET: Cannot change this setting while bulk load is enabled
SET rocksdb_bulk_load=0;
DROP TABLE IF EXISTS stats_test_table;
CREATE TABLE stats_test_table (a INT, b INT, PRIMARY KEY (a)) ENGINE=ROCKSDB;
SET GLOBAL rocksdb_perf_context_level=3;
INSERT INTO stats_test_table VALUES (7,1);
INSERT INTO stats_test_table VALUES (2,2);
SELECT io_write_bytes > 0 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME = "stats_test_table";
io_write_bytes > 0
1
DROP TABLE stats_test_table;
SET GLOBAL rocksdb_perf_context_level=DEFAULT;
...@@ -5,7 +5,7 @@ connection con1; ...@@ -5,7 +5,7 @@ connection con1;
CREATE TABLE t1 (a INT, pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=ROCKSDB; CREATE TABLE t1 (a INT, pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=ROCKSDB;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
connection con2; connection con2;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS'; select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE STAT_TYPE VALUE
...@@ -18,7 +18,7 @@ STAT_TYPE VALUE ...@@ -18,7 +18,7 @@ STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 0 DB_NUM_SNAPSHOTS 0
connection con1; connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
connection con2; connection con2;
INSERT INTO t1 (a) VALUES (1); INSERT INTO t1 (a) VALUES (1);
connection con1; connection con1;
...@@ -69,7 +69,7 @@ id value value2 ...@@ -69,7 +69,7 @@ id value value2
5 5 5 5 5 5
6 6 6 6 6 6
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
connection con2; connection con2;
INSERT INTO r1 values (7,7,7); INSERT INTO r1 values (7,7,7);
connection con1; connection con1;
...@@ -107,12 +107,12 @@ id value value2 ...@@ -107,12 +107,12 @@ id value value2
7 7 7 7 7 7
8 8 8 8 8 8
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
connection con2; connection con2;
INSERT INTO r1 values (9,9,9); INSERT INTO r1 values (9,9,9);
connection con1; connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
connection con2; connection con2;
INSERT INTO r1 values (10,10,10); INSERT INTO r1 values (10,10,10);
connection con1; connection con1;
...@@ -129,7 +129,7 @@ id value value2 ...@@ -129,7 +129,7 @@ id value value2
9 9 9 9 9 9
10 10 10 10 10 10
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 1105 ERROR: 12048
INSERT INTO r1 values (11,11,11); INSERT INTO r1 values (11,11,11);
ERROR: 0 ERROR: 0
SELECT * FROM r1; SELECT * FROM r1;
......
...@@ -125,7 +125,7 @@ id value value2 ...@@ -125,7 +125,7 @@ id value value2
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
ERROR: 0 ERROR: 0
INSERT INTO r1 values (11,11,11); INSERT INTO r1 values (11,11,11);
ERROR: 1105 ERROR: 12045
SELECT * FROM r1; SELECT * FROM r1;
id value value2 id value value2
1 1 1 1 1 1
......
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id INT,
fake_id INT,
bigfield VARCHAR(4096),
PRIMARY KEY (id),
KEY bf (bigfield(32)),
KEY fid (fake_id, bigfield(32))
) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1, 1001, REPEAT('a', 1)),
(8, 1008, REPEAT('b', 8)),
(24, 1024, REPEAT('c', 24)),
(31, 1031, REPEAT('d', 31)),
(32, 1032, REPEAT('x', 32)),
(33, 1033, REPEAT('y', 33)),
(128, 1128, REPEAT('z', 128));
SELECT * FROM t1;
id fake_id bigfield
1 1001 a
8 1008 bbbbbbbb
24 1024 cccccccccccccccccccccccc
31 1031 ddddddddddddddddddddddddddddddd
32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
128 1128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
# Eligible for optimization, access via fake_id only
SELECT id, bigfield FROM t1 FORCE INDEX(fid) WHERE fake_id = 1031;
id bigfield
31 ddddddddddddddddddddddddddddddd
include/assert.inc [Eligible for optimization, access via fake_id only: 2 rocksdb_covered_secondary_key_lookups]
# Not eligible for optimization, access via fake_id of big row.
SELECT id, bigfield FROM t1 FORCE INDEX(fid) WHERE fake_id = 1033;
id bigfield
33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
include/assert.inc [Not eligible for optimization, access via fake_id of big row.: 0 rocksdb_covered_secondary_key_lookups]
DROP TABLE t1;
set session debug= '+d,MYROCKS_NO_COVERED_BITMAP_FORMAT';
CREATE TABLE t1 (
id INT,
fake_id INT,
bigfield VARCHAR(4096),
PRIMARY KEY (id),
KEY bf (bigfield(32)),
KEY fid (fake_id, bigfield(32))
) ENGINE=rocksdb;
set session debug= '-d,MYROCKS_NO_COVERED_BITMAP_FORMAT';
INSERT INTO t1 VALUES (1, 1001, REPEAT('a', 1)),
(8, 1008, REPEAT('b', 8)),
(24, 1024, REPEAT('c', 24)),
(31, 1031, REPEAT('d', 31)),
(32, 1032, REPEAT('x', 32)),
(33, 1033, REPEAT('y', 33)),
(128, 1128, REPEAT('z', 128));
SELECT * FROM t1;
id fake_id bigfield
1 1001 a
8 1008 bbbbbbbb
24 1024 cccccccccccccccccccccccc
31 1031 ddddddddddddddddddddddddddddddd
32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
128 1128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
# No longer eligible for optimization since no covered bitmap was stored.
SELECT id, bigfield FROM t1 FORCE INDEX(fid) WHERE fake_id = 1031;
id bigfield
31 ddddddddddddddddddddddddddddddd
include/assert.inc [No longer eligible for optimization since no covered bitmap was stored.: 0 rocksdb_covered_secondary_key_lookups]
# Not eligible for optimization.
SELECT id, bigfield FROM t1 FORCE INDEX(fid) WHERE fake_id = 1033;
id bigfield
33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
include/assert.inc [Not eligible for optimization.: 0 rocksdb_covered_secondary_key_lookups]
DROP TABLE t1;
This diff is collapsed.
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;;
create table t (i int primary key) engine=rocksdb;
insert into t values (1), (2), (3);
begin;
select * from t where i=1 for update;
i
1
begin;
select * from t where i=2 for update;
i
2
select * from t where i=2 for update;
select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback;
i
2
rollback;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
row_lock_deadlocks
1
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
row_lock_deadlocks
1
begin;
select * from t where i=1 for update;
i
1
begin;
select * from t where i=2 for update;
i
2
select * from t where i=2 for update;
select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback;
i
2
rollback;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
row_lock_deadlocks
2
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
row_lock_deadlocks
2
set global rocksdb_lock_wait_timeout = @prior_lock_wait_timeout; set global rocksdb_deadlock_detect = @prior_deadlock_detect;;
drop table t;
This diff is collapsed.
...@@ -5,6 +5,9 @@ DROP TABLE IF EXISTS t2; ...@@ -5,6 +5,9 @@ DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3; DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4; DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5; DROP TABLE IF EXISTS t5;
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
call mtr.add_suppression("LibRocksDB");
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
...@@ -54,20 +57,4 @@ drop table t5; ...@@ -54,20 +57,4 @@ drop table t5;
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; 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; drop table t1;
...@@ -5,6 +5,8 @@ DROP TABLE IF EXISTS t2; ...@@ -5,6 +5,8 @@ DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3; DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4; DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5; DROP TABLE IF EXISTS t5;
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
...@@ -47,9 +49,15 @@ primary key (a,b) comment 'cf1', ...@@ -47,9 +49,15 @@ primary key (a,b) comment 'cf1',
key (b) comment 'rev:cf2' key (b) comment 'rev:cf2'
) ENGINE=RocksDB; ) ENGINE=RocksDB;
DELETE FROM t5; 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 t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
drop table t4; drop table t4;
drop table t5; drop table t5;
set @@global.rocksdb_compact_cf = 'cf1';
set @@global.rocksdb_compact_cf = 'rev:cf2';
set @@global.rocksdb_compact_cf = 'default';
Compacted Compacted
call mtr.add_suppression("Column family 'cf1' not found"); call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found"); call mtr.add_suppression("Column family 'rev:cf2' not found");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
......
...@@ -178,16 +178,20 @@ id1 id2 id3 ...@@ -178,16 +178,20 @@ id1 id2 id3
9 17 9 9 17 9
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
set global rocksdb_large_prefix=1;
CREATE TABLE t1 (id1 varchar(128) CHARACTER SET latin1 COLLATE latin1_bin, CREATE TABLE t1 (id1 varchar(128) CHARACTER SET latin1 COLLATE latin1_bin,
id2 varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, id2 varchar(256) CHARACTER SET utf8 COLLATE utf8_bin,
id3 varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci, id3 varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci,
PRIMARY KEY (id1, id2, id3), PRIMARY KEY (id1, id2, id3),
UNIQUE KEY (id3, id1)) ENGINE=ROCKSDB; UNIQUE KEY (id3, id1)) ENGINE=ROCKSDB;
set global rocksdb_large_prefix=DEFAULT;
set global rocksdb_large_prefix=1;
CREATE TABLE t2 (id1 varchar(128) CHARACTER SET latin1 COLLATE latin1_bin, CREATE TABLE t2 (id1 varchar(128) CHARACTER SET latin1 COLLATE latin1_bin,
id2 varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, id2 varchar(256) CHARACTER SET utf8 COLLATE utf8_bin,
id3 varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci, id3 varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci,
PRIMARY KEY (id1, id2, id3), PRIMARY KEY (id1, id2, id3),
UNIQUE KEY (id3, id1) COMMENT 'rev:cf') ENGINE=ROCKSDB; UNIQUE KEY (id3, id1) COMMENT 'rev:cf') ENGINE=ROCKSDB;
set global rocksdb_large_prefix=DEFAULT;
INSERT INTO t1 VALUES (1, 1, 1) ON DUPLICATE KEY UPDATE id2 = 9; INSERT INTO t1 VALUES (1, 1, 1) ON DUPLICATE KEY UPDATE id2 = 9;
SELECT * FROM t1 WHERE id1 = 1; SELECT * FROM t1 WHERE id1 = 1;
id1 id2 id3 id1 id2 id3
......
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (b INT PRIMARY KEY); CREATE TABLE t1 (b INT PRIMARY KEY);
CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, FOREIGN KEY (b) REFERENCES t1(b)); 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 MySQL doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
CREATE TABLE t2 (a INT NOT NULL, bforeign INT NOT NULL); CREATE TABLE t2 (a INT NOT NULL, bforeign INT NOT NULL);
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL, foreignkey INT NOT NULL); CREATE TABLE t2 (a INT NOT NULL, foreignkey INT NOT NULL);
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL, bforeign INT not null, FOREIGN KEY (bforeign) REFERENCES t1(b)); 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 MySQL doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL); CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL);
ALTER TABLE t2 ADD FOREIGN KEY (b) REFERENCES t1(b); 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 MySQL doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL); CREATE TABLE t2 (a INT NOT NULL);
ALTER TABLE t2 ADD bforeign INT NOT NULL; ALTER TABLE t2 ADD bforeign INT NOT NULL;
...@@ -20,6 +20,6 @@ ALTER TABLE t2 ADD foreignkey INT NOT NULL; ...@@ -20,6 +20,6 @@ ALTER TABLE t2 ADD foreignkey INT NOT NULL;
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (a INT NOT NULL); CREATE TABLE t2 (a INT NOT NULL);
ALTER TABLE t2 ADD bforeign INT NOT NULL, ADD FOREIGN KEY (bforeign) REFERENCES t1(b); 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 MySQL doesn't yet support 'FOREIGN KEY for the RocksDB storage engine'
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment