[tarantool-patches] Re: [PATCH v4 2/2] sql: remove busy handler

Stanislav Zudin szudin at tarantool.org
Wed Feb 13 10:10:41 MSK 2019


On 12.02.2019 20:05, n.pettik wrote:
>> -	 *
>> -	 * Call sqlite3_busy_timeout(db, N).  Return the current
>> -	 * timeout value * if one is set.  If no busy handler
>> -	 * or a different busy handler is set * then 0 is
>> -	 * returned.  Setting the busy_timeout to 0 or negative *
>> -	 * disables the timeout.
>> -	 */
>> -	/* case PragTyp_BUSY_TIMEOUT */
>> 	default:{
>> -			assert(pPragma->ePragTyp == PragTyp_BUSY_TIMEOUT);
>> -			if (zRight) {
>> -				sqlite3_busy_timeout(db, sqlite3Atoi(zRight));
>> -			}
>> -			returnSingleInt(v, db->busyTimeout);
>> -			break;
>> +		/* We shouldn't get here. */
>> +		diag_set(ClientError, ER_UNKNOWN);
>> +		pParse->rc = SQL_TARANTOOL_ERROR;
>> +		pParse->nErr++;
>> +		goto pragma_out;
> If we really can’t reach here under no circumstances
> (which seems to be true - pragmaLocate checks this) then
> it’s better to place unreachable(); assert. Fix this please.
Please find the fix below.


  src/box/sql/pragma.c | 9 ++-------
  1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 62ff1f2b2..1b456e0b5 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -643,13 +643,8 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First 
part of [schema.]id field */
          break;
      }

-    default:{
-        /* We shouldn't get here. */
-        diag_set(ClientError, ER_UNKNOWN);
-        pParse->rc = SQL_TARANTOOL_ERROR;
-        pParse->nErr++;
-        goto pragma_out;
-        }
+    default:
+        unreachable();
      }

      /* The following block is a no-op unless SQLITE_DEBUG is
-- 
2.17.1





More information about the Tarantool-patches mailing list