Skip to content

Commit

Permalink
Add ddst_dict_init api support for rocksdb dd
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
sunshine-Chun committed Apr 28, 2023
1 parent 1a0f581 commit 7897e70
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7434,6 +7434,7 @@ static int rocksdb_init_internal(void *const p) {
rocksdb_hton->clone_interface.clone_apply_end = rocksdb_clone_apply_end;

rocksdb_hton->dict_register_dd_table_id = rocksdb_dict_register_dd_table_id;
rocksdb_hton->ddse_dict_init = rocksdb_ddse_dict_init;

rocksdb_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;

Expand Down Expand Up @@ -19036,7 +19037,6 @@ bool ha_rocksdb::get_se_private_data(dd::Table *, bool reset) {
if (reset) {
native_dd::clear_dd_table_ids();
}

return false;
}

Expand Down
23 changes: 23 additions & 0 deletions storage/rocksdb/rdb_native_dd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/* MyRocks header files */
#include "ha_rocksdb.h"
#include "sql/plugin_table.h"

namespace myrocks {
std::unordered_set<dd::Object_id> native_dd::s_dd_table_ids = {};
Expand Down Expand Up @@ -50,4 +51,26 @@ void rocksdb_dict_register_dd_table_id(dd::Object_id dd_table_id) {
native_dd::insert_dd_table_ids(dd_table_id);
};

bool rocksdb_ddse_dict_init(
dict_init_mode_t dict_init_mode, uint,
[[maybe_unused]] List<const dd::Object_table> *tables,
List<const Plugin_tablespace> *tablespaces) {
// TODO: Remove assert(false); once we add the full rocksdb dd support
assert(false);

assert(tables);
assert(tables->is_empty());
assert(tablespaces);
assert(tablespaces->is_empty());

assert(dict_init_mode == DICT_INIT_CREATE_FILES ||
dict_init_mode == DICT_INIT_CHECK_FILES);

static Plugin_tablespace dd_space(rocksdb_dd_space_name, "", "", "",
rocksdb_hton_name);
tablespaces->push_back(&dd_space);

return false;
}

} // namespace myrocks
7 changes: 7 additions & 0 deletions storage/rocksdb/rdb_native_dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@

/* MySQL header files */
#include "sql/dd/object_id.h"
#include "sql/handler.h"

namespace dd {
class Table;
}

namespace myrocks {

constexpr const char *rocksdb_dd_space_name = "mysql";

void rocksdb_dict_register_dd_table_id(dd::Object_id dd_table_id);

bool rocksdb_ddse_dict_init(dict_init_mode_t dict_init_mode, uint version,
List<const dd::Object_table> *tables,
List<const Plugin_tablespace> *tablespaces);

class native_dd {
private:
/* Set of ids of DD tables */
Expand Down

0 comments on commit 7897e70

Please sign in to comment.