Re: implementing a database log



Paul,

thanks for your comments

On Apr 22, 1:56 am, paul c <toledoby...@xxxxxxxx> wrote:
Christoph Rupp wrote:
Hi,

i'm the author of a simple open-source database engine. i'm currently
adding recovery/logging, and i have some practical questions about the
implementation.

I have 3 options.

1. a physical log based on modified pages - whenever a page is
modified, a before/after image is stored in the log.
pro: easy to implement and to test
con: logfile will become huge!

2. a physical log based on modified bytes - whenever a database key or
record is modified, only the modified bytes in the file are logged.
pro: logfile is slim, very fine-grained control
con: tedious to implement, error prone, difficult to test

3. a logical logging - information about the high-level operation is
stored in the logfile. honestly, i don't know how i could implement
this, since one high-level operation is often splitted into several
physical operations, and if one of them fails i am not sure about the
consequences...

currently, i'm going with 2), but as i wrote above, it's hard to
implement and i'm not happy with the way i'm going.

what would you recommend?

thanks for your opinions,
chris

Several advantages of logical logging, not the only ones, I'm sure:

1) Likely more insensitive to future changes in physical
organization/operations.

2) Potential to reconstruct old db values with additional constraints
applied (I don't know how many times this would have avoided much more
awkward surprise requirements).

3) Ability to shadow via another physical db, eg., for read-only audit
or various performance requirements (my favourite advantage, maybe most
people would favour #1.)

I totally agree that logical logging is easy to implement (just dump
some function calls to the log), and all your points are valid.

i.e. if there's an insert(a, b), just write the information to the
logfile, and then during recovery repeat this operation. but that's
also my problem: my code base is not able to repeat an operation if
the database is corrupt. (and i don't think it has to work with a
corrupted database).

so i don't know how to implement this. i'd be curious if any database
uses logical logging - i think it's nice in theory, but just too
difficult to implement...
.



Relevant Pages

  • Re: Need Some Quick SBS/Exchange Help!
    ... This logfile has been damaged and is unusable. ... Information Store First Storage Group: Corruption was detected during ... about only 14mb free space in the Exchange database so I think I am bucking ...
    (microsoft.public.windows.server.sbs)
  • Re:logfiles grow non-stop in SQL2000
    ... this is a production database. ... managed to do it to have a huge logfile and huge logfile backup!!! ... "Hari Prasad" wrote: ... > If you do not have the 65 G to take a backup or if you do not want the transaction log backup. ...
    (microsoft.public.sqlserver.setup)
  • transaction logfile very large, how to truncate?
    ... I have a database on ms sql server 2000. ... The database data file is about 5 megs and the logfile ... I've tried runing commands like "dbcc shrinkfile" and "dbcc shrinkdatabase" ...
    (microsoft.public.sqlserver.programming)
  • Error message on startup in XP pro
    ... I am receiving this error message upon entry into Windows XP pro. ... Catalog Database Error -1811 occurred while opening ...
    (microsoft.public.windowsxp.general)
  • transaction logfile very large, how to truncate?
    ... I have a database on ms sql server 2000. ... The database data file is about 5 megs and the logfile ... I've tried runing commands like "dbcc shrinkfile" and "dbcc shrinkdatabase" ...
    (microsoft.public.sqlserver.server)

Loading