[tarantool-patches] Re: [PATCH 6/8] Removes the following unused macros: SQL_EXPLAIN_ESTIMATED_ROWS SQL_ENABLE_COLUMN_USED_MASK SQL_DISABLE_DIRSYNC SQL_OMIT_AUTOMATIC_INDEX SQL_DEBUG_SORTER_THREADS SQL_DEFAULT_WORKER_THREADS SQL_LIMIT_WORKER_THREADS SQL_MAX_WORKER_THREADS

n.pettik korablev at tarantool.org
Sun May 19 18:16:11 MSK 2019


> diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
> index b9dbe141a..f988dc3e7 100644
> --- a/src/box/sql/CMakeLists.txt
> +++ b/src/box/sql/CMakeLists.txt
> @@ -10,9 +10,6 @@ set(SQL_BIN_DIR ${CMAKE_BINARY_DIR}/src/box/sql)
> include_directories(${SQL_SRC_DIR})
> include_directories(${SQL_BIN_DIR})
> 
> -add_definitions(-DSQL_MAX_WORKER_THREADS=0)
> -add_definitions(-DSQL_OMIT_AUTOMATIC_INDEX)

Let’s keep routines connected with automatic indexes:
we are going to re-enable it in scope of https://github.com/tarantool/tarantool/issues/2583 <https://github.com/tarantool/tarantool/issues/2583>
This code is a good point to start with reincarnation.

> -
> set(TEST_DEFINITIONS
>     SQL_NO_SYNC=1
>     SQL_TEST=1
> 
> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> index f019cd291..4bf94fad2 100644
> --- a/src/box/sql/sqlInt.h
> +++ b/src/box/sql/sqlInt.h
> 
> @@ -4858,13 +4846,6 @@ int sqlMemdebugNoType(void *, u8);
> 
> -/*
> - * Threading interface
> - */
> -#if SQL_MAX_WORKER_THREADS>0
> -int sqlThreadCreate(sqlThread **, void *(*)(void *), void *);
> -int sqlThreadJoin(sqlThread *, void **);
> -#endif

Now we can remove struct sqlThread.

> diff --git a/src/box/sql/vdbesort.c b/src/box/sql/vdbesort.c
> index ddea6752c..a37fbd911 100644
> --- a/src/box/sql/vdbesort.c
> +++ b/src/box/sql/vdbesort.c
> @@ -118,11 +118,6 @@
>  * there are already N worker threads running, the main thread does the work
>  * itself.
>  *
> - * The sorter is running in multi-threaded mode if (a) the library was built
> - * with pre-processor symbol SQL_MAX_WORKER_THREADS set to a value greater
> - * than zero, and (b) worker threads have been enabled at runtime by calling
> - * "PRAGMA threads=N" with some value of N greater than 0.
> - *
>  * When Rewind() is called, any data remaining in memory is flushed to a
>  * final PMA. So at this point the data is stored in some number of sorted
>  * PMAs within temporary files on disk.
> @@ -159,15 +154,6 @@
> #include "sqlInt.h"
> #include "vdbeInt.h"
> 
> 
> /*
>  * Hard-coded maximum amount of data to accumulate in memory before flushing
>  * to a level 0 PMA. The purpose of this limit is to prevent various integer
> @@ -297,18 +283,14 @@ struct MergeEngine {
>  *
>  * Before a background thread is launched, variable bDone is set to 0. Then,
>  * right before it exits, the thread itself sets bDone to 1. This is used for
> - * two purposes:

bDone member is unused now.

> @@ -885,8 +848,8 @@ sqlVdbeSorterInit(sql * db,	/* Database connection (for malloc()) */
> 	} else {
> 		pSorter->key_def = pCsr->key_def;
> 		pSorter->pgsz = pgsz = 1024;
> -		pSorter->nTask = nWorker + 1;
> -		pSorter->iPrev = (u8) (nWorker - 1);
> +		pSorter->nTask = 1;

nTask now always equals to 1, you can refactor code using it.
The same concerns member iPrev.

> diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
> index 4dedb38a7..01fa138f6 100644
> --- a/src/box/sql/wherecode.c
> +++ b/src/box/sql/wherecode.c
> @@ -253,14 +253,6 @@ sqlWhereExplainOneScan(Parse * pParse,	/* Parse context */
> 				       " USING INTEGER PRIMARY KEY (rowid%s?)",
> 				       zRangeOp);
> 		}
> -#ifdef SQL_EXPLAIN_ESTIMATED_ROWS
> -		if (pLoop->nOut >= 10) {
> -			sqlXPrintf(&str, " (~%llu rows)",
> -				       sqlLogEstToInt(pLoop->nOut));
> -		} else {
> -			sqlStrAccumAppend(&str, " (~1 row)", 9);
> -		}
> -#endif

We can enable this code, instead of removing it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190519/c82b2640/attachment.html>


More information about the Tarantool-patches mailing list