From: imeevma@tarantool.org To: v.shpilevoy@tarantool.org Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH v1 17/28] sql: remove SQL_BUSY errcode Date: Mon, 10 Jun 2019 16:56:53 +0300 [thread overview] Message-ID: <ee5789c5bd96dbdc6843a7786bedf3750914df4b.1560174553.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1560174553.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 f42b323..9f15893 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 896585c..c63f11c 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -752,7 +752,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); @@ -1068,13 +1068,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; } @@ -2886,11 +2882,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 { @@ -5291,7 +5283,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-06-10 13:56 UTC|newest] Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-10 13:56 [tarantool-patches] [PATCH v1 00/28] sql: Remove SQL error system imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 01/28] sql: remove field zErrMsg from struct Vdbe imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 02/28] sql: remove field pErr from struct sql imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 03/28] sql: remove field errCode " imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 04/28] sql: remove sqlError() and remove sqlErrorWithMsg() imeevma 2019-06-13 22:25 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 9:45 ` Mergen Imeev 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 05/28] sql: remove unused functions of SQL error system imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 06/28] sql: disable lookaside system imeevma 2019-06-13 22:25 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 9:47 ` Mergen Imeev 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 07/28] sql: remove SQL_OK error/status code imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 9:52 ` Mergen Imeev 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 08/28] sql: remove SQL_PERM, SQL_WARNING, SQL_ABORT errcodes imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 09/28] sql: remove SQL_CANTOPEN errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 10/28] sql: remove SQL_NOTFOUND error/status code imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 11/28] sql: remove SQL_LOCKED errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 12/28] sql: remove SQL_FULL errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 13/28] sql: remove SQL_MISUSE errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 14/28] sql: remove SQL_RANGE errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 15/28] sql: remove SQL_SCHEMA errcode imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 9:55 ` Mergen Imeev 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 16/28] sql: remove SQL_TOOBIG errcode imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 9:57 ` Mergen Imeev 2019-06-10 13:56 ` imeevma [this message] 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 18/28] sql: remove SQL_CONSTRAINT errcode imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 10:00 ` Mergen Imeev 2019-06-18 20:40 ` Vladislav Shpilevoy 2019-06-19 8:02 ` Mergen Imeev 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 19/28] sql: remove SQL_ERROR errcode imeevma 2019-06-10 13:56 ` [tarantool-patches] [PATCH v1 20/28] sql: remove SQL_NOMEM errcode imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 10:01 ` Mergen Imeev 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 21/28] sql: remove SQL_IOERR errcode imeevma 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 22/28] sql: remove SQL_TARANTOOL_ERROR errcode imeevma 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 23/28] sql: remove field errMask from struct sql imeevma 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 24/28] sql: replace rc by is_aborted in struct VDBE imeevma 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 25/28] sql: remove sql_log() imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 10:02 ` Mergen Imeev 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 26/28] sql: cleanup of legacy memory management system imeevma 2019-06-13 22:24 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-15 10:04 ` Mergen Imeev 2019-06-18 20:40 ` Vladislav Shpilevoy 2019-06-19 8:04 ` Mergen Imeev 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 27/28] sql: make function return void instead of int imeevma 2019-06-10 13:57 ` [tarantool-patches] [PATCH v1 28/28] sql: remove function sqlApiExit() imeevma 2019-06-11 10:00 ` [tarantool-patches] Re: [PATCH v1 00/28] sql: Remove SQL error system Imeev Mergen 2019-06-13 22:24 ` Vladislav Shpilevoy 2019-06-15 10:08 ` Mergen Imeev 2019-06-19 19:11 ` Vladislav Shpilevoy 2019-06-20 16:08 ` 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=ee5789c5bd96dbdc6843a7786bedf3750914df4b.1560174553.git.imeevma@gmail.com \ --to=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH v1 17/28] 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