dibyendumajumdar/simpledbm

The recovery of create container operation is not correct

Closed this issue · 2 comments

SimpleDBM logs container create operations in the following way:

1. Encloses the operation in a nested top action.
2. Logs the creation of the container against the page 0 in virtual 
container 0.
3. Generates an open container log record immediately after logging the 
create operation. This is done because SimpleDBM uses the checkpoint record 
to track open containers, and if a container is created after the last 
checkpoint, and there is a crash, then the container would not appear in 
the checkpoint record and therefore will not be opened. The open container 
log enables the container to be opened after a crash.
4. Above poses a problem in the scenario where a container is dropped after 
being created, because in that case, if the container is physically 
deleted, then during restart recovery the open operation will fail. As a 
workaround for this, the current implementation does not physically delete 
a container.
5. The current implementation cannot distinguish if the same container is 
created and dropped multiple times. 

Above problems can be resolved by making the following changes:

a) When an open container operation is found during the restart analysis 
phase, make a note of the LSN - cache the LSN and container id.
b) If a drop container operation is subsequently found, remove the 
container id from the cache.
c) During restart redo, when an open container is encountered, check the 
LSN of the log record against the remembered LSN. If the LSN isn't in the 
cache or if the LSN is lower than the open container log record, then skip 
the log record.
d) The nested top action needs to be removed because the operation should 
be undone in case of a rollback.

Original issue reported on code.google.com by d.majum...@gmail.com on 4 Oct 2009 at 7:25

Fix checked in.

Original comment by d.majum...@gmail.com on 6 Oct 2009 at 9:51

  • Changed state: Started
Fixed in RSS 1.0.16

Original comment by d.majum...@gmail.com on 17 Oct 2009 at 6:10

  • Changed state: Fixed