aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-08-25 23:44:44 +0000
committerdrh <drh@noemail.net>2014-08-25 23:44:44 +0000
commit028696c4cc1f4bddcd376d3a290415f7eb67526e (patch)
tree97afe85907e7eda8353b65cd7653bf8626872483
parent6c4ec84256b48ec243b991fbe8d419abfa345025 (diff)
downloadsqlite-028696c4cc1f4bddcd376d3a290415f7eb67526e.tar.gz
sqlite-028696c4cc1f4bddcd376d3a290415f7eb67526e.zip
Remove the SQLITE_CONFIG_WORKER_THREADS configuration parameter. The number
of worker threads in the sorter is now determined only by the PRAGMA threads=N setting. FossilOrigin-Name: e3305d4b4efcbe06945ce7f6ec0f2e864244aaf9
-rw-r--r--manifest34
-rw-r--r--manifest.uuid2
-rw-r--r--src/global.c1
-rw-r--r--src/main.c9
-rw-r--r--src/pragma.c2
-rw-r--r--src/shell.c1
-rw-r--r--src/sqlite.h.in11
-rw-r--r--src/sqliteInt.h4
-rw-r--r--src/test_malloc.c26
-rw-r--r--src/vdbesort.c12
-rw-r--r--test/sort.test6
-rw-r--r--test/sort2.test10
-rw-r--r--test/sort4.test11
-rw-r--r--test/sortfault.test6
14 files changed, 35 insertions, 100 deletions
diff --git a/manifest b/manifest
index 84d67d606..9edec3f67 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sthe\sCAST\soperator\senhancements\sfrom\strunk.
-D 2014-08-25T22:43:17.516
+C Remove\sthe\sSQLITE_CONFIG_WORKER_THREADS\sconfiguration\sparameter.\s\sThe\snumber\nof\sworker\sthreads\sin\sthe\ssorter\sis\snow\sdetermined\sonly\sby\sthe\nPRAGMA\sthreads=N\ssetting.
+D 2014-08-25T23:44:44.281
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -181,7 +181,7 @@ F src/expr.c 358634f4ddeeb4e69643cb6db5819104a7834c60
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c 8d81a780ad78d16ec9082585758a8f1d6bf02ca3
F src/func.c bbb724b74ed96ca42675a7274646a71dd52bcda7
-F src/global.c 77ec119d6f6453039c2820336af8e8f804f20acf
+F src/global.c 1e4bd956dc2f608f87d2a929abc4a20db65f30e4
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
@@ -190,7 +190,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c 87c92f4a08e2f70220e3b22a9c3b2482d36a134a
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
F src/loadext.c 31c2122b7dd05a179049bbf163fd4839f181cbab
-F src/main.c ce41520e565eb8ef09824fa9778a72364291d371
+F src/main.c f1726e704941d365ce2846161e93ba689a245845
F src/malloc.c 954de5f998c23237e04474a3f2159bf483bba65a
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b
@@ -217,18 +217,18 @@ F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0
F src/pcache.c da602c5447051705cab41604bf3276815eb569d0
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
F src/pcache1.c c5af6403a55178c9d1c09e4f77b0f9c88822762c
-F src/pragma.c 4ed8bc86d1a9ee336e66bc441b30abb702f4de33
+F src/pragma.c 33971fcaa7c13b84b1a0f2e813f4a3ab4d745ede
F src/prepare.c 3842c1dfc0b053458e3adcf9f6efc48e03e3fe3d
F src/printf.c 00986c86ddfffefc2fd3c73667ff51b3b9709c74
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c 0ea356d32a5e884add23d1b9b4e8736681dd5697
F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be
F src/select.c f8b0b6c43bee15f4e239ead1c9c9e3009e507e39
-F src/shell.c 6dab215a30f7ca4d5fc31338c44b007bb6ef0dee
-F src/sqlite.h.in fef15a64d1358f5c365bd3f46f4c1915d5a5e5f0
+F src/shell.c 88378cef39aba4b4a1df82793dcb1daf9276bb81
+F src/sqlite.h.in aa2cc1405cb999c9d73484e0686f7b869b430ba3
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
-F src/sqliteInt.h d8eb2d4d4ce26365dc9d49efee3bc880618e87c2
+F src/sqliteInt.h 43419afaed8cd3bf99df06d38952a52f827217b9
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -257,7 +257,7 @@ F src/test_intarray.c db4614c2262a06abc4409dc048d59c580c38320f
F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202
F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64
F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4
-F src/test_malloc.c 27047a841f5bff1cb638123806a2c30714771307
+F src/test_malloc.c 5368fb1de77246da1ae0ff59cba0d30cb0e5812f
F src/test_multiplex.c ca90057438b63bf0840ebb84d0ef050624519a76
F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3
F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f
@@ -292,7 +292,7 @@ F src/vdbeapi.c cda974083d7597f807640d344ffcf76d872201ce
F src/vdbeaux.c cef5d34a64ae3a65b56d96d3fd663246ec8e1c36
F src/vdbeblob.c 848238dc73e93e48432991bb5651bf87d865eca4
F src/vdbemem.c 4e08ea087aea367dae7c45129b75487e0056e819
-F src/vdbesort.c 3a76f51efdf0790fd3d26afabdd81e0a21f52ae7
+F src/vdbesort.c 50fe3442f41dbfe0b37d2e8b55e7460244015533
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
F src/vtab.c 019dbfd0406a7447c990e1f7bd1dfcdb8895697f
F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a
@@ -838,11 +838,11 @@ F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5
F test/skipscan5.test d8b9692b702745a0e41c23f9da6beac81df01196
F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24
-F test/sort.test 688468cef8c9a66fcc1d54235de8e4deac745690
-F test/sort2.test c5e25eb674689e291d06b5209fe8d337ae0ec010
+F test/sort.test 15e1d3014abc3f6d4357ed81b93b82117aefd235
+F test/sort2.test 269f4f50c6e468cc32b302ae7ff0add8338ec6de
F test/sort3.test 6178ade30810ac9166fcdf14b7065e49c0f534e2
-F test/sort4.test 971452fd4e2928e6fc05c3868396ad7d5f9ce2ad
-F test/sortfault.test 1a12b6e27d475f50658a8164aaa34f0080a86b36
+F test/sort4.test 6c37d85f7cd28d50cce222fcab84ccd771e105cb
+F test/sortfault.test b8e35177f97438b930ee87c9419ca2599e8073e1
F test/speed1.test f2974a91d79f58507ada01864c0e323093065452
F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb
F test/speed1p.test b180e98609c7677382cf618c0ec9b69f789033a8
@@ -1193,7 +1193,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 29c5e8a7c9d7ce349a1e1d72082d23450e877b45 af364cce9da0961593ef876b646197f82df08ad5
-R c7c8cecd9a8ffa9d596fa5137e696964
+P 6c8f86e4e08d5d57e21496277613e0f9dcc06514
+R 428258d1143faa4ab393e38d0d72251a
U drh
-Z 1d9d719c4b1a959a79787aab5421ad60
+Z 37ad2e5d491e7e49897b74763238faf5
diff --git a/manifest.uuid b/manifest.uuid
index 25b89b4ea..a22d91284 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6c8f86e4e08d5d57e21496277613e0f9dcc06514 \ No newline at end of file
+e3305d4b4efcbe06945ce7f6ec0f2e864244aaf9 \ No newline at end of file
diff --git a/src/global.c b/src/global.c
index f152c3b5d..2c14b58ab 100644
--- a/src/global.c
+++ b/src/global.c
@@ -167,7 +167,6 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
0, /* nPage */
0, /* mxParserStack */
0, /* sharedCacheEnabled */
- SQLITE_DEFAULT_WORKER_THREADS, /* nWorker */
/* All the rest should always be initialized to zero */
0, /* isInit */
0, /* inProgress */
diff --git a/src/main.c b/src/main.c
index 8a6456d68..98bd82a29 100644
--- a/src/main.c
+++ b/src/main.c
@@ -515,15 +515,6 @@ int sqlite3_config(int op, ...){
}
#endif
- case SQLITE_CONFIG_WORKER_THREADS: {
-#if SQLITE_MAX_WORKER_THREADS>0
- int n = va_arg(ap, int);
- if( n>SQLITE_MAX_WORKER_THREADS ) n = SQLITE_MAX_WORKER_THREADS;
- if( n>=0 ) sqlite3GlobalConfig.nWorker = n;
-#endif
- break;
- }
-
default: {
rc = SQLITE_ERROR;
break;
diff --git a/src/pragma.c b/src/pragma.c
index 897d3b5d2..8421042e0 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -2292,7 +2292,7 @@ void sqlite3Pragma(
&& sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK
&& N>=0
){
- if( N>sqlite3GlobalConfig.nWorker ) N = sqlite3GlobalConfig.nWorker;
+ if( N>SQLITE_MAX_WORKER_THREADS ) N = SQLITE_MAX_WORKER_THREADS;
db->mxWorker = N&0xff;
}
returnSingleInt(pParse, "soft_heap_limit", db->mxWorker);
diff --git a/src/shell.c b/src/shell.c
index 0357c1a08..9c235414a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3818,7 +3818,6 @@ static void main_init(ShellState *data) {
sqlite3_config(SQLITE_CONFIG_URI, 1);
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
- sqlite3_config(SQLITE_CONFIG_WORKER_THREADS, 64);
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
}
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index be0ed7456..f8ea7ad62 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -1718,16 +1718,6 @@ struct sqlite3_mem_methods {
** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
** that specifies the maximum size of the created heap.
** </dl>
-**
-** [[SQLITE_CONFIG_WORKER_THREADS]]
-** <dt>SQLITE_CONFIG_WORKER_THREADS
-** <dd>^SQLITE_CONFIG_WORKER_THREADS takes a single argument of type int.
-** It is used to set the number of background worker threads that may be
-** launched when sorting large amounts of data. A value of 0 means launch
-** no background threads at all. The maximum number of background threads
-** allowed is configured at build-time by the SQLITE_MAX_WORKER_THREADS
-** pre-processor option.
-** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
@@ -1752,7 +1742,6 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
-#define SQLITE_CONFIG_WORKER_THREADS 24 /* int nWorker */
/*
** CAPI3REF: Database Connection Configuration Options
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index ce123b395..b48d5cf79 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -441,9 +441,10 @@
*/
#if SQLITE_TEMP_STORE==3
# undef SQLITE_MAX_WORKER_THREADS
+# define SQLITE_MAX_WORKER_THREADS 0
#endif
#ifndef SQLITE_MAX_WORKER_THREADS
-# define SQLITE_MAX_WORKER_THREADS 0
+# define SQLITE_MAX_WORKER_THREADS 4
#endif
#ifndef SQLITE_DEFAULT_WORKER_THREADS
# define SQLITE_DEFAULT_WORKER_THREADS 0
@@ -2764,7 +2765,6 @@ struct Sqlite3Config {
int nPage; /* Number of pages in pPage[] */
int mxParserStack; /* maximum depth of the parser stack */
int sharedCacheEnabled; /* true if shared-cache mode enabled */
- int nWorker; /* Number of worker threads to use */
/* The above might be initialized to non-zero. The following need to always
** initially be zero, however. */
int isInit; /* True after initialization has finished */
diff --git a/src/test_malloc.c b/src/test_malloc.c
index 6ac030f23..900a8ac40 100644
--- a/src/test_malloc.c
+++ b/src/test_malloc.c
@@ -1253,31 +1253,6 @@ static int test_config_cis(
return TCL_OK;
}
-/*
-** Usage: sqlite3_config_worker_threads N
-*/
-static int test_config_worker_threads(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- int rc;
- int nThread;
-
- if( objc!=2 ){
- Tcl_WrongNumArgs(interp, 1, objv, "N");
- return TCL_ERROR;
- }
- if( Tcl_GetIntFromObj(interp, objv[1], &nThread) ){
- return TCL_ERROR;
- }
-
- rc = sqlite3_config(SQLITE_CONFIG_WORKER_THREADS, nThread);
- Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE);
-
- return TCL_OK;
-}
/*
** Usage: sqlite3_dump_memsys3 FILENAME
@@ -1532,7 +1507,6 @@ int Sqlitetest_malloc_Init(Tcl_Interp *interp){
{ "sqlite3_config_error", test_config_error ,0 },
{ "sqlite3_config_uri", test_config_uri ,0 },
{ "sqlite3_config_cis", test_config_cis ,0 },
- { "sqlite3_config_worker_threads", test_config_worker_threads ,0 },
{ "sqlite3_db_config_lookaside",test_db_config_lookaside ,0 },
{ "sqlite3_dump_memsys3", test_dump_memsys3 ,3 },
{ "sqlite3_dump_memsys5", test_dump_memsys3 ,5 },
diff --git a/src/vdbesort.c b/src/vdbesort.c
index e71b19fc1..cdbf6e025 100644
--- a/src/vdbesort.c
+++ b/src/vdbesort.c
@@ -795,10 +795,16 @@ int sqlite3VdbeSorterInit(
int rc = SQLITE_OK;
#if SQLITE_MAX_WORKER_THREADS==0
# define nWorker 0
-#elif SQLITE_MAX_WORKER_THREADS>=SORTER_MAX_MERGE_COUNT
- int nWorker = MIN(SORTER_MAX_MERGE_COUNT-1, db->mxWorker);
#else
- int nWorker = db->mxWorker;
+ int nWorker = sqlite3TempInMemory(db) ? 0 : db->mxWorker ;
+#endif
+
+ /* Do not allow the total number of threads (main thread + all workers)
+ ** to exceed the maximum merge count */
+#if SQLITE_MAX_WORKER_THREADS>=SORTER_MAX_MERGE_COUNT
+ if( nWorker>=SORTER_MAX_MERGE_COUNT ){
+ nWorker = SORTER_MAX_MERGE_COUNT-1;
+ }
#endif
assert( pCsr->pKeyInfo && pCsr->pBt==0 );
diff --git a/test/sort.test b/test/sort.test
index e75740e9c..1c89552bb 100644
--- a/test/sort.test
+++ b/test/sort.test
@@ -544,7 +544,6 @@ foreach {tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit} {
} {
db close
sqlite3_shutdown
- sqlite3_config_worker_threads $nWorker
if {$coremutex} {
sqlite3_config multithread
} else {
@@ -556,7 +555,8 @@ foreach {tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit} {
reset_db
sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $mmap_limit
- execsql "PRAGMA temp_store = $tmpstore"
+ execsql "PRAGMA temp_store = $tmpstore; PRAGMA threads = $nWorker"
+
set ten [string repeat X 10300]
set one [string repeat y 200]
@@ -602,7 +602,6 @@ foreach {tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit} {
db close
sqlite3_shutdown
-sqlite3_config_worker_threads 0
set t(0) singlethread
set t(1) multithread
set t(2) serialized
@@ -637,4 +636,3 @@ do_execsql_test 17.1 {
} {}
finish_test
-
diff --git a/test/sort2.test b/test/sort2.test
index e4e40dab7..29001f009 100644
--- a/test/sort2.test
+++ b/test/sort2.test
@@ -22,9 +22,8 @@ foreach {tn script} {
1 { }
2 {
catch { db close }
- sqlite3_shutdown
- sqlite3_config_worker_threads 7
reset_db
+ catch { db eval {PRAGMA threads=7} }
}
} {
@@ -76,13 +75,6 @@ foreach {tn script} {
} {
200000 100 200000 100 200000 100 200000 100 200000 100
}
-
- db close
- sqlite3_shutdown
- sqlite3_config_worker_threads 0
- sqlite3_initialize
-
}
finish_test
-
diff --git a/test/sort4.test b/test/sort4.test
index 4e8336cd8..01fcbfee9 100644
--- a/test/sort4.test
+++ b/test/sort4.test
@@ -19,11 +19,7 @@ source $testdir/tester.tcl
set testprefix sort4
# Configure the sorter to use 3 background threads.
-catch { db close }
-sqlite3_shutdown
-sqlite3_config_worker_threads 3
-sqlite3_initialize
-reset_db
+db eval {PRAGMA threads=3}
# Minimum number of seconds to run for. If the value is 0, each test
# is run exactly once. Otherwise, tests are repeated until the timeout
@@ -190,9 +186,4 @@ for {set t 2} {1} {incr tn} {
do_test "$testprefix-([expr $iTimeLimit-$iNow] seconds remain)" {} {}
}
-catch { db close }
-sqlite3_shutdown
-sqlite3_config_worker_threads 0
-sqlite3_initialize
finish_test
-
diff --git a/test/sortfault.test b/test/sortfault.test
index 4c199ab21..a1983ac1c 100644
--- a/test/sortfault.test
+++ b/test/sortfault.test
@@ -30,9 +30,7 @@ foreach {tn mmap_limit nWorker tmpstore threadsmode fakeheap lookaside} {
} {
if {$sqlite_options(threadsafe)} { set threadsmode singlethread }
- catch { db close }
- sqlite3_shutdown
- sqlite3_config_worker_threads $nWorker
+ db eval "PRAGMA threads=$nWorker"
sqlite3_config $threadsmode
if { $lookaside } {
sqlite3_config_lookaside 100 500
@@ -110,7 +108,6 @@ foreach {tn mmap_limit nWorker tmpstore threadsmode fakeheap lookaside} {
catch { db close }
sqlite3_shutdown
-sqlite3_config_worker_threads 0
set t(0) singlethread
set t(1) multithread
set t(2) serialized
@@ -166,4 +163,3 @@ do_faultsim_test 5.1 -faults oom* -body {
}
finish_test
-