Commit 02c6f5bb authored by Rich Prohaska's avatar Rich Prohaska

#221 fix tokudb::estimate_num_rows

parent cae1d71b
...@@ -1706,7 +1706,7 @@ int ha_tokudb::initialize_share( ...@@ -1706,7 +1706,7 @@ int ha_tokudb::initialize_share(
} }
share->ref_length = ref_length; share->ref_length = ref_length;
error = estimate_num_rows(share->file,&num_rows, txn); error = estimate_num_rows(share->file, &num_rows, txn);
// //
// estimate_num_rows should not fail under normal conditions // estimate_num_rows should not fail under normal conditions
// //
...@@ -1916,7 +1916,6 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) { ...@@ -1916,7 +1916,6 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
// //
int ha_tokudb::estimate_num_rows(DB* db, uint64_t* num_rows, DB_TXN* txn) { int ha_tokudb::estimate_num_rows(DB* db, uint64_t* num_rows, DB_TXN* txn) {
int error = ENOSYS; int error = ENOSYS;
DBC* crsr = NULL;
bool do_commit = false; bool do_commit = false;
DB_BTREE_STAT64 dict_stats; DB_BTREE_STAT64 dict_stats;
DB_TXN* txn_to_use = NULL; DB_TXN* txn_to_use = NULL;
...@@ -1930,21 +1929,12 @@ int ha_tokudb::estimate_num_rows(DB* db, uint64_t* num_rows, DB_TXN* txn) { ...@@ -1930,21 +1929,12 @@ int ha_tokudb::estimate_num_rows(DB* db, uint64_t* num_rows, DB_TXN* txn) {
txn_to_use = txn; txn_to_use = txn;
} }
error = db->stat64( error = db->stat64(db, txn_to_use, &dict_stats);
share->file,
txn_to_use,
&dict_stats
);
if (error) { goto cleanup; } if (error) { goto cleanup; }
*num_rows = dict_stats.bt_ndata; *num_rows = dict_stats.bt_ndata;
error = 0; error = 0;
cleanup: cleanup:
if (crsr != NULL) {
int r = crsr->c_close(crsr);
assert(r==0);
crsr = NULL;
}
if (do_commit) { if (do_commit) {
commit_txn(txn_to_use, 0); commit_txn(txn_to_use, 0);
txn_to_use = NULL; txn_to_use = NULL;
......
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