From: imeevma@tarantool.org To: korablev@tarantool.org Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH v1 13/21] sql: remove SQL_BUSY errcode Date: Sat, 25 May 2019 13:44:51 +0300 [thread overview] Message-ID: <044595bf6de6a6d953bd16b80748cdb866c1eb4a.1558780708.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1558780708.git.imeevma@gmail.com> Removing this error code is part of getting rid of the SQL error system. --- src/box/sql/main.c | 2 +- src/box/sql/os_unix.c | 4 +--- src/box/sql/sqlInt.h | 2 -- src/box/sql/vdbe.c | 20 ++++++-------------- src/box/sql/vdbeaux.c | 14 ++++---------- 5 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/box/sql/main.c b/src/box/sql/main.c index 65d8de5..052683e 100644 --- a/src/box/sql/main.c +++ b/src/box/sql/main.c @@ -266,7 +266,7 @@ sqlCreateFunc(sql * db, /* Check if an existing function is being overridden or deleted. If so, - * and there are active VMs, then return SQL_BUSY. If a function + * and there are active VMs, then return an error. If a function * is being overridden/deleted but there are no active VMs, allow the * operation to continue but invalidate all precompiled statements. */ diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c index fa28c46..69f6867 100644 --- a/src/box/sql/os_unix.c +++ b/src/box/sql/os_unix.c @@ -554,9 +554,7 @@ posixUnlock(sql_file * id, int eFileLock, int handleNFSUnlock) /* In theory, the call to unixFileLock() cannot fail because another * process is holding an incompatible lock. If it does, this * indicates that the other process is not following the locking - * protocol. If this happens, return SQL_IOERR_RDLOCK. Returning - * SQL_BUSY would confuse the upper layer (in practice it causes - * an assert to fail). + * protocol. If this happens, return SQL_IOERR_RDLOCK. */ rc = SQL_IOERR_RDLOCK; storeLastErrno(pFile, errno); diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index fee6857..3cf2b8d 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -358,8 +358,6 @@ struct sql_vfs { enum sql_ret_code { /** Common error code. */ SQL_ERROR = 1, - /** The database file is locked. */ - SQL_BUSY, /** A malloc() failed. */ SQL_NOMEM, /** Some kind of disk I/O error occurred. */ diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 27ad06f..f4859b8 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -638,7 +638,7 @@ int sqlVdbeExec(Vdbe *p) */ goto no_mem; } - assert(p->rc==0 || (p->rc&0xff)==SQL_BUSY); + assert(p->rc == 0); p->rc = 0; p->iCurrentTime = 0; assert(p->explain==0); @@ -981,13 +981,9 @@ case OP_Halt: { assert(! diag_is_empty(diag_get())); } rc = sqlVdbeHalt(p); - assert(rc==SQL_BUSY || rc==0 || rc==SQL_ERROR); - if (rc==SQL_BUSY) { - p->rc = SQL_BUSY; - } else { - assert(rc==0 || (p->rc&0xff)==SQL_CONSTRAINT); - rc = p->rc ? SQL_TARANTOOL_ERROR : SQL_DONE; - } + assert(rc == 0 || rc==SQL_ERROR); + assert(rc==0 || (p->rc&0xff)==SQL_CONSTRAINT); + rc = p->rc ? SQL_TARANTOOL_ERROR : SQL_DONE; goto vdbe_return; } @@ -2900,11 +2896,7 @@ case OP_Savepoint: { if ((rc = sqlVdbeCheckFk(p, 1))!=0) { goto vdbe_return; } - if (sqlVdbeHalt(p)==SQL_BUSY) { - p->pc = (int)(pOp - aOp); - p->rc = rc = SQL_BUSY; - goto vdbe_return; - } + sqlVdbeHalt(p); if (p->rc != 0) goto abort_due_to_error; } else { @@ -5313,7 +5305,7 @@ vdbe_return: assert(rc!=0 || nExtraDelete==0 || sql_strlike_ci("DELETE%", p->zSql, 0) != 0 ); - assert(rc == 0 || rc == SQL_BUSY || rc == SQL_TARANTOOL_ERROR || + assert(rc == 0 || rc == SQL_TARANTOOL_ERROR || rc == SQL_ROW || rc == SQL_DONE); return rc; diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index efc5103..4f06369 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -1420,8 +1420,7 @@ sqlVdbeList(Vdbe * p) assert(p->explain); assert(p->magic == VDBE_MAGIC_RUN); - assert(p->rc == 0 || p->rc == SQL_BUSY - || p->rc == SQL_NOMEM); + assert(p->rc == 0 || p->rc == SQL_NOMEM); /* Even though this opcode does not use dynamic strings for * the result, result columns may become dynamic if the user calls @@ -2161,9 +2160,7 @@ sql_savepoint(MAYBE_UNUSED Vdbe *p, const char *zName) * SQL_MAGIC_RUN to SQL_MAGIC_HALT. It is harmless to * call this on a VM that is in the SQL_MAGIC_HALT state. * - * Return an error code. If the commit could not complete because of - * lock contention, return SQL_BUSY. If SQL_BUSY is returned, it - * means the close did not happen and needs to be repeated. + * Return an error code. */ int sqlVdbeHalt(Vdbe * p) @@ -2268,10 +2265,7 @@ sqlVdbeHalt(Vdbe * p) 0 : SQL_TARANTOOL_ERROR; closeCursorsAndFree(p); } - if (rc == SQL_BUSY && !p->pDelFrame) { - closeCursorsAndFree(p); - return SQL_BUSY; - } else if (rc != 0) { + if (rc != 0) { p->rc = rc; box_txn_rollback(); closeCursorsAndFree(p); @@ -2348,7 +2342,7 @@ sqlVdbeHalt(Vdbe * p) assert(db->nVdbeActive > 0 || box_txn() || p->anonymous_savepoint == NULL); - return (p->rc == SQL_BUSY ? SQL_BUSY : 0); + return 0; } /* -- 2.7.4
next prev parent reply other threads:[~2019-05-25 10:44 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-25 10:44 [tarantool-patches] [PATCH v1 00/21] sql: remove SQL error system imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 01/21] sql: remove unused functions of " imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 02/21] sql: disable lookaside system imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 03/21] sql: remove SQL_OK error/status code imeevma 2019-05-25 14:45 ` [tarantool-patches] " n.pettik 2019-05-26 9:39 ` Mergen Imeev 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 04/21] sql: remove SQL_PERM, SQL_WARNING, SQL_ABORT errcodes imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 05/21] sql: remove SQL_CANTOPEN errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 06/21] sql: remove SQL_NOTFOUND error/status code imeevma 2019-05-25 14:58 ` [tarantool-patches] " n.pettik 2019-05-25 20:26 ` Konstantin Osipov 2019-05-26 16:07 ` n.pettik 2019-05-26 9:45 ` Mergen Imeev 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 07/21] sql: remove SQL_LOCKED errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 08/21] sql: remove SQL_FULL errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 09/21] sql: remove SQL_MISUSE errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 10/21] sql: remove SQL_RANGE errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 11/21] sql: remove SQL_SCHEMA errcode imeevma 2019-05-25 16:18 ` [tarantool-patches] " n.pettik 2019-05-26 9:46 ` Mergen Imeev 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 12/21] sql: remove SQL_TOOBIG errcode imeevma 2019-05-25 16:11 ` [tarantool-patches] " n.pettik 2019-05-26 12:12 ` Mergen Imeev 2019-05-25 10:44 ` imeevma [this message] 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 14/21] sql: remove SQL_CONSTRAINT errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 15/21] sql: remove SQL_ERROR errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 16/21] sql: remove SQL_NOMEM errcode imeevma 2019-05-25 10:44 ` [tarantool-patches] [PATCH v1 17/21] sql: remove SQL_IOERR errcode imeevma 2019-05-25 10:45 ` [tarantool-patches] [PATCH v1 18/21] sql: remove SQL_TARANTOOL_ERROR errcode imeevma 2019-05-25 10:45 ` [tarantool-patches] [PATCH v1 19/21] sql: remove field errMask from struct sql imeevma 2019-05-25 10:45 ` [tarantool-patches] [PATCH v1 20/21] sql: replace rc by is_aborted in struct Parse imeevma 2019-05-25 15:46 ` [tarantool-patches] " n.pettik 2019-05-26 9:49 ` Mergen Imeev 2019-05-25 10:45 ` [tarantool-patches] [PATCH v1 21/21] sql: remove sql_log() imeevma 2019-05-25 16:36 ` [tarantool-patches] Re: [PATCH v1 00/21] sql: remove SQL error system n.pettik 2019-05-28 11:12 ` Mergen Imeev
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=044595bf6de6a6d953bd16b80748cdb866c1eb4a.1558780708.git.imeevma@gmail.com \ --to=imeevma@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH v1 13/21] sql: remove SQL_BUSY errcode' \ /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