/ Check-in [0714aecc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix errors in wal3.test caused by recent modifications.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1:0714aeccd82d82686c074c1bb74ea794b7bfa3a3
User & Date: dan 2010-07-28 15:10:38
Context
2010-07-28
18:35
Merge trunk changes into experimental branch. check-in: aa819001 user: dan tags: experimental
15:10
Fix errors in wal3.test caused by recent modifications. check-in: 0714aecc user: dan tags: experimental
14:26
Support FCNTL_CHUNK_SIZE on windows too. check-in: a038688c user: dan tags: experimental
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/wal3.test.

105
106
107
108
109
110
111





112
113
114
115
116
117
118
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176

177
178
179
180
181
182
183
...
696
697
698
699
700
701
702

703
704
705
706
707
708
709
...
718
719
720
721
722
723
724


725
726
727
728


729
730
731
732
733
734
735
736
737
738
    execsql { SELECT x FROM t1 WHERE rowid = $i }
  } $str
  do_test wal3-1.$i.7 {
    execsql { PRAGMA integrity_check } db2
  } {ok}
  db2 close
}






do_multiclient_test i {

  set testname(1) multiproc
  set testname(2) singleproc
  set tn $testname($i)

................................................................................
  # no-op, as the entire log has already been backfilled.
  #
  do_test wal3-2.$tn.4 {
    sql1 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    file size test.db
  } [expr $AUTOVACUUM ? 4*1024 : 3*1024]
  do_test wal3-2.$tn.5 {
    sql2 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    file size test.db
  } [expr $AUTOVACUUM ? 5*1024 : 4*1024]

  do_test wal3-2.$tn.6 {
    sql3 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    file size test.db
  } [expr $AUTOVACUUM ? 5*1024 : 4*1024]

}
catch {db close}

#-------------------------------------------------------------------------
# Test that that for the simple test:
#
#   CREATE TABLE x(y);
................................................................................
# the client takes a shared-lock on a slot without modifying the value
# and continues.
#
do_test wal3-9.0 {
  file delete -force test.db test.db-journal test.db wal
  sqlite3 db test.db
  execsql {

    PRAGMA journal_mode = WAL;
    CREATE TABLE whoami(x);
    INSERT INTO whoami VALUES('nobody');
  }
} {wal}
for {set i 0} {$i < 50} {incr i} {
  set c db$i
................................................................................
}
for {set i 0} {$i < 50} {incr i} {
  set c db$i
  do_test wal3-9.2.$i {
    execsql { SELECT * FROM whoami } $c
  } $c
}


do_test wal3-9.3 {
  for {set i 0} {$i < 49} {incr i} { db$i close }
  execsql { PRAGMA wal_checkpoint } 
  set sz1 [file size test.db]


  db49 close
  execsql { PRAGMA wal_checkpoint } 
  set sz2 [file size test.db]
  expr {$sz2 > $sz1}
} {1}

db close

finish_test








>
>
>
>
>







 







|
|





|
|
>





|
|
>







 







>







 







>
>



|
>
>



|
|





105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
...
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
...
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
    execsql { SELECT x FROM t1 WHERE rowid = $i }
  } $str
  do_test wal3-1.$i.7 {
    execsql { PRAGMA integrity_check } db2
  } {ok}
  db2 close
}

proc byte_is_zero {file offset} {
  if {[file size test.db] <= $offset} { return 1 }
  expr { [hexio_read $file $offset 1] == "00" }
}

do_multiclient_test i {

  set testname(1) multiproc
  set testname(2) singleproc
  set tn $testname($i)

................................................................................
  # no-op, as the entire log has already been backfilled.
  #
  do_test wal3-2.$tn.4 {
    sql1 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    byte_is_zero test.db [expr $AUTOVACUUM ? 4*1024 : 3*1024]
  } {1}
  do_test wal3-2.$tn.5 {
    sql2 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    list [byte_is_zero test.db [expr $AUTOVACUUM ? 4*1024 : 3*1024]]   \
         [byte_is_zero test.db [expr $AUTOVACUUM ? 5*1024 : 4*1024]]
  } {0 1}
  do_test wal3-2.$tn.6 {
    sql3 {
      COMMIT;
      PRAGMA wal_checkpoint;
    }
    list [byte_is_zero test.db [expr $AUTOVACUUM ? 4*1024 : 3*1024]]   \
         [byte_is_zero test.db [expr $AUTOVACUUM ? 5*1024 : 4*1024]]
  } {0 1}
}
catch {db close}

#-------------------------------------------------------------------------
# Test that that for the simple test:
#
#   CREATE TABLE x(y);
................................................................................
# the client takes a shared-lock on a slot without modifying the value
# and continues.
#
do_test wal3-9.0 {
  file delete -force test.db test.db-journal test.db wal
  sqlite3 db test.db
  execsql {
    PRAGMA page_size = 1024;
    PRAGMA journal_mode = WAL;
    CREATE TABLE whoami(x);
    INSERT INTO whoami VALUES('nobody');
  }
} {wal}
for {set i 0} {$i < 50} {incr i} {
  set c db$i
................................................................................
}
for {set i 0} {$i < 50} {incr i} {
  set c db$i
  do_test wal3-9.2.$i {
    execsql { SELECT * FROM whoami } $c
  } $c
}

set sz [expr 1024 * (2+$AUTOVACUUM)]
do_test wal3-9.3 {
  for {set i 0} {$i < 49} {incr i} { db$i close }
  execsql { PRAGMA wal_checkpoint } 
  byte_is_zero test.db [expr $sz-1024]
} {1}
do_test wal3-9.4 {
  db49 close
  execsql { PRAGMA wal_checkpoint } 
  set sz2 [file size test.db]
  byte_is_zero test.db [expr $sz-1024]
} {0}

db close

finish_test