I'm embedding sqlite using pthread. I have multiple tables
creation table on the fly and many concurrent accesses.
Sqlite version  : 2.8.9
OS              : Linux Debian
Cc              : gcc version 3.3.2
CFLAGS          : -O2 -ggdb -DTHREADSAFE=1 -DNDEBUG=0 \
                  -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 


1) Sometimes, i get this error with sqlite_exec char* err:
 "database schema has changed"
without a usefull error returned by the method.
I was hoping something like SQLITE_SCHEMA but i'm getting
SQLITE_ERROR.

I quote sqlite.h:
#define SQLITE_ERROR        1   /* SQL error or missing database */
#define SQLITE_SCHEMA      17   /* The database schema changed */

Do i need to manage errors via a 'char*' matching on err?
Do i need to close the db and (re)open it each time i get this
error?

This SCHEMA error can be reproduced with the file
"src/threadtest.c" contained in sqlite...


2) Disk image corruption (with indexes):
After a time of running, i get this error in return:
  "database disk image is malformed".
The time is quite short (few seconds) when i'm using the
default busy callback "sqliteDefaultBusyCallback" via
"sqlite_busy_timeout".
The time is short (env 30s) when i'm using a simple
busy callback like: 
{ usleep( 100 ); return 1; }

The table have two indexes and a primary key.
To be sure, i'm doing a "PRAGMA synchronous=FULL;"
after all my sqlite_open. This is not changing
anything.

When i'm dropping indexes and primary key from
the schema, i do not have any corruption anymore...

I'm sorry to not having time to get deeper.
I can provide the database file if needed.

Here is a PRAGMA integrity_check output:

sqlite>    PRAGMA integrity_check;
*** in database main ***
On page 1451 at right child: invalid page number 1480
rowid 13180 missing from index IDX_name
rowid 13181 missing from index IDX_name
rowid 13182 missing from index IDX_name
rowid 13183 missing from index IDX_name
rowid 13184 missing from index IDX_name
rowid 13185 missing from index IDX_name
rowid 13186 missing from index IDX_name
rowid 13187 missing from index IDX_name
rowid 13188 missing from index IDX_name
rowid 13189 missing from index IDX_name
rowid 13190 missing from index IDX_name
rowid 13191 missing from index IDX_name
rowid 13192 missing from index IDX_name
rowid 13193 missing from index IDX_name
rowid 13194 missing from index IDX_name
rowid 13195 missing from index IDX_name
rowid 13196 missing from index IDX_name
rowid 13197 missing from index IDX_name
rowid 13198 missing from index IDX_name
rowid 13199 missing from index IDX_name
rowid 13200 missing from index IDX_name
rowid 13201 missing from index IDX_name
SQL error: database disk image is malformed

Regards,
--
Guillaume FOUGNIES

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to