Commit 03faa214 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1097

back out analyze table for this release

git-svn-id: file:///svn/mysql/tokudb-engine/src@11531 c7de825b-a66e-492c-adef-691d508d4ae1
parent e35d1662
...@@ -3837,14 +3837,6 @@ void ha_tokudb::position(const uchar * record) { ...@@ -3837,14 +3837,6 @@ void ha_tokudb::position(const uchar * record) {
// //
int ha_tokudb::info(uint flag) { int ha_tokudb::info(uint flag) {
TOKUDB_DBUG_ENTER("ha_tokudb::info %p %d %lld", this, flag, share->rows); TOKUDB_DBUG_ENTER("ha_tokudb::info %p %d %lld", this, flag, share->rows);
int error = 0;
DB_TXN* txn = NULL;
error = db_env->txn_begin(db_env, 0, &txn, 0);
if (error) {
goto exit;
}
if (flag & HA_STATUS_VARIABLE) { if (flag & HA_STATUS_VARIABLE) {
// Just to get optimizations right // Just to get optimizations right
stats.records = share->rows + share->rows_from_locked_table; stats.records = share->rows + share->rows_from_locked_table;
...@@ -3852,20 +3844,7 @@ int ha_tokudb::info(uint flag) { ...@@ -3852,20 +3844,7 @@ int ha_tokudb::info(uint flag) {
} }
if ((flag & HA_STATUS_CONST)) { if ((flag & HA_STATUS_CONST)) {
for (uint i = 0; i < table_share->keys; i++) { for (uint i = 0; i < table_share->keys; i++) {
DB_BTREE_STAT64 stat64; table->key_info[i].rec_per_key[table->key_info[i].key_parts - 1] = 0;
u_int64_t rec_per_key = 0;
error = share->key_file[i]->stat64(
share->key_file[i],
txn,
&stat64
);
if (error) {
goto exit;
}
rec_per_key = (stat64.bt_nkeys) ? stat64.bt_ndata/stat64.bt_nkeys : 0;
table->key_info[i].rec_per_key[table->key_info[i].key_parts - 1] =
(table->key_info[i].flags & HA_CLUSTERING) ? 0 : (ulong)rec_per_key;
} }
} }
/* Don't return key if we got an error for the internal primary key */ /* Don't return key if we got an error for the internal primary key */
...@@ -3877,14 +3856,7 @@ int ha_tokudb::info(uint flag) { ...@@ -3877,14 +3856,7 @@ int ha_tokudb::info(uint flag) {
struct system_variables *variables= &thd->variables; struct system_variables *variables= &thd->variables;
stats.auto_increment_value = share->last_auto_increment + variables->auto_increment_increment; stats.auto_increment_value = share->last_auto_increment + variables->auto_increment_increment;
} }
error = 0; TOKUDB_DBUG_RETURN(0);
exit:
if (txn) {
int r;
r = txn->commit(txn, 0);
assert(!r);
}
TOKUDB_DBUG_RETURN(error);
} }
// //
...@@ -5432,13 +5404,51 @@ void ha_tokudb::print_error(int error, myf errflag) { ...@@ -5432,13 +5404,51 @@ void ha_tokudb::print_error(int error, myf errflag) {
handler::print_error(error, errflag); handler::print_error(error, errflag);
} }
#if 0 // QQQ use default
// //
// This function will probably need to be redone from scratch // This function will probably need to be redone from scratch
// if we ever choose to implement it // if we ever choose to implement it
// //
int ha_tokudb::analyze(THD * thd, HA_CHECK_OPT * check_opt) { int ha_tokudb::analyze(THD * thd, HA_CHECK_OPT * check_opt) {
return info(HA_STATUS_CONST | HA_STATUS_VARIABLE); uint i;
DB_BTREE_STAT *stat = 0;
DB_TXN_STAT *txn_stat_ptr = 0;
tokudb_trx_data *trx = (tokudb_trx_data *) thd->ha_data[tokudb_hton->slot];
DBUG_ASSERT(trx);
for (i = 0; i < table_share->keys; i++) {
if (stat) {
free(stat);
stat = 0;
}
if ((key_file[i]->stat) (key_file[i], trx->all, (void *) &stat, 0))
goto err;
share->rec_per_key[i] = (stat->bt_ndata / (stat->bt_nkeys ? stat->bt_nkeys : 1));
}
/* A hidden primary key is not in key_file[] */
if (hidden_primary_key) {
if (stat) {
free(stat);
stat = 0;
}
if ((file->stat) (file, trx->all, (void *) &stat, 0))
goto err;
}
pthread_mutex_lock(&share->mutex);
share->status |= STATUS_TOKUDB_ANALYZE; // Save status on close
share->version++; // Update stat in table
pthread_mutex_unlock(&share->mutex);
update_status(share, table); // Write status to file
if (stat)
free(stat);
return ((share->status & STATUS_TOKUDB_ANALYZE) ? HA_ADMIN_FAILED : HA_ADMIN_OK);
err:
if (stat)
free(stat);
return HA_ADMIN_FAILED;
} }
#endif
// //
// flatten all DB's in this table, to do so, just do a full scan on every DB // flatten all DB's in this table, to do so, just do a full scan on every DB
......
...@@ -327,7 +327,9 @@ public: ...@@ -327,7 +327,9 @@ public:
int delete_table(const char *name); int delete_table(const char *name);
int rename_table(const char *from, const char *to); int rename_table(const char *from, const char *to);
int optimize(THD * thd, HA_CHECK_OPT * check_opt); int optimize(THD * thd, HA_CHECK_OPT * check_opt);
#if 0
int analyze(THD * thd, HA_CHECK_OPT * check_opt); int analyze(THD * thd, HA_CHECK_OPT * check_opt);
#endif
int write_row(uchar * buf); int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data); int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const uchar * buf); int delete_row(const uchar * buf);
......
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