Skip to content

Commit

Permalink
PS-5577: Merge fb-prod201901 (8.0)
Browse files Browse the repository at this point in the history
1. Update rocksdb submodule to ab55c2591fae5630e9a7135aaf9bf3fd6fa97372

2. Cherry pick the following commits from `fb-prod201901`:
7fabe86 Updating RocksDB submodule
d6e1f00 Add rocksdb_rollback_on_timeout system variable to allow rollback transactions on timeouts
86a992e "Replace 'const T &' with 'const T' for primitive types"
a7271b7 "Add rocksdb_cache_dump option"
b939510 "Bug Fix: MyRocks locking scan with RC may not return full result sets (percona#916)"

3. Null cherry-picked upstream commits:
57975b5 Update rocksdb submodule to 5.18 latest @update-submodule: rocksdb
8e24353 myrocks_hotbackup+xbstream to support O_DIRECT
828629b [mysql-5.6][PR] issue-902 : Debug assertion 'max_val == std::numeric_limits<ulonglong… (percona#909)
6264a3e issue 900 : Segentation fault in myrocks::Rdb_string_reader::read (percona#910)
b3c2648 issue-896 : Segmentation fault in myrocks::Rdb_string_reader::read (percona#898)
274bad3 Fix assertion whitelist == nullptr for rocksdb_read_free_rpl_tables (percona#887)
04d444a issue-661 : rocksdb_sys_vars.rocksdb_update_cf_options_basic is unstable (percona#899)
b6b73e4 Temporary fix for mtr show_engine test
  • Loading branch information
inikep authored and oleksandr-kachan committed Jan 29, 2024
1 parent 220f60b commit e79bd6a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 55 deletions.
Expand Up @@ -17,11 +17,11 @@ let $comment="";
--source rocksdb_concurrent_delete.inc

let $order=ASC;
let $comment="rev:cf2";
let $comment="cfname=rev:cf2";
--source rocksdb_concurrent_delete.inc

let $order=DESC;
let $comment="rev:cf2";
let $comment="cfname=rev:cf2";
--source rocksdb_concurrent_delete.inc

let $index=PRIMARY;
Expand Down
19 changes: 11 additions & 8 deletions storage/rocksdb/ha_rocksdb.cc
Expand Up @@ -462,7 +462,7 @@ static const constexpr ulong RDB_DEADLOCK_DETECT_DEPTH = 50;
static long long rocksdb_block_cache_size = RDB_DEFAULT_BLOCK_CACHE_SIZE;
static long long rocksdb_sim_cache_size = 0;
static double rocksdb_cache_high_pri_pool_ratio = 0.0;
static my_bool rocksdb_cache_dump = FALSE;
static bool rocksdb_cache_dump = false;
/* Use unsigned long long instead of uint64_t because of MySQL compatibility */
static unsigned long long // NOLINT(runtime/int)
rocksdb_rate_limiter_bytes_per_sec = 0;
Expand Down Expand Up @@ -526,7 +526,7 @@ static uint32_t rocksdb_stats_recalc_rate = 0;
static bool rocksdb_no_create_column_family = false;
static uint32_t rocksdb_debug_manual_compaction_delay = 0;
static uint32_t rocksdb_max_manual_compactions = 0;
static my_bool rocksdb_rollback_on_timeout = FALSE;
static bool rocksdb_rollback_on_timeout = false;

std::atomic<uint64_t> rocksdb_row_lock_deadlocks(0);
std::atomic<uint64_t> rocksdb_row_lock_wait_timeouts(0);
Expand Down Expand Up @@ -1446,7 +1446,7 @@ static MYSQL_SYSVAR_BOOL(
rollback_on_timeout, rocksdb_rollback_on_timeout, PLUGIN_VAR_OPCMDARG,
"Whether to roll back the complete transaction or a single statement on "
"lock wait timeout (a single statement by default)",
NULL, NULL, FALSE);
NULL, NULL, false);

static MYSQL_SYSVAR_UINT(
debug_manual_compaction_delay, rocksdb_debug_manual_compaction_delay,
Expand Down Expand Up @@ -2041,7 +2041,8 @@ class Rdb_transaction {
convert_error_code_to_mysql() does: force a statement
rollback before returning HA_ERR_LOCK_WAIT_TIMEOUT:
*/
thd->mark_transaction_to_rollback(static_cast<bool>(rocksdb_rollback_on_timeout));
thd->mark_transaction_to_rollback(
static_cast<bool>(rocksdb_rollback_on_timeout));

rocksdb_row_lock_wait_timeouts++;

Expand Down Expand Up @@ -4488,7 +4489,8 @@ static int rocksdb_init_func(void *const p) {
}
std::shared_ptr<rocksdb::Cache> block_cache = rocksdb::NewLRUCache(
rocksdb_block_cache_size, -1 /*num_shard_bits*/,
false /*strict_capcity_limit*/, rocksdb_cache_high_pri_pool_ratio, memory_allocator);
false /*strict_capcity_limit*/, rocksdb_cache_high_pri_pool_ratio,
memory_allocator);
if (rocksdb_sim_cache_size > 0) {
// Simulated cache enabled
// Wrap block cache inside a simulated cache and pass it to RocksDB
Expand Down Expand Up @@ -8423,7 +8425,7 @@ int ha_rocksdb::index_next_with_direction(uchar *const buf, bool move_forward) {
if (m_skip_scan_it_next_call) {
m_skip_scan_it_next_call = false;
} else if (!m_scan_it->Valid()) {
DBUG_RETURN(HA_ERR_KEY_NOT_FOUND);
DBUG_RETURN(HA_ERR_KEY_NOT_FOUND);
} else {
if (move_forward)
m_scan_it->Next(); /* this call cannot fail */
Expand Down Expand Up @@ -8547,8 +8549,9 @@ int ha_rocksdb::index_first_intern(uchar *const buf) {
m_skip_scan_it_next_call = true;

rc = index_next_with_direction(buf, true);
if (rc != HA_ERR_ROCKSDB_STATUS_BUSY || !is_new_snapshot)
break; // exit the loop
if (!should_recreate_snapshot(rc, is_new_snapshot)) {
break; /* exit the loop */
}

// release the snapshot and iterator so they will be regenerated
tx->release_snapshot();
Expand Down
32 changes: 16 additions & 16 deletions storage/rocksdb/properties_collector.h
Expand Up @@ -106,28 +106,28 @@ class Rdb_tbl_card_coll {

class Rdb_tbl_prop_coll : public rocksdb::TablePropertiesCollector {
public:
Rdb_tbl_prop_coll(Rdb_ddl_manager *const ddl_manager,
const Rdb_compact_params &params, const uint32_t cf_id,
const uint8_t table_stats_sampling_pct);
Rdb_tbl_prop_coll(Rdb_ddl_manager *const ddl_manager,
const Rdb_compact_params &params, const uint32_t cf_id,
const uint8_t table_stats_sampling_pct);

/*
Override parent class's virtual methods of interest.
*/
/*
Override parent class's virtual methods of interest.
*/

virtual rocksdb::Status AddUserKey(const rocksdb::Slice &key,
const rocksdb::Slice &value,
rocksdb::EntryType type,
rocksdb::SequenceNumber seq,
uint64_t file_size) override;
virtual rocksdb::Status AddUserKey(const rocksdb::Slice &key,
const rocksdb::Slice &value,
rocksdb::EntryType type,
rocksdb::SequenceNumber seq,
uint64_t file_size) override;

virtual rocksdb::Status
Finish(rocksdb::UserCollectedProperties *properties) override;
virtual rocksdb::Status
Finish(rocksdb::UserCollectedProperties *properties) override;

virtual const char *Name() const override { return "Rdb_tbl_prop_coll"; }
virtual const char *Name() const override { return "Rdb_tbl_prop_coll"; }

rocksdb::UserCollectedProperties GetReadableProperties() const override;
rocksdb::UserCollectedProperties GetReadableProperties() const override;

bool NeedCompact() const override;
bool NeedCompact() const override;

public:
uint64_t GetMaxDeletedRows() const { return m_max_deleted_rows; }
Expand Down
58 changes: 29 additions & 29 deletions storage/rocksdb/rdb_datadic.h
Expand Up @@ -966,37 +966,37 @@ class Rdb_field_packing {
rdb_index_field_skip_t m_skip_func;

private:
/*
Location of the field in the table (key number and key part number).
Note that this describes not the field, but rather a position of field in
the index. Consider an example:
col1 VARCHAR (100),
INDEX idx1 (col1)),
INDEX idx2 (col1(10)),
Here, idx2 has a special Field object that is set to describe a 10-char
prefix of col1.
We must also store the keynr. It is needed for implicit "extended keys".
Every key in MyRocks needs to include PK columns. Generally, SQL layer
includes PK columns as part of its "Extended Keys" feature, but sometimes
it does not (known examples are unique secondary indexes and partitioned
tables).
In that case, MyRocks's index descriptor has invisible suffix of PK
columns (and the point is that these columns are parts of PK, not parts
of the current index).
*/
uint m_keynr;
uint m_key_part;
/*
Location of the field in the table (key number and key part number).
Note that this describes not the field, but rather a position of field in
the index. Consider an example:
col1 VARCHAR (100),
INDEX idx1 (col1)),
INDEX idx2 (col1(10)),
Here, idx2 has a special Field object that is set to describe a 10-char
prefix of col1.
We must also store the keynr. It is needed for implicit "extended keys".
Every key in MyRocks needs to include PK columns. Generally, SQL layer
includes PK columns as part of its "Extended Keys" feature, but sometimes
it does not (known examples are unique secondary indexes and partitioned
tables).
In that case, MyRocks's index descriptor has invisible suffix of PK
columns (and the point is that these columns are parts of PK, not parts
of the current index).
*/
uint m_keynr;
uint m_key_part;

public:
bool setup(const Rdb_key_def *const key_descr, const Field *const field,
const uint keynr_arg, const uint key_part_arg,
const uint16 key_length);
Field *get_field_in_table(const TABLE *const tbl) const;
void fill_hidden_pk_val(uchar **dst, const longlong hidden_pk_id) const;
bool setup(const Rdb_key_def *const key_descr, const Field *const field,
const uint keynr_arg, const uint key_part_arg,
const uint16 key_length);
Field *get_field_in_table(const TABLE *const tbl) const;
void fill_hidden_pk_val(uchar **dst, const longlong hidden_pk_id) const;
};

/*
Expand Down

0 comments on commit e79bd6a

Please sign in to comment.