[haiku-gsoc] Re: Handling Device Unmounting

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Thu, 09 Jul 2009 09:00:40 +0200 CEST

Ankur Sethi <get.me.ankur@xxxxxxxxx> wrote:
> As of now, unmounting a volume while Beacon is running will 
> inevitably
> cause the index on the volume to become corrupted (CLucene indexes
> become completely unusable if they are not close()d). To fix this, 
> the
> indexer must have a chance to write to the volume before it is
> unmounted. What I really need is a way to achieve this:
> 
> 1. The user chooses to unmount a volume from Tracker.
> 2. Before the volume is unmounted, a notification is sent to the 
> indexer.
> 3. There is a slight delay as the indexer closes the index on the 
> volume.
> 4. The volume is unmounted.
> 
> The indexer could also close() the index after every write. That 
> would
> be inefficient performance wise, but safer if either the indexer or
> the OS crashes.

Unmounting is only one problem as you point out - power loss, and other 
currently not so uncommon OS failures are quite important, too. Since 
you cannot know that those will happen beforehand, that's obviously not 
the way to solve these problems.

The only thing that really does the trick is to use transactional 
writing, that's how databases do it, and that's how you should do it, 
too. If that's too much work for now, there is still the possibility to 
postpone that particular problem a bit.

Bye,
   Axel.


Other related posts: