lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Rodriguez <>
Subject Are index updates ATOMIC or not?
Date Tue, 19 Oct 2004 21:55:11 GMT

First: I have read before a comment from Doug Cuttling saying that
"all index updates are atomic". Is this true? It looks like a bunch of
files are manipulated and in the end a rename of a file is done, which
"commits" the operation. If the operation is interrupted before it is
commited then it is just lost completely (and if any new files were
created they will be just silently overwritten). This makes the
operations atomic.

Am I correct about this?

Second: in FSDirectory.renameFile() there is a comment saying this
operation should be atomic. And that it is NOT currently atomic
because its implemented by a delete followed by a rename or copy
INSTEAD of just a simple rename (which is atomic in most file
systems). It looks as if 1. there is a "" that is created
and 2. it is renamed to "segments" (or deleted and copied).

Now, if there is a crash between the file being deleted and copied...
a comment says "we are screwed up". But what does screw up mean? Why
isnt the standard "crash recovery" just rename the file?
I mean, why not doing the following:

if there is a "segments", do nothing.
if there is no "segments" but there is a "" then rename it
to "segments".

Christian Rodriguez

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message