Hi,

> I've taken a look at the flushRedoLog method in the DiskFile. I may be
> wrong, but could you explain how it supposed to work.

It is first writing all deleted blocks, and then the blocks that are
not deleted. However for a given position, only the last entry is
written.

> If my log
> contains and INSERT/UPDATE for a given record followed by the DELETE
> for the same record then it seems like the log recovery would apply
> the DELETE operation first and then follow that by the UPDATE/INSERT.
> Would that not break the correct sequence and corrupt the data ?

No, because the INSERT/UPDATE is not written:

>  // now write the last entry, skipping deleted entries
>  for (int i = 0; i < redoBuffer.size(); i++) {
>      if (last != null && entry.recordId != last.recordId) {

If the deleted entry was already written, don't overwrite it:

>          if (last.data != null) {
>              writeRedoLog(last);

The same here:

>  if (last != null && last.data != null) {

Regards,
Thomas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to