On 09/11/2012 02:22 PM, Yongil Jang wrote:
Please, don't forget my questions.

2012/9/10 Yongil Jang<yongilj...@gmail.com>

Dear sqlite-users,

I have a question about directory sync.

Question: In case of journal file already exists on disk with persist
journal mode,
                does it necessary to sync directory for first
fsync(unixSync) call?

AFAIK, directory sync should be called when a file is created or deleted.
Does it mean that calling directory sync doesn't necessary for existing
files?

I think you're right, in persistent journal mode once the file
has been created the second and subsequent fsync() calls are
redundant.

Did removing the extra fsync() calls produce any performance
improvement?

In general, SQLite can't use this trick because in a multi-process
environment there is no way to tell if an existing journal file has
already been synced to disk (e.g. the process that created it may
have crashed before calling fsync(), or it may have been created by
a process running with synchronous=off). But if this does produce a
performance improvement, perhaps we could do something in
locking_mode=EXCLUSIVE mode.



When I tested it with 1,000 insert queries, about 1,000 fsync calls were
decreased on persist journal mode.
To compare this, I just changed "unixOpen" function as like as follows.

   int syncDir = 0;
   if(isCreate&&  (eType==SQLITE_OPEN_MASTER_JOURNAL ||
eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_WAL))
   {
     int exists = 0;
     unixAccess(pVfs, zPath, SQLITE_ACCESS_EXISTS,&exists);
     if(!exists) {
       syncDir = 1;
     }
   }

Thank you for reading this message.

Best regards,
YongIl Jang


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to