Enable shared cache on the server demonstration. (CVS 2899)
FossilOrigin-Name: 8719f880a395db8be65ea45615d8e55985306f1e
This commit is contained in:
parent
7910e76ddb
commit
bdd6da23cd
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sthe\sfirst\ssimple\stests\sof\sserver\smode.\s\sGet\sthe\sMakefile\sgenerated\sfrom\nthe\sconfigure\sscript\sworking\sagain.\s(CVS\s2898)
|
||||
D 2006-01-09T23:50:11
|
||||
C Enable\sshared\scache\son\sthe\sserver\sdemonstration.\s(CVS\s2899)
|
||||
D 2006-01-10T02:30:33
|
||||
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
|
||||
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -67,7 +67,7 @@ F src/prepare.c 41d9a8563e2b988932922c9f96a7bb1271932564
|
||||
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
|
||||
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
|
||||
F src/select.c acfeda959fe07eac04950d945ac7ec0518ef4b7d
|
||||
F src/server.c 934555eb73d9051c2ba1fc5367f0f969516dfec8
|
||||
F src/server.c 42a2bd02eec5018098a96e08f7a923f4965a2b1d
|
||||
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
|
||||
F src/sqlite.h.in 537bac9e9ef703695268aaad5c56b6bf64f815be
|
||||
F src/sqliteInt.h 073d84b12a07b25a31e08a3fd5115d44424511c3
|
||||
@ -224,7 +224,7 @@ F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca
|
||||
F test/select5.test 07a90ab3c7e3f0a241a9cdea1d997b2c8a89ff0b
|
||||
F test/select6.test f459a19bdac0501c4d3eb1a4df4b7a76f1bb8ad4
|
||||
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
|
||||
F test/server1.test c1611e0d6a032e740c09a07c9066ff9c83755126
|
||||
F test/server1.test 95c497a8b4c35599768d6a93b168cc272e83fee3
|
||||
F test/shared.test 413289e177e73c844cfc9896b6d78e0f2e62d963
|
||||
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
|
||||
F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd
|
||||
@ -340,7 +340,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P ec332d8822d1ac9673581a26ab2a2fce5f2554a3
|
||||
R e5d15dbb3e926b9920df07fb0ac31ca5
|
||||
P 66f84068f3c7c0963ce88f84fc0ba6775f64cd19
|
||||
R c5563d07cb2805e3f2db53bc3bd82ad8
|
||||
U drh
|
||||
Z 9152e6540471def63c6c7493e6fbf1c1
|
||||
Z 3c5423459a64450bbf5c75dd316847e8
|
||||
|
@ -1 +1 @@
|
||||
66f84068f3c7c0963ce88f84fc0ba6775f64cd19
|
||||
8719f880a395db8be65ea45615d8e55985306f1e
|
@ -331,6 +331,7 @@ int sqlite3_client_close(sqlite3 *pDb){
|
||||
** true.
|
||||
*/
|
||||
void *sqlite3_server(void *NotUsed){
|
||||
sqlite3_enable_shared_cache(1);
|
||||
if( pthread_mutex_trylock(&g.serverMutex) ){
|
||||
return 0; /* Another server is already running */
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#
|
||||
# This file is derived from thread1.test
|
||||
#
|
||||
# $Id: server1.test,v 1.1 2006/01/09 23:50:11 drh Exp $
|
||||
# $Id: server1.test,v 1.2 2006/01/10 02:30:33 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -96,20 +96,8 @@ do_test server1-1.12 {
|
||||
} {t1 t2}
|
||||
|
||||
|
||||
#
|
||||
# The following tests - server1-2.* - test the following scenario:
|
||||
#
|
||||
# 1: Read-lock thread A
|
||||
# 2: Read-lock thread B
|
||||
# 3: Attempt to write in thread C -> SQLITE_BUSY
|
||||
# 4: Check db write failed from main thread.
|
||||
# 5: Unlock from thread A.
|
||||
# 6: Attempt to write in thread C -> SQLITE_BUSY
|
||||
# 7: Check db write failed from main thread.
|
||||
# 8: Unlock from thread B.
|
||||
# 9: Attempt to write in thread C -> SQLITE_DONE
|
||||
# 10: Finalize the write from thread C
|
||||
# 11: Check db write succeeded from main thread.
|
||||
# Read from table t1. Do not finalize the statement. This
|
||||
# will leave the lock pending.
|
||||
#
|
||||
do_test server1-2.1 {
|
||||
client_halt *
|
||||
@ -118,12 +106,19 @@ do_test server1-2.1 {
|
||||
client_step A
|
||||
client_result A
|
||||
} SQLITE_ROW
|
||||
|
||||
# Read from the same table from another thread. This is allows.
|
||||
#
|
||||
do_test server1-2.2 {
|
||||
client_create B test.db
|
||||
client_compile B {SELECT b FROM t1}
|
||||
client_step B
|
||||
client_result B
|
||||
} SQLITE_ROW
|
||||
|
||||
# Write to a different table from another thread. This is allowed
|
||||
# becaus in server mode with a shared cache we have table-level locking.
|
||||
#
|
||||
do_test server1-2.3 {
|
||||
client_create C test.db
|
||||
client_compile C {INSERT INTO t2 VALUES(98,99)}
|
||||
@ -131,42 +126,35 @@ do_test server1-2.3 {
|
||||
client_result C
|
||||
client_finalize C
|
||||
client_result C
|
||||
} SQLITE_BUSY
|
||||
} SQLITE_OK
|
||||
|
||||
# But we cannot insert into table t1 because threads A and B have it locked.
|
||||
#
|
||||
do_test server1-2.4 {
|
||||
execsql {SELECT * FROM t2}
|
||||
} {}
|
||||
|
||||
client_compile C {INSERT INTO t1 VALUES(98,99)}
|
||||
client_step C
|
||||
client_result C
|
||||
client_finalize C
|
||||
client_result C
|
||||
} SQLITE_LOCKED
|
||||
do_test server1-2.5 {
|
||||
client_finalize A
|
||||
client_result A
|
||||
} SQLITE_OK
|
||||
do_test server1-2.6 {
|
||||
client_compile C {INSERT INTO t2 VALUES(98,99)}
|
||||
client_step C
|
||||
client_result C
|
||||
client_finalize C
|
||||
client_result C
|
||||
} SQLITE_BUSY
|
||||
do_test server1-2.7 {
|
||||
execsql {SELECT * FROM t2}
|
||||
} {}
|
||||
do_test server1-2.8 {
|
||||
client_finalize B
|
||||
client_result B
|
||||
} SQLITE_OK
|
||||
do_test server1-2.9 {
|
||||
client_compile C {INSERT INTO t2 VALUES(98,99)}
|
||||
client_compile C {INSERT INTO t1 VALUES(98,99)}
|
||||
client_step C
|
||||
client_result C
|
||||
client_finalize C
|
||||
client_result C
|
||||
} SQLITE_LOCKED
|
||||
|
||||
# Insert into t1 is successful after finishing the other two threads.
|
||||
do_test server1-2.6 {
|
||||
client_finalize A
|
||||
client_compile C {INSERT INTO t1 VALUES(98,99)}
|
||||
client_step C
|
||||
client_result C
|
||||
} SQLITE_DONE
|
||||
do_test server1-2.10 {
|
||||
client_finalize C
|
||||
client_result C
|
||||
} SQLITE_OK
|
||||
do_test server1-2.11 {
|
||||
execsql {SELECT * FROM t2}
|
||||
} {98 99}
|
||||
|
||||
client_halt *
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user