[tarantool-patches] [PATCH v1 04/21] sql: remove SQL_PERM, SQL_WARNING, SQL_ABORT errcodes

imeevma at tarantool.org imeevma at tarantool.org
Sat May 25 13:44:36 MSK 2019


Removing these error codes is part of getting rid of the SQL error
system.
---
 src/box/sql/legacy.c  |  4 ++--
 src/box/sql/os_unix.c | 47 -----------------------------------------------
 src/box/sql/sqlInt.h  |  6 ------
 src/box/sql/where.c   | 10 ----------
 4 files changed, 2 insertions(+), 65 deletions(-)

diff --git a/src/box/sql/legacy.c b/src/box/sql/legacy.c
index e3024f2..600c53c 100644
--- a/src/box/sql/legacy.c
+++ b/src/box/sql/legacy.c
@@ -138,9 +138,9 @@ sql_exec(sql * db,	/* The database on which the SQL executes */
 				if (xCallback(pArg, nCol, azVals, azCols)) {
 					/* EVIDENCE-OF: R-38229-40159 If the callback function to
 					 * sql_exec() returns non-zero, then sql_exec() will
-					 * return SQL_ABORT.
+					 * return -1.
 					 */
-					rc = SQL_ABORT;
+					rc = -1;
 					sqlVdbeFinalize((Vdbe *) pStmt);
 					pStmt = 0;
 					goto exec_out;
diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c
index fd9576e..d9e5656 100644
--- a/src/box/sql/os_unix.c
+++ b/src/box/sql/os_unix.c
@@ -164,9 +164,6 @@ robust_open(const char *z, int f, mode_t m)
 		if (fd >= SQL_MINIMUM_FILE_DESCRIPTOR)
 			break;
 		close(fd);
-		sql_log(SQL_WARNING,
-			    "attempt to open \"%s\" as file descriptor %d", z,
-			    fd);
 		fd = -1;
 		if (open("/dev/null", f, m) < 0)
 			break;
@@ -502,48 +499,6 @@ fileHasMoved(unixFile * pFile)
 }
 
 /*
- * Check a unixFile that is a database.  Verify the following:
- *
- * (1) There is exactly one hard link on the file
- * (2) The file is not a symbolic link
- * (3) The file has not been renamed or unlinked
- *
- * Issue sql_log(SQL_WARNING,...) messages if anything is not right.
- */
-static void
-verifyDbFile(unixFile * pFile)
-{
-	struct stat buf;
-	int rc;
-
-	/* These verifications occurs for the main database only */
-	if (pFile->ctrlFlags & UNIXFILE_NOLOCK)
-		return;
-
-	rc = fstat(pFile->h, &buf);
-	if (rc != 0) {
-		sql_log(SQL_WARNING, "cannot fstat db file %s",
-			    pFile->zPath);
-		return;
-	}
-	if (buf.st_nlink == 0) {
-		sql_log(SQL_WARNING, "file unlinked while open: %s",
-			    pFile->zPath);
-		return;
-	}
-	if (buf.st_nlink > 1) {
-		sql_log(SQL_WARNING, "multiple links to file: %s",
-			    pFile->zPath);
-		return;
-	}
-	if (fileHasMoved(pFile)) {
-		sql_log(SQL_WARNING, "file renamed while open: %s",
-			    pFile->zPath);
-		return;
-	}
-}
-
-/*
  * Attempt to set a system-lock on the file pFile.  The lock is
  * described by pLock.
  *
@@ -766,7 +721,6 @@ unixClose(sql_file * id)
 {
 	int rc;
 	unixFile *pFile = (unixFile *) id;
-	verifyDbFile(pFile);
 	unixUnlock(id, NO_LOCK);
 
 	/* unixFile.pInode is always valid here. Otherwise, a different close
@@ -1528,7 +1482,6 @@ fillInUnixFile(sql_vfs * pVfs,	/* Pointer to vfs object */
 			robust_close(pNew, h, __LINE__);
 	} else {
 		pNew->pMethod = pLockingStyle;
-		verifyDbFile(pNew);
 	}
 	return rc;
 }
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index c989664..e3f50b0 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -358,10 +358,6 @@ struct sql_vfs {
 enum sql_ret_code {
 	/** Common error code. */
 	SQL_ERROR = 1,
-	/** Access permission denied. */
-	SQL_PERM,
-	/** Callback routine requested an abort. */
-	SQL_ABORT,
 	/** The database file is locked. */
 	SQL_BUSY,
 	/** A table in the database is locked. */
@@ -387,8 +383,6 @@ enum sql_ret_code {
 	/** 2nd parameter to sql_bind out of range. */
 	SQL_RANGE,
 	SQL_TARANTOOL_ERROR,
-	/** Warnings from sql_log(). */
-	SQL_WARNING,
 	/** sql_step() has another row ready. */
 	SQL_ROW,
 	/** sql_step() has finished executing. */
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index c716a0e..0b1ccd9 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -742,7 +742,6 @@ constructAutomaticIndex(Parse * pParse,			/* The parsing context */
 	char *zNotUsed;		/* Extra space on the end of pIdx */
 	Bitmask idxCols;	/* Bitmap of columns used for indexing */
 	Bitmask extraCols;	/* Bitmap of additional columns */
-	u8 sentWarning = 0;	/* True if a warnning has been issued */
 	int iContinue = 0;	/* Jump here to skip excluded rows */
 	struct SrcList_item *pTabItem;	/* FROM clause term being indexed */
 	int addrCounter = 0;	/* Address where integer counter is initialized */
@@ -769,15 +768,6 @@ constructAutomaticIndex(Parse * pParse,			/* The parsing context */
 			int iCol = pTerm->u.leftColumn;
 			Bitmask cMask =
 			    iCol >= BMS ? MASKBIT(BMS - 1) : MASKBIT(iCol);
-			testcase(iCol == BMS);
-			testcase(iCol == BMS - 1);
-			if (!sentWarning) {
-				sql_log(SQL_WARNING_AUTOINDEX,
-					    "automatic index on %s(%s)",
-					    pTable->def->name,
-					    pTable->aCol[iCol].zName);
-				sentWarning = 1;
-			}
 			if ((idxCols & cMask) == 0) {
 				if (whereLoopResize
 				    (pParse->db, pLoop, nKeyCol + 1)) {
-- 
2.7.4





More information about the Tarantool-patches mailing list