diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/global.c | 1 | ||||
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/pragma.c | 2 | ||||
-rw-r--r-- | src/shell.c | 1 | ||||
-rw-r--r-- | src/sqlite.h.in | 11 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/test_malloc.c | 26 | ||||
-rw-r--r-- | src/vdbesort.c | 12 |
8 files changed, 12 insertions, 54 deletions
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 ); |