--- Charles Cazabon <[EMAIL PROTECTED]> wrote: > I'm using sqlite (through the pysqlite wrapper, but this behaviour seems > unrelated to the wrapper) in an application on various platforms. One process > create an sqlite database and starts writing data to it; another process opens > the sqlite database and reads from it. > > On most platforms, the reader sees new data appear in the database > periodically as the writer creates new records. But on Solaris, the reader > never sees any updates -- it only ever sees whatever data was in the database > when the reader first opened it, even though the writer is continuing to > insert new data periodically. > > I've seen similar behaviour with non-database files on Solaris -- writes to a > file across processes aren't seen by the reader unless the reader supplies the > O_RSYNC flag to the open(2) call. It seems to be a Solaris peculiarity, as I > don't see this behaviour on Linux, *BSD, or other commercial Unices. > > I've looked at the sqlite source code, and it does not appear to be supplying > the O_RSYNC or O_SYNC flags to open(2).
I thought that SQLite's use of fdatasync on Solaris should be enough to synchronize reads and writes from various processes: The fdatasync() function forces all currently queued I/O operations associated with the file indicated by file descriptor fildes to the synchronized I/O completion state. The functionality is as described for fsync(3C) (with the symbol _XOPEN_REALTIME defined), with the exception that all I/O operations are completed as defined for synchronised I/O data integrity completion. As far as I know, this ought to have the same effect as O_RSYNC: O_RSYNC If this flag is set, reading the data will block until any pending writes which affect the data are complete. Consider the situation where we want to read a block of data, which another process is updating. If this flag is not set, it is indeterminate whether the data returned will be that which is on the disk, or that which is scheduled to be written. Can you confirm that the pysqlite wrapper that you're using compiled sqlite with fdatasync? nm your_python_sqlite_wrapper.so | grep fdatasync or nm sqlite3.so | grep fdatasync ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------