Re: [sqlite] [Question]SQLite cannot remove journal file as soon as UPDATE transaction finishes?

2016-07-11 Thread Dan Kennedy

On 07/11/2016 11:18 AM, 刘翔 wrote:

Dear SQLite developers,

Sqlite version: 3.8.8.3
Linux version: 3.10.31-ltsi

Question:
We found when updated a sqlite database in emmc disk, it cannot remove 
journal file as soon as the transaction finished.
We know after the transaction finishes, SQLite will unlink the journal 
file.
But when we update a database and shut down in about 2~3s, the journal 
file still exists after system startups.
It seems unlink() file would not remove it immediately, until kernel 
call sync() to flush disk.
So, does this correspond to SQLite's design? Or could you give me some 
suggestion how to remove the journal file quickly.


With version 3.11.0 or greater, either building with 
-DSQLITE_EXTRA_DURABLE or execute "PRAGMA synchronous=EXTRA" after 
connecting to the database causes SQLite to sync the directory after 
deleting the rollback journal.


With older versions, using "PRAGMA journal_mode=PERSIST" or "PRAGMA 
journal_mode=TRUNCATE" provides the same level of durability.


Dan.

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [Question]SQLite cannot remove journal file as soon as UPDATE transaction finishes?

2016-07-10 Thread Rowan Worth
On 11 July 2016 at 12:18, 刘翔  wrote:

> Dear SQLite developers,
>
> Sqlite version: 3.8.8.3
> Linux version: 3.10.31-ltsi
>
> Question:
> We found when updated a sqlite database in emmc disk, it cannot remove
> journal file as soon as the transaction finished.
> We know after the transaction finishes, SQLite will unlink the journal
> file.
> But when we update a database and shut down in about 2~3s, the journal
> file still exists after system startups.
> It seems unlink() file would not remove it immediately, until kernel call
> sync() to flush disk.
>

You can't be sure that unlink() has been committed to disk until the
_directory_ containing the file has been synced. SQLite does not sync the
directory at every transaction, unless you specify "PRAGMA synchronous =
EXTRA".

It may make more sense to sync the whole disk as part of your shutdown
process.
-Rowan
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] [Question]SQLite cannot remove journal file as soon as UPDATE transaction finishes?

2016-07-10 Thread 刘翔

Dear SQLite developers,

Sqlite version: 3.8.8.3
Linux version: 3.10.31-ltsi

Question:
We found when updated a sqlite database in emmc disk, it cannot remove 
journal file as soon as the transaction finished.

We know after the transaction finishes, SQLite will unlink the journal file.
But when we update a database and shut down in about 2~3s, the journal 
file still exists after system startups.
It seems unlink() file would not remove it immediately, until kernel 
call sync() to flush disk.
So, does this correspond to SQLite's design? Or could you give me some 
suggestion how to remove the journal file quickly.



Cordially yours

LiuXiang
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users