diff --git a/storage/rocksdb/rdb_cf_manager.h b/storage/rocksdb/rdb_cf_manager.h index b4a8aff2691624ed8e7b78beb1e382ebad320131..e2bf2ab02dd5c1bcda6c2af1d29e53971458b4c1 100644 --- a/storage/rocksdb/rdb_cf_manager.h +++ b/storage/rocksdb/rdb_cf_manager.h @@ -60,4 +60,67 @@ class Rdb_cf_manager { public: Rdb_cf_manager(const Rdb_cf_manager &) = delete; Rdb_cf_manager &operator=(const Rdb_cf_manager &) = delete; - Rdb_cf_manager() = default; \ No newline at end of file + Rdb_cf_manager() = default; + + static bool is_cf_name_reverse(const char *const name); + + /* + This is called right after the DB::Open() call. The parameters describe + column + families that are present in the database. The first CF is the default CF. + */ + void init(std::unique_ptr &&cf_options, + std::vector *const handles); + void cleanup(); + + /* + Used by CREATE TABLE. + - cf_name requires non-empty string + - create=true means create cf if missing, otherwise return nullptr + */ + std::shared_ptr get_or_create_cf( + rocksdb::DB *const rdb, const std::string &cf_name, bool create); + + /* Used by table open */ + std::shared_ptr get_cf( + const std::string &cf_name) const; + + /* Look up cf by id; used by datadic */ + std::shared_ptr get_cf(const uint32_t id) const; + + /* Used to iterate over column families for show status */ + std::vector get_cf_names(void) const; + + /* Used to iterate over column families */ + std::vector> get_all_cf( + void) const; + + int remove_dropped_cf(Rdb_dict_manager *const dict_manager, + rocksdb::TransactionDB *const rdb, const uint32 &cf_id); + + /* Used to delete cf by name */ + int drop_cf(Rdb_ddl_manager *const ddl_manager, + Rdb_dict_manager *const dict_manager, const std::string &cf_name); + + /* Create cf flags if it does not exist */ + int create_cf_flags_if_needed(const Rdb_dict_manager *const dict_manager, + const uint32 &cf_id, const std::string &cf_name, + const bool is_per_partition_cf = false); + + void get_cf_options(const std::string &cf_name, + rocksdb::ColumnFamilyOptions *const opts) + MY_ATTRIBUTE((__nonnull__)) { + m_cf_options->get_cf_options(cf_name, opts); + } + + void update_options_map(const std::string &cf_name, + const std::string &updated_options) { + m_cf_options->update(cf_name, updated_options); + } + + private: + std::shared_ptr get_cf( + const std::string &cf_name, const bool lock_held_by_caller) const; +}; + +} // namespace myrocks