[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] small dbcheck patch for mysql

In response to Marc Schiffbauer <marc@xxxxxxxxxxxxxxx>:

> * Dan Langille schrieb am 09.09.08 um 22:15 Uhr:
> > Marc Schiffbauer wrote:
> > > * Bill Moran schrieb am 09.09.08 um 19:41 Uhr:
> > >> The canonical way to solve this would be to keep a reference counter in
> > >> the filename/path tables that keeps track of how many file entries
> > >> reference that row.  When it's hits 0, it can be deleted.  But this
> > >> creates other issues:
> > >> 1) What is the overhead of maintaining the reference counter?
> > >> 2) In the case of a crash, we _must_ fix all reference counters immediately,
> > >>    otherwise records could be deleted that still need to be used.
> > >>
> > >> Referential integrity doesn't even gain us much here, as that only
> > >> guarantees that records can't be created that don't have proper
> > >> references, it doesn't automatically clean up after deletes.
> > > 
> > > AFAIK it does work if the database is properly created, not?
> > > (with foreign keys)
> > 
> > What are you talking about?  :)  Please elaborate.
> I was talking about constraints that let the database delete records
> that would otherwise be "orphaned" records.
> Would this be to much of a performance impact?
> Or did I not get the point? :)

1) Not supported by all platforms that Bacula supports (unless the project
   has already dropped support for slightly older MySQL versions?)
2) Doesn't solve the problem anyway.  CASCADE will delete child records
   (file) when parent records (filename) are deleted.  The orphan problem
   is the reverse and no SQL engine I'm aware of does that because it
   requires exactly the sort of reference counting overhead that I
   described earlier.

Bill Moran
Collaborative Fusion Inc.

Phone: 412-422-3463x4023

This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Bacula-devel mailing list

This mailing list archive is a service of Copilot Consulting.