Commit 0b1ccfc1 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

put the status update cursor inside of a transaction. close #426

git-svn-id: file:///svn/mysql/tokudb-engine/src@2353 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4dfbf205
...@@ -1088,25 +1088,32 @@ void ha_tokudb::get_status() { ...@@ -1088,25 +1088,32 @@ void ha_tokudb::get_status() {
} }
if (!(share->status & STATUS_ROW_COUNT_INIT) && share->status_block) { if (!(share->status & STATUS_ROW_COUNT_INIT) && share->status_block) {
share->org_rows = share->rows = table_share->max_rows ? table_share->max_rows : HA_TOKUDB_MAX_ROWS; share->org_rows = share->rows = table_share->max_rows ? table_share->max_rows : HA_TOKUDB_MAX_ROWS;
if (!share->status_block->cursor(share->status_block, 0, &cursor, 0)) { DB_TXN *transaction = 0;
DBT row; int r = db_env->txn_begin(db_env, 0, &transaction, 0);
char rec_buff[64]; if (r == 0) {
bzero((void *) &row, sizeof(row)); r = share->status_block->cursor(share->status_block, transaction, &cursor, 0);
bzero((void *) &last_key, sizeof(last_key)); if (r == 0) {
row.data = rec_buff; DBT row;
row.ulen = sizeof(rec_buff); char rec_buff[64];
row.flags = DB_DBT_USERMEM; bzero((void *) &row, sizeof(row));
if (!cursor->c_get(cursor, &last_key, &row, DB_FIRST)) { bzero((void *) &last_key, sizeof(last_key));
uint i; row.data = rec_buff;
uchar *pos = (uchar *) row.data; row.ulen = sizeof(rec_buff);
share->org_rows = share->rows = uint4korr(pos); row.flags = DB_DBT_USERMEM;
pos += 4; if (!cursor->c_get(cursor, &last_key, &row, DB_FIRST)) {
for (i = 0; i < table_share->keys; i++) { uint i;
share->rec_per_key[i] = uint4korr(pos); uchar *pos = (uchar *) row.data;
share->org_rows = share->rows = uint4korr(pos);
pos += 4; pos += 4;
for (i = 0; i < table_share->keys; i++) {
share->rec_per_key[i] = uint4korr(pos);
pos += 4;
}
} }
cursor->c_close(cursor);
} }
cursor->c_close(cursor); r = transaction->commit(transaction, 0);
transaction = 0;
} }
cursor = 0; cursor = 0;
} }
......
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