Hi,

I'm validating SQLite test suite version 3.7.2 on QNX operating system. I have 
built the testfixture using SQLite amalgation file and other related 
files/libraries.

I ran the full test suite and most of the test cases are passing, except some 
run in journal_mode = WAL. Test cases whose autocheckpoint is turned off and 
large amount of
data is being inserted without checkpointing are failing. Other WAL tests are 
passing. I tried increasing the stack size of the testfixture process, but that 
didn't help.

If i reduce the number of inserts or increase the WAL page size, test cases are 
passing. I believe there is some corruption happening with the WAL index while
inserting large number of rows. Here is an example (from SQLite test suite) of 
the failure
(Purposefully added "PRAGMA integrity_check" at end of wal3-1.0)

set a_string_counter 1
proc a_string {n} {
  global a_string_counter
  incr a_string_counter
  string range [string repeat "${a_string_counter}." $n] 1 $n
}
db func a_string a_string

do_test wal3-1.0 {
  execsql {
    PRAGMA cache_size = 2000;
    PRAGMA page_size = 1024;
    PRAGMA auto_vacuum = off;
    PRAGMA synchronous = normal;
    PRAGMA journal_mode = WAL;
    PRAGMA wal_autocheckpoint = 0;
    BEGIN;
      CREATE TABLE t1(x);
      INSERT INTO t1 VALUES( a_string(800) );                  /*    1 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*    2 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*    4 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*    8 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*   16 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*   32 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*   64 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*  128*/
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*  256 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /*  512 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /* 1024 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;             /* 2048 */
      INSERT INTO t1 SELECT a_string(800) FROM t1;              /* 4018 */
    COMMIT;
    PRAGMA cache_size = 10;
    PRAGMA integrity_check;
  }
} {ok}

for {set i 1} {$i < 50} {incr i} {

  do_test wal3-1.$i.1 {
    set str [a_string 800]
    execsql { UPDATE t1 SET x = $str WHERE rowid = $i }
    lappend L [wal_frame_count test.db-wal 1024]
    execsql {
      BEGIN;
        INSERT INTO t1 SELECT a_string(800) FROM t1 LIMIT 100;
      ROLLBACK;
      PRAGMA integrity_check;
    }
  } {ok}

  # Check that everything looks OK from the point of view of an
  # external connection.
  #
  sqlite3 db2 test.db
  do_test wal3-1.$i.2 {
    execsql { SELECT count(*) FROM t1 } db2
  } 4018
  do_test wal3-1.$i.3 {
    execsql { SELECT x FROM t1 WHERE rowid = $i }
  } $str
  do_test wal3-1.$i.4 {
    execsql { PRAGMA integrity_check } db2
  } {ok}
  db2 close

  # Check that the file-system in its current state can be recovered.
  #
  file copy -force test.db test2.db
  file copy -force test.db-wal test2.db-wal
  file delete -force test2.db-journal
  sqlite3 db2 test2.db
  do_test wal3-1.$i.5 {
    execsql { SELECT count(*) FROM t1 } db2
  } 4018
  do_test wal3-1.$i.6 {
    execsql { SELECT x FROM t1 WHERE rowid = $i }
  } $str
  do_test wal3-1.$i.7 {
    execsql { PRAGMA integrity_check } db2
  } {ok}
  db2 close
}

The result of above test:

wal3-1.0...
Expected: [ok]
     Got: [wal 0 {*** in database main ***
Page 2: btreeInitPage() returns error code 11
Page 3 is never used
Page 4 is never used
Page 5 is never used
....................................
Page 99 is never used
Page 100 is never used
Page 101 is never used
Page 102 is never used}]
wal3-1.1.1...
Error: database disk image is malformed
wal3-1.1.2...
Error: no such table: t1
wal3-1.1.3...
Error: database disk image is malformed
wal3-1.1.4... Ok
wal3-1.1.5...
Error: no such table: t1
wal3-1.1.6...
Error: database disk image is malformed
wal3-1.1.7... Ok

The above error repeats for all iterations.

Any help/suggestions for the above issue will be highly appreciated.

Other tests which fail include:
walfault-6-pre-1
walfault-11-pre-1
wal-13.$tn.$ii.a - wal-13.$tn.$ii.d (after 12th iteration)
wal-20.2 - wal-20.4

Thanks.

________________________________
The information contained in this message may be confidential and legally 
protected under applicable law. The message is intended solely for the 
addressee(s). If you are not the intended recipient, you are hereby notified 
that any use, forwarding, dissemination, or reproduction of this message is 
strictly prohibited and may be unlawful. If you are not the intended recipient, 
please contact the sender by return e-mail and destroy all copies of the 
original message.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to