Fixed broken block list introduced in hrev44357.
* cache_abort_sub_transaction() was setting the transaction_next pointer to NULL in order to remove a block from a transaction -- however, it forgot to actually remove it from the transaction's block list. * Minor restructuring.
This commit is contained in:
+21
-9
@@ -3035,6 +3035,7 @@ cache_abort_sub_transaction(void* _cache, int32 id)
|
|||||||
// revert all changes back to the version of the parent
|
// revert all changes back to the version of the parent
|
||||||
|
|
||||||
cached_block* block = transaction->first_block;
|
cached_block* block = transaction->first_block;
|
||||||
|
cached_block* last = NULL;
|
||||||
cached_block* next;
|
cached_block* next;
|
||||||
for (; block != NULL; block = next) {
|
for (; block != NULL; block = next) {
|
||||||
next = block->transaction_next;
|
next = block->transaction_next;
|
||||||
@@ -3046,21 +3047,32 @@ cache_abort_sub_transaction(void* _cache, int32 id)
|
|||||||
ASSERT(block->original_data != NULL);
|
ASSERT(block->original_data != NULL);
|
||||||
memcpy(block->current_data, block->original_data,
|
memcpy(block->current_data, block->original_data,
|
||||||
cache->block_size);
|
cache->block_size);
|
||||||
|
|
||||||
|
if (last != NULL)
|
||||||
|
last->transaction_next = next;
|
||||||
|
else
|
||||||
|
transaction->first_block = next;
|
||||||
|
|
||||||
block->transaction_next = NULL;
|
block->transaction_next = NULL;
|
||||||
block->transaction = NULL;
|
block->transaction = NULL;
|
||||||
if (block->previous_transaction == NULL)
|
if (block->previous_transaction == NULL)
|
||||||
block->is_dirty = false;
|
block->is_dirty = false;
|
||||||
} else if (block->parent_data != block->current_data) {
|
} else {
|
||||||
// The block has been changed and must be restored - the block
|
if (block->parent_data != block->current_data) {
|
||||||
// is still dirty and part of the transaction
|
// The block has been changed and must be restored - the block
|
||||||
TRACE(("cache_abort_sub_transaction(id = %ld): restored contents "
|
// is still dirty and part of the transaction
|
||||||
"of block %Ld\n", transaction->id, block->block_number));
|
TRACE(("cache_abort_sub_transaction(id = %ld): restored "
|
||||||
memcpy(block->current_data, block->parent_data, cache->block_size);
|
"contents of block %Ld\n", transaction->id,
|
||||||
cache->Free(block->parent_data);
|
block->block_number));
|
||||||
// The block stays dirty
|
memcpy(block->current_data, block->parent_data,
|
||||||
|
cache->block_size);
|
||||||
|
cache->Free(block->parent_data);
|
||||||
|
// The block stays dirty
|
||||||
|
}
|
||||||
|
block->parent_data = NULL;
|
||||||
|
last = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
block->parent_data = NULL;
|
|
||||||
block->discard = false;
|
block->discard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user