Commit e9f17601 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5500 fix bug related to cleanup


git-svn-id: file:///svn/toku/tokudb@48323 c7de825b-a66e-492c-adef-691d508d4ae1
parent c6d3bf14
...@@ -477,7 +477,7 @@ static int ...@@ -477,7 +477,7 @@ static int
toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t flags) { toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t flags) {
HANDLE_PANICKED_DB(db); HANDLE_PANICKED_DB(db);
HANDLE_DB_ILLEGAL_WORKING_PARENT_TXN(db, txn); HANDLE_DB_ILLEGAL_WORKING_PARENT_TXN(db, txn);
int r; int r = 0;
TOKUTXN ttxn = txn ? db_txn_struct_i(txn)->tokutxn : NULL; TOKUTXN ttxn = txn ? db_txn_struct_i(txn)->tokutxn : NULL;
DBT old_descriptor; DBT old_descriptor;
bool is_db_hot_index = ((flags & DB_IS_HOT_INDEX) != 0); bool is_db_hot_index = ((flags & DB_IS_HOT_INDEX) != 0);
...@@ -500,8 +500,10 @@ toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t f ...@@ -500,8 +500,10 @@ toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t f
if (r != 0) { goto cleanup; } if (r != 0) { goto cleanup; }
} }
// TODO: use toku_clone_dbt(&old-descriptor, db->descriptor);
old_descriptor.size = db->descriptor->dbt.size; old_descriptor.size = db->descriptor->dbt.size;
old_descriptor.data = toku_memdup(db->descriptor->dbt.data, db->descriptor->dbt.size); old_descriptor.data = toku_memdup(db->descriptor->dbt.data, db->descriptor->dbt.size);
toku_ft_change_descriptor( toku_ft_change_descriptor(
db->i->ft_handle, db->i->ft_handle,
&old_descriptor, &old_descriptor,
...@@ -518,7 +520,9 @@ toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t f ...@@ -518,7 +520,9 @@ toku_db_change_descriptor(DB *db, DB_TXN* txn, const DBT* descriptor, uint32_t f
toku_lt_update_descriptor(db->i->lt, db->cmp_descriptor); toku_lt_update_descriptor(db->i->lt, db->cmp_descriptor);
} }
cleanup: cleanup:
if (old_descriptor.data) toku_free(old_descriptor.data); if (old_descriptor.data) {
toku_free(old_descriptor.data);
}
return r; return r;
} }
......
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