2008-02-05 17:00:53 +01:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2013-04-17 06:01:37 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
2008-02-05 17:00:53 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <db.h>
|
2013-04-17 06:01:47 +02:00
|
|
|
#include "hatoku_cmp.h"
|
2008-02-05 17:00:53 +01:00
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
typedef struct st_col_pack_info {
|
|
|
|
u_int32_t col_pack_val; //offset if fixed, pack_index if var
|
|
|
|
} COL_PACK_INFO;
|
|
|
|
|
|
|
|
typedef struct st_multi_col_pack_info {
|
|
|
|
u_int32_t var_len_offset; //where the fixed length stuff ends and the offsets for var stuff begins
|
|
|
|
u_int32_t len_of_offsets; //length of the offset bytes in a packed row
|
|
|
|
} MULTI_COL_PACK_INFO;
|
|
|
|
|
2013-04-17 06:01:52 +02:00
|
|
|
//
|
|
|
|
// This object stores table information that is to be shared
|
|
|
|
// among all ha_tokudb objects.
|
|
|
|
// There is one instance per table, shared among threads.
|
|
|
|
// Some of the variables here are the DB* pointers to indexes,
|
|
|
|
// and auto increment information.
|
|
|
|
//
|
2008-02-05 17:00:53 +01:00
|
|
|
typedef struct st_tokudb_share {
|
2013-04-17 06:01:37 +02:00
|
|
|
char *table_name;
|
|
|
|
uint table_name_length, use_count;
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
THR_LOCK lock;
|
|
|
|
|
|
|
|
ulonglong auto_ident;
|
2013-04-17 06:01:44 +02:00
|
|
|
ulonglong last_auto_increment, auto_inc_create_value;
|
2013-04-17 06:01:46 +02:00
|
|
|
//
|
|
|
|
// estimate on number of rows in table
|
|
|
|
//
|
2013-04-17 06:01:43 +02:00
|
|
|
ha_rows rows;
|
2013-04-17 06:01:46 +02:00
|
|
|
//
|
|
|
|
// estimate on number of rows added in the process of a locked tables
|
|
|
|
// this is so we can better estimate row count during a lock table
|
|
|
|
//
|
|
|
|
ha_rows rows_from_locked_table;
|
2013-04-17 06:01:41 +02:00
|
|
|
DB *status_block;
|
|
|
|
//
|
|
|
|
// DB that is indexed on the primary key
|
|
|
|
//
|
|
|
|
DB *file;
|
|
|
|
//
|
|
|
|
// array of all DB's that make up table, includes DB that
|
2013-04-17 06:01:42 +02:00
|
|
|
// is indexed on the primary key, add 1 in case primary
|
|
|
|
// key is hidden
|
2013-04-17 06:01:41 +02:00
|
|
|
//
|
2013-04-17 06:01:42 +02:00
|
|
|
DB *key_file[MAX_KEY +1];
|
|
|
|
u_int32_t key_type[MAX_KEY +1];
|
2013-04-17 06:01:43 +02:00
|
|
|
uint status, version, capabilities;
|
2013-04-17 06:01:37 +02:00
|
|
|
uint ref_length;
|
2013-04-17 06:01:44 +02:00
|
|
|
//
|
|
|
|
// whether table has an auto increment column
|
|
|
|
//
|
|
|
|
bool has_auto_inc;
|
|
|
|
//
|
|
|
|
// index of auto increment column in table->field, if auto_inc exists
|
|
|
|
//
|
|
|
|
uint ai_field_index;
|
2013-04-17 06:01:52 +02:00
|
|
|
bool ai_first_col;
|
2013-04-17 06:01:50 +02:00
|
|
|
|
|
|
|
MY_BITMAP key_filters[MAX_KEY+1];
|
|
|
|
uchar* field_lengths; //stores the field lengths of fixed size fields (255 max)
|
|
|
|
uchar* length_bytes; // stores the length of lengths of varchars and varbinaries
|
|
|
|
u_int32_t* blob_fields; // list of indexes of blob fields
|
|
|
|
u_int32_t num_blobs;
|
|
|
|
MULTI_COL_PACK_INFO mcp_info[MAX_KEY+1];
|
|
|
|
COL_PACK_INFO* cp_info[MAX_KEY+1];
|
|
|
|
u_int32_t num_offset_bytes; //number of bytes needed to encode the offset
|
2008-02-05 17:00:53 +01:00
|
|
|
} TOKUDB_SHARE;
|
|
|
|
|
2013-04-17 06:01:45 +02:00
|
|
|
#define HA_TOKU_VERSION 2
|
2013-04-17 06:01:43 +02:00
|
|
|
//
|
|
|
|
// no capabilities yet
|
|
|
|
//
|
2013-04-17 06:01:43 +02:00
|
|
|
#define HA_TOKU_CAP 0
|
2013-04-17 06:01:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// These are keys that will be used for retrieving metadata in status.tokudb
|
|
|
|
// To get the version, one looks up the value associated with key hatoku_version
|
|
|
|
// in status.tokudb
|
|
|
|
//
|
2013-04-17 06:01:50 +02:00
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
typedef ulonglong HA_METADATA_KEY;
|
|
|
|
#define hatoku_version 0
|
|
|
|
#define hatoku_capabilities 1
|
|
|
|
#define hatoku_max_ai 2 //maximum auto increment value found so far
|
|
|
|
#define hatoku_ai_create_value 3
|
2013-04-17 06:01:43 +02:00
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
typedef struct st_filter_key_part_info {
|
2013-04-17 06:01:41 +02:00
|
|
|
uint offset;
|
|
|
|
uint part_index;
|
2013-04-17 06:01:50 +02:00
|
|
|
} FILTER_KEY_PART_INFO;
|
2013-04-17 06:01:41 +02:00
|
|
|
|
2013-04-17 06:01:42 +02:00
|
|
|
typedef enum {
|
|
|
|
lock_read = 0,
|
|
|
|
lock_write
|
|
|
|
} TABLE_LOCK_TYPE;
|
|
|
|
|
2013-04-17 06:01:37 +02:00
|
|
|
class ha_tokudb : public handler {
|
2013-04-17 06:01:40 +02:00
|
|
|
private:
|
2013-04-17 06:01:37 +02:00
|
|
|
THR_LOCK_DATA lock; ///< MySQL lock
|
|
|
|
TOKUDB_SHARE *share; ///< Shared lock info
|
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// last key returned by ha_tokudb's cursor
|
|
|
|
//
|
|
|
|
DBT last_key;
|
|
|
|
//
|
|
|
|
// current row pointed to by ha_tokudb's cursor
|
|
|
|
// TODO: make sure current_row gets set properly
|
|
|
|
//
|
|
|
|
DBT current_row;
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// pointer used for multi_alloc of key_buff, key_buff2, primary_key_buff
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
void *alloc_ptr;
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// buffer used to temporarily store a "packed row"
|
|
|
|
// data pointer of a DBT will end up pointing to this
|
|
|
|
// see pack_row for usage
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
uchar *rec_buff;
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// number of bytes allocated in rec_buff
|
|
|
|
//
|
|
|
|
ulong alloced_rec_buff_length;
|
|
|
|
//
|
|
|
|
// buffer used to temporarily store a "packed key"
|
|
|
|
// data pointer of a DBT will end up pointing to this
|
|
|
|
//
|
|
|
|
uchar *key_buff;
|
|
|
|
//
|
|
|
|
// buffer used to temporarily store a "packed key"
|
|
|
|
// data pointer of a DBT will end up pointing to this
|
|
|
|
// This is used in functions that require the packing
|
|
|
|
// of more than one key
|
|
|
|
//
|
|
|
|
uchar *key_buff2;
|
2013-04-17 06:01:50 +02:00
|
|
|
uchar *key_buff3;
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// buffer used to temporarily store a "packed key"
|
|
|
|
// data pointer of a DBT will end up pointing to this
|
|
|
|
// currently this is only used for a primary key in
|
|
|
|
// the function update_row, hence the name. It
|
|
|
|
// does not carry any state throughout the class.
|
|
|
|
//
|
|
|
|
uchar *primary_key_buff;
|
2013-04-17 06:01:40 +02:00
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
//
|
|
|
|
// when unpacking blobs, we need to store it in a temporary
|
|
|
|
// buffer that will persist because MySQL just gets a pointer to the
|
|
|
|
// blob data, a pointer we need to ensure is valid until the next
|
|
|
|
// query
|
|
|
|
//
|
|
|
|
uchar* blob_buff;
|
|
|
|
u_int32_t num_blob_bytes;
|
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
bool unpack_entire_row;
|
|
|
|
|
|
|
|
//
|
|
|
|
// buffers (and their sizes) that will hold the indexes
|
|
|
|
// of fields that need to be read for a query
|
|
|
|
//
|
|
|
|
u_int32_t* fixed_cols_for_query;
|
|
|
|
u_int32_t num_fixed_cols_for_query;
|
|
|
|
u_int32_t* var_cols_for_query;
|
|
|
|
u_int32_t num_var_cols_for_query;
|
|
|
|
bool read_blobs;
|
|
|
|
bool read_key;
|
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// transaction used by ha_tokudb's cursor
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
DB_TXN *transaction;
|
2013-04-17 06:01:41 +02:00
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// instance of cursor being used for init_xxx and rnd_xxx functions
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
DBC *cursor;
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// flags that are returned in table_flags()
|
|
|
|
//
|
2013-04-17 06:01:46 +02:00
|
|
|
ulonglong int_table_flags;
|
2013-04-17 06:01:43 +02:00
|
|
|
//
|
2013-04-17 06:01:46 +02:00
|
|
|
// count on the number of rows that gets changed, such as when write_row occurs
|
|
|
|
// this is meant to help keep estimate on number of elements in DB
|
2013-04-17 06:01:43 +02:00
|
|
|
//
|
|
|
|
ulonglong added_rows;
|
|
|
|
ulonglong deleted_rows;
|
2013-04-17 06:01:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// count on number of rows inserted by statement
|
|
|
|
// this is to help give user progress on what is happening
|
|
|
|
// the reason that the variables added_rows and deleted_rows
|
|
|
|
// are not used is that those variables are also used to help
|
|
|
|
// estimate the number of rows in the DB. There are tricky things that
|
|
|
|
// can happen with "lock tables", so I do not want to couple these
|
|
|
|
// two features together. There is a little duplicate work, but I think it is fine
|
|
|
|
//
|
|
|
|
ulonglong num_added_rows_in_stmt;
|
|
|
|
ulonglong num_deleted_rows_in_stmt;
|
|
|
|
ulonglong num_updated_rows_in_stmt;
|
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
uint last_dup_key;
|
|
|
|
//
|
|
|
|
// if set to 0, then the primary key is not hidden
|
|
|
|
// if non-zero (not necessarily 1), primary key is hidden
|
|
|
|
//
|
|
|
|
uint hidden_primary_key;
|
2013-04-17 06:01:37 +02:00
|
|
|
bool key_read, using_ignore;
|
2013-04-17 06:01:41 +02:00
|
|
|
|
2013-04-17 06:01:42 +02:00
|
|
|
//
|
|
|
|
// After a cursor encounters an error, the cursor will be unusable
|
|
|
|
// In case MySQL attempts to do a cursor operation (such as rnd_next
|
|
|
|
// or index_prev), we will gracefully return this error instead of crashing
|
|
|
|
//
|
|
|
|
int last_cursor_error;
|
|
|
|
|
2013-04-17 06:01:42 +02:00
|
|
|
//
|
|
|
|
// For instances where we successfully prelock a range or a table,
|
|
|
|
// we set this to TRUE so that successive cursor calls can know
|
|
|
|
// know to limit the locking overhead in a call to the fractal tree
|
|
|
|
//
|
2013-04-17 06:01:42 +02:00
|
|
|
bool range_lock_grabbed;
|
2013-04-17 06:01:42 +02:00
|
|
|
|
2013-04-17 06:01:52 +02:00
|
|
|
//
|
|
|
|
// For bulk inserts, we want option of not updating auto inc
|
|
|
|
// until all inserts are done. By default, is false
|
|
|
|
//
|
2013-04-17 06:01:52 +02:00
|
|
|
bool delay_updating_ai_metadata; // if true, don't update auto-increment metadata until bulk load completes
|
|
|
|
bool ai_metadata_update_required; // if true, autoincrement metadata must be updated
|
2013-04-17 06:01:52 +02:00
|
|
|
|
2013-04-17 06:01:47 +02:00
|
|
|
//
|
|
|
|
// buffer for updating the status of long insert, delete, and update
|
|
|
|
// statements. Right now, the the messages are
|
|
|
|
// "[inserted|updated|deleted] about %llu rows",
|
|
|
|
// so a buffer of 200 is good enough.
|
|
|
|
//
|
|
|
|
char write_status_msg[200]; //buffer of 200 should be a good upper bound.
|
|
|
|
|
2013-04-17 06:01:37 +02:00
|
|
|
bool fix_rec_buff_for_blob(ulong length);
|
|
|
|
uchar current_ident[TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH];
|
|
|
|
|
|
|
|
ulong max_row_length(const uchar * buf);
|
2013-04-17 06:01:50 +02:00
|
|
|
int pack_row(
|
|
|
|
DBT * row,
|
|
|
|
const uchar* record,
|
|
|
|
uint index
|
|
|
|
);
|
2013-04-17 06:01:47 +02:00
|
|
|
u_int32_t place_key_into_mysql_buff(KEY* key_info, uchar * record, uchar* data);
|
2013-04-17 06:01:44 +02:00
|
|
|
void unpack_key(uchar * record, DBT const *key, uint index);
|
2013-04-17 06:01:45 +02:00
|
|
|
u_int32_t place_key_into_dbt_buff(KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length);
|
2013-04-17 06:01:44 +02:00
|
|
|
DBT* create_dbt_key_from_key(DBT * key, KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH);
|
|
|
|
DBT *create_dbt_key_from_table(DBT * key, uint keynr, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH);
|
2013-04-17 06:01:45 +02:00
|
|
|
DBT *pack_key(DBT * key, uint keynr, uchar * buff, const uchar * key_ptr, uint key_length, uchar inf_byte);
|
2013-04-17 06:01:37 +02:00
|
|
|
int remove_key(DB_TXN * trans, uint keynr, const uchar * record, DBT * prim_key);
|
2013-04-17 06:01:51 +02:00
|
|
|
int remove_keys(DB_TXN * trans, const uchar * record, DBT * prim_key);
|
2013-04-17 06:01:37 +02:00
|
|
|
int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row);
|
2013-04-17 06:01:44 +02:00
|
|
|
int update_primary_key(DB_TXN * trans, bool primary_key_changed, const uchar * old_row, DBT * old_key, const uchar * new_row, DBT * prim_key);
|
2013-04-17 06:01:44 +02:00
|
|
|
int handle_cursor_error(int error, int err_to_return, uint keynr);
|
2013-04-17 06:01:37 +02:00
|
|
|
DBT *get_pos(DBT * to, uchar * pos);
|
2013-04-17 06:01:41 +02:00
|
|
|
|
|
|
|
int open_secondary_table(DB** ptr, KEY* key_info, const char* name, int mode, u_int32_t* key_type);
|
2013-04-17 06:01:42 +02:00
|
|
|
int acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt);
|
2013-04-17 06:01:43 +02:00
|
|
|
int estimate_num_rows(DB* db, u_int64_t* num_rows);
|
2013-04-17 06:01:44 +02:00
|
|
|
bool has_auto_increment_flag(uint* index);
|
2013-04-17 06:01:45 +02:00
|
|
|
int write_metadata(DB* db, HA_METADATA_KEY curr_key_data, void* data, uint size );
|
2013-04-17 06:01:44 +02:00
|
|
|
int update_max_auto_inc(DB* db, ulonglong val);
|
|
|
|
int write_auto_inc_create(DB* db, ulonglong val);
|
|
|
|
void init_auto_increment();
|
2013-04-17 06:01:50 +02:00
|
|
|
int initialize_share(
|
|
|
|
const char* name,
|
|
|
|
int mode
|
|
|
|
);
|
|
|
|
|
|
|
|
void set_query_columns(uint keynr);
|
2013-04-17 06:01:52 +02:00
|
|
|
int prelock_range ( const key_range *start_key, const key_range *end_key);
|
2013-04-17 06:01:52 +02:00
|
|
|
|
2013-04-17 06:01:41 +02:00
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
public:
|
|
|
|
ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg);
|
|
|
|
~ha_tokudb() {
|
|
|
|
}
|
|
|
|
const char *table_type() const {
|
2013-04-17 06:01:37 +02:00
|
|
|
return "TOKUDB";
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
|
|
|
const char *index_type(uint inx) {
|
2013-04-17 06:01:37 +02:00
|
|
|
return "BTREE";
|
|
|
|
}
|
|
|
|
const char **bas_ext() const;
|
2013-04-17 06:01:40 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Returns a bit mask of capabilities of storage engine. Capabilities
|
|
|
|
// defined in sql/handler.h
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
ulonglong table_flags(void) const {
|
|
|
|
return int_table_flags;
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
|
|
|
ulong index_flags(uint inx, uint part, bool all_parts) const;
|
2013-04-17 06:01:37 +02:00
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
//
|
|
|
|
// Returns limit on the number of keys imposed by tokudb.
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
uint max_supported_keys() const {
|
2013-04-17 06:01:42 +02:00
|
|
|
return MAX_KEY;
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
2013-04-17 06:01:40 +02:00
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
uint extra_rec_buf_length() const {
|
2013-04-17 06:01:37 +02:00
|
|
|
return TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH;
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
|
|
|
ha_rows estimate_rows_upper_bound();
|
2013-04-17 06:01:40 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Returns the limit on the key length imposed by tokudb.
|
|
|
|
//
|
2013-04-17 06:01:37 +02:00
|
|
|
uint max_supported_key_length() const {
|
|
|
|
return UINT_MAX32;
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
2013-04-17 06:01:40 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Returns limit on key part length imposed by tokudb.
|
|
|
|
//
|
2013-04-17 06:01:40 +02:00
|
|
|
uint max_supported_key_part_length() const {
|
2013-04-17 06:01:37 +02:00
|
|
|
return UINT_MAX32;
|
2013-04-17 06:01:40 +02:00
|
|
|
}
|
|
|
|
const key_map *keys_to_use_for_scanning() {
|
2013-04-17 06:01:37 +02:00
|
|
|
return &key_map_full;
|
|
|
|
}
|
|
|
|
|
|
|
|
double scan_time();
|
2013-04-17 06:01:42 +02:00
|
|
|
double read_time(uint index, uint ranges, ha_rows rows);
|
2013-04-17 06:01:37 +02:00
|
|
|
|
|
|
|
int open(const char *name, int mode, uint test_if_locked);
|
|
|
|
int close(void);
|
2013-04-17 06:01:47 +02:00
|
|
|
void update_create_info(HA_CREATE_INFO* create_info);
|
2013-04-17 06:01:37 +02:00
|
|
|
int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info);
|
|
|
|
int delete_table(const char *name);
|
|
|
|
int rename_table(const char *from, const char *to);
|
2013-04-17 06:01:44 +02:00
|
|
|
int optimize(THD * thd, HA_CHECK_OPT * check_opt);
|
2013-04-17 06:01:51 +02:00
|
|
|
#if 0
|
2013-04-17 06:01:37 +02:00
|
|
|
int analyze(THD * thd, HA_CHECK_OPT * check_opt);
|
2013-04-17 06:01:51 +02:00
|
|
|
#endif
|
2013-04-17 06:01:37 +02:00
|
|
|
int write_row(uchar * buf);
|
|
|
|
int update_row(const uchar * old_data, uchar * new_data);
|
|
|
|
int delete_row(const uchar * buf);
|
|
|
|
|
2013-04-17 06:01:52 +02:00
|
|
|
void start_bulk_insert(ha_rows rows);
|
|
|
|
int end_bulk_insert();
|
|
|
|
|
2013-04-17 06:01:42 +02:00
|
|
|
int prepare_index_scan();
|
2013-04-17 06:01:51 +02:00
|
|
|
int prepare_index_key_scan( const uchar * key, uint key_len );
|
2013-04-17 06:01:52 +02:00
|
|
|
int prepare_range_scan( const key_range *start_key, const key_range *end_key);
|
2013-04-17 06:01:51 +02:00
|
|
|
void column_bitmaps_signal();
|
2013-04-17 06:01:37 +02:00
|
|
|
int index_init(uint index, bool sorted);
|
|
|
|
int index_end();
|
2013-04-17 06:01:50 +02:00
|
|
|
int index_next_same(uchar * buf, const uchar * key, uint keylen);
|
2013-04-17 06:01:37 +02:00
|
|
|
int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag);
|
|
|
|
int index_read_last(uchar * buf, const uchar * key, uint key_len);
|
|
|
|
int index_next(uchar * buf);
|
|
|
|
int index_prev(uchar * buf);
|
|
|
|
int index_first(uchar * buf);
|
|
|
|
int index_last(uchar * buf);
|
|
|
|
|
|
|
|
int rnd_init(bool scan);
|
|
|
|
int rnd_end();
|
|
|
|
int rnd_next(uchar * buf);
|
|
|
|
int rnd_pos(uchar * buf, uchar * pos);
|
|
|
|
|
2013-04-17 06:01:42 +02:00
|
|
|
int read_range_first(const key_range *start_key,
|
|
|
|
const key_range *end_key,
|
|
|
|
bool eq_range, bool sorted);
|
|
|
|
int read_range_next();
|
|
|
|
|
|
|
|
|
2013-04-17 06:01:37 +02:00
|
|
|
void position(const uchar * record);
|
|
|
|
int info(uint);
|
|
|
|
int extra(enum ha_extra_function operation);
|
|
|
|
int reset(void);
|
|
|
|
int external_lock(THD * thd, int lock_type);
|
|
|
|
int start_stmt(THD * thd, thr_lock_type lock_type);
|
|
|
|
|
|
|
|
ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key);
|
|
|
|
|
|
|
|
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type);
|
|
|
|
|
2013-04-17 06:01:43 +02:00
|
|
|
int get_status();
|
2013-04-17 06:01:43 +02:00
|
|
|
void init_hidden_prim_key_info();
|
2013-04-17 06:01:37 +02:00
|
|
|
inline void get_auto_primary_key(uchar * to) {
|
|
|
|
pthread_mutex_lock(&share->mutex);
|
|
|
|
share->auto_ident++;
|
2013-04-17 06:01:47 +02:00
|
|
|
hpk_num_to_char(to, share->auto_ident);
|
2013-04-17 06:01:37 +02:00
|
|
|
pthread_mutex_unlock(&share->mutex);
|
|
|
|
}
|
|
|
|
virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong * first_value, ulonglong * nb_reserved_values);
|
2013-04-17 06:01:45 +02:00
|
|
|
bool is_auto_inc_singleton();
|
2013-04-17 06:01:37 +02:00
|
|
|
void print_error(int error, myf errflag);
|
|
|
|
uint8 table_cache_type() {
|
|
|
|
return HA_CACHE_TBL_TRANSACT;
|
|
|
|
}
|
|
|
|
bool primary_key_is_clustered() {
|
|
|
|
return true;
|
|
|
|
}
|
2013-04-17 06:01:45 +02:00
|
|
|
bool supports_clustered_keys() {
|
|
|
|
return true;
|
|
|
|
}
|
2013-04-17 06:01:37 +02:00
|
|
|
int cmp_ref(const uchar * ref1, const uchar * ref2);
|
|
|
|
bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
|
|
|
|
|
2013-04-17 06:01:41 +02:00
|
|
|
int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
|
|
|
|
int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
|
|
|
|
int final_drop_index(TABLE *table_arg);
|
|
|
|
|
2013-04-17 06:01:44 +02:00
|
|
|
// delete all rows from the table
|
|
|
|
// effect: all dictionaries, including the main and indexes, should be empty
|
|
|
|
int delete_all_rows();
|
2013-04-17 06:01:44 +02:00
|
|
|
void extract_hidden_primary_key(uint keynr, DBT const *row, DBT const *found_key);
|
|
|
|
void read_key_only(uchar * buf, uint keynr, DBT const *row, DBT const *found_key);
|
2013-04-17 06:01:52 +02:00
|
|
|
void read_row_callback (uchar * buf, uint keynr, DBT const *row, DBT const *found_key);
|
2013-04-17 06:01:50 +02:00
|
|
|
int read_primary_key(uchar * buf, uint keynr, DBT const *row, DBT const *found_key);
|
2013-04-17 06:01:44 +02:00
|
|
|
int read_row(uchar * buf, uint keynr, DBT const *row, DBT const *found_key);
|
2013-04-17 06:01:50 +02:00
|
|
|
int unpack_blobs(
|
2013-04-17 06:01:50 +02:00
|
|
|
uchar* record,
|
|
|
|
const uchar* from_tokudb_blob,
|
|
|
|
u_int32_t num_blob_bytes
|
|
|
|
);
|
2013-04-17 06:01:50 +02:00
|
|
|
int unpack_row(
|
2013-04-17 06:01:50 +02:00
|
|
|
uchar* record,
|
|
|
|
DBT const *row,
|
|
|
|
DBT const *key,
|
|
|
|
uint index
|
|
|
|
);
|
2013-04-17 06:01:44 +02:00
|
|
|
|
2013-04-17 06:01:45 +02:00
|
|
|
int heavi_ret_val;
|
|
|
|
|
2013-04-17 06:01:50 +02:00
|
|
|
//
|
|
|
|
// index into key_file that holds DB* that is indexed on
|
|
|
|
// the primary_key. this->key_file[primary_index] == this->file
|
|
|
|
//
|
|
|
|
uint primary_key;
|
|
|
|
|
2013-04-17 06:01:40 +02:00
|
|
|
private:
|
2013-04-17 06:01:44 +02:00
|
|
|
int read_full_row(uchar * buf);
|
2013-04-17 06:01:37 +02:00
|
|
|
int __close(int mutex_is_locked);
|
2013-04-17 06:01:52 +02:00
|
|
|
int read_last(uint keynr);
|
|
|
|
bool is_auto_inc_first_column (uint* keynr);
|
2008-02-05 17:00:53 +01:00
|
|
|
};
|