Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: v.shpilevoy@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH v6 1/7] sql: remove unused macros from pragma.c and pragma.h
Date: Thu, 21 Feb 2019 16:00:41 +0300	[thread overview]
Message-ID: <6c5752c0a4049ebd6da6579e09ff6bc85f42d95d.1550753723.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1550753723.git.imeevma@gmail.com>

Some macros in pragma.c and pragma.h are obsolete because the
values they are checking are no longer used or their usage makes
no sense. Let's remove them.
---
 src/box/sql/CMakeLists.txt |  2 --
 src/box/sql/parse.y        |  6 +++---
 src/box/sql/pragma.c       |  4 ----
 src/box/sql/pragma.h       | 31 ++-----------------------------
 src/box/sql/printf.c       |  2 +-
 src/box/sql/select.c       | 22 +++++++++++-----------
 src/box/sql/sqlInt.h       | 18 +-----------------
 src/box/sql/where.c        | 46 ++++++++++++++++++++--------------------------
 src/box/sql/whereInt.h     |  4 ++--
 9 files changed, 40 insertions(+), 95 deletions(-)

diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 0db0b3b..5c47e97 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -1,7 +1,5 @@
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQL_DEBUG=1)
-  add_definitions(-DSQL_ENABLE_SELECTTRACE)
-  add_definitions(-DSQL_ENABLE_WHERETRACE)
 endif()
 
 set(EXT_SRC_DIR ${CMAKE_SOURCE_DIR}/extra)
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 661e695..2f8e5d3 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -449,11 +449,11 @@ multiselect_op(A) ::= EXCEPT|INTERSECT(OP).  {A = @OP; /*A-overwrites-OP*/}
 %endif SQL_OMIT_COMPOUND_SELECT
 oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
                  groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
   Token s = S; /*A-overwrites-S*/
 #endif
   A = sqlSelectNew(pParse,W,X,Y,P,Q,Z,D,L.pLimit,L.pOffset);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
   /* Populate the Select.zSelName[] string that is used to help with
   ** query planner debugging, to differentiate between multiple Select
   ** objects in a complex query.
@@ -476,7 +476,7 @@ oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
       sql_snprintf(sizeof(A->zSelName), A->zSelName, "%.*s", i, z);
     }
   }
-#endif /* SELECTRACE_ENABLED */
+#endif /* SQL_DEBUG */
 }
 oneselect(A) ::= values(A).
 
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 499c677..2eda204 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -481,7 +481,6 @@ sqlPragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	/* Jump to the appropriate pragma handler */
 	switch (pPragma->ePragTyp) {
 
-#ifndef SQL_OMIT_FLAG_PRAGMAS
 	case PragTyp_FLAG:{
 			if (zRight == 0) {
 				setPragmaResultColumnNames(v, pPragma);
@@ -510,9 +509,7 @@ sqlPragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 			}
 			break;
 		}
-#endif				/* SQL_OMIT_FLAG_PRAGMAS */
 
-#ifndef SQL_OMIT_SCHEMA_PRAGMAS
 	case PragTyp_TABLE_INFO:
 		sql_pragma_table_info(pParse, zRight);
 		break;
@@ -554,7 +551,6 @@ sqlPragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_iterator_free(iter);
 		break;
 	}
-#endif				/* SQL_OMIT_SCHEMA_PRAGMAS */
 
 	case PragTyp_FOREIGN_KEY_LIST:{
 		if (zRight == NULL)
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index d2775ac..088b64d 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -87,41 +87,32 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_NoColumns,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
-#if !defined(SQL_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "collation_list",
 	 /* ePragTyp:  */ PragTyp_COLLATION_LIST,
 	 /* ePragFlg:  */ PragFlg_Result0,
 	 /* ColNames:  */ 19, 2,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "count_changes",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_CountRows},
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "defer_foreign_keys",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_DeferFKs},
-#endif
 	{ /* zName:     */ "foreign_key_list",
 	 /* ePragTyp:  */ PragTyp_FOREIGN_KEY_LIST,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 21, 8,
 	 /* iArg:      */ 0},
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "full_column_names",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_FullColNames},
-#endif
-#if !defined(SQL_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "index_info",
 	 /* ePragTyp:  */ PragTyp_INDEX_INFO,
 	 /* ePragFlg:  */
@@ -134,42 +125,35 @@ static const PragmaName aPragmaName[] = {
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 16, 3,
 	 /* iArg:      */ 0},
-#endif
-#if defined(SQL_DEBUG) && !defined(SQL_OMIT_PARSER_TRACE)
+#if defined(SQL_DEBUG)
 	{ /* zName:     */ "parser_trace",
 	 /* ePragTyp:  */ PragTyp_PARSER_TRACE,
 	 /* ePragFlg:  */ 0,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
 #endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "recursive_triggers",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_RecTriggers},
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "reverse_unordered_selects",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_ReverseOrder},
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS) && defined(SQL_ENABLE_SELECTTRACE)
+#if defined(SQL_DEBUG)
 	{ /* zName:     */ "select_trace",
 	/* ePragTyp:  */ PragTyp_FLAG,
 	/* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	/* ColNames:  */ 0, 0,
 	/* iArg:      */ SQL_SelectTrace},
 #endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "short_column_names",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_ShortColNames},
-#endif
 	{ /* zName:     */ "sql_compound_select_limit",
 	/* ePragTyp:  */ PragTyp_COMPOUND_SELECT_LIMIT,
 	/* ePragFlg:  */ PragFlg_Result0,
@@ -180,7 +164,6 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 #if defined(SQL_DEBUG)
 	{ /* zName:     */ "sql_trace",
 	 /* ePragTyp:  */ PragTyp_FLAG,
@@ -188,24 +171,18 @@ static const PragmaName aPragmaName[] = {
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_SqlTrace},
 #endif
-#endif
-#if !defined(SQL_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "stats",
 	 /* ePragTyp:  */ PragTyp_STATS,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result0 | PragFlg_SchemaReq,
 	 /* ColNames:  */ 6, 4,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQL_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "table_info",
 	 /* ePragTyp:  */ PragTyp_TABLE_INFO,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 0, 6,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS)
 #if defined(SQL_DEBUG)
 	{ /* zName:     */ "vdbe_addoptrace",
 	 /* ePragTyp:  */ PragTyp_FLAG,
@@ -233,10 +210,6 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQL_VdbeTrace},
-#endif
-#endif
-#if !defined(SQL_OMIT_FLAG_PRAGMAS) && defined(SQL_ENABLE_WHERETRACE)
-
 	{ /* zName:     */ "where_trace",
 	/* ePragTyp:  */ PragTyp_FLAG,
 	/* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
diff --git a/src/box/sql/printf.c b/src/box/sql/printf.c
index aeb1fc2..e8f66af 100644
--- a/src/box/sql/printf.c
+++ b/src/box/sql/printf.c
@@ -1196,7 +1196,7 @@ sql_log(int iErrCode, const char *zFormat, ...)
 	}
 }
 
-#if (defined(SQL_DEBUG) || defined(SQL_ENABLE_SELECTTRACE))
+#if defined(SQL_DEBUG)
 /*
  * A version of printf() that understands %lld.  Used for debugging.
  */
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index f469de5..41b3d24 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -45,7 +45,7 @@
 /*
  * Trace output macros
  */
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 /***/ int sqlSelectTrace = 0;
 #define SELECTTRACE(K,P,S,X)  \
   if(sqlSelectTrace&(K))   \
@@ -174,7 +174,7 @@ sqlSelectNew(Parse * pParse,	/* Parsing context */
 	pNew->selFlags = selFlags;
 	pNew->iLimit = 0;
 	pNew->iOffset = 0;
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	pNew->zSelName[0] = 0;
 	if (user_session->sql_flags & SQL_SelectTrace)
 		sqlSelectTrace = 0xfff;
@@ -208,7 +208,7 @@ sqlSelectNew(Parse * pParse,	/* Parsing context */
 	return pNew;
 }
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 /*
  * Set the name of a Select object
  */
@@ -4215,7 +4215,7 @@ flattenSubquery(Parse * pParse,		/* Parsing context */
 	 */
 	sql_select_delete(db, pSub1);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (sqlSelectTrace & 0x100) {
 		SELECTTRACE(0x100, pParse, p, ("After flattening:\n"));
 		sqlTreeViewSelect(0, p, 0);
@@ -5444,7 +5444,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 		return 1;
 	}
 	memset(&sAggInfo, 0, sizeof(sAggInfo));
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	pParse->nSelectIndent++;
 	SELECTTRACE(1, pParse, p, ("begin processing:\n"));
 	if (sqlSelectTrace & 0x100) {
@@ -5480,7 +5480,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 	}
 	assert(p->pEList != 0);
 	isAgg = (p->selFlags & SF_Aggregate) != 0;
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (sqlSelectTrace & 0x100) {
 		SELECTTRACE(0x100, pParse, p, ("after name resolution:\n"));
 		sqlTreeViewSelect(0, p, 0);
@@ -5547,7 +5547,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 		}
 		sqlVdbeResolveLabel(v, end);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 		SELECTTRACE(1, pParse, p, ("end compound-select processing\n"));
 		pParse->nSelectIndent--;
 #endif
@@ -5595,7 +5595,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 		    && pushDownWhereTerms(pParse, pSub, p->pWhere,
 					  pItem->iCursor)
 		    ) {
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 			if (sqlSelectTrace & 0x100) {
 				SELECTTRACE(0x100, pParse, p,
 					    ("After WHERE-clause push-down:\n"));
@@ -5700,7 +5700,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 	pHaving = p->pHaving;
 	sDistinct.isTnct = (p->selFlags & SF_Distinct) != 0;
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (sqlSelectTrace & 0x400) {
 		SELECTTRACE(0x400, pParse, p,
 			    ("After all FROM-clause analysis:\n"));
@@ -5733,7 +5733,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 		 */
 		assert(sDistinct.isTnct);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 		if (sqlSelectTrace & 0x400) {
 			SELECTTRACE(0x400, pParse, p,
 				    ("Transform DISTINCT into GROUP BY:\n"));
@@ -6385,7 +6385,7 @@ sqlSelect(Parse * pParse,		/* The parser context */
 
 	sqlDbFree(db, sAggInfo.aCol);
 	sqlDbFree(db, sAggInfo.aFunc);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 	SELECTTRACE(1, pParse, p, ("end processing\n"));
 	pParse->nSelectIndent--;
 #endif
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 2830ab6..a52c0bd 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -1290,22 +1290,6 @@ extern const int sqlone;
 #endif
 
 /*
- * SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
- * the Select query generator tracing logic is turned on.
- */
-#if defined(SQL_DEBUG) || defined(SQL_ENABLE_SELECTTRACE)
-#define SELECTTRACE_ENABLED
-#else
-#undef SELECTTRACE_ENABLED
-#endif
-
-#if defined(SQL_DEBUG) || defined(SQL_ENABLE_WHERETRACE)
-#define WHERETRACE_ENABLED
-#else
-#undef WHERETRACE_ENABLED
-#endif
-
-/*
  * A convenience macro that returns the number of elements in
  * an array.
  */
@@ -3855,7 +3839,7 @@ Expr *sqlExprDup(sql *, Expr *, int);
 SrcList *sqlSrcListDup(sql *, SrcList *, int);
 IdList *sqlIdListDup(sql *, IdList *);
 Select *sqlSelectDup(sql *, Select *, int);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQL_DEBUG
 void sqlSelectSetName(Select *, const char *);
 #else
 #define sqlSelectSetName(A,B)
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index fc05c9f..61b1868 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -50,7 +50,7 @@
 static int whereLoopResize(sql *, WhereLoop *, int);
 
 /* Test variable that can be set to enable WHERE tracing */
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 /***/ int sqlWhereTrace = 0; /* -1; */
 #endif
 
@@ -145,7 +145,7 @@ sqlWhereOkOnePass(WhereInfo * pWInfo, int *aiCur)
 	if (pWInfo->eOnePass == ONEPASS_MULTI) {
 		pWInfo->eOnePass = ONEPASS_OFF;
 	}
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (sqlWhereTrace && pWInfo->eOnePass != ONEPASS_OFF) {
 		sqlDebugPrintf("%s cursors: %d %d\n",
 				   pWInfo->eOnePass ==
@@ -1491,7 +1491,7 @@ whereRangeScanEst(Parse * pParse,	/* Parsing & code generating context */
 		nNew = 10;
 	if (nNew < nOut)
 		nOut = nNew;
-#if defined(WHERETRACE_ENABLED)
+#if defined(SQL_DEBUG)
 	if (pLoop->nOut > nOut) {
 		WHERETRACE(0x10, ("Range scan lowers nOut from %d to %d\n",
 				  pLoop->nOut, nOut));
@@ -1605,7 +1605,7 @@ whereInScanEst(Parse * pParse,	/* Parsing & code generating context */
 	return rc;
 }
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 /*
  * Print the content of a WhereTerm object
  */
@@ -1649,9 +1649,7 @@ whereTermPrint(WhereTerm * pTerm, int iTerm)
 		sqlTreeViewExpr(0, pTerm->pExpr, 0);
 	}
 }
-#endif
 
-#ifdef WHERETRACE_ENABLED
 /*
  * Show the complete content of a WhereClause
  */
@@ -1663,9 +1661,7 @@ sqlWhereClausePrint(WhereClause * pWC)
 		whereTermPrint(&pWC->a[i], i);
 	}
 }
-#endif
 
-#ifdef WHERETRACE_ENABLED
 /*
  * Print a WhereLoop object for debugging purposes
  */
@@ -1677,12 +1673,10 @@ whereLoopPrint(WhereLoop * p, WhereClause * pWC)
 	struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;
 	struct space_def *space_def = pItem->space->def;
 	Bitmask mAll = (((Bitmask) 1) << (nb * 4)) - 1;
-#ifdef SQL_DEBUG
 	sqlDebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
 			   p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
 	sqlDebugPrintf(" %12s",
 			   pItem->zAlias ? pItem->zAlias : space_def->name);
-#endif
 	const char *zName;
 	if (p->index_def != NULL && (zName = p->index_def->name) != NULL) {
 		if (strncmp(zName, "sql_autoindex_", 17) == 0) {
@@ -2043,14 +2037,14 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 	 */
 	if (pBuilder->pOrSet != 0) {
 		if (pTemplate->nLTerm) {
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 			u16 n = pBuilder->pOrSet->n;
 			int x =
 #endif
 			    whereOrInsert(pBuilder->pOrSet, pTemplate->prereq,
 					  pTemplate->rRun,
 					  pTemplate->nOut);
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQL_DEBUG		/* 0x8 */
 			if (sqlWhereTrace & 0x8) {
 				sqlDebugPrintf(x ? "   or-%d:  " :
 						   "   or-X:  ", n);
@@ -2070,7 +2064,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 		/* There already exists a WhereLoop on the list that is better
 		 * than pTemplate, so just ignore pTemplate
 		 */
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQL_DEBUG		/* 0x8 */
 		if (sqlWhereTrace & 0x8) {
 			sqlDebugPrintf("   skip: ");
 			whereLoopPrint(pTemplate, pBuilder->pWC);
@@ -2085,7 +2079,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 	 * with pTemplate[] if p[] exists, or if p==NULL then allocate a new
 	 * WhereLoop and insert it.
 	 */
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQL_DEBUG		/* 0x8 */
 	if (sqlWhereTrace & 0x8) {
 		if (p != 0) {
 			sqlDebugPrintf("replace: ");
@@ -2117,7 +2111,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 			if (pToDel == 0)
 				break;
 			*ppTail = pToDel->pNextLoop;
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQL_DEBUG		/* 0x8 */
 			if (sqlWhereTrace & 0x8) {
 				sqlDebugPrintf(" delete: ");
 				whereLoopPrint(pToDel, pBuilder->pWC);
@@ -3004,7 +2998,7 @@ whereLoopAddOr(WhereLoopBuilder * pBuilder, Bitmask mPrereq, Bitmask mUnusable)
 					continue;
 				}
 				sCur.n = 0;
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 				WHERETRACE(0x200,
 					   ("OR-term %d of %p has %d subterms:\n",
 					    (int)(pOrTerm - pOrWC->a), pTerm,
@@ -3502,7 +3496,7 @@ sqlWhereIsSorted(WhereInfo * pWInfo)
 	return pWInfo->sorted;
 }
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 /* For debugging use only: */
 static const char *
 wherePathName(WherePath * pPath, int nLoop, WhereLoop * pLast)
@@ -3770,7 +3764,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 						 * paths currently in the best-so-far buffer.  So discard
 						 * this candidate as not viable.
 						 */
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQL_DEBUG	/* 0x4 */
 						if (sqlWhereTrace & 0x4) {
 							sqlDebugPrintf("Skip   %s cost=%-3d,%3d order=%c\n",
 									   wherePathName(pFrom, iLoop,
@@ -3793,7 +3787,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 						jj = mxI;
 					}
 					pTo = &aTo[jj];
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQL_DEBUG	/* 0x4 */
 					if (sqlWhereTrace & 0x4) {
 						sqlDebugPrintf
 						    ("New    %s cost=%-3d,%3d order=%c\n",
@@ -3813,7 +3807,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 					if (pTo->rCost < rCost
 					    || (pTo->rCost == rCost
 						&& pTo->nRow <= nOut)) {
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQL_DEBUG	/* 0x4 */
 						if (sqlWhereTrace & 0x4) {
 							sqlDebugPrintf("Skip   %s cost=%-3d,%3d order=%c",
 									   wherePathName(pFrom, iLoop,
@@ -3838,7 +3832,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 					/* Control reaches here if the candidate path is better than the
 					 * pTo path.  Replace pTo with the candidate.
 					 */
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQL_DEBUG	/* 0x4 */
 					if (sqlWhereTrace & 0x4) {
 						sqlDebugPrintf("Update %s cost=%-3d,%3d order=%c",
 								   wherePathName(pFrom, iLoop,
@@ -3887,7 +3881,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 			}
 		}
 
-#ifdef WHERETRACE_ENABLED	/* >=2 */
+#ifdef SQL_DEBUG	/* >=2 */
 		if (sqlWhereTrace & 0x02) {
 			sqlDebugPrintf("---- after round %d ----\n", iLoop);
 			for (ii = 0, pTo = aTo; ii < nTo; ii++, pTo++) {
@@ -4247,7 +4241,7 @@ sqlWhereBegin(Parse * pParse,	/* The parser context */
 	u8 bFordelete = 0;	/* OPFLAG_FORDELETE or zero, as appropriate */
 	struct session *user_session = current_session();
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (user_session->sql_flags & SQL_WhereTrace)
 		sqlWhereTrace = 0xfff;
 	else
@@ -4410,7 +4404,7 @@ sqlWhereBegin(Parse * pParse,	/* The parser context */
 	}
 
 	/* Construct the WhereLoop objects */
-#if defined(WHERETRACE_ENABLED)
+#if defined(SQL_DEBUG)
 	if (sqlWhereTrace & 0xffff) {
 		sqlDebugPrintf("*** Optimizer Start *** (wctrlFlags: 0x%x",
 				   wctrlFlags);
@@ -4429,7 +4423,7 @@ sqlWhereBegin(Parse * pParse,	/* The parser context */
 		if (rc)
 			goto whereBeginError;
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 		if (sqlWhereTrace) {	/* Display all of the WhereLoop objects */
 			WhereLoop *p;
 			int i;
@@ -4460,7 +4454,7 @@ sqlWhereBegin(Parse * pParse,	/* The parser context */
 	if (pParse->nErr || NEVER(db->mallocFailed)) {
 		goto whereBeginError;
 	}
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 	if (sqlWhereTrace) {
 		sqlDebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
 		if (pWInfo->nOBSat > 0) {
diff --git a/src/box/sql/whereInt.h b/src/box/sql/whereInt.h
index 7a0312d..1f4b22a 100644
--- a/src/box/sql/whereInt.h
+++ b/src/box/sql/whereInt.h
@@ -39,7 +39,7 @@
 /*
  * Trace output macros
  */
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 /***/ extern int sqlWhereTrace;
 #define WHERETRACE(K,X)  if(sqlWhereTrace&(K)) sqlDebugPrintf X
 #else
@@ -444,7 +444,7 @@ struct WhereInfo {
  * where.c:
  */
 Bitmask sqlWhereGetMask(WhereMaskSet *, int);
-#ifdef WHERETRACE_ENABLED
+#ifdef SQL_DEBUG
 void sqlWhereClausePrint(WhereClause * pWC);
 #endif
 WhereTerm *sqlWhereFindTerm(WhereClause * pWC,	/* The WHERE clause to be searched */
-- 
2.7.4

  reply	other threads:[~2019-02-21 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 13:00 [tarantool-patches] [PATCH v6 0/7] sql: set column types for EXPLAIN and PRAGMA imeevma
2019-02-21 13:00 ` imeevma [this message]
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 2/7] sql: fix "PRAGMA parser_trace" result imeevma
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 3/7] sql: Show currently set sql_default_engine imeevma
2019-02-21 15:52   ` [tarantool-patches] " Konstantin Osipov
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 4/7] sql: fix "PRAGMA case_sensitive_like" result imeevma
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 5/7] sql: get results of PRAGMA statement as result set imeevma
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 6/7] sql: set column types for EXPLAIN and PRAGMA imeevma
2019-02-21 13:00 ` [tarantool-patches] [PATCH v6 7/7] sql: remove test gh-3733-pragma.test.lua imeevma
2019-02-25 11:59 ` [tarantool-patches] Re: [PATCH v6 0/7] sql: set column types for EXPLAIN and PRAGMA Vladislav Shpilevoy
2019-02-25 21:05   ` Imeev Mergen
2019-02-26  9:33     ` Vladislav Shpilevoy
2019-02-27 11:09 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c5752c0a4049ebd6da6579e09ff6bc85f42d95d.1550753723.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v6 1/7] sql: remove unused macros from pragma.c and pragma.h' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox