<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div class="">diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt<br class="">index b9dbe141a..f988dc3e7 100644<br class="">--- a/src/box/sql/CMakeLists.txt<br class="">+++ b/src/box/sql/CMakeLists.txt<br class="">@@ -10,9 +10,6 @@ set(SQL_BIN_DIR ${CMAKE_BINARY_DIR}/src/box/sql)<br class=""> include_directories(${SQL_SRC_DIR})<br class=""> include_directories(${SQL_BIN_DIR})<br class=""><br class="">-add_definitions(-DSQL_MAX_WORKER_THREADS=0)<br class="">-add_definitions(-DSQL_OMIT_AUTOMATIC_INDEX)<br class=""></div></div></blockquote><div><br class=""></div><div>Let’s keep routines connected with automatic indexes:</div><div>we are going to re-enable it in scope of <a href="https://github.com/tarantool/tarantool/issues/2583" class="">https://github.com/tarantool/tarantool/issues/2583</a></div><div>This code is a good point to start with reincarnation.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">-<br class=""> set(TEST_DEFINITIONS<br class="">     SQL_NO_SYNC=1<br class="">     SQL_TEST=1<br class=""><br class="">diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h<br class="">index f019cd291..4bf94fad2 100644<br class="">--- a/src/box/sql/sqlInt.h<br class="">+++ b/src/box/sql/sqlInt.h<br class=""><br class="">@@ -4858,13 +4846,6 @@ int sqlMemdebugNoType(void *, u8);<br class=""><br class="">-/*<br class="">- * Threading interface<br class="">- */<br class="">-#if SQL_MAX_WORKER_THREADS>0<br class="">-int sqlThreadCreate(sqlThread **, void *(*)(void *), void *);<br class="">-int sqlThreadJoin(sqlThread *, void **);<br class="">-#endif<br class=""></div></div></blockquote><div><br class=""></div><div>Now we can remove struct sqlThread.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">diff --git a/src/box/sql/vdbesort.c b/src/box/sql/vdbesort.c<br class="">index ddea6752c..a37fbd911 100644<br class="">--- a/src/box/sql/vdbesort.c<br class="">+++ b/src/box/sql/vdbesort.c<br class="">@@ -118,11 +118,6 @@<br class="">  * there are already N worker threads running, the main thread does the work<br class="">  * itself.<br class="">  *<br class="">- * The sorter is running in multi-threaded mode if (a) the library was built<br class="">- * with pre-processor symbol SQL_MAX_WORKER_THREADS set to a value greater<br class="">- * than zero, and (b) worker threads have been enabled at runtime by calling<br class="">- * "PRAGMA threads=N" with some value of N greater than 0.<br class="">- *<br class="">  * When Rewind() is called, any data remaining in memory is flushed to a<br class="">  * final PMA. So at this point the data is stored in some number of sorted<br class="">  * PMAs within temporary files on disk.<br class="">@@ -159,15 +154,6 @@<br class=""> #include "sqlInt.h"<br class=""> #include "vdbeInt.h"<br class=""><br class=""><br class=""> /*<br class="">  * Hard-coded maximum amount of data to accumulate in memory before flushing<br class="">  * to a level 0 PMA. The purpose of this limit is to prevent various integer<br class="">@@ -297,18 +283,14 @@ struct MergeEngine {<br class="">  *<br class="">  * Before a background thread is launched, variable bDone is set to 0. Then,<br class="">  * right before it exits, the thread itself sets bDone to 1. This is used for<br class="">- * two purposes:<br class=""></div></div></blockquote><div><br class=""></div><div>bDone member is unused now.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">@@ -885,8 +848,8 @@ sqlVdbeSorterInit(sql * db,<span class="Apple-tab-span" style="white-space:pre">   </span>/* Database connection (for malloc()) */<br class=""> <span class="Apple-tab-span" style="white-space:pre">      </span>} else {<br class=""> <span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>pSorter->key_def = pCsr->key_def;<br class=""> <span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>pSorter->pgsz = pgsz = 1024;<br class="">-<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>pSorter->nTask = nWorker + 1;<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>pSorter->iPrev = (u8) (nWorker - 1);<br class="">+<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>pSorter->nTask = 1;<br class=""></div></div></blockquote><div><br class=""></div><div>nTask now always equals to 1, you can refactor code using it.</div><div>The same concerns member iPrev.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c<br class="">index 4dedb38a7..01fa138f6 100644<br class="">--- a/src/box/sql/wherecode.c<br class="">+++ b/src/box/sql/wherecode.c<br class="">@@ -253,14 +253,6 @@ sqlWhereExplainOneScan(Parse * pParse,<span class="Apple-tab-span" style="white-space:pre">    </span>/* Parse context */<br class=""> <span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>       " USING INTEGER PRIMARY KEY (rowid%s?)",<br class=""> <span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>       zRangeOp);<br class=""> <span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br class="">-#ifdef SQL_EXPLAIN_ESTIMATED_ROWS<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>if (pLoop->nOut >= 10) {<br class="">-<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>sqlXPrintf(&str, " (~%llu rows)",<br class="">-<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>       sqlLogEstToInt(pLoop->nOut));<br class="">-<span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span>} else {<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>sqlStrAccumAppend(&str, " (~1 row)", 9);<br class="">-<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br class="">-#endif<br class=""></div></div></blockquote><div><br class=""></div><div>We can enable this code, instead of removing it.</div></div><br class=""></body></html>