summaryrefslogtreecommitdiff
path: root/storage/rocksdb/ha_rocksdb.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2017-02-06 17:39:08 +0000
committerSergei Petrunia <psergey@askmonty.org>2017-02-06 17:39:08 +0000
commit7468ccfadf27a0c5f87c8909ee8514bdd52dc4a7 (patch)
treeb77bc71584e1fe8d727b04a1577dd612da7b9fdd /storage/rocksdb/ha_rocksdb.h
parentcfb59f3196aac1b41cdda79952031dcc64042914 (diff)
downloadmariadb-git-7468ccfadf27a0c5f87c8909ee8514bdd52dc4a7.tar.gz
Copy of
commit d1bb19b8f751875472211312c8e810143a7ba4b6 Author: Manuel Ung <mung@fb.com> Date: Fri Feb 3 11:50:34 2017 -0800 Add cardinality stats to information schema Summary: This adds cardinality stats to the INFORMATION_SCHEMA.ROCKSDB_INDEX_FILE_MAP table. This is the only missing user collected properties from SST files that we don't expose, which is useful for debugging cardinality bugs. Reviewed By: hermanlee Differential Revision: D4509156 fbshipit-source-id: 2d3918a
Diffstat (limited to 'storage/rocksdb/ha_rocksdb.h')
-rw-r--r--storage/rocksdb/ha_rocksdb.h926
1 files changed, 492 insertions, 434 deletions
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index a15ae6dd443..db95a4d919a 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -16,7 +16,7 @@
#pragma once
#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
+#pragma interface /* gcc class implementation */
#endif
/* C++ standard header files */
@@ -26,8 +26,8 @@
#include <vector>
/* MySQL header files */
-#include "./handler.h" /* handler */
-#include "./my_global.h" /* ulonglong */
+#include "./handler.h" /* handler */
+#include "./my_global.h" /* ulonglong */
#include "./sql_string.h"
#include "./ut0counter.h"
@@ -93,41 +93,51 @@ std::vector<Rdb_trx_info> rdb_get_all_trx_info();
- the name used to set the default column family parameter for per-cf
arguments.
*/
-const char * const DEFAULT_CF_NAME= "default";
+const char *const DEFAULT_CF_NAME = "default";
/*
This is the name of the Column Family used for storing the data dictionary.
*/
-const char * const DEFAULT_SYSTEM_CF_NAME= "__system__";
+const char *const DEFAULT_SYSTEM_CF_NAME = "__system__";
/*
This is the name of the hidden primary key for tables with no pk.
*/
-const char * const HIDDEN_PK_NAME= "HIDDEN_PK_ID";
+const char *const HIDDEN_PK_NAME = "HIDDEN_PK_ID";
/*
Column family name which means "put this index into its own column family".
See Rdb_cf_manager::get_per_index_cf_name().
*/
-const char * const PER_INDEX_CF_NAME = "$per_index_cf";
+const char *const PER_INDEX_CF_NAME = "$per_index_cf";
+
+/*
+ Name for the background thread.
+*/
+const char *const BG_THREAD_NAME = "myrocks-bg";
+
+/*
+ Name for the drop index thread.
+*/
+const char *const INDEX_THREAD_NAME = "myrocks-index";
/*
Default, minimal valid, and maximum valid sampling rate values when collecting
statistics about table.
*/
-#define RDB_DEFAULT_TBL_STATS_SAMPLE_PCT 10
-#define RDB_TBL_STATS_SAMPLE_PCT_MIN 1
-#define RDB_TBL_STATS_SAMPLE_PCT_MAX 100
+#define RDB_DEFAULT_TBL_STATS_SAMPLE_PCT 10
+#define RDB_TBL_STATS_SAMPLE_PCT_MIN 1
+#define RDB_TBL_STATS_SAMPLE_PCT_MAX 100
/*
Default and maximum values for rocksdb-compaction-sequential-deletes and
rocksdb-compaction-sequential-deletes-window to add basic boundary checking.
*/
-#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES 0
-#define MAX_COMPACTION_SEQUENTIAL_DELETES 2000000
+#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES 0
+#define MAX_COMPACTION_SEQUENTIAL_DELETES 2000000
-#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES_WINDOW 0
-#define MAX_COMPACTION_SEQUENTIAL_DELETES_WINDOW 2000000
+#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES_WINDOW 0
+#define MAX_COMPACTION_SEQUENTIAL_DELETES_WINDOW 2000000
/*
Default and maximum values for various compaction and flushing related
@@ -139,11 +149,11 @@ const char * const PER_INDEX_CF_NAME = "$per_index_cf";
CPU-s and derive the values from there. This however has its own set of
problems and we'll choose simplicity for now.
*/
-#define MAX_BACKGROUND_COMPACTIONS 64
-#define MAX_BACKGROUND_FLUSHES 64
+#define MAX_BACKGROUND_COMPACTIONS 64
+#define MAX_BACKGROUND_FLUSHES 64
-#define DEFAULT_SUBCOMPACTIONS 1
-#define MAX_SUBCOMPACTIONS 64
+#define DEFAULT_SUBCOMPACTIONS 1
+#define MAX_SUBCOMPACTIONS 64
/*
Defines the field sizes for serializing XID object to a string representation.
@@ -167,7 +177,7 @@ const char * const PER_INDEX_CF_NAME = "$per_index_cf";
The reason behind the cast issue is the lack of unsigned int support in Java.
*/
-#define MAX_RATE_LIMITER_BYTES_PER_SEC static_cast<uint64_t>(LONGLONG_MAX)
+#define MAX_RATE_LIMITER_BYTES_PER_SEC static_cast<uint64_t>(LONGLONG_MAX)
/*
Hidden PK column (for tables with no primary key) is a longlong (aka 8 bytes).
@@ -179,14 +189,13 @@ const char * const PER_INDEX_CF_NAME = "$per_index_cf";
MyRocks specific error codes. NB! Please make sure that you will update
HA_ERR_ROCKSDB_LAST when adding new ones.
*/
-#define HA_ERR_ROCKSDB_UNIQUE_NOT_SUPPORTED (HA_ERR_LAST + 1)
-#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_LAST + 2)
-#define HA_ERR_ROCKSDB_TOO_MANY_LOCKS (HA_ERR_LAST + 3)
-#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_TOO_MANY_LOCKS
-
-inline bool looks_like_per_index_cf_typo(const char* const name)
-{
- return (name && name[0]=='$' && strcmp(name, PER_INDEX_CF_NAME));
+#define HA_ERR_ROCKSDB_UNIQUE_NOT_SUPPORTED (HA_ERR_LAST + 1)
+#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_LAST + 2)
+#define HA_ERR_ROCKSDB_TOO_MANY_LOCKS (HA_ERR_LAST + 3)
+#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_TOO_MANY_LOCKS
+
+inline bool looks_like_per_index_cf_typo(const char *const name) {
+ return (name && name[0] == '$' && strcmp(name, PER_INDEX_CF_NAME));
}
/**
@@ -196,21 +205,18 @@ inline bool looks_like_per_index_cf_typo(const char* const name)
//TODO: join this with Rdb_tbl_def ?
*/
-struct Rdb_table_handler
-{
- char *m_table_name;
- uint m_table_name_length;
- int m_ref_count;
+struct Rdb_table_handler {
+ char *m_table_name;
+ uint m_table_name_length;
+ int m_ref_count;
- my_core::THR_LOCK m_thr_lock; ///< MySQL latch needed by m_db_lock
+ my_core::THR_LOCK m_thr_lock; ///< MySQL latch needed by m_db_lock
/* Stores cumulative table statistics */
- my_io_perf_atomic_t m_io_perf_read;
- Rdb_atomic_perf_counters m_table_perf_context;
+ my_io_perf_atomic_t m_io_perf_read;
+ Rdb_atomic_perf_counters m_table_perf_context;
};
-
-
class Rdb_key_def;
class Rdb_tbl_def;
class Rdb_transaction;
@@ -218,38 +224,32 @@ class Rdb_transaction_impl;
class Rdb_writebatch_impl;
class Rdb_field_encoder;
-const char *const rocksdb_hton_name= "ROCKSDB";
+const char *const rocksdb_hton_name = "ROCKSDB";
typedef struct _gl_index_id_s {
uint32_t cf_id;
uint32_t index_id;
- bool operator==(const struct _gl_index_id_s& other) const
- {
+ bool operator==(const struct _gl_index_id_s &other) const {
return cf_id == other.cf_id && index_id == other.index_id;
}
- bool operator!=(const struct _gl_index_id_s& other) const
- {
+ bool operator!=(const struct _gl_index_id_s &other) const {
return cf_id != other.cf_id || index_id != other.index_id;
}
- bool operator<(const struct _gl_index_id_s& other) const
- {
+ bool operator<(const struct _gl_index_id_s &other) const {
return cf_id < other.cf_id ||
- (cf_id == other.cf_id && index_id < other.index_id);
+ (cf_id == other.cf_id && index_id < other.index_id);
}
- bool operator<=(const struct _gl_index_id_s& other) const
- {
+ bool operator<=(const struct _gl_index_id_s &other) const {
return cf_id < other.cf_id ||
- (cf_id == other.cf_id && index_id <= other.index_id);
+ (cf_id == other.cf_id && index_id <= other.index_id);
}
- bool operator>(const struct _gl_index_id_s& other) const
- {
+ bool operator>(const struct _gl_index_id_s &other) const {
return cf_id > other.cf_id ||
- (cf_id == other.cf_id && index_id > other.index_id);
+ (cf_id == other.cf_id && index_id > other.index_id);
}
- bool operator>=(const struct _gl_index_id_s& other) const
- {
+ bool operator>=(const struct _gl_index_id_s &other) const {
return cf_id > other.cf_id ||
- (cf_id == other.cf_id && index_id >= other.index_id);
+ (cf_id == other.cf_id && index_id >= other.index_id);
}
} GL_INDEX_ID;
@@ -289,23 +289,20 @@ struct st_export_stats {
ulonglong system_rows_updated;
};
-} // namespace myrocks
+} // namespace myrocks
#include "./rdb_buff.h"
/* Provide hash function for GL_INDEX_ID so we can include it in sets */
namespace std {
- template <>
- struct hash<myrocks::GL_INDEX_ID>
- {
- std::size_t operator()(const myrocks::GL_INDEX_ID& gl_index_id) const
- {
- const uint64_t val = ((uint64_t) gl_index_id.cf_id << 32 |
- (uint64_t) gl_index_id.index_id);
- return std::hash<uint64_t>()(val);
- }
- };
-} // namespace std
+template <> struct hash<myrocks::GL_INDEX_ID> {
+ std::size_t operator()(const myrocks::GL_INDEX_ID &gl_index_id) const {
+ const uint64_t val =
+ ((uint64_t)gl_index_id.cf_id << 32 | (uint64_t)gl_index_id.index_id);
+ return std::hash<uint64_t>()(val);
+ }
+};
+} // namespace std
namespace myrocks {
@@ -314,11 +311,10 @@ namespace myrocks {
Class definition for ROCKSDB storage engine plugin handler
*/
-class ha_rocksdb: public my_core::handler
-{
- my_core::THR_LOCK_DATA m_db_lock; ///< MySQL database lock
+class ha_rocksdb : public my_core::handler {
+ my_core::THR_LOCK_DATA m_db_lock; ///< MySQL database lock
- Rdb_table_handler *m_table_handler; ///< Open table handler
+ Rdb_table_handler *m_table_handler; ///< Open table handler
/* Iterator used for range scans and for full table/index scans */
rocksdb::Iterator *m_scan_it;
@@ -354,7 +350,7 @@ class ha_rocksdb: public my_core::handler
*/
bool m_maybe_unpack_info;
- uchar *m_pk_tuple; /* Buffer for storing PK in KeyTupleFormat */
+ uchar *m_pk_tuple; /* Buffer for storing PK in KeyTupleFormat */
uchar *m_pk_packed_tuple; /* Buffer for storing PK in StorageFormat */
// ^^ todo: change it to 'char*'? TODO: ^ can we join this with last_rowkey?
@@ -387,6 +383,10 @@ class ha_rocksdb: public my_core::handler
uchar *m_sk_packed_tuple_old;
Rdb_string_writer m_sk_tails_old;
+ /* Buffers used for duplicate checking during unique_index_creation */
+ uchar *m_dup_sk_packed_tuple;
+ uchar *m_dup_sk_packed_tuple_old;
+
/*
Temporary space for packing VARCHARs (we provide it to
pack_record()/pack_index_tuple() calls).
@@ -448,40 +448,37 @@ class ha_rocksdb: public my_core::handler
*/
int m_dupp_errkey;
- int create_key_defs(const TABLE* const table_arg,
- Rdb_tbl_def* const tbl_def_arg,
- const TABLE* const old_table_arg= nullptr,
- const Rdb_tbl_def* const old_tbl_def_arg= nullptr) const
- __attribute__((__nonnull__(2, 3), __warn_unused_result__));
- int secondary_index_read(const int keyno, uchar* const buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int create_key_defs(const TABLE *const table_arg,
+ Rdb_tbl_def *const tbl_def_arg,
+ const TABLE *const old_table_arg = nullptr,
+ const Rdb_tbl_def *const old_tbl_def_arg = nullptr) const
+ MY_ATTRIBUTE((__nonnull__(2, 3), __warn_unused_result__));
+ int secondary_index_read(const int keyno, uchar *const buf)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void setup_iterator_for_rnd_scan();
- void setup_scan_iterator(const Rdb_key_def& kd, rocksdb::Slice* const slice)
- __attribute__((__nonnull__))
- {
+ void setup_scan_iterator(const Rdb_key_def &kd, rocksdb::Slice *const slice)
+ MY_ATTRIBUTE((__nonnull__)) {
setup_scan_iterator(kd, slice, false, false, 0);
}
- bool is_ascending(const Rdb_key_def& keydef,
+ bool is_ascending(const Rdb_key_def &keydef,
enum ha_rkey_function find_flag) const
- __attribute__((__nonnull__, __warn_unused_result__));
- void setup_scan_iterator(const Rdb_key_def& kd,
- rocksdb::Slice *slice, const bool use_all_keys,
- const bool is_ascending, const uint eq_cond_len)
- __attribute__((__nonnull__));
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ void setup_scan_iterator(const Rdb_key_def &kd, rocksdb::Slice *slice,
+ const bool use_all_keys, const bool is_ascending,
+ const uint eq_cond_len) MY_ATTRIBUTE((__nonnull__));
void release_scan_iterator(void);
- rocksdb::Status get_for_update(Rdb_transaction* const tx,
- rocksdb::ColumnFamilyHandle* const column_family,
- const rocksdb::Slice& key,
- std::string* const value) const;
+ rocksdb::Status
+ get_for_update(Rdb_transaction *const tx,
+ rocksdb::ColumnFamilyHandle *const column_family,
+ const rocksdb::Slice &key, std::string *const value) const;
- int get_row_by_rowid(uchar* const buf, const char* const rowid,
+ int get_row_by_rowid(uchar *const buf, const char *const rowid,
const uint rowid_size)
- __attribute__((__nonnull__, __warn_unused_result__));
- int get_row_by_rowid(uchar* const buf, const uchar* const rowid,
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int get_row_by_rowid(uchar *const buf, const uchar *const rowid,
const uint rowid_size)
- __attribute__((__nonnull__, __warn_unused_result__))
- {
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__)) {
return get_row_by_rowid(buf, reinterpret_cast<const char *>(rowid),
rowid_size);
}
@@ -489,22 +486,22 @@ class ha_rocksdb: public my_core::handler
void update_auto_incr_val();
void load_auto_incr_value();
longlong update_hidden_pk_val();
- int load_hidden_pk_value() __attribute__((__warn_unused_result__));
- int read_hidden_pk_id_from_rowkey(longlong* const hidden_pk_id)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int load_hidden_pk_value() MY_ATTRIBUTE((__warn_unused_result__));
+ int read_hidden_pk_id_from_rowkey(longlong *const hidden_pk_id)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
bool can_use_single_delete(const uint &index) const
- __attribute__((__warn_unused_result__));
- bool skip_unique_check() const __attribute__((__warn_unused_result__));
+ MY_ATTRIBUTE((__warn_unused_result__));
+ bool skip_unique_check() const MY_ATTRIBUTE((__warn_unused_result__));
void set_force_skip_unique_check(bool skip) override;
- bool commit_in_the_middle() __attribute__((__warn_unused_result__));
- bool do_bulk_commit(Rdb_transaction* const tx)
- __attribute__((__nonnull__, __warn_unused_result__));
- bool has_hidden_pk(const TABLE* const table) const
- __attribute__((__nonnull__, __warn_unused_result__));
+ bool commit_in_the_middle() MY_ATTRIBUTE((__warn_unused_result__));
+ bool do_bulk_commit(Rdb_transaction *const tx)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ bool has_hidden_pk(const TABLE *const table) const
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void update_row_stats(const operation_type &type);
- void set_last_rowkey(const uchar* const old_data);
+ void set_last_rowkey(const uchar *const old_data);
/*
Array of table->s->fields elements telling how to store fields in the
@@ -513,15 +510,14 @@ class ha_rocksdb: public my_core::handler
Rdb_field_encoder *m_encoder_arr;
/* Describes instructions on how to decode the field */
- class READ_FIELD
- {
- public:
+ class READ_FIELD {
+ public:
/* Points to Rdb_field_encoder describing the field */
- Rdb_field_encoder* m_field_enc;
+ Rdb_field_encoder *m_field_enc;
/* if true, decode the field, otherwise skip it */
- bool m_decode;
+ bool m_decode;
/* Skip this many bytes before reading (or skipping) this field */
- int m_skip;
+ int m_skip;
};
/*
@@ -540,11 +536,12 @@ class ha_rocksdb: public my_core::handler
*/
uint m_null_bytes_in_rec;
- void get_storage_type(Rdb_field_encoder* const encoder, const uint &kp);
+ void get_storage_type(Rdb_field_encoder *const encoder, const uint &kp);
void setup_field_converters();
- int alloc_key_buffers(const TABLE* const table_arg,
- const Rdb_tbl_def* const tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int alloc_key_buffers(const TABLE *const table_arg,
+ const Rdb_tbl_def *const tbl_def_arg,
+ bool alloc_alter_buffers = false)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void free_key_buffers();
// the buffer size should be at least 2*Rdb_key_def::INDEX_NUMBER_SIZE
@@ -568,7 +565,8 @@ class ha_rocksdb: public my_core::handler
public:
/*
- Controls whether writes include checksums. This is updated from the session variable
+ Controls whether writes include checksums. This is updated from the session
+ variable
at the start of each query.
*/
bool m_store_row_debug_checksums;
@@ -577,12 +575,11 @@ public:
bool m_verify_row_debug_checksums;
int m_checksums_pct;
- ha_rocksdb(my_core::handlerton* const hton,
- my_core::TABLE_SHARE* const table_arg);
- ~ha_rocksdb()
- {
- int err __attribute__((__unused__));
- err= finalize_bulk_load();
+ ha_rocksdb(my_core::handlerton *const hton,
+ my_core::TABLE_SHARE *const table_arg);
+ ~ha_rocksdb() {
+ int err MY_ATTRIBUTE((__unused__));
+ err = finalize_bulk_load();
DBUG_ASSERT(err == 0);
mysql_mutex_destroy(&m_bulk_load_mutex);
}
@@ -590,28 +587,37 @@ public:
/** @brief
The name that will be used for display purposes.
*/
- const char *table_type() const { return rocksdb_hton_name; }
+ const char *table_type() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(rocksdb_hton_name);
+ }
/* The following is only used by SHOW KEYS: */
- const char *index_type(uint inx) { return "LSMTREE"; }
+ const char *index_type(uint inx) override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN("LSMTREE");
+ }
/** @brief
The file extensions.
*/
- const char **bas_ext() const;
+ const char **bas_ext() const override;
/*
See if this is the same base table - this should only be true for different
partitions of the same table.
*/
- bool same_table(const ha_rocksdb& other) const;
+ bool same_table(const ha_rocksdb &other) const;
/** @brief
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
- ulonglong table_flags() const override
- {
+ ulonglong table_flags() const override {
+ DBUG_ENTER_FUNC();
+
/*
HA_BINLOG_STMT_CAPABLE
We are saying that this engine is just statement capable to have
@@ -621,12 +627,11 @@ public:
If we don't set it, filesort crashes, because it assumes rowids are
1..8 byte numbers
*/
- return HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
- HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS |
- (m_pk_can_be_decoded? HA_PRIMARY_KEY_IN_READ_INDEX : 0) |
- HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
- HA_NULL_IN_KEY |
- HA_PARTIAL_COLUMN_READ;
+ DBUG_RETURN(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
+ HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS |
+ (m_pk_can_be_decoded ? HA_PRIMARY_KEY_IN_READ_INDEX : 0) |
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY |
+ HA_PARTIAL_COLUMN_READ);
}
bool init_with_fields() override;
@@ -641,61 +646,62 @@ public:
If all_parts is set, MySQL wants to know the flags for the combined
index, up to and including 'part'.
*/
- ulong index_flags(uint inx, uint part, bool all_parts) const;
+ ulong index_flags(uint inx, uint part, bool all_parts) const override;
- const key_map * keys_to_use_for_scanning()
- {
- return &key_map_full;
+ const key_map *keys_to_use_for_scanning() override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(&key_map_full);
}
- bool primary_key_is_clustered()
- {
- return true;
+ bool primary_key_is_clustered() override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(true);
}
- bool should_store_row_debug_checksums() const
- {
+ bool should_store_row_debug_checksums() const {
return m_store_row_debug_checksums && (rand() % 100 < m_checksums_pct);
}
- int rename_table(const char* const from, const char* const to)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int rename_table(const char *const from, const char *const to) override
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- int convert_record_from_storage_format(const rocksdb::Slice* const key,
- const rocksdb::Slice* const value,
- uchar* const buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int convert_record_from_storage_format(const rocksdb::Slice *const key,
+ const rocksdb::Slice *const value,
+ uchar *const buf)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- int convert_record_from_storage_format(const rocksdb::Slice* const key,
- uchar* const buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int convert_record_from_storage_format(const rocksdb::Slice *const key,
+ uchar *const buf)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- void convert_record_to_storage_format(const rocksdb::Slice& pk_packed_slice,
- Rdb_string_writer* const pk_unpack_info,
- rocksdb::Slice* const packed_rec)
- __attribute__((__nonnull__));
+ void convert_record_to_storage_format(const rocksdb::Slice &pk_packed_slice,
+ Rdb_string_writer *const pk_unpack_info,
+ rocksdb::Slice *const packed_rec)
+ MY_ATTRIBUTE((__nonnull__));
- static const char* get_key_name(const uint index,
- const TABLE* const table_arg,
- const Rdb_tbl_def* const tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ static const char *get_key_name(const uint index,
+ const TABLE *const table_arg,
+ const Rdb_tbl_def *const tbl_def_arg)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- static const char* get_key_comment(const uint index,
- const TABLE* const table_arg,
- const Rdb_tbl_def* const tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ static const char *get_key_comment(const uint index,
+ const TABLE *const table_arg,
+ const Rdb_tbl_def *const tbl_def_arg)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- static bool is_hidden_pk(const uint index, const TABLE* const table_arg,
- const Rdb_tbl_def* const tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ static bool is_hidden_pk(const uint index, const TABLE *const table_arg,
+ const Rdb_tbl_def *const tbl_def_arg)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- static uint pk_index(const TABLE* const table_arg,
- const Rdb_tbl_def* const tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ static uint pk_index(const TABLE *const table_arg,
+ const Rdb_tbl_def *const tbl_def_arg)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- static bool is_pk(const uint index, const TABLE* table_arg,
- const Rdb_tbl_def* tbl_def_arg)
- __attribute__((__nonnull__, __warn_unused_result__));
+ static bool is_pk(const uint index, const TABLE *table_arg,
+ const Rdb_tbl_def *tbl_def_arg)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
/** @brief
unireg.cc will call max_supported_record_length(), max_supported_keys(),
@@ -704,11 +710,30 @@ public:
send. Return *real* limits of your storage engine here; MySQL will do
min(your_limits, MySQL_limits) automatically.
*/
- uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
+ uint max_supported_record_length() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(HA_MAX_REC_LENGTH);
+ }
+
+ uint max_supported_keys() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(MAX_INDEXES);
+ }
+
+ uint max_supported_key_parts() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(MAX_REF_PARTS);
+ }
+
+ uint max_supported_key_part_length() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(2048);
+ }
- uint max_supported_keys() const { return MAX_INDEXES; }
- uint max_supported_key_parts() const { return MAX_REF_PARTS; }
- uint max_supported_key_part_length() const { return 2048; }
/** @brief
unireg.cc will call this to make sure that the storage engine can handle
the data it is about to send. Return *real* limits of your storage engine
@@ -718,222 +743,253 @@ public:
There is no need to implement ..._key_... methods if your engine doesn't
support indexes.
*/
- uint max_supported_key_length() const { return 16*1024; /* just to return something*/ }
+ uint max_supported_key_length() const override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(16 * 1024); /* just to return something*/
+ }
/**
TODO: return actual upper bound of number of records in the table.
(e.g. save number of records seen on full table scan and/or use file size
as upper bound)
*/
- ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; }
+ ha_rows estimate_rows_upper_bound() override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(HA_POS_ERROR);
+ }
- /* At the moment, we're ok with default handler::index_init() implementation. */
- int index_read_map(uchar* const buf, const uchar* const key,
+ /* At the moment, we're ok with default handler::index_init() implementation.
+ */
+ int index_read_map(uchar *const buf, const uchar *const key,
key_part_map keypart_map,
- enum ha_rkey_function find_flag);
- __attribute__((__warn_unused_result__));
+ enum ha_rkey_function find_flag) override
+ MY_ATTRIBUTE((__warn_unused_result__));
- int index_read_map_impl(uchar* const buf, const uchar* const key,
+ int index_read_map_impl(uchar *const buf, const uchar *const key,
key_part_map keypart_map,
enum ha_rkey_function find_flag,
- const key_range* end_key)
- __attribute__((__warn_unused_result__));;
+ const key_range *end_key)
+ MY_ATTRIBUTE((__warn_unused_result__));
- int index_read_last_map(uchar* const buf, const uchar* const key,
- key_part_map keypart_map)
- __attribute__((__warn_unused_result__));;
+ int index_read_last_map(uchar *const buf, const uchar *const key,
+ key_part_map keypart_map) override
+ MY_ATTRIBUTE((__warn_unused_result__));
- int read_range_first(const key_range* const start_key,
- const key_range* const end_key,
- bool eq_range, bool sorted)
- __attribute__((__warn_unused_result__));;
+ int read_range_first(const key_range *const start_key,
+ const key_range *const end_key, bool eq_range,
+ bool sorted) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ virtual double scan_time() override {
+ DBUG_ENTER_FUNC();
+
+ DBUG_RETURN(
+ static_cast<double>((stats.records + stats.deleted) / 20.0 + 10));
+ }
- virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; }
virtual double read_time(uint, uint, ha_rows rows) override;
- int open(const char* const name, int mode, uint test_if_locked)
- __attribute__((__warn_unused_result__));
- int close(void) __attribute__((__warn_unused_result__));
-
- int write_row(uchar* const buf) __attribute__((__warn_unused_result__));
- int update_row(const uchar* const old_data, uchar* const new_data)
- __attribute__((__warn_unused_result__));
- int delete_row(const uchar* const buf)
- __attribute__((__warn_unused_result__));
- rocksdb::Status delete_or_singledelete(uint index,
- Rdb_transaction* const tx,
- rocksdb::ColumnFamilyHandle* const cf,
- const rocksdb::Slice& key)
- __attribute__((__warn_unused_result__));
-
- int index_next(uchar* const buf) __attribute__((__warn_unused_result__));
- int index_next_with_direction(uchar* const buf, bool move_forward)
- __attribute__((__warn_unused_result__));
- int index_prev(uchar* const buf) __attribute__((__warn_unused_result__));
-
- int index_first(uchar* const buf) __attribute__((__warn_unused_result__));
- int index_last(uchar* const buf) __attribute__((__warn_unused_result__));
-
- class Item* idx_cond_push(uint keyno, class Item* const idx_cond);
+ int open(const char *const name, int mode, uint test_if_locked) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int close(void) override MY_ATTRIBUTE((__warn_unused_result__));
+
+ int write_row(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int update_row(const uchar *const old_data, uchar *const new_data) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int delete_row(const uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ rocksdb::Status delete_or_singledelete(uint index, Rdb_transaction *const tx,
+ rocksdb::ColumnFamilyHandle *const cf,
+ const rocksdb::Slice &key)
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ int index_next(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int index_next_with_direction(uchar *const buf, bool move_forward)
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int index_prev(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ int index_first(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int index_last(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ class Item *idx_cond_push(uint keyno, class Item *const idx_cond) override;
/*
Default implementation from cancel_pushed_idx_cond() suits us
*/
private:
- struct key_def_cf_info
- {
- rocksdb::ColumnFamilyHandle* cf_handle;
+ struct key_def_cf_info {
+ rocksdb::ColumnFamilyHandle *cf_handle;
bool is_reverse_cf;
bool is_auto_cf;
};
- struct update_row_info
- {
- Rdb_transaction* tx;
- const uchar* new_data;
- const uchar* old_data;
- rocksdb::Slice new_pk_slice;
- rocksdb::Slice old_pk_slice;
+ struct update_row_info {
+ Rdb_transaction *tx;
+ const uchar *new_data;
+ const uchar *old_data;
+ rocksdb::Slice new_pk_slice;
+ rocksdb::Slice old_pk_slice;
// "unpack_info" data for the new PK value
Rdb_string_writer *new_pk_unpack_info;
- longlong hidden_pk_id;
- bool skip_unique_check;
+ longlong hidden_pk_id;
+ bool skip_unique_check;
};
- int create_cfs(const TABLE* const table_arg, Rdb_tbl_def* const tbl_def_arg,
- std::array<struct key_def_cf_info, MAX_INDEXES + 1>* const cfs) const;
- __attribute__((__nonnull__, __warn_unused_result__));
-
- int create_key_def(const TABLE* const table_arg, const uint &i,
- const Rdb_tbl_def* const tbl_def_arg,
- std::shared_ptr<Rdb_key_def>* const new_key_def,
- const struct key_def_cf_info& cf_info) const;
- __attribute__((__nonnull__, __warn_unused_result__));
-
- int create_inplace_key_defs(const TABLE* const table_arg,
- Rdb_tbl_def* vtbl_def_arg,
- const TABLE* const old_table_arg,
- const Rdb_tbl_def* const old_tbl_def_arg,
- const std::array<key_def_cf_info, MAX_INDEXES + 1>& cfs) const;
- __attribute__((__nonnull__, __warn_unused_result__));
-
- std::unordered_map<std::string, uint> get_old_key_positions(
- const TABLE* table_arg,
- const Rdb_tbl_def* tbl_def_arg,
- const TABLE* old_table_arg,
- const Rdb_tbl_def* old_tbl_def_arg) const
- __attribute__((__nonnull__));
-
- int compare_key_parts(const KEY* const old_key,
- const KEY* const new_key) const;
- __attribute__((__nonnull__, __warn_unused_result__));
+ /*
+ Used to check for duplicate entries during fast unique secondary index
+ creation.
+ */
+ struct unique_sk_buf_info {
+ bool sk_buf_switch = false;
+ rocksdb::Slice sk_memcmp_key;
+ rocksdb::Slice sk_memcmp_key_old;
+ uchar *dup_sk_buf;
+ uchar *dup_sk_buf_old;
+
+ /*
+ This method is meant to be called back to back during inplace creation
+ of unique indexes. It will switch between two buffers, which
+ will each store the memcmp form of secondary keys, which are then
+ converted to slices in sk_memcmp_key or sk_memcmp_key_old.
+
+ Switching buffers on each iteration allows us to retain the
+ sk_memcmp_key_old value for duplicate comparison.
+ */
+ inline uchar *swap_and_get_sk_buf() {
+ sk_buf_switch = !sk_buf_switch;
+ return sk_buf_switch ? dup_sk_buf : dup_sk_buf_old;
+ }
+ };
+
+ int create_cfs(const TABLE *const table_arg, Rdb_tbl_def *const tbl_def_arg,
+ std::array<struct key_def_cf_info, MAX_INDEXES + 1> *const cfs)
+ const MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+
+ int create_key_def(const TABLE *const table_arg, const uint &i,
+ const Rdb_tbl_def *const tbl_def_arg,
+ std::shared_ptr<Rdb_key_def> *const new_key_def,
+ const struct key_def_cf_info &cf_info) const
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+
+ int create_inplace_key_defs(
+ const TABLE *const table_arg, Rdb_tbl_def *vtbl_def_arg,
+ const TABLE *const old_table_arg,
+ const Rdb_tbl_def *const old_tbl_def_arg,
+ const std::array<key_def_cf_info, MAX_INDEXES + 1> &cfs) const
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+
+ std::unordered_map<std::string, uint>
+ get_old_key_positions(const TABLE *table_arg, const Rdb_tbl_def *tbl_def_arg,
+ const TABLE *old_table_arg,
+ const Rdb_tbl_def *old_tbl_def_arg) const
+ MY_ATTRIBUTE((__nonnull__));
+
+ int compare_key_parts(const KEY *const old_key,
+ const KEY *const new_key) const;
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int index_first_intern(uchar *buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int index_last_intern(uchar *buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
enum icp_result check_index_cond() const;
- int find_icp_matching_index_rec(const bool &move_forward, uchar* const buf)
- __attribute__((__nonnull__, __warn_unused_result__));
+ int find_icp_matching_index_rec(const bool &move_forward, uchar *const buf)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void calc_updated_indexes();
- int update_write_row(const uchar* const old_data, const uchar* const new_data,
+ int update_write_row(const uchar *const old_data, const uchar *const new_data,
const bool skip_unique_check)
- __attribute__((__warn_unused_result__));
- int get_pk_for_update(struct update_row_info* const row_info);
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int get_pk_for_update(struct update_row_info *const row_info);
int check_and_lock_unique_pk(const uint &key_id,
- const struct update_row_info& row_info,
- bool* const found, bool* const pk_changed)
- __attribute__((__warn_unused_result__));
+ const struct update_row_info &row_info,
+ bool *const found, bool *const pk_changed)
+ MY_ATTRIBUTE((__warn_unused_result__));
int check_and_lock_sk(const uint &key_id,
- const struct update_row_info& row_info,
- bool* const found) const
- __attribute__((__warn_unused_result__));
- int check_uniqueness_and_lock(const struct update_row_info& row_info,
- bool* const pk_changed)
- __attribute__((__warn_unused_result__));
- bool over_bulk_load_threshold(int* err)
- __attribute__((__warn_unused_result__));
- int bulk_load_key(Rdb_transaction* const tx,
- const Rdb_key_def& kd,
- const rocksdb::Slice& key,
- const rocksdb::Slice& value)
- __attribute__((__nonnull__, __warn_unused_result__));
- int update_pk(const Rdb_key_def& kd,
- const struct update_row_info& row_info,
- const bool &pk_changed)
- __attribute__((__warn_unused_result__));
- int update_sk(const TABLE* const table_arg,
- const Rdb_key_def& kd,
- const struct update_row_info& row_info)
- __attribute__((__warn_unused_result__));
- int update_indexes(const struct update_row_info& row_info,
+ const struct update_row_info &row_info,
+ bool *const found) const
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int check_uniqueness_and_lock(const struct update_row_info &row_info,
+ bool *const pk_changed)
+ MY_ATTRIBUTE((__warn_unused_result__));
+ bool over_bulk_load_threshold(int *err)
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int check_duplicate_sk(const TABLE *table_arg, const Rdb_key_def &index,
+ const rocksdb::Slice *key,
+ struct unique_sk_buf_info *sk_info)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int bulk_load_key(Rdb_transaction *const tx, const Rdb_key_def &kd,
+ const rocksdb::Slice &key, const rocksdb::Slice &value)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int update_pk(const Rdb_key_def &kd, const struct update_row_info &row_info,
+ const bool &pk_changed) MY_ATTRIBUTE((__warn_unused_result__));
+ int update_sk(const TABLE *const table_arg, const Rdb_key_def &kd,
+ const struct update_row_info &row_info)
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int update_indexes(const struct update_row_info &row_info,
const bool &pk_changed)
- __attribute__((__warn_unused_result__));
-
- int read_key_exact(const Rdb_key_def& kd,
- rocksdb::Iterator* const iter, const bool &using_full_key,
- const rocksdb::Slice& key_slice) const
- __attribute__((__nonnull__, __warn_unused_result__));
- int read_before_key(const Rdb_key_def& kd,
- const bool &using_full_key,
- const rocksdb::Slice& key_slice)
- __attribute__((__nonnull__, __warn_unused_result__));
- int read_after_key(const Rdb_key_def& kd,
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ int read_key_exact(const Rdb_key_def &kd, rocksdb::Iterator *const iter,
const bool &using_full_key,
- const rocksdb::Slice& key_slice)
- __attribute__((__nonnull__, __warn_unused_result__));
-
- int position_to_correct_key(const Rdb_key_def& kd,
- const enum ha_rkey_function &find_flag,
- const bool &full_key_match,
- const uchar* const key,
- const key_part_map &keypart_map,
- const rocksdb::Slice& key_slice,
- bool* const move_forward)
- __attribute__((__warn_unused_result__));
-
- int read_row_from_primary_key(uchar* const buf)
- __attribute__((__nonnull__, __warn_unused_result__));
- int read_row_from_secondary_key(uchar* const buf,
- const Rdb_key_def& kd,
+ const rocksdb::Slice &key_slice) const
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int read_before_key(const Rdb_key_def &kd, const bool &using_full_key,
+ const rocksdb::Slice &key_slice)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int read_after_key(const Rdb_key_def &kd, const bool &using_full_key,
+ const rocksdb::Slice &key_slice)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+
+ int position_to_correct_key(
+ const Rdb_key_def &kd, const enum ha_rkey_function &find_flag,
+ const bool &full_key_match, const uchar *const key,
+ const key_part_map &keypart_map, const rocksdb::Slice &key_slice,
+ bool *const move_forward) MY_ATTRIBUTE((__warn_unused_result__));
+
+ int read_row_from_primary_key(uchar *const buf)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ int read_row_from_secondary_key(uchar *const buf, const Rdb_key_def &kd,
bool move_forward)
- __attribute__((__nonnull__, __warn_unused_result__));
- int try_keyonly_read_from_sk(uchar* buf,
- const Rdb_key_def& kd,
- const rocksdb::Slice& key,
- const rocksdb::Slice& value,
- uint rowid_size)
- __attribute__((__nonnull__, __warn_unused_result__));
-
- int calc_eq_cond_len(const Rdb_key_def& kd,
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+
+ int calc_eq_cond_len(const Rdb_key_def &kd,
const enum ha_rkey_function &find_flag,
- const rocksdb::Slice& slice,
+ const rocksdb::Slice &slice,
const int &bytes_changed_by_succ,
- const key_range* const end_key,
- uint* const end_key_packed_size)
- __attribute__((__warn_unused_result__));
+ const key_range *const end_key,
+ uint *const end_key_packed_size)
+ MY_ATTRIBUTE((__warn_unused_result__));
- Rdb_tbl_def* get_table_if_exists(const char* const tablename)
- __attribute__((__nonnull__, __warn_unused_result__));
- void read_thd_vars(THD* const thd)
- __attribute__((__nonnull__));
- const char* thd_rocksdb_tmpdir()
- __attribute__((__nonnull__, __warn_unused_result__));
+ Rdb_tbl_def *get_table_if_exists(const char *const tablename)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
+ void read_thd_vars(THD *const thd) MY_ATTRIBUTE((__nonnull__));
+ const char *thd_rocksdb_tmpdir()
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- bool contains_foreign_key(THD* const thd)
- __attribute__((__nonnull__, __warn_unused_result__));
+ bool contains_foreign_key(THD *const thd)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
- int inplace_populate_sk(const TABLE* const table_arg,
- const std::unordered_set<std::shared_ptr<Rdb_key_def>>& indexes);
+ int inplace_populate_sk(
+ TABLE *const table_arg,
+ const std::unordered_set<std::shared_ptr<Rdb_key_def>> &indexes)
+ MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
public:
- int index_init(uint idx, bool sorted) __attribute__((__warn_unused_result__));
- int index_end() __attribute__((__warn_unused_result__));
+ int index_init(uint idx, bool sorted) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int index_end() override MY_ATTRIBUTE((__warn_unused_result__));
- void unlock_row();
+ void unlock_row() override;
/** @brief
Unlike index_init(), rnd_init() can be called two consecutive times
@@ -943,107 +999,114 @@ public:
cursor to the start of the table; no need to deallocate and allocate
it again. This is a required method.
*/
- int rnd_init(bool scan) __attribute__((__warn_unused_result__));
- int rnd_end() __attribute__((__warn_unused_result__));
+ int rnd_init(bool scan) override MY_ATTRIBUTE((__warn_unused_result__));
+ int rnd_end() override MY_ATTRIBUTE((__warn_unused_result__));
- int rnd_next(uchar* const buf) __attribute__((__warn_unused_result__));
- int rnd_next_with_direction(uchar* const buf, bool move_forward)
- __attribute__((__warn_unused_result__));
+ int rnd_next(uchar *const buf) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int rnd_next_with_direction(uchar *const buf, bool move_forward)
+ MY_ATTRIBUTE((__warn_unused_result__));
- int rnd_pos(uchar* const buf, uchar* const pos)
- __attribute__((__warn_unused_result__));
- void position(const uchar* const record);
+ int rnd_pos(uchar *const buf, uchar *const pos) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ void position(const uchar *const record) override;
int info(uint) override;
/* This function will always return success, therefore no annotation related
* to checking the return value. Can't change the signature because it's
* required by the interface. */
- int extra(enum ha_extra_function operation);
+ int extra(enum ha_extra_function operation) override;
- int start_stmt(THD* const thd, thr_lock_type lock_type)
- __attribute__((__warn_unused_result__));
- int external_lock(THD* const thd, int lock_type)
- __attribute__((__warn_unused_result__));
- int delete_all_rows(ha_rows* const nrows) __attribute__((__warn_unused_result__));
- int truncate() __attribute__((__warn_unused_result__));
+ int start_stmt(THD *const thd, thr_lock_type lock_type) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int external_lock(THD *const thd, int lock_type) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int truncate() override MY_ATTRIBUTE((__warn_unused_result__));
+
+ int reset() override {
+ DBUG_ENTER_FUNC();
- int reset() override
- {
/* Free blob data */
m_retrieved_record.clear();
- return 0;
+
+ DBUG_RETURN(HA_EXIT_SUCCESS);
}
- int check(THD* const thd, HA_CHECK_OPT* const check_opt)
- __attribute__((__warn_unused_result__));
- void remove_rows(Rdb_tbl_def* const tbl);
- ha_rows records_in_range(uint inx, key_range* const min_key,
- key_range* const max_key)
- __attribute__((__warn_unused_result__));
- int delete_table(const char* const from) __attribute__((__warn_unused_result__));
- int create(const char* const name, TABLE* const form,
- HA_CREATE_INFO* const create_info)
- __attribute__((__warn_unused_result__));
- bool check_if_incompatible_data(HA_CREATE_INFO* const info,
- uint table_changes)
- __attribute__((__warn_unused_result__));
-
- THR_LOCK_DATA **store_lock(THD* const thd, THR_LOCK_DATA **to,
- enum thr_lock_type lock_type)
- __attribute__((__warn_unused_result__));
-
- my_bool register_query_cache_table(THD* const thd, char* const table_key,
+ int check(THD *const thd, HA_CHECK_OPT *const check_opt) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ void remove_rows(Rdb_tbl_def *const tbl);
+ ha_rows records_in_range(uint inx, key_range *const min_key,
+ key_range *const max_key) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int delete_table(const char *const from) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int create(const char *const name, TABLE *const form,
+ HA_CREATE_INFO *const create_info) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ bool check_if_incompatible_data(HA_CREATE_INFO *const info,
+ uint table_changes) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ THR_LOCK_DATA **store_lock(THD *const thd, THR_LOCK_DATA **to,
+ enum thr_lock_type lock_type) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+
+ my_bool register_query_cache_table(THD *const thd, char *const table_key,
uint key_length,
- qc_engine_callback* const engine_callback,
- ulonglong* const engine_data)
- {
+ qc_engine_callback *const engine_callback,
+ ulonglong *const engine_data) override {
+ DBUG_ENTER_FUNC();
+
/* Currently, we don't support query cache */
- return FALSE;
+ DBUG_RETURN(FALSE);
}
- bool get_error_message(const int error, String* const buf)
- __attribute__((__nonnull__));
+ bool get_error_message(const int error, String *const buf) override
+ MY_ATTRIBUTE((__nonnull__));
void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
- ulonglong* const first_value,
- ulonglong* const nb_reserved_values);
- void update_create_info(HA_CREATE_INFO* const create_info);
- int optimize(THD* const thd, HA_CHECK_OPT* const check_opt)
- __attribute__((__warn_unused_result__));
- int analyze(THD* const thd, HA_CHECK_OPT* const check_opt)
- __attribute__((__warn_unused_result__));
- int calculate_stats(const TABLE* const table_arg, THD* const thd,
- HA_CHECK_OPT* const check_opt)
- __attribute__((__warn_unused_result__));
+ ulonglong *const first_value,
+ ulonglong *const nb_reserved_values) override;
+ void update_create_info(HA_CREATE_INFO *const create_info) override;
+ int optimize(THD *const thd, HA_CHECK_OPT *const check_opt) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int analyze(THD *const thd, HA_CHECK_OPT *const check_opt) override
+ MY_ATTRIBUTE((__warn_unused_result__));
+ int calculate_stats(const TABLE *const table_arg, THD *const thd,
+ HA_CHECK_OPT *const check_opt)
+ MY_ATTRIBUTE((__warn_unused_result__));
enum_alter_inplace_result check_if_supported_inplace_alter(
- TABLE *altered_table,
- my_core::Alter_inplace_info* const ha_alter_info) override;
+ TABLE *altered_table,
+ my_core::Alter_inplace_info *const ha_alter_info) override;
- bool prepare_inplace_alter_table(TABLE* const altered_table,
- my_core::Alter_inplace_info* const ha_alter_info);
+ bool prepare_inplace_alter_table(
+ TABLE *const altered_table,
+ my_core::Alter_inplace_info *const ha_alter_info) override;
- bool inplace_alter_table(TABLE* const altered_table,
- my_core::Alter_inplace_info* const ha_alter_info);
+ bool inplace_alter_table(
+ TABLE *const altered_table,
+ my_core::Alter_inplace_info *const ha_alter_info) override;
- bool commit_inplace_alter_table(TABLE* const altered_table,
- my_core::Alter_inplace_info* const ha_alter_info,
- bool commit);
+ bool
+ commit_inplace_alter_table(TABLE *const altered_table,
+ my_core::Alter_inplace_info *const ha_alter_info,
+ bool commit) override;
- int finalize_bulk_load() __attribute__((__warn_unused_result__));
+ int finalize_bulk_load() MY_ATTRIBUTE((__warn_unused_result__));
- void set_use_read_free_rpl(const char* const whitelist);
- void set_skip_unique_check_tables(const char* const whitelist);
+ void set_use_read_free_rpl(const char *const whitelist);
+ void set_skip_unique_check_tables(const char *const whitelist);
- public:
+public:
virtual void rpl_before_delete_rows() override;
virtual void rpl_after_delete_rows() override;
virtual void rpl_before_update_rows() override;
virtual void rpl_after_update_rows() override;
virtual bool use_read_free_rpl();
- private:
+private:
/* Flags tracking if we are inside different replication operation */
bool m_in_rpl_delete_rows;
bool m_in_rpl_update_rows;
@@ -1055,16 +1118,15 @@ public:
Helper class for in-place alter, for storing handler context between inplace
alter calls
*/
-struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx
-{
+struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx {
/* The new table definition */
- Rdb_tbl_def* const m_new_tdef;
+ Rdb_tbl_def *const m_new_tdef;
/* Stores the original key definitions */
- std::shared_ptr<Rdb_key_def>* const m_old_key_descr;
+ std::shared_ptr<Rdb_key_def> *const m_old_key_descr;
/* Stores the new key definitions */
- std::shared_ptr<Rdb_key_def>* m_new_key_descr;
+ std::shared_ptr<Rdb_key_def> *m_new_key_descr;
/* Stores the old number of key definitions */
const uint m_old_n_keys;
@@ -1085,28 +1147,24 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx
const uint m_n_dropped_keys;
Rdb_inplace_alter_ctx(
- Rdb_tbl_def* new_tdef, std::shared_ptr<Rdb_key_def>* old_key_descr,
- std::shared_ptr<Rdb_key_def>* new_key_descr, uint old_n_keys,
+ Rdb_tbl_def *new_tdef, std::shared_ptr<Rdb_key_def> *old_key_descr,
+ std::shared_ptr<Rdb_key_def> *new_key_descr, uint old_n_keys,
uint new_n_keys,
std::unordered_set<std::shared_ptr<Rdb_key_def>> added_indexes,
- std::unordered_set<GL_INDEX_ID> dropped_index_ids,
- uint n_added_keys, uint n_dropped_keys) :
- my_core::inplace_alter_handler_ctx(), m_new_tdef(new_tdef),
- m_old_key_descr(old_key_descr), m_new_key_descr(new_key_descr),
- m_old_n_keys(old_n_keys), m_new_n_keys(new_n_keys),
- m_added_indexes(added_indexes),
- m_dropped_index_ids(dropped_index_ids),
- m_n_added_keys(n_added_keys),
- m_n_dropped_keys(n_dropped_keys)
- {
- }
+ std::unordered_set<GL_INDEX_ID> dropped_index_ids, uint n_added_keys,
+ uint n_dropped_keys)
+ : my_core::inplace_alter_handler_ctx(), m_new_tdef(new_tdef),
+ m_old_key_descr(old_key_descr), m_new_key_descr(new_key_descr),
+ m_old_n_keys(old_n_keys), m_new_n_keys(new_n_keys),
+ m_added_indexes(added_indexes), m_dropped_index_ids(dropped_index_ids),
+ m_n_added_keys(n_added_keys), m_n_dropped_keys(n_dropped_keys) {}
- ~Rdb_inplace_alter_ctx(){}
+ ~Rdb_inplace_alter_ctx() {}
- private:
+private:
/* Disable Copying */
- Rdb_inplace_alter_ctx(const Rdb_inplace_alter_ctx&);
- Rdb_inplace_alter_ctx& operator=(const Rdb_inplace_alter_ctx&);
+ Rdb_inplace_alter_ctx(const Rdb_inplace_alter_ctx &);
+ Rdb_inplace_alter_ctx &operator=(const Rdb_inplace_alter_ctx &);
};
-} // namespace myrocks
+} // namespace myrocks