Commit 02573a41 authored by Rich Prohaska's avatar Rich Prohaska

#171 clean up tokudb comparison APIs a bit

parent 33ba98de
......@@ -98,7 +98,7 @@ PATENT RIGHTS GRANT:
// in a TokuDB table. The non-valid fields are those
// that have been deprecated since before 5.1, and can
// only exist through upgrades of old versions of MySQL
bool field_valid_for_tokudb_table(Field* field) {
static bool field_valid_for_tokudb_table(Field* field) {
bool ret_val = false;
enum_field_types mysql_type = field->real_type();
switch (mysql_type) {
......@@ -151,7 +151,7 @@ exit:
return ret_val;
}
void get_var_field_info(
static void get_var_field_info(
uint32_t* field_len, // output: length of field
uint32_t* start_offset, // output, length of offset where data starts
uint32_t var_field_index, //input, index of var field we want info on
......@@ -195,7 +195,7 @@ void get_var_field_info(
*field_len = data_end_offset - data_start_offset;
}
void get_blob_field_info(
static void get_blob_field_info(
uint32_t* start_offset,
uint32_t len_of_offsets,
const uchar* var_field_data_ptr,
......@@ -231,7 +231,7 @@ void get_blob_field_info(
// this function is pattern matched from
// InnoDB's get_innobase_type_from_mysql_type
TOKU_TYPE mysql_to_toku_type (Field* field) {
static TOKU_TYPE mysql_to_toku_type (Field* field) {
TOKU_TYPE ret_val = toku_type_unknown;
enum_field_types mysql_type = field->real_type();
switch (mysql_type) {
......@@ -618,7 +618,7 @@ exit:
//
// partially copied from below
//
uchar* pack_toku_varbinary_from_desc(
static uchar* pack_toku_varbinary_from_desc(
uchar* to_tokudb,
const uchar* from_desc,
uint32_t key_part_length, //number of bytes to use to encode the length in to_tokudb
......@@ -858,7 +858,7 @@ static inline uchar* unpack_toku_blob(
//
// partially copied from below
//
uchar* pack_toku_varstring_from_desc(
static uchar* pack_toku_varstring_from_desc(
uchar* to_tokudb,
const uchar* from_desc,
uint32_t key_part_length, //number of bytes to use to encode the length in to_tokudb
......@@ -1038,7 +1038,7 @@ static inline int tokudb_compare_two_hidden_keys(
// created in create_toku_key_descriptor_for_key. The first
// byte points to the TOKU_TYPE.
//
uint32_t skip_field_in_descriptor(uchar* row_desc) {
static uint32_t skip_field_in_descriptor(uchar* row_desc) {
uchar* row_desc_pos = row_desc;
TOKU_TYPE toku_type = (TOKU_TYPE)row_desc_pos[0];
row_desc_pos++;
......@@ -1073,7 +1073,7 @@ uint32_t skip_field_in_descriptor(uchar* row_desc) {
// to store the descriptor. Number of bytes used MUST match number of bytes
// we would skip in skip_field_in_descriptor
//
int create_toku_key_descriptor_for_key(KEY* key, uchar* buf) {
static int create_toku_key_descriptor_for_key(KEY* key, uchar* buf) {
uchar* pos = buf;
uint32_t num_bytes_in_field = 0;
uint32_t charset_num = 0;
......@@ -1178,7 +1178,7 @@ int create_toku_key_descriptor_for_key(KEY* key, uchar* buf) {
// to the descriptor, we can.
//
//
int create_toku_key_descriptor(
static int create_toku_key_descriptor(
uchar* buf,
bool is_first_hpk,
KEY* first_key,
......@@ -1354,7 +1354,7 @@ static inline int compare_toku_field(
// packs a field from a MySQL buffer into a tokudb buffer.
// Used for inserts/updates
//
uchar* pack_toku_key_field(
static uchar* pack_toku_key_field(
uchar* to_tokudb,
uchar* from_mysql,
Field* field,
......@@ -1447,7 +1447,7 @@ exit:
// use 2 bytes to encode the length, regardless of the field
// So varchar(4) will still use 2 bytes to encode the field
//
uchar* pack_key_toku_key_field(
static uchar* pack_key_toku_key_field(
uchar* to_tokudb,
uchar* from_mysql,
Field* field,
......@@ -1570,7 +1570,7 @@ exit:
}
int tokudb_compare_two_keys(
static int tokudb_compare_two_keys(
const void* new_key_data,
const uint32_t new_key_size,
const void* saved_key_data,
......@@ -1704,7 +1704,7 @@ static int simple_memcmp(const DBT *keya, const DBT *keyb) {
}
// comparison function to be used by the fractal trees.
int tokudb_cmp_dbt_key(DB* file, const DBT *keya, const DBT *keyb) {
static int tokudb_cmp_dbt_key(DB* file, const DBT *keya, const DBT *keyb) {
int cmp;
if (file->cmp_descriptor->dbt.size == 0) {
cmp = simple_memcmp(keya, keyb);
......@@ -1732,7 +1732,7 @@ int tokudb_cmp_dbt_key(DB* file, const DBT *keya, const DBT *keyb) {
}
//TODO: QQQ Only do one direction for prefix.
int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) {
static int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) {
// calls to this function are done by the handlerton, and are
// comparing just the keys as MySQL would compare them.
bool read_string = false;
......@@ -1852,7 +1852,7 @@ static int tokudb_cmp_dbt_key_parts(DB *file, const DBT *keya, const DBT *keyb,
max_parts);
}
uint32_t create_toku_main_key_pack_descriptor (
static uint32_t create_toku_main_key_pack_descriptor (
uchar* buf
)
{
......@@ -1880,10 +1880,6 @@ exit:
return pos - buf;
}
#define COL_FIX_FIELD 0x11
#define COL_VAR_FIELD 0x22
#define COL_BLOB_FIELD 0x33
#define COL_HAS_NO_CHARSET 0x44
#define COL_HAS_CHARSET 0x55
......@@ -1901,7 +1897,7 @@ exit:
pos += sizeof(uint32_t);
uint32_t pack_desc_pk_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
static uint32_t pack_desc_pk_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
uchar* pos = buf;
uint16 field_index = key_part->field->field_index;
Field* field = table_share->field[field_index];
......@@ -1946,7 +1942,7 @@ uint32_t pack_desc_pk_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* t
return pos - buf;
}
uint32_t pack_desc_pk_offset_info(
static uint32_t pack_desc_pk_offset_info(
uchar* buf,
KEY_AND_COL_INFO* kc_info,
TABLE_SHARE* table_share,
......@@ -1995,7 +1991,7 @@ uint32_t pack_desc_pk_offset_info(
return pos - buf;
}
uint32_t pack_desc_offset_info(uchar* buf, KEY_AND_COL_INFO* kc_info, uint pk_index, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
static uint32_t pack_desc_offset_info(uchar* buf, KEY_AND_COL_INFO* kc_info, uint pk_index, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
uchar* pos = buf;
uint16 field_index = key_part->field->field_index;
Field* field = table_share->field[field_index];
......@@ -2044,7 +2040,7 @@ uint32_t pack_desc_offset_info(uchar* buf, KEY_AND_COL_INFO* kc_info, uint pk_in
return pos - buf;
}
uint32_t pack_desc_key_length_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
static uint32_t pack_desc_key_length_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
uchar* pos = buf;
uint16 field_index = key_part->field->field_index;
Field* field = table_share->field[field_index];
......@@ -2079,7 +2075,7 @@ uint32_t pack_desc_key_length_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_
return pos - buf;
}
uint32_t pack_desc_char_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
static uint32_t pack_desc_char_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, KEY_PART_INFO* key_part) {
uchar* pos = buf;
uint16 field_index = key_part->field->field_index;
Field* field = table_share->field[field_index];
......@@ -2116,7 +2112,7 @@ uint32_t pack_desc_char_info(uchar* buf, KEY_AND_COL_INFO* kc_info, TABLE_SHARE*
return pos - buf;
}
uint32_t pack_some_row_info (
static uint32_t pack_some_row_info (
uchar* buf,
uint pk_index,
TABLE_SHARE* table_share,
......@@ -2145,7 +2141,7 @@ uint32_t pack_some_row_info (
return pos - buf;
}
uint32_t get_max_clustering_val_pack_desc_size(
static uint32_t get_max_clustering_val_pack_desc_size(
TABLE_SHARE* table_share
)
{
......@@ -2172,7 +2168,7 @@ uint32_t get_max_clustering_val_pack_desc_size(
return ret_val;
}
uint32_t create_toku_clustering_val_pack_descriptor (
static uint32_t create_toku_clustering_val_pack_descriptor (
uchar* buf,
uint pk_index,
TABLE_SHARE* table_share,
......@@ -2326,7 +2322,7 @@ exit:
return pos - buf;
}
uint32_t pack_clustering_val_from_desc(
static uint32_t pack_clustering_val_from_desc(
uchar* buf,
void* row_desc,
uint32_t row_desc_size,
......@@ -2480,7 +2476,7 @@ uint32_t pack_clustering_val_from_desc(
}
uint32_t get_max_secondary_key_pack_desc_size(
static uint32_t get_max_secondary_key_pack_desc_size(
KEY_AND_COL_INFO* kc_info
)
{
......@@ -2519,7 +2515,7 @@ uint32_t get_max_secondary_key_pack_desc_size(
return ret_val;
}
uint32_t create_toku_secondary_key_pack_descriptor (
static uint32_t create_toku_secondary_key_pack_descriptor (
uchar* buf,
bool has_hpk,
uint pk_index,
......@@ -2685,7 +2681,7 @@ uint32_t create_toku_secondary_key_pack_descriptor (
return pos - buf;
}
uint32_t skip_key_in_desc(
static uint32_t skip_key_in_desc(
uchar* row_desc
)
{
......@@ -2721,7 +2717,7 @@ exit:
}
uint32_t max_key_size_from_desc(
static uint32_t max_key_size_from_desc(
void* row_desc,
uint32_t row_desc_size
)
......@@ -2806,7 +2802,7 @@ uint32_t max_key_size_from_desc(
return max_size;
}
uint32_t pack_key_from_desc(
static uint32_t pack_key_from_desc(
uchar* buf,
void* row_desc,
uint32_t row_desc_size,
......@@ -3144,7 +3140,7 @@ uint32_t pack_key_from_desc(
return (uint32_t)(packed_key_pos - buf); //
}
bool fields_have_same_name(
static bool fields_have_same_name(
Field* a,
Field* b
)
......@@ -3152,7 +3148,7 @@ bool fields_have_same_name(
return strcmp(a->field_name, b->field_name) == 0;
}
bool fields_are_same_type(
static bool fields_are_same_type(
Field* a,
Field* b
)
......@@ -3320,7 +3316,7 @@ cleanup:
}
bool are_two_fields_same(
static bool are_two_fields_same(
Field* a,
Field* b
)
......
......@@ -156,7 +156,6 @@ typedef struct st_multi_col_pack_info {
uint32_t len_of_offsets; //length of the offset bytes in a packed row
} MULTI_COL_PACK_INFO;
typedef struct st_key_and_col_info {
//
// bitmaps for each key. key_filters[i] is associated with the i'th dictionary
......@@ -198,9 +197,9 @@ typedef struct st_key_and_col_info {
uint32_t num_offset_bytes; //number of bytes needed to encode the offset
} KEY_AND_COL_INFO;
bool field_valid_for_tokudb_table(Field* field);
static bool field_valid_for_tokudb_table(Field* field);
void get_var_field_info(
static void get_var_field_info(
uint32_t* field_len,
uint32_t* start_offset,
uint32_t var_field_index,
......@@ -208,7 +207,7 @@ void get_var_field_info(
uint32_t num_offset_bytes
);
void get_blob_field_info(
static void get_blob_field_info(
uint32_t* start_offset,
uint32_t len_of_offsets,
const uchar* var_field_data_ptr,
......@@ -285,16 +284,16 @@ typedef enum {
} TOKU_TYPE;
TOKU_TYPE mysql_to_toku_type (Field* field);
static TOKU_TYPE mysql_to_toku_type (Field* field);
uchar* pack_toku_varbinary_from_desc(
static uchar* pack_toku_varbinary_from_desc(
uchar* to_tokudb,
const uchar* from_desc,
uint32_t key_part_length, //number of bytes to use to encode the length in to_tokudb
uint32_t field_length //length of field
);
uchar* pack_toku_varstring_from_desc(
static uchar* pack_toku_varstring_from_desc(
uchar* to_tokudb,
const uchar* from_desc,
uint32_t key_part_length, //number of bytes to use to encode the length in to_tokudb
......@@ -303,21 +302,21 @@ uchar* pack_toku_varstring_from_desc(
);
uchar* pack_toku_key_field(
static uchar* pack_toku_key_field(
uchar* to_tokudb,
uchar* from_mysql,
Field* field,
uint32_t key_part_length //I really hope this is temporary as I phase out the pack_cmp stuff
);
uchar* pack_key_toku_key_field(
static uchar* pack_key_toku_key_field(
uchar* to_tokudb,
uchar* from_mysql,
Field* field,
uint32_t key_part_length //I really hope this is temporary as I phase out the pack_cmp stuff
);
uchar* unpack_toku_key_field(
static uchar* unpack_toku_key_field(
uchar* to_mysql,
uchar* from_tokudb,
Field* field,
......@@ -338,6 +337,10 @@ uchar* unpack_toku_key_field(
#define COL_ZERO 0
#define COL_POS_INF 1
#define COL_FIX_FIELD 0x11
#define COL_VAR_FIELD 0x22
#define COL_BLOB_FIELD 0x33
//
// information for hidden primary keys
//
......@@ -357,7 +360,7 @@ static inline ulonglong hpk_char_to_num(uchar* val) {
return uint8korr(val);
}
int tokudb_compare_two_keys(
static int tokudb_compare_two_keys(
const void* new_key_data,
const uint32_t new_key_size,
const void* saved_key_data,
......@@ -368,10 +371,10 @@ int tokudb_compare_two_keys(
bool* read_string
);
int tokudb_cmp_dbt_key(DB* db, const DBT *keya, const DBT *keyb);
static int tokudb_cmp_dbt_key(DB* db, const DBT *keya, const DBT *keyb);
//TODO: QQQ Only do one direction for prefix.
int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb);
static int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb);
static int tokudb_compare_two_key_parts(
const void* new_key_data,
......@@ -385,7 +388,7 @@ static int tokudb_compare_two_key_parts(
static int tokudb_cmp_dbt_key_parts(DB *file, const DBT *keya, const DBT *keyb, uint max_parts);
int create_toku_key_descriptor(
static int create_toku_key_descriptor(
uchar* buf,
bool is_first_hpk,
KEY* first_key,
......@@ -394,15 +397,15 @@ int create_toku_key_descriptor(
);
uint32_t create_toku_main_key_pack_descriptor (
static uint32_t create_toku_main_key_pack_descriptor (
uchar* buf
);
uint32_t get_max_clustering_val_pack_desc_size(
static uint32_t get_max_clustering_val_pack_desc_size(
TABLE_SHARE* table_share
);
uint32_t create_toku_clustering_val_pack_descriptor (
static uint32_t create_toku_clustering_val_pack_descriptor (
uchar* buf,
uint pk_index,
TABLE_SHARE* table_share,
......@@ -419,18 +422,18 @@ static inline bool is_key_clustering(
return (row_desc_size > 0);
}
uint32_t pack_clustering_val_from_desc(
static uint32_t pack_clustering_val_from_desc(
uchar* buf,
void* row_desc,
uint32_t row_desc_size,
const DBT* pk_val
);
uint32_t get_max_secondary_key_pack_desc_size(
static uint32_t get_max_secondary_key_pack_desc_size(
KEY_AND_COL_INFO* kc_info
);
uint32_t create_toku_secondary_key_pack_descriptor (
static uint32_t create_toku_secondary_key_pack_descriptor (
uchar* buf,
bool has_hpk,
uint pk_index,
......@@ -450,13 +453,13 @@ static inline bool is_key_pk(
return buf[0];
}
uint32_t max_key_size_from_desc(
static uint32_t max_key_size_from_desc(
void* row_desc,
uint32_t row_desc_size
);
uint32_t pack_key_from_desc(
static uint32_t pack_key_from_desc(
uchar* buf,
void* row_desc,
uint32_t row_desc_size,
......@@ -464,17 +467,17 @@ uint32_t pack_key_from_desc(
const DBT* pk_val
);
bool fields_have_same_name(
static bool fields_have_same_name(
Field* a,
Field* b
);
bool fields_are_same_type(
static bool fields_are_same_type(
Field* a,
Field* b
);
bool are_two_fields_same(
static bool are_two_fields_same(
Field* a,
Field* b
);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment