I tried to solve this problem by myself... But, It's very difficult work to me. :)
SQLITE_CORRUPT_BKPT is returned in lockBtree, because of, nPage(=4) is bigger than nPageFile(=3). First call of creating table "b" returns "database or disk is full" and it is normal case. But, second call of creating table "b" returns database corruption. If I close database connection and reconnect to target database, it shows same patterns with above. In my opinion, a new page information of a table is not cleaned when meets first "disk is full" in "ATOMIC WRITE" and "AUTOVACUUM" mode. It makes database corruption status when nPage and nPageFile is compared. For example, If auto_vacuum == 0, then nPage and nPageFile have same values of #2. In btreeCreateTable function, it is changed with "if (pBt->autoVacuum)" condition. Could anyone give me some hints to solve it? B. R. Yongil Jang. 2012/11/26 Yongil Jang <yongilj...@gmail.com> > Hi, there. > > I just found some illegal processing of SQLite. > As I mentioned in title, "CREATE TABLE" query returns "database disk image > is malformed" when disk is full and "SQLITE_IOCAP_ATOMIC" and > "SQLITE_DEFAULT_AUTOVACUUM" is enabled. > Here is my test scripts. > > sudo mkdir /mnt/db > sudo chmod 777 /mnt/db > sudo mount -t tmpfs -o size=16K tmpfs /mnt/db > /home/yi.jang/git/sqlite_source/sqlite3 /mnt/db/test.db > > SQLite version 3.7.13 2012-06-11 02:05:22 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> pragma journal_mode=persist; > persist > sqlite> pragma page_size=4096; > sqlite> create table a (id); > sqlite> create table b (id); > *Error: database or disk is full* > sqlite> create table b (id); > *Error: database disk image is malformed* > sqlite> > > What I attached options to Makefile are as following. > > -DSQLITE_ENABLE_ATOMIC_WRITE > -DSQLITE_DEFAULT_AUTOVACUUM=1 > -DSQLITE_DEFAULT_PAGE_SIZE=4096 > > sqlite3.c is also changed. > > static int unixDeviceCharacteristics(sqlite3_file *id){ > unixFile *p = (unixFile*)id; > if( p->ctrlFlags & UNIXFILE_PSOW ){ > return SQLITE_IOCAP_POWERSAFE_OVERWRITE | SQLITE_IOCAP_ATOMIC; > }else{ > return SQLITE_IOCAP_ATOMIC; > } > } > > B.R. > Yongil Jang. > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users