tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: half-atomically rebuild databases
Date: Tue, 03 Jan 2012 13:39:28 +0100	[thread overview]
Message-ID: <4F02F700.1060506@bsd.lv> (raw)
In-Reply-To: <20120101162958.GB5307@iris.usta.de>

> Joerg Sonnenberger wrote on Sun, Jan 01, 2012 at 04:55:08PM +0100:
>> On Sun, Jan 01, 2012 at 04:45:38PM +0100, Ingo Schwarze wrote:
>
>>> This is not perfect because the mandocdb process might get -KILLed
>>> between the two renames, but i don't see a syscall anywhere to
>>> atomically rename *two* files.
>
>> Why do you have to?
>
> There are two files to rename(2):  whatis.{db,index}.
>
>> You can create the new file under temporary name in
>> the same directory and rename it to the normal file name.
>
> That's exactly what the patch i sent does:
> Creating both files under temporary names in the same directory
> and rename both to the normal file names when both are ready.

Hi Ingo,

I don't like this: no matter how we splice it, at some point the files 
will be inconsistent.  I also don't think it's unreasonable to have a 
"bogus" database for a few seconds when they're being rebuilt so long as 
this is documented.

However, if this is a problem scenario, we can just use flock(2) and be 
upfront that the database is inconsistent (apropos_db.c and mandocdb.c 
would need to sync open order) instead of crossing our fingers and 
hoping that they don't dbopen(3) between rename(2)s.

Thoughts?

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2012-01-03 12:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-01 15:45 Ingo Schwarze
2012-01-01 15:55 ` Joerg Sonnenberger
2012-01-01 16:29   ` Ingo Schwarze
2012-01-03 12:39     ` Kristaps Dzonsons [this message]
2012-01-04  0:29       ` Ingo Schwarze
2012-01-03 12:45     ` Joerg Sonnenberger
2012-01-03 13:07       ` Kristaps Dzonsons
2012-01-03 13:19         ` Joerg Sonnenberger
2012-01-03 13:45           ` Kristaps Dzonsons
2012-01-03 13:49             ` Joerg Sonnenberger
2012-01-03 23:59               ` Ingo Schwarze
2012-01-04  0:09             ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F02F700.1060506@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).