Hi,
Below is the part of code which gives error, when running the corrupted
DB with gdb, i guess this may help to find the root cause for DB
corruption,
The DB was able to recover with "vacuum" command also.
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma integrity_check;
*** in database main ***
Main freelist: 21 of 21 pages missing from overflow list starting at 0
Page 1604: btreeInitPage() returns error code 11
Page 1461 is never used
Page 1468 is never used
Page 1469 is never used
Page 1472 is never used
Page 1473 is never used
Page 1474 is never used
Page 1475 is never used
Page 1478 is never used
Page 1480 is never used
Page 1482 is never used
Page 1484 is never used
Page 1485 is never used
Page 1486 is never used
Page 1488 is never used
Page 1489 is never used
Page 1491 is never used
Page 1517 is never used
Page 1531 is never used
Page 1536 is never used
Page 1578 is never used
Page 1581 is never used
(gdb) b btreeInitPage
Breakpoint 1 at 0x40031130: file sqlite3.c, line 38929.
(gdb) list
...
..
(gdb)
39024 if( nFree>usableSize ){
39025 return SQLITE_CORRUPT_BKPT;
39026 }
39027 pPage->nFree = (u16)(nFree - iCellFirst);
39028 pPage->isInit = 1;
39029 }
39030 return SQLITE_OK;
39031 }
39032
39033 /*
(gdb) b 39025
Breakpoint 2 at 0x4003134c: file sqlite3.c, line 39025.
(gdb)del 1
(gdb) c
Continuing.
Breakpoint 2, btreeInitPage (pPage=0x82986d4) at sqlite3.c:39025
39025 return SQLITE_CORRUPT_BKPT;
(gdb) bt
#0 btreeInitPage (pPage=0x82986d4) at sqlite3.c:39025
#1 0x4003b0fb in checkTreePage (pCheck=0xbfffced0, iPage=1604,
zParentContext=0xbfffcda0 "On page 226 at right child: ")
...
...
(gdb) print nFree
$1 = 0
(gdb) print usableSize
$2 = 2053
(gdb)
This shows it returns from here
if( nFree>usableSize ){
return SQLITE_CORRUPT_BKPT;
}
Thanks and Regards,
Ramesh
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users