Skip to content

Commit 88b36f4

Browse files
committed
Add ddst_dict_init api support for rocksdb dd
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 1a0f581 commit 88b36f4

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

storage/rocksdb/ha_rocksdb.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include "sql/dd/dictionary.h" // dd::Dictionary
5757
#include "sql/debug_sync.h"
5858
#include "sql/json_dom.h"
59+
#include "sql/plugin_table.h"
5960
#include "sql/sql_audit.h"
6061
#include "sql/sql_class.h"
6162
#include "sql/sql_lex.h"
@@ -7434,6 +7435,7 @@ static int rocksdb_init_internal(void *const p) {
74347435
rocksdb_hton->clone_interface.clone_apply_end = rocksdb_clone_apply_end;
74357436

74367437
rocksdb_hton->dict_register_dd_table_id = rocksdb_dict_register_dd_table_id;
7438+
rocksdb_hton->ddse_dict_init = rocksdb_ddse_dict_init;
74377439

74387440
rocksdb_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;
74397441

@@ -19036,7 +19038,7 @@ bool ha_rocksdb::get_se_private_data(dd::Table *, bool reset) {
1903619038
if (reset) {
1903719039
native_dd::clear_dd_table_ids();
1903819040
}
19039-
19041+
1904019042
return false;
1904119043
}
1904219044

storage/rocksdb/rdb_native_dd.cc

+23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
/* MyRocks header files */
2424
#include "ha_rocksdb.h"
25+
#include "sql/plugin_table.h"
2526

2627
namespace myrocks {
2728
std::unordered_set<dd::Object_id> native_dd::s_dd_table_ids = {};
@@ -50,4 +51,26 @@ void rocksdb_dict_register_dd_table_id(dd::Object_id dd_table_id) {
5051
native_dd::insert_dd_table_ids(dd_table_id);
5152
};
5253

54+
bool rocksdb_ddse_dict_init(
55+
dict_init_mode_t dict_init_mode, uint,
56+
[[maybe_unused]] List<const dd::Object_table> *tables,
57+
List<const Plugin_tablespace> *tablespaces) {
58+
// TODO: Remove assert(false); once we add the full rocksdb dd support
59+
assert(false);
60+
61+
assert(tables);
62+
assert(tables->is_empty());
63+
assert(tablespaces);
64+
assert(tablespaces->is_empty());
65+
66+
assert(dict_init_mode == DICT_INIT_CREATE_FILES ||
67+
dict_init_mode == DICT_INIT_CHECK_FILES);
68+
69+
static Plugin_tablespace dd_space(rocksdb_dd_space_name, "", "", "",
70+
rocksdb_hton_name);
71+
tablespaces->push_back(&dd_space);
72+
73+
return false;
74+
}
75+
5376
} // namespace myrocks

storage/rocksdb/rdb_native_dd.h

+7
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@
2020

2121
/* MySQL header files */
2222
#include "sql/dd/object_id.h"
23+
#include "sql/handler.h"
2324

2425
namespace dd {
2526
class Table;
2627
}
2728

2829
namespace myrocks {
2930

31+
constexpr const char *rocksdb_dd_space_name = "mysql";
32+
3033
void rocksdb_dict_register_dd_table_id(dd::Object_id dd_table_id);
3134

35+
bool rocksdb_ddse_dict_init(dict_init_mode_t dict_init_mode, uint version,
36+
List<const dd::Object_table> *tables,
37+
List<const Plugin_tablespace> *tablespaces);
38+
3239
class native_dd {
3340
private:
3441
/* Set of ids of DD tables */

0 commit comments

Comments
 (0)