SQLite

Check-in [ee8d3ceeec]
Login

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

Overview
Comment:Adjustments to mmap1.test so that it works better on windows. It still gets some answers wrong, but it no longer crashes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: ee8d3ceeec40d84adb8798f084b6f1215ab56d92
User & Date: drh 2013-04-02 20:29:33.219
Context
2013-04-02
20:55
Fix a resource leak in os_unix.c. (check-in: b29cda03fe user: dan tags: experimental-mmap)
20:29
Adjustments to mmap1.test so that it works better on windows. It still gets some answers wrong, but it no longer crashes. (check-in: ee8d3ceeec user: drh tags: experimental-mmap)
20:19
Fix a bug in mmap2.test that was leaving an invalid sqlite3_log() callback installed, causing a crash. (check-in: c0cdaa0735 user: dan tags: experimental-mmap)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/mmap1.test.
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
set testprefix mmap1

proc nRead {db} {
  set bt [btree_from_db $db]
  db_enter $db
  array set stats [btree_pager_stats $bt]
  db_leave $db

  return $stats(read)
}

foreach {t mmap_limit nRead c2init} {
  1.1 { PRAGMA mmap_limit = 70000000 }   4 {}
  1.2 { PRAGMA mmap_limit =    51200 } 156 {}
  1.3 { PRAGMA mmap_limit =        0 } 344 {}
  1.4 { PRAGMA mmap_limit = 70000000 }   4 {PRAGMA mmap_limit = 70000000 }
  1.5 { PRAGMA mmap_limit =    51200 } 156 {PRAGMA mmap_limit = 70000000 }
  1.6 { PRAGMA mmap_limit =        0 } 344 {PRAGMA mmap_limit = 70000000 }
} {
  do_multiclient_test tn {

    sql1 $mmap_limit
    sql2 $c2init

    code2 {
      set ::rcnt 0
      proc rblob {n} {
        set ::rcnt [expr (($::rcnt << 3) + $::rcnt + 456) & 0xFFFFFFFF]
        set str [format %.8x [expr $::rcnt ^ 0xbdf20da3]] 
        string range [string repeat $str [expr $n/4]] 1 $n
      }
      db2 func rblob rblob
    }

    sql2 { 

      PRAGMA auto_vacuum = 1;
      CREATE TABLE t1(a, b, UNIQUE(a, b));
      INSERT INTO t1 VALUES(rblob(500), rblob(500));
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    2
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    4
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    8
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --   16







>




|
|

|
|
|


>













|
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set testprefix mmap1

proc nRead {db} {
  set bt [btree_from_db $db]
  db_enter $db
  array set stats [btree_pager_stats $bt]
  db_leave $db
  # puts [array get stats]
  return $stats(read)
}

foreach {t mmap_limit nRead c2init} {
  1.1 { PRAGMA mmap_limit = 67108864 }   4 {}
  1.2 { PRAGMA mmap_limit =    53248 } 150 {}
  1.3 { PRAGMA mmap_limit =        0 } 344 {}
  1.4 { PRAGMA mmap_limit = 67108864 }   4 {PRAGMA mmap_limit = 67108864 }
  1.5 { PRAGMA mmap_limit =    53248 } 150 {PRAGMA mmap_limit = 67108864 }
  1.6 { PRAGMA mmap_limit =        0 } 344 {PRAGMA mmap_limit = 67108864 }
} {
  do_multiclient_test tn {
    sql1 {PRAGMA page_size=1024}
    sql1 $mmap_limit
    sql2 $c2init

    code2 {
      set ::rcnt 0
      proc rblob {n} {
        set ::rcnt [expr (($::rcnt << 3) + $::rcnt + 456) & 0xFFFFFFFF]
        set str [format %.8x [expr $::rcnt ^ 0xbdf20da3]] 
        string range [string repeat $str [expr $n/4]] 1 $n
      }
      db2 func rblob rblob
    }

    sql2 {
      PRAGMA page_size=1024;
      PRAGMA auto_vacuum = 1;
      CREATE TABLE t1(a, b, UNIQUE(a, b));
      INSERT INTO t1 VALUES(rblob(500), rblob(500));
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    2
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    4
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    8
      INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --   16
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
}

reset_db
db func rblob rblob

do_execsql_test 2.1 {
  PRAGMA auto_vacuum = 1;
  PRAGMA mmap_limit = 70000000;
  PRAGMA journal_mode = wal;
  CREATE TABLE t1(a, b, UNIQUE(a, b));
  INSERT INTO t1 VALUES(rblob(500), rblob(500));
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    2
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    4
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    8
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --   16







|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
}

reset_db
db func rblob rblob

do_execsql_test 2.1 {
  PRAGMA auto_vacuum = 1;
  PRAGMA mmap_limit = 67108864;
  PRAGMA journal_mode = wal;
  CREATE TABLE t1(a, b, UNIQUE(a, b));
  INSERT INTO t1 VALUES(rblob(500), rblob(500));
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    2
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    4
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --    8
  INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; --   16
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  }
} {16}

do_execsql_test 2.4 {
  PRAGMA wal_checkpoint;
} {0 24 24}


reset_db
db func rblob rblob
do_execsql_test 3.1 {
  PRAGMA auto_vacuum = 1;

  CREATE TABLE t1(a, b, UNIQUE(a, b));
  INSERT INTO t1 VALUES(rblob(500), rblob(500));







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  }
} {16}

do_execsql_test 2.4 {
  PRAGMA wal_checkpoint;
} {0 24 24}

db2 close
reset_db
db func rblob rblob
do_execsql_test 3.1 {
  PRAGMA auto_vacuum = 1;

  CREATE TABLE t1(a, b, UNIQUE(a, b));
  INSERT INTO t1 VALUES(rblob(500), rblob(500));