nested transactions is starting to get interesting
Had a bit of time at lunch (Rupali is taking English classes these days) and worked on cachfile initialization. Each record in the before-image file contains the overall transaction id, the block number and the before image.
First I read until the tran id changes, then read backwards and apply the before images to the file. I suspect that this reverse application should have been done before, so I may have uncovered a bug.
I'm starting to understand the complexities of nested transactions. I'll need to maintain a stack of before image start/end pointers, one layer for each nested transaction. Then when a nested transaction aborts, you apply (again, in reverse order) the before images for that transaction only.
Where it could get tricky is in deciding when to flush to disk. With a nested transaction, you've got to create a second before image record if a record is changed by both the outer and inner transaction. Now before images can be buffered in RAM (makes things much faster), only so long as you have not written any changes to the primary file. And you need to be sure that all the before images for a transaction are written out before any before images are written for a nested transaction. On the other hand, once a transaction completes, the associated before images, if still buffered, can now be associated with the before images of the outer transaction, and in the process, you can purge any duplicates. Uh, what was that?
There's fun, but this is sounding too much like work. Did I say I'd be done this by tomorrow?
Bill
0 Comments:
Post a Comment
<< Home