1 /* 2 Copyright (c) 2012,2013 Monty Program Ab 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; version 2 of the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 16 #pragma once 17 18 /* C++ standard header files */ 19 #include <string> 20 #include <vector> 21 22 /* MySQL header files */ 23 #include "sql_string.h" 24 25 /* RocksDB includes */ 26 #include "rocksdb/table.h" 27 #include "rocksdb/utilities/transaction_db.h" 28 29 /* MyRocks header files */ 30 #include "./rdb_global.h" 31 32 namespace myrocks { 33 34 enum RDB_IO_ERROR_TYPE { 35 RDB_IO_ERROR_TX_COMMIT, 36 RDB_IO_ERROR_DICT_COMMIT, 37 RDB_IO_ERROR_BG_THREAD, 38 RDB_IO_ERROR_GENERAL, 39 RDB_IO_ERROR_LAST 40 }; 41 42 const char *get_rdb_io_error_string(const RDB_IO_ERROR_TYPE err_type); 43 44 void rdb_handle_io_error(const rocksdb::Status status, 45 const RDB_IO_ERROR_TYPE err_type); 46 47 bool rdb_is_tablename_normalized(const std::string &tablename) 48 MY_ATTRIBUTE((__warn_unused_result__)); 49 50 int rdb_normalize_tablename(const std::string &tablename, std::string *str) 51 MY_ATTRIBUTE((__warn_unused_result__)); 52 53 int rdb_split_normalized_tablename(const std::string &fullname, std::string *db, 54 std::string *table = nullptr, 55 std::string *partition = nullptr) 56 MY_ATTRIBUTE((__warn_unused_result__)); 57 void rdb_gen_normalized_tablename(const std::string *db, 58 const std::string *table, 59 const std::string *partition, 60 std::string *fullname); 61 62 std::vector<std::string> rdb_get_open_table_names(void); 63 64 int rdb_get_table_perf_counters(const char *tablename, 65 Rdb_perf_counters *counters); 66 67 void rdb_get_global_perf_counters(Rdb_perf_counters *counters); 68 69 void rdb_queue_save_stats_request(); 70 71 extern const std::string TRUNCATE_TABLE_PREFIX; 72 73 /* 74 Access to singleton objects. 75 */ 76 77 rocksdb::TransactionDB *rdb_get_rocksdb_db(); 78 79 class Rdb_cf_manager; 80 Rdb_cf_manager &rdb_get_cf_manager(); 81 82 const rocksdb::BlockBasedTableOptions &rdb_get_table_options(); 83 bool rdb_is_table_scan_index_stats_calculation_enabled(); 84 bool rdb_is_ttl_enabled(); 85 bool rdb_is_ttl_read_filtering_enabled(); 86 #if !defined(NDEBUG) 87 int rdb_dbug_set_ttl_rec_ts(); 88 int rdb_dbug_set_ttl_snapshot_ts(); 89 int rdb_dbug_set_ttl_read_filter_ts(); 90 bool rdb_dbug_set_ttl_ignore_pk(); 91 #endif // !defined(NDEBUG) 92 93 enum operation_type : int; 94 void rdb_update_global_stats(const operation_type &type, uint count, 95 bool is_system_table = false); 96 97 class Rdb_dict_manager; 98 Rdb_dict_manager *rdb_get_dict_manager(void) 99 MY_ATTRIBUTE((__warn_unused_result__)); 100 101 class Rdb_ddl_manager; 102 Rdb_ddl_manager *rdb_get_ddl_manager(void) 103 MY_ATTRIBUTE((__warn_unused_result__)); 104 105 struct Rdb_hton_init_state; 106 Rdb_hton_init_state *rdb_get_hton_init_state(void) 107 MY_ATTRIBUTE((__warn_unused_result__)); 108 } // namespace myrocks 109