Commit ae2a011b authored by Rich Prohaska's avatar Rich Prohaska

#232 fix indexer progress callback to estimate number of rows with stat64

parent 387bfff4
...@@ -699,44 +699,19 @@ abort_indexer(DB_INDEXER *indexer) { ...@@ -699,44 +699,19 @@ abort_indexer(DB_INDEXER *indexer) {
// derived from ha_tokudb::estimate_num_rows // derived from ha_tokudb::estimate_num_rows
static int static int
update_estimated_rows(DB_INDEXER *indexer) { update_estimated_rows(DB_INDEXER *indexer) {
DBT key; toku_init_dbt(&key);
DBT data; toku_init_dbt(&data);
DBC* crsr = NULL;
DB_TXN* txn = NULL;
uint64_t less, equal, greater;
int is_exact;
int error; int error;
DB *db = indexer->i->src_db; DB_TXN *txn = NULL;
DB_ENV *db_env = indexer->i->env; DB_ENV *db_env = indexer->i->env;
error = db_env->txn_begin(db_env, 0, &txn, DB_READ_UNCOMMITTED); error = db_env->txn_begin(db_env, 0, &txn, DB_READ_UNCOMMITTED);
if (error) goto cleanup; if (error == 0) {
DB_BTREE_STAT64 stats;
error = db->cursor(db, txn, &crsr, 0); DB *db = indexer->i->src_db;
if (error) { goto cleanup; } error = db->stat64(db, txn, &stats);
if (error == 0) {
error = crsr->c_get(crsr, &key, &data, DB_FIRST); indexer->i->estimated_rows = stats.bt_ndata;
if (error == DB_NOTFOUND) { }
indexer->i->estimated_rows = 0; txn->commit(txn, 0);
error = 0;
goto cleanup;
}
else if (error) { goto cleanup; }
error = db->key_range64(db, txn, &key,
&less, &equal, &greater,
&is_exact);
if (error) { goto cleanup; }
indexer->i->estimated_rows = equal + greater;
error = 0;
cleanup:
if ( crsr != NULL ) {
int rr = crsr->c_close(crsr);
invariant(rr == 0);
crsr = NULL;
} }
txn->commit(txn, 0);
return error; return error;
} }
......
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