BTW, the following is from the SQLite3 docs on locking.  Much of it
applies to SQLite2 as well.

http://sqlite.org/lockingv3.html#how_to_corrupt

"
    If a crash or power failure occurs and results in a hot journal but
    that journal is deleted, the next process to open the database will
    not know that it contains changes that need to be rolled back. The
    rollback will not occur and the database will be left in an
    inconsistent state.  Rollback journals might be deleted for any
    number of reasons:

        * An administrator might be cleaning up after an OS crash or
          power failure, see the journal file, think it is junk, and
          delete it.
        * Someone (or some process) might rename the database file but
          fail to also rename its associated journal.
        * If the database file has aliases (hard or soft links) and the
          file is opened by a different alias than the one used to
          create the journal, then the journal will not be found. To
          avoid this problem, you should not create links to SQLite
          database files.
        * Filesystem corruption following a power failure might cause
          the journal to be renamed or deleted.

    The last (fourth) bullet above merits additional comment. When
    SQLite creates a journal file on Unix, it opens the directory that
    contains that file and calls fsync() on the directory, in an effort
    to push the directory information to disk. But suppose some other
    process is adding or removing unrelated files to the directory that
    contains the database and journal at the the moment of a power
    failure. The supposedly unrelated actions of this other process
    might result in the journal file being dropped from the directory
    and moved into "lost+found". This is an unlikely scenario, but it
--> could happen. The best defenses are to use a journaling filesystem
--> or to keep the database and journal in a directory by themselves.
"

Well.  SMF does not keep each of its SQLite2 databases in a directory by
themselves.  Specifically it keeps repository.db in /etc/svc/ along with
a number of other files.  I don't know if /etc/svc/ is modified during
shutdown.

Casper,

Is this a clue to the corruption that you've seen?

Nico
-- 

Reply via email to