Commit 82a43c14 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3129 fix recover of insert multiple and delete multiple with a valid source filenum closes[t:3129]

git-svn-id: file:///svn/toku/tokudb@26506 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1e068378
...@@ -839,16 +839,18 @@ static int toku_recover_enq_insert_multiple (struct logtype_enq_insert_multiple ...@@ -839,16 +839,18 @@ static int toku_recover_enq_insert_multiple (struct logtype_enq_insert_multiple
if (r == 0) if (r == 0)
src_db = tuple->brt->db; src_db = tuple->brt->db;
else else
do_inserts = FALSE; // src file was probably deleted do_inserts = FALSE; // src file was probably deleted, #3129
} }
} }
if (do_inserts) {
DBT src_key, src_val, dest_key, dest_val; DBT src_key, src_val, dest_key, dest_val;
toku_fill_dbt(&src_key, l->src_key.data, l->src_key.len); toku_fill_dbt(&src_key, l->src_key.data, l->src_key.len);
toku_fill_dbt(&src_val, l->src_val.data, l->src_val.len); toku_fill_dbt(&src_val, l->src_val.data, l->src_val.len);
toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC); toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC);
toku_init_dbt_flags(&dest_val, DB_DBT_REALLOC); toku_init_dbt_flags(&dest_val, DB_DBT_REALLOC);
for (uint32_t file = 0; do_inserts && file < l->dest_filenums.num; file++) { for (uint32_t file = 0; file < l->dest_filenums.num; file++) {
struct file_map_tuple *tuple = NULL; struct file_map_tuple *tuple = NULL;
r = file_map_find(&renv->fmap, l->dest_filenums.filenums[file], &tuple); r = file_map_find(&renv->fmap, l->dest_filenums.filenums[file], &tuple);
if (r==0) { if (r==0) {
...@@ -869,8 +871,10 @@ static int toku_recover_enq_insert_multiple (struct logtype_enq_insert_multiple ...@@ -869,8 +871,10 @@ static int toku_recover_enq_insert_multiple (struct logtype_enq_insert_multiple
toku_init_dbt_flags(&dest_val, DB_DBT_REALLOC); toku_init_dbt_flags(&dest_val, DB_DBT_REALLOC);
} }
} }
if (dest_key.data) toku_free(dest_key.data); //TODO: #2321 May need windows hack if (dest_key.data) toku_free(dest_key.data); //TODO: #2321 May need windows hack
if (dest_val.data) toku_free(dest_val.data); //TODO: #2321 May need windows hack if (dest_val.data) toku_free(dest_val.data); //TODO: #2321 May need windows hack
}
return 0; return 0;
} }
...@@ -897,16 +901,17 @@ static int toku_recover_enq_delete_multiple (struct logtype_enq_delete_multiple ...@@ -897,16 +901,17 @@ static int toku_recover_enq_delete_multiple (struct logtype_enq_delete_multiple
if (r == 0) if (r == 0)
src_db = tuple->brt->db; src_db = tuple->brt->db;
else else
do_deletes = FALSE; // src file was probably deleted do_deletes = FALSE; // src file was probably deleted, #3129
} }
} }
if (do_deletes) {
DBT src_key, src_val, dest_key; DBT src_key, src_val, dest_key;
toku_fill_dbt(&src_key, l->src_key.data, l->src_key.len); toku_fill_dbt(&src_key, l->src_key.data, l->src_key.len);
toku_fill_dbt(&src_val, l->src_val.data, l->src_val.len); toku_fill_dbt(&src_val, l->src_val.data, l->src_val.len);
toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC); toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC);
for (uint32_t file = 0; do_deletes && file < l->dest_filenums.num; file++) { for (uint32_t file = 0; file < l->dest_filenums.num; file++) {
struct file_map_tuple *tuple = NULL; struct file_map_tuple *tuple = NULL;
r = file_map_find(&renv->fmap, l->dest_filenums.filenums[file], &tuple); r = file_map_find(&renv->fmap, l->dest_filenums.filenums[file], &tuple);
if (r==0) { if (r==0) {
...@@ -923,7 +928,9 @@ static int toku_recover_enq_delete_multiple (struct logtype_enq_delete_multiple ...@@ -923,7 +928,9 @@ static int toku_recover_enq_delete_multiple (struct logtype_enq_delete_multiple
toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC); toku_init_dbt_flags(&dest_key, DB_DBT_REALLOC);
} }
} }
if (dest_key.flags & DB_DBT_REALLOC && dest_key.data) toku_free(dest_key.data); //TODO: #2321 May need windows hack if (dest_key.flags & DB_DBT_REALLOC && dest_key.data) toku_free(dest_key.data); //TODO: #2321 May need windows hack
}
return 0; return 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