[Rhythmbox-devel] Re: Syncing the RhythmDB on every update



On Mon, Feb 16, 2004 at 01:36:50AM -0500, Colin Walters wrote:
> On Sun, 2004-02-15 at 23:16, Andreas Bombe wrote:
> > I want to get that sorted out.  The database really should be saved to
> > disk on every change immediately (including rating changes).
> 
> The biggest problem with this is larger libraries - it can take as long
> as 5 seconds to save here with 20000 songs; the XML file is over 10
> megs.  Doing that much I/O every time the user wants to rate a song is a
> bit much.

Which is just a strong hint that using an XML backend (or any other
non-random access backend) is wholly inadequate, not that syncing the
library instantly is not the very right thing to do.

What would speak against a gdbm backend, apart from the additional
library dependency?

> I think it would be easier to just have a thread which sits around and
> checks whether the db is dirty or not, and if it is, saves it.  You
> could do this just with a boolean and a mutex/condition pair inside
> rhythmdb.c, and another thread dedicated to saving.
> 
> That way you wouldn't have to change code elsewhere in rb.

This solution would be rather XML (or generally non-random access
backend) specific.  Probably we should stop using XML as the working
database backend and demote it to an export database that is dumped on
shutdown only.

That way we'd have an up-to-date template to initialize newly
implemented backends.  If we have gdbm and someone implements SQL, the
SQL Rhythmbox wouldn't have to have gdbm compiled in to initialize the
SQL database, for example.  No hassles with data conversions on upgrades
and downgrades that way.

-- 
Andreas Bombe <bombe@informatik.tu-muenchen.de>    GPG key 0x04880A44



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