SQLite

Check-in [3bd94e4317]
Login

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

Overview
Comment:Avoid incrementing the SQLITE_LOOKASIDE_MISS_SIZE stat before sqlite3_open() returns. Fix test script problem in lookaside.test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.25
Files: files | file ages | folders
SHA3-256: 3bd94e431783085a22733102218c0fe24a26376033cf9fe4380f6890aba8c79a
User & Date: drh 2018-09-24 21:07:35.559
Context
2018-09-25
01:17
Fix a problem building on Android with SQLITE_ENABLE_BATCH_ATOMIC_WRITE set. (check-in: b9ffa77c92 user: drh tags: branch-3.25)
2018-09-24
21:07
Avoid incrementing the SQLITE_LOOKASIDE_MISS_SIZE stat before sqlite3_open() returns. Fix test script problem in lookaside.test. (check-in: 3bd94e4317 user: drh tags: branch-3.25)
20:50
Fix missing space in 'configure.ac' reported on the mailing list. (check-in: 4407e15ac9 user: drh tags: branch-3.25)
2018-09-18
17:50
Avoid incrementing the SQLITE_LOOKASIDE_MISS_SIZE stat before sqlite3_open() returns. Fix test script problem in lookaside.test. (check-in: e461cb2819 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
3017
3018
3019
3020
3021
3022
3023

3024
3025
3026
3027
3028
3029
3030
    }
  }
  sqlite3_mutex_enter(db->mutex);
  db->errMask = 0xff;
  db->nDb = 2;
  db->magic = SQLITE_MAGIC_BUSY;
  db->aDb = db->aDbStatic;


  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
  db->autoCommit = 1;
  db->nextAutovac = -1;
  db->szMmap = sqlite3GlobalConfig.szMmap;







>







3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
    }
  }
  sqlite3_mutex_enter(db->mutex);
  db->errMask = 0xff;
  db->nDb = 2;
  db->magic = SQLITE_MAGIC_BUSY;
  db->aDb = db->aDbStatic;
  db->lookaside.bDisable = 1;

  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
  db->autoCommit = 1;
  db->nextAutovac = -1;
  db->szMmap = sqlite3GlobalConfig.szMmap;
Changes to test/lookaside.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
  finish_test
  return
}

# The tests in this file configure the lookaside allocator after a 
# connection is opened. This will not work if there is any "presql"
# configured (SQL run within the [sqlite3] wrapper in tester.tcl).
if {[info exists ::G(perm:presql)]} {
  finish_test
  return
}

test_set_config_pagecache 0 0

catch {db close}
sqlite3_shutdown
sqlite3_initialize
autoinstall_test_functions

sqlite3 db test.db


# Make sure sqlite3_db_config() and sqlite3_db_status are working.
#
do_test lookaside-1.1 {
  catch {sqlite3_config_error db}
} {0}








|










>

>







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
  finish_test
  return
}

# The tests in this file configure the lookaside allocator after a 
# connection is opened. This will not work if there is any "presql"
# configured (SQL run within the [sqlite3] wrapper in tester.tcl).
if {[info exists ::G(perm:dbconfig)] && $::G(perm:dbconfig)!=""} {
  finish_test
  return
}

test_set_config_pagecache 0 0

catch {db close}
sqlite3_shutdown
sqlite3_initialize
autoinstall_test_functions

sqlite3 db test.db
db cache size 4

# Make sure sqlite3_db_config() and sqlite3_db_status are working.
#
do_test lookaside-1.1 {
  catch {sqlite3_config_error db}
} {0}

95
96
97
98
99
100
101

102
103
104
105
106
107
108
} {0}
do_test lookaside-2.2 {
  db eval {CREATE TABLE t2(x);}
  foreach {x y z} [sqlite3_db_status db DBSTATUS_LOOKASIDE_USED 0] break
  expr {$x==0 && $y<$z && $z>10 && $z<100}
} {1}
do_test lookaside-2.3 {

  sqlite3_db_config_lookaside db 0 50 50
} {5}  ;# SQLITE_BUSY
do_test lookaside-2.4 {
  db cache flush
  sqlite3_db_config_lookaside db 0 50 50
} {0}  ;# SQLITE_OK
do_test lookaside-2.5 {







>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
} {0}
do_test lookaside-2.2 {
  db eval {CREATE TABLE t2(x);}
  foreach {x y z} [sqlite3_db_status db DBSTATUS_LOOKASIDE_USED 0] break
  expr {$x==0 && $y<$z && $z>10 && $z<100}
} {1}
do_test lookaside-2.3 {
  db eval {SELECT 1}
  sqlite3_db_config_lookaside db 0 50 50
} {5}  ;# SQLITE_BUSY
do_test lookaside-2.4 {
  db cache flush
  sqlite3_db_config_lookaside db 0 50 50
} {0}  ;# SQLITE_OK
do_test lookaside-2.5 {