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

Add ddst_dict_init api support for rocksdb dd #1297

Open
wants to merge 1 commit into
base: fb-mysql-8.0.28
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
2 changes: 1 addition & 1 deletion storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7511,6 +7511,7 @@ static int rocksdb_init_internal(void *const p) {
rocksdb_hton->dict_get_server_version = rocksdb_dict_get_server_version;
rocksdb_hton->dict_set_server_version = rocksdb_dict_set_server_version;
rocksdb_hton->is_supported_system_table = rocksdb_is_supported_system_table;
rocksdb_hton->ddse_dict_init = rocksdb_ddse_dict_init;

rocksdb_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;

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

return false;
sunshine-Chun marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
19 changes: 19 additions & 0 deletions storage/rocksdb/rdb_native_dd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ha_rocksdb.h"
#include "storage/rocksdb/ha_rocksdb_proto.h"
#include "storage/rocksdb/rdb_datadic.h"
#include "sql/plugin_table.h"

namespace myrocks {
std::unordered_set<dd::Object_id> native_dd::s_dd_table_ids = {};
Expand Down Expand Up @@ -77,4 +78,22 @@ bool rocksdb_is_supported_system_table([[maybe_unused]] const char *db_name,
return false;
}

bool rocksdb_ddse_dict_init(
[[maybe_unused]] dict_init_mode_t dict_init_mode, uint,
[[maybe_unused]] List<const dd::Object_table> *tables,
List<const Plugin_tablespace> *tablespaces) {
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
6 changes: 6 additions & 0 deletions storage/rocksdb/rdb_native_dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@

/* 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_dict_get_server_version(uint *version);
bool rocksdb_dict_set_server_version();
bool rocksdb_is_supported_system_table(const char *, const char *, bool);
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:
Expand Down