Commit a04aa405 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#4921 add per table data size to the tokudb_user_data information schema....

#4921 add per table data size to the tokudb_user_data information schema. also, combine all handlerton source into one compiled file refs[t:4921]

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@43824 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5ae60068
......@@ -9,5 +9,5 @@ FIND_LIBRARY(TOKUFRACTALTREE_LIB NAMES ${TOKUFRACTALTREE_LIBNAME} HINTS ${TOKUFR
FIND_LIBRARY(TOKUPORTABILITY_LIB NAMES ${TOKUPORTABILITY_LIBNAME} HINTS ${TOKUFRACTALTREE_RELEASE_DIR}/lib)
SET(TOKUDB_PLUGIN_DYNAMIC "ha_tokudb")
SET(TOKUDB_SOURCES hatoku_hton.cc hatoku_cmp.cc ha_tokudb.cc)
SET(TOKUDB_SOURCES ha_tokudb.cc)
MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES ${TOKUFRACTALTREE_LIB} ${TOKUPORTABILITY_LIB})
......@@ -23,12 +23,12 @@ pkgplugin_LTLIBRARIES = @plugin_tokudb_shared_target@
ha_tokudb_la_LIBADD = -L$(TOKUFRACTALTREE)/lib -l$(TOKUFRACTALTREE_LIBNAME) -l$(TOKUPORTABILITY_LIBNAME)
ha_tokudb_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_tokudb_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -DTOKUDB_VERSION=\"$(TOKUDB_VERSION)\" -Wall
ha_tokudb_la_SOURCES = hatoku_hton.cc hatoku_cmp.cc ha_tokudb.cc
ha_tokudb_la_SOURCES = ha_tokudb.cc
EXTRA_LIBRARIES = libtokudb.a
noinst_LIBRARIES = @plugin_tokudb_static_target@
libtokudb_a_CXXFLAGS = $(AM_CXXFLAGS) -Wall
libtokudb_a_SOURCES = hatoku_hton.cc hatoku_cmp.cc ha_tokudb.cc
libtokudb_a_SOURCES = ha_tokudb.cc
EXTRA_DIST = CMakeLists.txt plug.in
# Don't update the files from bitkeeper
......
......@@ -94,7 +94,7 @@ static void share_key_file_unlock(TOKUDB_SHARE * share)
//
// This offset is calculated starting from AFTER the NULL bytes
//
inline u_int32_t get_fixed_field_size(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
static inline u_int32_t get_fixed_field_size(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
uint offset = 0;
for (uint i = 0; i < table_share->fields; i++) {
if (kc_info->field_lengths[i] && !bitmap_is_set(&kc_info->key_filters[keynr],i)) {
......@@ -105,7 +105,7 @@ inline u_int32_t get_fixed_field_size(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* ta
}
inline u_int32_t get_len_of_offsets(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
static inline u_int32_t get_len_of_offsets(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
uint len = 0;
for (uint i = 0; i < table_share->fields; i++) {
if (kc_info->length_bytes[i] && !bitmap_is_set(&kc_info->key_filters[keynr],i)) {
......@@ -219,7 +219,7 @@ exit:
}
void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) {
static void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) {
for (uint i = 0; i < MAX_KEY+1; i++) {
bitmap_free(&kc_info->key_filters[i]);
}
......@@ -376,7 +376,7 @@ typedef struct index_read_info {
} *INDEX_READ_INFO;
int ai_poll_fun(void *extra, float progress) {
static int ai_poll_fun(void *extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (context->thd->killed) {
sprintf(context->write_status_msg, "The process has been killed, aborting add index.");
......@@ -387,7 +387,7 @@ int ai_poll_fun(void *extra, float progress) {
return 0;
}
int poll_fun(void *extra, float progress) {
static int poll_fun(void *extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (context->thd->killed) {
sprintf(context->write_status_msg, "The process has been killed, aborting bulk load.");
......@@ -403,7 +403,7 @@ struct hot_poll_fun_extra {
uint num_tables;
};
int hot_poll_fun(void *extra, float progress) {
static int hot_poll_fun(void *extra, float progress) {
HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra;
if (context->thd->killed) {
sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize.");
......@@ -415,13 +415,13 @@ int hot_poll_fun(void *extra, float progress) {
}
void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
static void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
assert(context->ha);
context->ha->set_loader_error(err);
}
void loader_dup_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
static void loader_dup_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
assert(context->ha);
context->ha->set_loader_error(err);
......@@ -626,9 +626,7 @@ ulonglong retrieve_auto_increment(uint16 type, uint32 offset,const uchar *record
unsigned_autoinc : (ulonglong) signed_autoinc;
}
inline bool
static inline bool
is_null_field( TABLE* table, Field* field, const uchar* record) {
uint null_offset;
bool ret_val;
......@@ -643,11 +641,11 @@ exitpt:
return ret_val;
}
inline ulong field_offset(Field* field, TABLE* table) {
static inline ulong field_offset(Field* field, TABLE* table) {
return((ulong) (field->ptr - table->record[0]));
}
inline HA_TOKU_ISO_LEVEL tx_to_toku_iso(ulong tx_isolation) {
static inline HA_TOKU_ISO_LEVEL tx_to_toku_iso(ulong tx_isolation) {
if (tx_isolation == ISO_READ_UNCOMMITTED) {
return hatoku_iso_read_uncommitted;
}
......@@ -662,7 +660,7 @@ inline HA_TOKU_ISO_LEVEL tx_to_toku_iso(ulong tx_isolation) {
}
}
inline u_int32_t toku_iso_to_txn_flag (HA_TOKU_ISO_LEVEL lvl) {
static inline u_int32_t toku_iso_to_txn_flag (HA_TOKU_ISO_LEVEL lvl) {
if (lvl == hatoku_iso_read_uncommitted) {
return DB_READ_UNCOMMITTED;
}
......@@ -677,15 +675,12 @@ inline u_int32_t toku_iso_to_txn_flag (HA_TOKU_ISO_LEVEL lvl) {
}
}
int filter_key_part_compare (const void* left, const void* right) {
static int filter_key_part_compare (const void* left, const void* right) {
FILTER_KEY_PART_INFO* left_part= (FILTER_KEY_PART_INFO *)left;
FILTER_KEY_PART_INFO* right_part = (FILTER_KEY_PART_INFO *)right;
return left_part->offset - right_part->offset;
}
//
// Be very careful with parameters passed to this function. Who knows
// if key, table have proper info set. I had to verify by checking
......@@ -750,8 +745,7 @@ void set_key_filter(MY_BITMAP* key_filter, KEY* key, TABLE* table, bool get_offs
}
}
inline uchar* pack_fixed_field(
static inline uchar* pack_fixed_field(
uchar* to_tokudb,
const uchar* from_mysql,
u_int32_t num_bytes
......@@ -780,7 +774,7 @@ inline uchar* pack_fixed_field(
return to_tokudb+num_bytes;
}
inline const uchar* unpack_fixed_field(
static inline const uchar* unpack_fixed_field(
uchar* to_mysql,
const uchar* from_tokudb,
u_int32_t num_bytes
......@@ -809,8 +803,7 @@ inline const uchar* unpack_fixed_field(
return from_tokudb+num_bytes;
}
inline uchar* write_var_field(
static inline uchar* write_var_field(
uchar* to_tokudb_offset_ptr, //location where offset data is going to be written
uchar* to_tokudb_data, // location where data is going to be written
uchar* to_tokudb_offset_start, //location where offset starts, IS THIS A BAD NAME????
......@@ -838,7 +831,7 @@ inline uchar* write_var_field(
return to_tokudb_data + data_length;
}
inline u_int32_t get_var_data_length(
static inline u_int32_t get_var_data_length(
const uchar * from_mysql,
u_int32_t mysql_length_bytes
)
......@@ -858,7 +851,7 @@ inline u_int32_t get_var_data_length(
return data_length;
}
inline uchar* pack_var_field(
static inline uchar* pack_var_field(
uchar* to_tokudb_offset_ptr, //location where offset data is going to be written
uchar* to_tokudb_data, // pointer to where tokudb data should be written
uchar* to_tokudb_offset_start, //location where data starts, IS THIS A BAD NAME????
......@@ -878,7 +871,7 @@ inline uchar* pack_var_field(
);
}
inline void unpack_var_field(
static inline void unpack_var_field(
uchar* to_mysql,
const uchar* from_tokudb_data,
u_int32_t from_tokudb_data_len,
......@@ -905,7 +898,7 @@ inline void unpack_var_field(
memcpy(to_mysql+mysql_length_bytes, from_tokudb_data, from_tokudb_data_len);
}
uchar* pack_toku_field_blob(
static uchar* pack_toku_field_blob(
uchar* to_tokudb,
const uchar* from_mysql,
Field* field
......@@ -1069,7 +1062,7 @@ static int check_table_in_metadata(const char *name, bool* table_found, DB_TXN*
return error;
}
int create_tokudb_trx_data_instance(tokudb_trx_data** out_trx) {
static int create_tokudb_trx_data_instance(tokudb_trx_data** out_trx) {
int error;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) my_malloc(sizeof(*trx), MYF(MY_ZEROFILL));
......@@ -1085,7 +1078,7 @@ cleanup:
}
inline int tokudb_generate_row(
static inline int tokudb_generate_row(
DB *dest_db,
DB *src_db,
DBT *dest_key,
......@@ -1215,7 +1208,7 @@ cleanup:
return error;
}
int generate_row_for_del(
static int generate_row_for_del(
DB *dest_db,
DB *src_db,
DBT *dest_key,
......@@ -1234,7 +1227,7 @@ int generate_row_for_del(
}
int generate_row_for_put(
static int generate_row_for_put(
DB *dest_db,
DB *src_db,
DBT *dest_key,
......@@ -1332,7 +1325,7 @@ bool ha_tokudb::has_auto_increment_flag(uint* index) {
return ai_found;
}
int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn) {
static int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn) {
int error;
char* newname = NULL;
uint open_mode = DB_THREAD;
......@@ -1463,7 +1456,7 @@ cleanup:
return error;
}
int initialize_col_pack_info(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
static int initialize_col_pack_info(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* table_share, uint keynr) {
int error = ENOSYS;
//
// set up the cp_info
......@@ -1526,7 +1519,7 @@ static void reset_key_and_col_info(KEY_AND_COL_INFO *kc_info, uint keynr) {
kc_info->mcp_info[keynr] = (MULTI_COL_PACK_INFO) { 0, 0 };
}
int initialize_key_and_col_info(TABLE_SHARE* table_share, TABLE* table, KEY_AND_COL_INFO* kc_info, uint hidden_primary_key, uint primary_key) {
static int initialize_key_and_col_info(TABLE_SHARE* table_share, TABLE* table, KEY_AND_COL_INFO* kc_info, uint hidden_primary_key, uint primary_key) {
int error = 0;
u_int32_t curr_blob_field_index = 0;
u_int32_t max_var_bytes = 0;
......@@ -6166,13 +6159,6 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
DBUG_RETURN(to);
}
int toku_dbt_up(DB*,
u_int32_t old_version, const DBT *old_descriptor, const DBT *old_key, const DBT *old_val,
u_int32_t new_version, const DBT *new_descriptor, const DBT *new_key, const DBT *new_val) {
assert(false);
return 0;
}
static inline enum row_type
compression_method_to_row_type(enum toku_compression_method method)
{
......@@ -6406,7 +6392,7 @@ void ha_tokudb::trace_create_table_info(const char *name, TABLE * form) {
}
}
u_int32_t get_max_desc_size(KEY_AND_COL_INFO* kc_info, TABLE* form) {
static u_int32_t get_max_desc_size(KEY_AND_COL_INFO* kc_info, TABLE* form) {
u_int32_t max_row_desc_buff_size;
max_row_desc_buff_size = 2*(form->s->fields * 6)+10; // upper bound of key comparison descriptor
max_row_desc_buff_size += get_max_secondary_key_pack_desc_size(kc_info); // upper bound for sec. key part
......@@ -6414,7 +6400,7 @@ u_int32_t get_max_desc_size(KEY_AND_COL_INFO* kc_info, TABLE* form) {
return max_row_desc_buff_size;
}
u_int32_t create_secondary_key_descriptor(
static u_int32_t create_secondary_key_descriptor(
uchar* buf,
KEY* key_info,
KEY* prim_key,
......@@ -6532,7 +6518,7 @@ cleanup:
}
u_int32_t create_main_key_descriptor(
static u_int32_t create_main_key_descriptor(
uchar* buf,
KEY* prim_key,
uint hpk,
......@@ -7994,7 +7980,6 @@ int ha_tokudb::truncate() {
TOKUDB_DBUG_RETURN(error);
}
// delete all rows from a table
//
// effects: delete all of the rows in the main dictionary and all of the
......@@ -8208,3 +8193,10 @@ ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
#include "ha_tokudb_alter_51.cc"
#include "ha_tokudb_alter_55.cc"
#include "ha_tokudb_alter_56.cc"
// key comparisons
#include "hatoku_cmp.cc"
// handlerton
#include "hatoku_hton.h"
#include "hatoku_hton.cc"
#if !defined(HA_TOKUDB_H)
#define HA_TOKUDB_H
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
......@@ -141,31 +144,6 @@ typedef enum {
lock_write
} TABLE_LOCK_TYPE;
int create_tokudb_trx_data_instance(tokudb_trx_data** out_trx);
int generate_row_for_del(
DB *dest_db,
DB *src_db,
DBT *dest_key,
const DBT *src_key,
const DBT *src_val
);
int generate_row_for_put(
DB *dest_db,
DB *src_db,
DBT *dest_key,
DBT *dest_val,
const DBT *src_key,
const DBT *src_val
);
int tokudb_update_fun(
DB* db,
const DBT *key,
const DBT *old_val,
const DBT *extra,
void (*set_val)(const DBT *new_val, void *set_extra),
void *set_extra
);
// the number of rows bulk fetched in one callback grows exponentially
// with the bulk fetch iteration, so the max iteration is the max number
// of shifts we can perform on a 64 bit integer.
......@@ -706,9 +684,6 @@ private:
int delete_all_rows_internal();
};
int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn);
#if MYSQL_VERSION_ID >= 50506
static inline void my_free(void *p, int arg) {
......@@ -721,3 +696,5 @@ static inline void *memcpy_fixed(void *a, const void *b, size_t n) {
#endif
#endif
......@@ -128,7 +128,7 @@ void get_blob_field_info(
u_int32_t num_offset_bytes
);
inline u_int32_t get_blob_field_len(
static inline u_int32_t get_blob_field_len(
const uchar* from_tokudb,
u_int32_t len_bytes
)
......@@ -154,7 +154,7 @@ inline u_int32_t get_blob_field_len(
}
inline const uchar* unpack_toku_field_blob(
static inline const uchar* unpack_toku_field_blob(
uchar *to_mysql,
const uchar* from_tokudb,
u_int32_t len_bytes,
......@@ -175,7 +175,7 @@ inline const uchar* unpack_toku_field_blob(
return (from_tokudb + len_bytes + length);
}
inline uint get_null_offset(TABLE* table, Field* field) {
static inline uint get_null_offset(TABLE* table, Field* field) {
return (uint) ((uchar*) field->null_ptr - (uchar*) table->record[0]);
}
......@@ -255,14 +255,14 @@ uchar* unpack_toku_key_field(
//
// function to convert a hidden primary key into a byte stream that can be stored in DBT
//
inline void hpk_num_to_char(uchar* to, ulonglong num) {
static inline void hpk_num_to_char(uchar* to, ulonglong num) {
int8store(to, num);
}
//
// function that takes a byte stream of a hidden primary key and returns a ulonglong
//
inline ulonglong hpk_char_to_num(uchar* val) {
static inline ulonglong hpk_char_to_num(uchar* val) {
return uint8korr(val);
}
......@@ -308,7 +308,7 @@ u_int32_t create_toku_clustering_val_pack_descriptor (
bool is_clustering
);
inline bool is_key_clustering(
static inline bool is_key_clustering(
void* row_desc,
u_int32_t row_desc_size
)
......@@ -338,7 +338,7 @@ u_int32_t create_toku_secondary_key_pack_descriptor (
KEY* prim_key
);
inline bool is_key_pk(
static inline bool is_key_pk(
void* row_desc,
u_int32_t row_desc_size
)
......
......@@ -43,7 +43,7 @@ extern ulong tokudb_debug;
printf("%d:%s:%d:" f, my_tid(), __FILE__, __LINE__, ##__VA_ARGS__);
inline unsigned int my_tid() {
static inline unsigned int my_tid() {
return (unsigned int)toku_os_gettid();
}
......
......@@ -39,15 +39,6 @@ typedef struct savepoint_info {
bool in_sub_stmt;
} *SP_INFO, SP_INFO_T;
static inline void *thd_data_get(THD *thd, int slot) {
return thd->ha_data[slot].ha_ptr;
}
static inline void thd_data_set(THD *thd, int slot, void *data) {
thd->ha_data[slot].ha_ptr = data;
}
static uchar *tokudb_get_key(TOKUDB_SHARE * share, size_t * length, my_bool not_used __attribute__ ((unused))) {
*length = share->table_name_length;
return (uchar *) share->table_name;
......@@ -145,11 +136,10 @@ static MYSQL_THDVAR_UINT(read_buf_size,
1 // blocksize???
);
void tokudb_checkpoint_lock(THD * thd);
void tokudb_checkpoint_unlock(THD * thd);
static void tokudb_checkpoint_lock(THD * thd);
static void tokudb_checkpoint_unlock(THD * thd);
static
void
static void
tokudb_checkpoint_lock_update(
THD* thd,
struct st_mysql_sys_var* var,
......@@ -1000,6 +990,7 @@ static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoin
TOKUDB_DBUG_RETURN(error);
}
#if 0
static int
smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) {
DBT* stored_frm = (DBT *)context;
......@@ -1009,6 +1000,8 @@ smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) {
memcpy(stored_frm->data, row->data, row->size);
return 0;
}
#endif
static int tokudb_discover(handlerton *hton, THD* thd, const char *db,
const char *name,
uchar **frmblob,
......@@ -1060,14 +1053,8 @@ cleanup:
TOKUDB_DBUG_RETURN(error);
}
static int smart_dbt_do_nothing (DBT const *key, DBT const *row, void *context) {
return 0;
}
static int tokudb_get_user_data_size(THD *thd, bool exact, u_int64_t *data_size_ret) {
static int tokudb_get_user_data_size(TABLE *table, THD *thd, bool exact) {
int error;
u_int64_t num_bytes_in_db = 0;
DB* curr_db = NULL;
DB_TXN* txn = NULL;
DBC* tmp_cursor = NULL;
......@@ -1186,7 +1173,21 @@ static int tokudb_get_user_data_size(THD *thd, bool exact, u_int64_t *data_size_
curr_num_bytes = (inf_byte_space > curr_num_bytes) ? 0 : curr_num_bytes - inf_byte_space;
}
num_bytes_in_db += curr_num_bytes;
char *tablename = strrchr(name, '/');
if (tablename == NULL) goto cleanup;
*tablename++ = 0;
char *dbname = strchr(name, '/');
if (dbname == NULL)
dbname = name;
else
dbname++;
table->field[0]->store(dbname, strlen(dbname), system_charset_info);
table->field[1]->store(tablename, strlen(tablename), system_charset_info);
table->field[2]->store(curr_num_bytes, false);
error = schema_table_store_record(thd, table);
if (error) goto cleanup;
{
int r = curr_db->close(curr_db, 0);
......@@ -1202,8 +1203,6 @@ static int tokudb_get_user_data_size(THD *thd, bool exact, u_int64_t *data_size_
}
}
*data_size_ret = num_bytes_in_db;
error = 0;
cleanup:
......@@ -1344,7 +1343,7 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_RETURN(error);
}
void tokudb_checkpoint_lock(THD * thd) {
static void tokudb_checkpoint_lock(THD * thd) {
int error;
tokudb_trx_data* trx = NULL;
char status_msg[200]; //buffer of 200 should be a good upper bound.
......@@ -1375,7 +1374,7 @@ cleanup:
return;
}
void tokudb_checkpoint_unlock(THD * thd) {
static void tokudb_checkpoint_unlock(THD * thd) {
int error;
char status_msg[200]; //buffer of 200 should be a good upper bound.
tokudb_trx_data* trx = NULL;
......@@ -1402,10 +1401,7 @@ cleanup:
return;
}
bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * stat_print, enum ha_stat_type stat_type) {
static bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * stat_print, enum ha_stat_type stat_type) {
switch (stat_type) {
case HA_ENGINE_STATUS:
return tokudb_show_engine_status(thd, stat_print);
......@@ -1420,7 +1416,7 @@ static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, con
sql_print_error("%s: %s", db_errpfx, buffer);
}
void tokudb_cleanup_log_files(void) {
static void tokudb_cleanup_log_files(void) {
TOKUDB_DBUG_ENTER("tokudb_cleanup_log_files");
char **names;
int error;
......@@ -1602,7 +1598,9 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
struct st_mysql_storage_engine tokudb_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_user_data_field_info[] = {
{"User Data Size", 8, MYSQL_TYPE_LONGLONG, 0, 0, "user data size", SKIP_OPEN_TABLE },
{"database_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"data_size", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
......@@ -1612,7 +1610,6 @@ static int tokudb_user_data_fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
static int tokudb_user_data_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
int error;
uint64_t data_size;
TABLE *table = tables->table;
// 3938: Get a read lock on the status flag, since we must
......@@ -1623,11 +1620,7 @@ static int tokudb_user_data_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
error = tokudb_get_user_data_size(thd, false, &data_size);
if (error == 0) {
table->field[0]->store(data_size, false);
error = schema_table_store_record(thd, table);
}
error = tokudb_get_user_data_size(table, thd, false);
}
// 3938: unlock the status flag lock
......@@ -1646,10 +1639,12 @@ static int tokudb_user_data_done(void *p) {
return 0;
}
struct st_mysql_information_schema tokudb_user_data_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static struct st_mysql_information_schema tokudb_user_data_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_user_data_exact_field_info[] = {
{"User Data Size", 8, MYSQL_TYPE_LONGLONG, 0, 0, "user data size", SKIP_OPEN_TABLE },
{"database_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"data_size", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
......@@ -1659,7 +1654,6 @@ static int tokudb_user_data_exact_fill_table(THD *thd, TABLE_LIST *tables, Item
static int tokudb_user_data_exact_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
int error;
uint64_t data_size;
TABLE *table = tables->table;
// 3938: Get a read lock on the status flag, since we must
......@@ -1670,11 +1664,7 @@ static int tokudb_user_data_exact_fill_table(THD *thd, TABLE_LIST *tables, COND
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
error = tokudb_get_user_data_size(thd, true, &data_size);
if (error == 0) {
table->field[0]->store(data_size, false);
error = schema_table_store_record(thd, table);
}
error = tokudb_get_user_data_size(table, thd, true);
}
//3938: unlock the status flag lock
......@@ -1693,7 +1683,7 @@ static int tokudb_user_data_exact_done(void *p) {
return 0;
}
struct st_mysql_information_schema tokudb_user_data_exact_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static struct st_mysql_information_schema tokudb_user_data_exact_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
enum { TOKUDB_PLUGIN_VERSION = 0x0400 };
#define TOKUDB_PLUGIN_VERSION_STR "1024"
......
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