Re: [sqlite] [BugReport]Data changes cannot actually flush to disk

2016-06-08 Thread r . a . nagy
Some times writes that have been cached will not be written to disk. In code we 
use the flush() to insure changes are made. In the OS we need to be sure that 
the system has been shutdown properly.

.02 ends.


Sent from my iPhone

> On Jun 8, 2016, at 7:20 AM, Simon Slavin  wrote:
> 
> 
>> On 7 Jun 2016, at 8:13am, 刘翔  wrote:
>> 
>> Problem:
>> When update database and power off immediately,
> 
> How soon do you turn the power off ?  Two seconds ?  Ten seconds ?  One 
> minute ?
> 
> What type of hard disk do you have ?  Is it a rotating disk or a solid state 
> drive ?
> 
> Is the drive you have the database on the boot drive of the computer ?
> 
> If you try to make a database on an external drive (Flash drive ?  External 
> rotating drive ?) instead of the drive you were using, do you see the same 
> problem ?
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [BugReport]Data changes cannot actually flush to disk

2016-06-08 Thread Simon Slavin

On 7 Jun 2016, at 8:13am, 刘翔  wrote:

> Problem:
> When update database and power off immediately,

How soon do you turn the power off ?  Two seconds ?  Ten seconds ?  One minute ?

What type of hard disk do you have ?  Is it a rotating disk or a solid state 
drive ?

Is the drive you have the database on the boot drive of the computer ?

If you try to make a database on an external drive (Flash drive ?  External 
rotating drive ?) instead of the drive you were using, do you see the same 
problem ?

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


Re: [sqlite] [BugReport]Data changes cannot actually flush to disk

2016-06-08 Thread Richard Hipp
On 6/7/16, 刘翔  wrote:
> Dear SQLite developers,
>
> Sqlite version: 3.8.8.3
> Linux version: 3.10.31-ltsi
>
> Problem:
> When update database and power off immediately, it cannnot actually make
> changes to database file in the disk.
> Although the HAVE_FDATASYNC comile-time option is true.
> If manually called sync() after executing a SQL statement, it does flush
> the database file to disk.

This is sounds like a hardware or operating system problem.  If I
understand you correctly - fdatasync() is being called but fdatasync()
is not correctly updating the HDD?  Is that right?

SQLite depends on fdatasync() doing what it is suppose to do.  If
fdatasync() misbehaves, there is nothing SQLite can do about that.

What happens if you compile *without* HAVE_FDATASYNC?  Does it work
correctly then?

>
> I think the OSTRACE log can be helpful, so I toke it.
> Could you help to analyse it and tell me why fdatasync() doesn't work?
> 
> LOCK154 SHARED was NONE(NONE,0) pid=2289 (unix)
> LOCK154 SHARED ok (unix)
> READ15416  24 0
> LOCK154 RESERVED was SHARED(SHARED,1) pid=2289 (unix)
> LOCK154 RESERVED ok (unix)
> OPENX   168 /var/user/aaa/bbb.db-journal 0400102
> OPEN168 /var/user/aaa/bbb.db-journal
> WRITE   168   512   0 0
> WRITE   168 4 512 0
> WRITE   168  1024 516 0
> WRITE   168 41540 0
> LOCK154 EXCLUSIVE was RESERVED(RESERVED,1) pid=2289 (unix)
> LOCK154 EXCLUSIVE ok (unix)
> WRITE   168 41544 0
> WRITE   168  10241548 0
> WRITE   168 42572 0
> READ168 03072 0
> SYNC168
> DIRSYNC /var/user/aaa/bbb.db-journal (have_fullfsync=0 fullsync=0)
> OPENDIR 169 /var/user/aaa
> WRITE   16812   0 0
> SYNC168
> READ154 4  24 0
> WRITE   154  1024   0 0
> WRITE   154  1024   20480 0
> SYNC154
> CLOSE   -1
> UNLOCK  154 1 was 4(4,1) pid=2289 (unix)
> UNLOCK  154 0 was 1(1,1) pid=2289 (unix)
> 
>
>
> Cordially yours
>
> LiuXiang
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


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


[sqlite] [BugReport]Data changes cannot actually flush to disk

2016-06-07 Thread 刘翔

Dear SQLite developers,

Sqlite version: 3.8.8.3
Linux version: 3.10.31-ltsi

Problem:
When update database and power off immediately, it cannnot actually make 
changes to database file in the disk.

Although the HAVE_FDATASYNC comile-time option is true.
If manually called sync() after executing a SQL statement, it does flush 
the database file to disk.


I think the OSTRACE log can be helpful, so I toke it.
Could you help to analyse it and tell me why fdatasync() doesn't work?

LOCK154 SHARED was NONE(NONE,0) pid=2289 (unix)
LOCK154 SHARED ok (unix)
READ15416  24 0
LOCK154 RESERVED was SHARED(SHARED,1) pid=2289 (unix)
LOCK154 RESERVED ok (unix)
OPENX   168 /var/user/aaa/bbb.db-journal 0400102
OPEN168 /var/user/aaa/bbb.db-journal
WRITE   168   512   0 0
WRITE   168 4 512 0
WRITE   168  1024 516 0
WRITE   168 41540 0
LOCK154 EXCLUSIVE was RESERVED(RESERVED,1) pid=2289 (unix)
LOCK154 EXCLUSIVE ok (unix)
WRITE   168 41544 0
WRITE   168  10241548 0
WRITE   168 42572 0
READ168 03072 0
SYNC168
DIRSYNC /var/user/aaa/bbb.db-journal (have_fullfsync=0 fullsync=0)
OPENDIR 169 /var/user/aaa
WRITE   16812   0 0
SYNC168
READ154 4  24 0
WRITE   154  1024   0 0
WRITE   154  1024   20480 0
SYNC154
CLOSE   -1
UNLOCK  154 1 was 4(4,1) pid=2289 (unix)
UNLOCK  154 0 was 1(1,1) pid=2289 (unix)



Cordially yours

LiuXiang

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