SQLite

Check-in [ef9e7a87a4]
Login

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

Overview
Comment:Add test cases to wal2concurrent.test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | begin-concurrent-wal2
Files: files | file ages | folders
SHA3-256: ef9e7a87a4ce4fe9596aed2f880f2b9fc3526c00c48f2868c625a4c24be65abe
User & Date: dan 2018-12-05 18:25:23.042
Context
2018-12-07
20:25
Add multi-threaded performance test program "tserver" to this branch. Fix bugs in the begin-concurrent/wal2 integration revealed by the same. (check-in: 7bd3b35661 user: dan tags: begin-concurrent-wal2)
2018-12-05
18:25
Add test cases to wal2concurrent.test. (check-in: ef9e7a87a4 user: dan tags: begin-concurrent-wal2)
17:36
Fix a test script problem on this branch. (check-in: 692ddc2808 user: dan tags: begin-concurrent-wal2)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/wal2concurrent.test.
1
2
3
4
5
6
7
8
# 2015 July 26
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
|







1
2
3
4
5
6
7
8
# 2018 December 6
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
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
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76











77

78
79
80
81






82
83
84
  return
}


#-------------------------------------------------------------------------
# Warm-body test.
#


sqlite3 db2 test.db
do_execsql_test 1.0 {
  PRAGMA page_size = 1024;
  CREATE TABLE t1(x);
  CREATE TABLE t2(y);
  PRAGMA journal_size_limit = 5000;
  PRAGMA journal_mode = wal2;
} {5000 wal2}

do_execsql_test 1.1 {
  INSERT INTO t1 VALUES(1);
  BEGIN CONCURRENT;
    INSERT INTO t1 VALUES(2);
} {}

do_test 1.2 {
  execsql { 
    PRAGMA journal_size_limit = 5000;
    INSERT INTO t1 VALUES(3) 
  } db2
  catchsql { COMMIT }
} {1 {database is locked}}

do_catchsql_test 1.3 { COMMIT   } {1 {database is locked}}
do_catchsql_test 1.4 { ROLLBACK } {0 {}}

do_test 1.5 {
  list [file size test.db-wal] [file size test.db-wal2]
} {2128 0}

do_execsql_test 1.6 {
  BEGIN CONCURRENT;
    INSERT INTO t1 VALUES(2);
} {}

do_test 1.7 {
  execsql { INSERT INTO t2 VALUES(randomblob(4000)) } db2
  list [file size test.db-wal] [file size test.db-wal2]
} {7368 0}


do_test 1.8 {
  execsql { 
    INSERT INTO t2 VALUES(1);
    INSERT INTO t1 VALUES(5);
  } db2
  list [file size test.db-wal] [file size test.db-wal2]
} {7368 2128}

do_catchsql_test 1.9  { COMMIT   } {1 {database is locked}}
do_catchsql_test 1.10 { ROLLBACK } {0 {}}













db close
sqlite3 db test.db
do_execsql_test 1.11 { SELECT * FROM t1 } {1 3 5}
do_execsql_test 1.12 { SELECT count(*) FROM t2 } {2}







finish_test








>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|

|
|
>
>
>
>
>
>
>
>
>
>
>

>
|
|
|
|
>
>
>
>
>
>



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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  return
}


#-------------------------------------------------------------------------
# Warm-body test.
#
foreach tn {1 2} {
  reset_db
  sqlite3 db2 test.db
  do_execsql_test 1.0 {
    PRAGMA page_size = 1024;
    CREATE TABLE t1(x);
    CREATE TABLE t2(y);
    PRAGMA journal_size_limit = 5000;
    PRAGMA journal_mode = wal2;
  } {5000 wal2}
  
  do_execsql_test 1.1 {
    INSERT INTO t1 VALUES(1);
    BEGIN CONCURRENT;
      INSERT INTO t1 VALUES(2);
  } {}
  
  do_test 1.2 {
    execsql { 
      PRAGMA journal_size_limit = 5000;
      INSERT INTO t1 VALUES(3) 
    } db2
    catchsql { COMMIT }
  } {1 {database is locked}}
  
  do_catchsql_test 1.3 { COMMIT   } {1 {database is locked}}
  do_catchsql_test 1.4 { ROLLBACK } {0 {}}
  
  do_test 1.5 {
    list [file size test.db-wal] [file size test.db-wal2]
  } {2128 0}
  
  do_execsql_test 1.6 {
    BEGIN CONCURRENT;
      INSERT INTO t1 VALUES(2);
  } {}
  
  do_test 1.7 {
    execsql { INSERT INTO t2 VALUES(randomblob(4000)) } db2
    list [file size test.db-wal] [file size test.db-wal2]
  } {7368 0}
  
  if {$tn==1} {
    do_test 1.8 {
      execsql { 
        INSERT INTO t2 VALUES(1);
        INSERT INTO t1 VALUES(5);
      } db2
      list [file size test.db-wal] [file size test.db-wal2]
    } {7368 2128}

    do_catchsql_test 1.9  { COMMIT   } {1 {database is locked}}
    do_catchsql_test 1.10 { ROLLBACK } {0 {}}
    db close
    sqlite3 db test.db
    do_execsql_test 1.11 { SELECT * FROM t1 } {1 3 5}
    do_execsql_test 1.12 { SELECT count(*) FROM t2 } {2}
  } else {
    do_test 1.8 {
      execsql { 
        INSERT INTO t2 VALUES(1);
      } db2
      list [file size test.db-wal] [file size test.db-wal2]
    } {7368 1080}

    do_catchsql_test 1.9  { COMMIT   } {0 {}}
    db close
    sqlite3 db test.db
    do_execsql_test 1.11 { SELECT * FROM t1 } {1 3 2}
    do_execsql_test 1.12 { SELECT count(*) FROM t2 } {2}

    do_test 1.13 {
      list [file size test.db-wal] [file size test.db-wal2]
    } {7368 2128}
  }
}

finish_test