Skip to content

Commit 0593d65

Browse files
committed
Add ddst_dict_init api support for rocksdb dd
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 9f101f0 commit 0593d65

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

storage/rocksdb/ha_rocksdb.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7511,6 +7511,7 @@ static int rocksdb_init_internal(void *const p) {
75117511
rocksdb_hton->dict_get_server_version = rocksdb_dict_get_server_version;
75127512
rocksdb_hton->dict_set_server_version = rocksdb_dict_set_server_version;
75137513
rocksdb_hton->is_supported_system_table = rocksdb_is_supported_system_table;
7514+
rocksdb_hton->ddse_dict_init = rocksdb_ddse_dict_init;
75147515

75157516
rocksdb_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;
75167517

@@ -19170,7 +19171,6 @@ bool ha_rocksdb::get_se_private_data(dd::Table *, bool reset) {
1917019171
if (reset) {
1917119172
native_dd::clear_dd_table_ids();
1917219173
}
19173-
1917419174
return false;
1917519175
}
1917619176

storage/rocksdb/rdb_native_dd.cc

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "ha_rocksdb.h"
2626
#include "storage/rocksdb/ha_rocksdb_proto.h"
2727
#include "storage/rocksdb/rdb_datadic.h"
28+
#include "sql/plugin_table.h"
2829

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

81+
bool rocksdb_ddse_dict_init(
82+
[[maybe_unused]] dict_init_mode_t dict_init_mode, uint,
83+
[[maybe_unused]] List<const dd::Object_table> *tables,
84+
List<const Plugin_tablespace> *tablespaces) {
85+
assert(tables);
86+
assert(tables->is_empty());
87+
assert(tablespaces);
88+
assert(tablespaces->is_empty());
89+
90+
assert(dict_init_mode == DICT_INIT_CREATE_FILES ||
91+
dict_init_mode == DICT_INIT_CHECK_FILES);
92+
93+
static Plugin_tablespace dd_space(rocksdb_dd_space_name, "", "", "",
94+
rocksdb_hton_name);
95+
tablespaces->push_back(&dd_space);
96+
97+
return false;
98+
}
8099
} // namespace myrocks

storage/rocksdb/rdb_native_dd.h

+6
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@
2121

2222
/* MySQL header files */
2323
#include "sql/dd/object_id.h"
24+
#include "sql/handler.h"
2425

2526
namespace dd {
2627
class Table;
2728
}
2829

2930
namespace myrocks {
3031

32+
constexpr const char *rocksdb_dd_space_name = "mysql";
33+
3134
void rocksdb_dict_register_dd_table_id(dd::Object_id dd_table_id);
3235
bool rocksdb_dict_get_server_version(uint *version);
3336
bool rocksdb_dict_set_server_version();
3437
bool rocksdb_is_supported_system_table(const char *, const char *, bool);
38+
bool rocksdb_ddse_dict_init(dict_init_mode_t dict_init_mode, uint version,
39+
List<const dd::Object_table> *tables,
40+
List<const Plugin_tablespace> *tablespaces);
3541

3642
class native_dd {
3743
private:

0 commit comments

Comments
 (0)