[patches] [PATCH V2 6/9] sql: remove journal_mode
Bulat Niatshin
niatshin at tarantool.org
Tue Feb 27 16:54:51 MSK 2018
SQL journal is a completely unnecessary element in our code base,
it needs to be removed with journal_mode. In this patch it was
removed along with refactoring other related code - like
VDBE sorter, which may open temp files or SQL pragmas.
For #3119
---
src/box/sql/CMakeLists.txt | 1 -
src/box/sql/global.c | 14 +-
src/box/sql/main.c | 8 +-
src/box/sql/memjournal.c | 473 ---------------------------------------------
src/box/sql/opcodes.c | 214 ++++++++++----------
src/box/sql/opcodes.h | 244 ++++++++++++-----------
src/box/sql/os.c | 2 +-
src/box/sql/os_unix.c | 105 ++--------
src/box/sql/pragma.c | 18 --
src/box/sql/sqlite3.h | 98 +---------
src/box/sql/sqliteInt.h | 10 -
src/box/sql/sqliteLimit.h | 8 -
src/box/sql/vdbe.c | 81 --------
src/box/sql/vdbeaux.c | 8 -
src/box/sql/vdbesort.c | 1 -
15 files changed, 242 insertions(+), 1043 deletions(-)
delete mode 100644 src/box/sql/memjournal.c
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 858440157..9a2556df5 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -55,7 +55,6 @@ add_library(sql STATIC
mem2.c
mem3.c
mem5.c
- memjournal.c
mutex.c
mutex_noop.c
mutex_unix.c
diff --git a/src/box/sql/global.c b/src/box/sql/global.c
index bdcb37331..97bdbe66b 100644
--- a/src/box/sql/global.c
+++ b/src/box/sql/global.c
@@ -189,18 +189,6 @@ const unsigned char sqlite3CtypeMap[256] = {
#define SQLITE_SORTER_PMASZ 250
#endif
-/* Statement journals spill to disk when their size exceeds the following
- * threshold (in bytes). 0 means that statement journals are created and
- * written to disk immediately (the default behavior for SQLite versions
- * before 3.12.0). -1 means always keep the entire statement journal in
- * memory. (The statement journal is also always held entirely in memory
- * if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
- * setting.)
- */
-#ifndef SQLITE_STMTJRNL_SPILL
-#define SQLITE_STMTJRNL_SPILL (64*1024)
-#endif
-
/*
* The following singleton contains the global configuration for
* the SQLite library.
@@ -215,7 +203,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
0, /* neverCorrupt */
512, /* szLookaside */
125, /* nLookaside */
- SQLITE_STMTJRNL_SPILL, /* nStmtSpill */
+ 0, /* nStmtSpill */
{0, 0, 0, 0, 0, 0, 0, 0}, /* m */
{0, 0, 0, 0, 0, 0, 0, 0, 0}, /* mutex */
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* pcache2 */
diff --git a/src/box/sql/main.c b/src/box/sql/main.c
index 7cc88d172..4150acb6a 100644
--- a/src/box/sql/main.c
+++ b/src/box/sql/main.c
@@ -2326,12 +2326,8 @@ openDatabase(const char *zFilename, /* Database filename UTF-8 encoded */
SQLITE_OPEN_MAIN_DB |
SQLITE_OPEN_TEMP_DB |
SQLITE_OPEN_TRANSIENT_DB |
- SQLITE_OPEN_MAIN_JOURNAL |
- SQLITE_OPEN_TEMP_JOURNAL |
- SQLITE_OPEN_SUBJOURNAL |
- SQLITE_OPEN_MASTER_JOURNAL |
SQLITE_OPEN_NOMUTEX |
- SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_WAL);
+ SQLITE_OPEN_FULLMUTEX);
flags |= SQLITE_OPEN_MEMORY;
/* Allocate the sqlite data structure */
db = sqlite3MallocZero(sizeof(sqlite3));
@@ -2442,8 +2438,6 @@ openDatabase(const char *zFilename, /* Database filename UTF-8 encoded */
setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
sqlite3GlobalConfig.nLookaside);
- sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);
-
opendb_out:
if (db) {
assert(db->mutex != 0 || isThreadsafe == 0
diff --git a/src/box/sql/memjournal.c b/src/box/sql/memjournal.c
deleted file mode 100644
index 808b00d47..000000000
--- a/src/box/sql/memjournal.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright 2010-2017, Tarantool AUTHORS, please see AUTHORS file.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- *
- * This file contains code use to implement an in-memory rollback journal.
- * The in-memory rollback journal is used to journal transactions for
- * ":memory:" databases and when the journal_mode=MEMORY pragma is used.
- *
- * Update: The in-memory journal is also used to temporarily cache
- * smaller journals that are not critical for power-loss recovery.
- * For example, statement journals that are not too big will be held
- * entirely in memory, thus reducing the number of file I/O calls, and
- * more importantly, reducing temporary file creation events. If these
- * journals become too large for memory, they are spilled to disk. But
- * in the common case, they are usually small and no file I/O needs to
- * occur.
- */
-#include "sqliteInt.h"
-
-/* Forward references to internal structures */
-typedef struct MemJournal MemJournal;
-typedef struct FilePoint FilePoint;
-typedef struct FileChunk FileChunk;
-
-/*
- * The rollback journal is composed of a linked list of these structures.
- *
- * The zChunk array is always at least 8 bytes in size - usually much more.
- * Its actual size is stored in the MemJournal.nChunkSize variable.
- */
-struct FileChunk {
- FileChunk *pNext; /* Next chunk in the journal */
- u8 zChunk[8]; /* Content of this chunk */
-};
-
-/*
- * By default, allocate this many bytes of memory for each FileChunk object.
- */
-#define MEMJOURNAL_DFLT_FILECHUNKSIZE 1024
-
-/*
- * For chunk size nChunkSize, return the number of bytes that should
- * be allocated for each FileChunk structure.
- */
-#define fileChunkSize(nChunkSize) (sizeof(FileChunk) + ((nChunkSize)-8))
-
-/*
- * An instance of this object serves as a cursor into the rollback journal.
- * The cursor can be either for reading or writing.
- */
-struct FilePoint {
- sqlite3_int64 iOffset; /* Offset from the beginning of the file */
- FileChunk *pChunk; /* Specific chunk into which cursor points */
-};
-
-/*
- * This structure is a subclass of sqlite3_file. Each open memory-journal
- * is an instance of this class.
- */
-struct MemJournal {
- const sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */
- int nChunkSize; /* In-memory chunk-size */
-
- int nSpill; /* Bytes of data before flushing */
- int nSize; /* Bytes of data currently in memory */
- FileChunk *pFirst; /* Head of in-memory chunk-list */
- FilePoint endpoint; /* Pointer to the end of the file */
- FilePoint readpoint; /* Pointer to the end of the last xRead() */
-
- int flags; /* xOpen flags */
- sqlite3_vfs *pVfs; /* The "real" underlying VFS */
- const char *zJournal; /* Name of the journal file */
-};
-
-/*
- * Read data from the in-memory journal file. This is the implementation
- * of the sqlite3_vfs.xRead method.
- */
-static int
-memjrnlRead(sqlite3_file * pJfd, /* The journal file from which to read */
- void *zBuf, /* Put the results here */
- int iAmt, /* Number of bytes to read */
- sqlite_int64 iOfst /* Begin reading at this offset */
- )
-{
- MemJournal *p = (MemJournal *) pJfd;
- u8 *zOut = zBuf;
- int nRead = iAmt;
- int iChunkOffset;
- FileChunk *pChunk;
-
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
- if ((iAmt + iOfst) > p->endpoint.iOffset) {
- return SQLITE_IOERR_SHORT_READ;
- }
-#endif
-
- assert((iAmt + iOfst) <= p->endpoint.iOffset);
- assert(p->readpoint.iOffset == 0 || p->readpoint.pChunk != 0);
- if (p->readpoint.iOffset != iOfst || iOfst == 0) {
- sqlite3_int64 iOff = 0;
- for (pChunk = p->pFirst;
- ALWAYS(pChunk) && (iOff + p->nChunkSize) <= iOfst;
- pChunk = pChunk->pNext) {
- iOff += p->nChunkSize;
- }
- } else {
- pChunk = p->readpoint.pChunk;
- assert(pChunk != 0);
- }
-
- iChunkOffset = (int)(iOfst % p->nChunkSize);
- do {
- int iSpace = p->nChunkSize - iChunkOffset;
- int nCopy = MIN(nRead, (p->nChunkSize - iChunkOffset));
- memcpy(zOut, (u8 *) pChunk->zChunk + iChunkOffset, nCopy);
- zOut += nCopy;
- nRead -= iSpace;
- iChunkOffset = 0;
- } while (nRead >= 0 && (pChunk = pChunk->pNext) != 0 && nRead > 0);
- p->readpoint.iOffset = pChunk ? iOfst + iAmt : 0;
- p->readpoint.pChunk = pChunk;
-
- return SQLITE_OK;
-}
-
-/*
- * Free the list of FileChunk structures headed at MemJournal.pFirst.
- */
-static void
-memjrnlFreeChunks(MemJournal * p)
-{
- FileChunk *pIter;
- FileChunk *pNext;
- for (pIter = p->pFirst; pIter; pIter = pNext) {
- pNext = pIter->pNext;
- sqlite3_free(pIter);
- }
- p->pFirst = 0;
-}
-
-/*
- * Flush the contents of memory to a real file on disk.
- */
-static int
-memjrnlCreateFile(MemJournal * p)
-{
- int rc;
- sqlite3_file *pReal = (sqlite3_file *) p;
- MemJournal copy = *p;
-
- memset(p, 0, sizeof(MemJournal));
- rc = sqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0);
- if (rc == SQLITE_OK) {
- int nChunk = copy.nChunkSize;
- i64 iOff = 0;
- FileChunk *pIter;
- for (pIter = copy.pFirst; pIter; pIter = pIter->pNext) {
- if (iOff + nChunk > copy.endpoint.iOffset) {
- nChunk = copy.endpoint.iOffset - iOff;
- }
- rc = sqlite3OsWrite(pReal, (u8 *) pIter->zChunk, nChunk,
- iOff);
- if (rc)
- break;
- iOff += nChunk;
- }
- if (rc == SQLITE_OK) {
- /* No error has occurred. Free the in-memory buffers. */
- memjrnlFreeChunks(©);
- }
- }
- if (rc != SQLITE_OK) {
- /* If an error occurred while creating or writing to the file, restore
- * the original before returning. This way, SQLite uses the in-memory
- * journal data to roll back changes made to the internal page-cache
- * before this function was called.
- */
- sqlite3OsClose(pReal);
- *p = copy;
- }
- return rc;
-}
-
-/*
- * Write data to the file.
- */
-static int
-memjrnlWrite(sqlite3_file * pJfd, /* The journal file into which to write */
- const void *zBuf, /* Take data to be written from here */
- int iAmt, /* Number of bytes to write */
- sqlite_int64 iOfst /* Begin writing at this offset into the file */
- )
-{
- MemJournal *p = (MemJournal *) pJfd;
- int nWrite = iAmt;
- u8 *zWrite = (u8 *) zBuf;
-
- /* If the file should be created now, create it and write the new data
- * into the file on disk.
- */
- if (p->nSpill > 0 && (iAmt + iOfst) > p->nSpill) {
- int rc = memjrnlCreateFile(p);
- if (rc == SQLITE_OK) {
- rc = sqlite3OsWrite(pJfd, zBuf, iAmt, iOfst);
- }
- return rc;
- }
-
- /* If the contents of this write should be stored in memory */
- else {
- /* An in-memory journal file should only ever be appended to. Random
- * access writes are not required. The only exception to this is when
- * the in-memory journal is being used by a connection using the
- * atomic-write optimization. In this case the first 28 bytes of the
- * journal file may be written as part of committing the transaction.
- */
- assert(iOfst == p->endpoint.iOffset || iOfst == 0);
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
- if (iOfst == 0 && p->pFirst) {
- assert(p->nChunkSize > iAmt);
- memcpy((u8 *) p->pFirst->zChunk, zBuf, iAmt);
- } else
-#else
- assert(iOfst > 0 || p->pFirst == 0);
-#endif
- {
- while (nWrite > 0) {
- FileChunk *pChunk = p->endpoint.pChunk;
- int iChunkOffset =
- (int)(p->endpoint.iOffset % p->nChunkSize);
- int iSpace =
- MIN(nWrite, p->nChunkSize - iChunkOffset);
-
- if (iChunkOffset == 0) {
- /* New chunk is required to extend the file. */
- FileChunk *pNew =
- sqlite3_malloc(fileChunkSize
- (p->nChunkSize));
- if (!pNew) {
- return SQLITE_IOERR_NOMEM_BKPT;
- }
- pNew->pNext = 0;
- if (pChunk) {
- assert(p->pFirst);
- pChunk->pNext = pNew;
- } else {
- assert(!p->pFirst);
- p->pFirst = pNew;
- }
- p->endpoint.pChunk = pNew;
- }
-
- memcpy((u8 *) p->endpoint.pChunk->zChunk +
- iChunkOffset, zWrite, iSpace);
- zWrite += iSpace;
- nWrite -= iSpace;
- p->endpoint.iOffset += iSpace;
- }
- p->nSize = iAmt + iOfst;
- }
- }
-
- return SQLITE_OK;
-}
-
-/*
- * Truncate the file.
- *
- * If the journal file is already on disk, truncate it there. Or, if it
- * is still in main memory but is being truncated to zero bytes in size,
- * ignore
- */
-static int
-memjrnlTruncate(sqlite3_file * pJfd, sqlite_int64 size)
-{
- MemJournal *p = (MemJournal *) pJfd;
- if (ALWAYS(size == 0)) {
- memjrnlFreeChunks(p);
- p->nSize = 0;
- p->endpoint.pChunk = 0;
- p->endpoint.iOffset = 0;
- p->readpoint.pChunk = 0;
- p->readpoint.iOffset = 0;
- }
- return SQLITE_OK;
-}
-
-/*
- * Close the file.
- */
-static int
-memjrnlClose(sqlite3_file * pJfd)
-{
- MemJournal *p = (MemJournal *) pJfd;
- memjrnlFreeChunks(p);
- return SQLITE_OK;
-}
-
-/*
- * Sync the file.
- *
- * If the real file has been created, call its xSync method. Otherwise,
- * syncing an in-memory journal is a no-op.
- */
-static int
-memjrnlSync(sqlite3_file * pJfd, int flags)
-{
- UNUSED_PARAMETER2(pJfd, flags);
- return SQLITE_OK;
-}
-
-/*
- * Query the size of the file in bytes.
- */
-static int
-memjrnlFileSize(sqlite3_file * pJfd, sqlite_int64 * pSize)
-{
- MemJournal *p = (MemJournal *) pJfd;
- *pSize = (sqlite_int64) p->endpoint.iOffset;
- return SQLITE_OK;
-}
-
-/*
- * Table of methods for MemJournal sqlite3_file object.
- */
-static const struct sqlite3_io_methods MemJournalMethods = {
- 1, /* iVersion */
- memjrnlClose, /* xClose */
- memjrnlRead, /* xRead */
- memjrnlWrite, /* xWrite */
- memjrnlTruncate, /* xTruncate */
- memjrnlSync, /* xSync */
- memjrnlFileSize, /* xFileSize */
- 0, /* xLock */
- 0, /* xUnlock */
- 0, /* xCheckReservedLock */
- 0, /* xFileControl */
- 0, /* xSectorSize */
- 0, /* xDeviceCharacteristics */
- 0, /* xShmMap */
- 0, /* xShmLock */
- 0, /* xShmBarrier */
- 0, /* xShmUnmap */
- 0, /* xFetch */
- 0 /* xUnfetch */
-};
-
-/*
- * Open a journal file.
- *
- * The behaviour of the journal file depends on the value of parameter
- * nSpill. If nSpill is 0, then the journal file is always create and
- * accessed using the underlying VFS. If nSpill is less than zero, then
- * all content is always stored in main-memory. Finally, if nSpill is a
- * positive value, then the journal file is initially created in-memory
- * but may be flushed to disk later on. In this case the journal file is
- * flushed to disk either when it grows larger than nSpill bytes in size,
- * or when sqlite3JournalCreate() is called.
- */
-int
-sqlite3JournalOpen(sqlite3_vfs * pVfs, /* The VFS to use for actual file I/O */
- const char *zName, /* Name of the journal file */
- sqlite3_file * pJfd, /* Preallocated, blank file handle */
- int flags, /* Opening flags */
- int nSpill /* Bytes buffered before opening the file */
- )
-{
- MemJournal *p = (MemJournal *) pJfd;
-
- /* Zero the file-handle object. If nSpill was passed zero, initialize
- * it using the sqlite3OsOpen() function of the underlying VFS. In this
- * case none of the code in this module is executed as a result of calls
- * made on the journal file-handle.
- */
- memset(p, 0, sizeof(MemJournal));
- if (nSpill == 0) {
- return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);
- }
-
- if (nSpill > 0) {
- p->nChunkSize = nSpill;
- } else {
- p->nChunkSize =
- 8 + MEMJOURNAL_DFLT_FILECHUNKSIZE - sizeof(FileChunk);
- assert(MEMJOURNAL_DFLT_FILECHUNKSIZE ==
- fileChunkSize(p->nChunkSize));
- }
-
- p->pMethod = (const sqlite3_io_methods *)&MemJournalMethods;
- p->nSpill = nSpill;
- p->flags = flags;
- p->zJournal = zName;
- p->pVfs = pVfs;
- return SQLITE_OK;
-}
-
-/*
- * Open an in-memory journal file.
- */
-void
-sqlite3MemJournalOpen(sqlite3_file * pJfd)
-{
- sqlite3JournalOpen(0, 0, pJfd, 0, -1);
-}
-
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
-/*
- * If the argument p points to a MemJournal structure that is not an
- * in-memory-only journal file (i.e. is one that was opened with a +ve
- * nSpill parameter), and the underlying file has not yet been created,
- * create it now.
- */
-int
-sqlite3JournalCreate(sqlite3_file * p)
-{
- int rc = SQLITE_OK;
- if (p->pMethods == &MemJournalMethods && ((MemJournal *) p)->nSpill > 0) {
- rc = memjrnlCreateFile((MemJournal *) p);
- }
- return rc;
-}
-#endif
-
-/*
- * The file-handle passed as the only argument is open on a journal file.
- * Return true if this "journal file" is currently stored in heap memory,
- * or false otherwise.
- */
-int
-sqlite3JournalIsInMemory(sqlite3_file * p)
-{
- return p->pMethods == &MemJournalMethods;
-}
-
-/*
- * Return the number of bytes required to store a JournalFile that uses vfs
- * pVfs to create the underlying on-disk files.
- */
-int
-sqlite3JournalSize(sqlite3_vfs * pVfs)
-{
- return MAX(pVfs->szOsFile, (int)sizeof(MemJournal));
-}
diff --git a/src/box/sql/opcodes.c b/src/box/sql/opcodes.c
index a7f735da9..2d5dc62ef 100644
--- a/src/box/sql/opcodes.c
+++ b/src/box/sql/opcodes.c
@@ -22,8 +22,8 @@ const char *sqlite3OpcodeName(int i){
/* 8 */ "NextIfOpen" OpHelp(""),
/* 9 */ "Prev" OpHelp(""),
/* 10 */ "Next" OpHelp(""),
- /* 11 */ "Checkpoint" OpHelp(""),
- /* 12 */ "JournalMode" OpHelp(""),
+ /* 11 */ "Goto" OpHelp(""),
+ /* 12 */ "Gosub" OpHelp(""),
/* 13 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
/* 14 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
/* 15 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
@@ -43,115 +43,113 @@ const char *sqlite3OpcodeName(int i){
/* 29 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
/* 30 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
/* 31 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
- /* 32 */ "Goto" OpHelp(""),
+ /* 32 */ "InitCoroutine" OpHelp(""),
/* 33 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
- /* 34 */ "Gosub" OpHelp(""),
- /* 35 */ "InitCoroutine" OpHelp(""),
- /* 36 */ "Yield" OpHelp(""),
- /* 37 */ "MustBeInt" OpHelp(""),
- /* 38 */ "Jump" OpHelp(""),
- /* 39 */ "Once" OpHelp(""),
- /* 40 */ "If" OpHelp(""),
- /* 41 */ "IfNot" OpHelp(""),
- /* 42 */ "SeekLT" OpHelp("key=r[P3 at P4]"),
- /* 43 */ "SeekLE" OpHelp("key=r[P3 at P4]"),
- /* 44 */ "SeekGE" OpHelp("key=r[P3 at P4]"),
- /* 45 */ "SeekGT" OpHelp("key=r[P3 at P4]"),
- /* 46 */ "NoConflict" OpHelp("key=r[P3 at P4]"),
- /* 47 */ "NotFound" OpHelp("key=r[P3 at P4]"),
- /* 48 */ "Found" OpHelp("key=r[P3 at P4]"),
- /* 49 */ "Last" OpHelp(""),
- /* 50 */ "SorterSort" OpHelp(""),
- /* 51 */ "Sort" OpHelp(""),
- /* 52 */ "Rewind" OpHelp(""),
- /* 53 */ "IdxLE" OpHelp("key=r[P3 at P4]"),
- /* 54 */ "IdxGT" OpHelp("key=r[P3 at P4]"),
- /* 55 */ "IdxLT" OpHelp("key=r[P3 at P4]"),
- /* 56 */ "IdxGE" OpHelp("key=r[P3 at P4]"),
- /* 57 */ "Program" OpHelp(""),
- /* 58 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
- /* 59 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
- /* 60 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
- /* 61 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
- /* 62 */ "Init" OpHelp("Start at P2"),
- /* 63 */ "Return" OpHelp(""),
- /* 64 */ "EndCoroutine" OpHelp(""),
- /* 65 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
- /* 66 */ "Halt" OpHelp(""),
- /* 67 */ "Integer" OpHelp("r[P2]=P1"),
- /* 68 */ "Bool" OpHelp("r[P2]=P1"),
- /* 69 */ "Int64" OpHelp("r[P2]=P4"),
- /* 70 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
- /* 71 */ "Null" OpHelp("r[P2..P3]=NULL"),
- /* 72 */ "SoftNull" OpHelp("r[P1]=NULL"),
- /* 73 */ "Blob" OpHelp("r[P2]=P4 (len=P1, subtype=P3)"),
- /* 74 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
+ /* 34 */ "Yield" OpHelp(""),
+ /* 35 */ "MustBeInt" OpHelp(""),
+ /* 36 */ "Jump" OpHelp(""),
+ /* 37 */ "Once" OpHelp(""),
+ /* 38 */ "If" OpHelp(""),
+ /* 39 */ "IfNot" OpHelp(""),
+ /* 40 */ "SeekLT" OpHelp("key=r[P3 at P4]"),
+ /* 41 */ "SeekLE" OpHelp("key=r[P3 at P4]"),
+ /* 42 */ "SeekGE" OpHelp("key=r[P3 at P4]"),
+ /* 43 */ "SeekGT" OpHelp("key=r[P3 at P4]"),
+ /* 44 */ "NoConflict" OpHelp("key=r[P3 at P4]"),
+ /* 45 */ "NotFound" OpHelp("key=r[P3 at P4]"),
+ /* 46 */ "Found" OpHelp("key=r[P3 at P4]"),
+ /* 47 */ "Last" OpHelp(""),
+ /* 48 */ "SorterSort" OpHelp(""),
+ /* 49 */ "Sort" OpHelp(""),
+ /* 50 */ "Rewind" OpHelp(""),
+ /* 51 */ "IdxLE" OpHelp("key=r[P3 at P4]"),
+ /* 52 */ "IdxGT" OpHelp("key=r[P3 at P4]"),
+ /* 53 */ "IdxLT" OpHelp("key=r[P3 at P4]"),
+ /* 54 */ "IdxGE" OpHelp("key=r[P3 at P4]"),
+ /* 55 */ "Program" OpHelp(""),
+ /* 56 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
+ /* 57 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
+ /* 58 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
+ /* 59 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
+ /* 60 */ "Init" OpHelp("Start at P2"),
+ /* 61 */ "Return" OpHelp(""),
+ /* 62 */ "EndCoroutine" OpHelp(""),
+ /* 63 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
+ /* 64 */ "Halt" OpHelp(""),
+ /* 65 */ "Integer" OpHelp("r[P2]=P1"),
+ /* 66 */ "Bool" OpHelp("r[P2]=P1"),
+ /* 67 */ "Int64" OpHelp("r[P2]=P4"),
+ /* 68 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
+ /* 69 */ "Null" OpHelp("r[P2..P3]=NULL"),
+ /* 70 */ "SoftNull" OpHelp("r[P1]=NULL"),
+ /* 71 */ "Blob" OpHelp("r[P2]=P4 (len=P1, subtype=P3)"),
+ /* 72 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
+ /* 73 */ "Move" OpHelp("r[P2 at P3]=r[P1 at P3]"),
+ /* 74 */ "Copy" OpHelp("r[P2 at P3+1]=r[P1 at P3+1]"),
/* 75 */ "String8" OpHelp("r[P2]='P4'"),
- /* 76 */ "Move" OpHelp("r[P2 at P3]=r[P1 at P3]"),
- /* 77 */ "Copy" OpHelp("r[P2 at P3+1]=r[P1 at P3+1]"),
- /* 78 */ "SCopy" OpHelp("r[P2]=r[P1]"),
- /* 79 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
- /* 80 */ "ResultRow" OpHelp("output=r[P1 at P2]"),
- /* 81 */ "CollSeq" OpHelp(""),
- /* 82 */ "Function0" OpHelp("r[P3]=func(r[P2 at P5])"),
- /* 83 */ "Function" OpHelp("r[P3]=func(r[P2 at P5])"),
- /* 84 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
- /* 85 */ "RealAffinity" OpHelp(""),
- /* 86 */ "Cast" OpHelp("affinity(r[P1])"),
- /* 87 */ "Permutation" OpHelp(""),
- /* 88 */ "Compare" OpHelp("r[P1 at P3] <-> r[P2 at P3]"),
- /* 89 */ "Column" OpHelp("r[P3]=PX"),
- /* 90 */ "Affinity" OpHelp("affinity(r[P1 at P2])"),
- /* 91 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1 at P2])"),
- /* 92 */ "Count" OpHelp("r[P2]=count()"),
- /* 93 */ "FkCheckCommit" OpHelp(""),
- /* 94 */ "TTransaction" OpHelp(""),
- /* 95 */ "ReadCookie" OpHelp(""),
- /* 96 */ "SetCookie" OpHelp(""),
- /* 97 */ "ReopenIdx" OpHelp("root=P2"),
- /* 98 */ "OpenRead" OpHelp("root=P2"),
- /* 99 */ "OpenWrite" OpHelp("root=P2"),
- /* 100 */ "OpenTEphemeral" OpHelp("nColumn = P2"),
- /* 101 */ "SorterOpen" OpHelp(""),
- /* 102 */ "SequenceTest" OpHelp("if (cursor[P1].ctr++) pc = P2"),
- /* 103 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
- /* 104 */ "Close" OpHelp(""),
- /* 105 */ "ColumnsUsed" OpHelp(""),
- /* 106 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
- /* 107 */ "NextId" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
- /* 108 */ "NextIdEphemeral" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
- /* 109 */ "FCopy" OpHelp("reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)]"),
- /* 110 */ "Delete" OpHelp(""),
- /* 111 */ "ResetCount" OpHelp(""),
- /* 112 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
- /* 113 */ "SorterData" OpHelp("r[P2]=data"),
- /* 114 */ "RowData" OpHelp("r[P2]=data"),
+ /* 76 */ "SCopy" OpHelp("r[P2]=r[P1]"),
+ /* 77 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
+ /* 78 */ "ResultRow" OpHelp("output=r[P1 at P2]"),
+ /* 79 */ "CollSeq" OpHelp(""),
+ /* 80 */ "Function0" OpHelp("r[P3]=func(r[P2 at P5])"),
+ /* 81 */ "Function" OpHelp("r[P3]=func(r[P2 at P5])"),
+ /* 82 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
+ /* 83 */ "RealAffinity" OpHelp(""),
+ /* 84 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 85 */ "Permutation" OpHelp(""),
+ /* 86 */ "Compare" OpHelp("r[P1 at P3] <-> r[P2 at P3]"),
+ /* 87 */ "Column" OpHelp("r[P3]=PX"),
+ /* 88 */ "Affinity" OpHelp("affinity(r[P1 at P2])"),
+ /* 89 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1 at P2])"),
+ /* 90 */ "Count" OpHelp("r[P2]=count()"),
+ /* 91 */ "FkCheckCommit" OpHelp(""),
+ /* 92 */ "TTransaction" OpHelp(""),
+ /* 93 */ "ReadCookie" OpHelp(""),
+ /* 94 */ "SetCookie" OpHelp(""),
+ /* 95 */ "ReopenIdx" OpHelp("root=P2"),
+ /* 96 */ "OpenRead" OpHelp("root=P2"),
+ /* 97 */ "OpenWrite" OpHelp("root=P2"),
+ /* 98 */ "OpenTEphemeral" OpHelp("nColumn = P2"),
+ /* 99 */ "SorterOpen" OpHelp(""),
+ /* 100 */ "SequenceTest" OpHelp("if (cursor[P1].ctr++) pc = P2"),
+ /* 101 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
+ /* 102 */ "Close" OpHelp(""),
+ /* 103 */ "ColumnsUsed" OpHelp(""),
+ /* 104 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
+ /* 105 */ "NextId" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
+ /* 106 */ "NextIdEphemeral" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
+ /* 107 */ "FCopy" OpHelp("reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)]"),
+ /* 108 */ "Delete" OpHelp(""),
+ /* 109 */ "ResetCount" OpHelp(""),
+ /* 110 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
+ /* 111 */ "SorterData" OpHelp("r[P2]=data"),
+ /* 112 */ "RowData" OpHelp("r[P2]=data"),
+ /* 113 */ "NullRow" OpHelp(""),
+ /* 114 */ "SorterInsert" OpHelp("key=r[P2]"),
/* 115 */ "Real" OpHelp("r[P2]=P4"),
- /* 116 */ "NullRow" OpHelp(""),
- /* 117 */ "SorterInsert" OpHelp("key=r[P2]"),
- /* 118 */ "IdxReplace" OpHelp("key=r[P2]"),
- /* 119 */ "IdxInsert" OpHelp("key=r[P2]"),
- /* 120 */ "IdxDelete" OpHelp("key=r[P2 at P3]"),
- /* 121 */ "Destroy" OpHelp(""),
- /* 122 */ "Clear" OpHelp(""),
- /* 123 */ "ResetSorter" OpHelp(""),
- /* 124 */ "ParseSchema2" OpHelp("rows=r[P1 at P2]"),
- /* 125 */ "ParseSchema3" OpHelp("name=r[P1] sql=r[P1+1]"),
- /* 126 */ "RenameTable" OpHelp("P1 = root, P4 = name"),
- /* 127 */ "LoadAnalysis" OpHelp(""),
- /* 128 */ "DropTable" OpHelp(""),
- /* 129 */ "DropIndex" OpHelp(""),
- /* 130 */ "DropTrigger" OpHelp(""),
- /* 131 */ "Param" OpHelp(""),
- /* 132 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
- /* 133 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
- /* 134 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2 at P5])"),
- /* 135 */ "AggStep" OpHelp("accum=r[P3] step(r[P2 at P5])"),
- /* 136 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
- /* 137 */ "Expire" OpHelp(""),
- /* 138 */ "IncMaxid" OpHelp(""),
- /* 139 */ "Noop" OpHelp(""),
- /* 140 */ "Explain" OpHelp(""),
+ /* 116 */ "IdxReplace" OpHelp("key=r[P2]"),
+ /* 117 */ "IdxInsert" OpHelp("key=r[P2]"),
+ /* 118 */ "IdxDelete" OpHelp("key=r[P2 at P3]"),
+ /* 119 */ "Destroy" OpHelp(""),
+ /* 120 */ "Clear" OpHelp(""),
+ /* 121 */ "ResetSorter" OpHelp(""),
+ /* 122 */ "ParseSchema2" OpHelp("rows=r[P1 at P2]"),
+ /* 123 */ "ParseSchema3" OpHelp("name=r[P1] sql=r[P1+1]"),
+ /* 124 */ "RenameTable" OpHelp("P1 = root, P4 = name"),
+ /* 125 */ "LoadAnalysis" OpHelp(""),
+ /* 126 */ "DropTable" OpHelp(""),
+ /* 127 */ "DropIndex" OpHelp(""),
+ /* 128 */ "DropTrigger" OpHelp(""),
+ /* 129 */ "Param" OpHelp(""),
+ /* 130 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
+ /* 131 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
+ /* 132 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2 at P5])"),
+ /* 133 */ "AggStep" OpHelp("accum=r[P3] step(r[P2 at P5])"),
+ /* 134 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
+ /* 135 */ "Expire" OpHelp(""),
+ /* 136 */ "IncMaxid" OpHelp(""),
+ /* 137 */ "Noop" OpHelp(""),
+ /* 138 */ "Explain" OpHelp(""),
};
return azName[i];
}
diff --git a/src/box/sql/opcodes.h b/src/box/sql/opcodes.h
index 4bf321b03..3f60e4066 100644
--- a/src/box/sql/opcodes.h
+++ b/src/box/sql/opcodes.h
@@ -11,8 +11,8 @@
#define OP_NextIfOpen 8
#define OP_Prev 9
#define OP_Next 10
-#define OP_Checkpoint 11
-#define OP_JournalMode 12
+#define OP_Goto 11
+#define OP_Gosub 12
#define OP_IsNull 13 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
#define OP_NotNull 14 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
#define OP_Ne 15 /* same as TK_NE, synopsis: IF r[P3]!=r[P1] */
@@ -32,115 +32,113 @@
#define OP_Divide 29 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
#define OP_Remainder 30 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
#define OP_Concat 31 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
-#define OP_Goto 32
+#define OP_InitCoroutine 32
#define OP_BitNot 33 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
-#define OP_Gosub 34
-#define OP_InitCoroutine 35
-#define OP_Yield 36
-#define OP_MustBeInt 37
-#define OP_Jump 38
-#define OP_Once 39
-#define OP_If 40
-#define OP_IfNot 41
-#define OP_SeekLT 42 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekLE 43 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekGE 44 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekGT 45 /* synopsis: key=r[P3 at P4] */
-#define OP_NoConflict 46 /* synopsis: key=r[P3 at P4] */
-#define OP_NotFound 47 /* synopsis: key=r[P3 at P4] */
-#define OP_Found 48 /* synopsis: key=r[P3 at P4] */
-#define OP_Last 49
-#define OP_SorterSort 50
-#define OP_Sort 51
-#define OP_Rewind 52
-#define OP_IdxLE 53 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxGT 54 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxLT 55 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxGE 56 /* synopsis: key=r[P3 at P4] */
-#define OP_Program 57
-#define OP_FkIfZero 58 /* synopsis: if fkctr[P1]==0 goto P2 */
-#define OP_IfPos 59 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
-#define OP_IfNotZero 60 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
-#define OP_DecrJumpZero 61 /* synopsis: if (--r[P1])==0 goto P2 */
-#define OP_Init 62 /* synopsis: Start at P2 */
-#define OP_Return 63
-#define OP_EndCoroutine 64
-#define OP_HaltIfNull 65 /* synopsis: if r[P3]=null halt */
-#define OP_Halt 66
-#define OP_Integer 67 /* synopsis: r[P2]=P1 */
-#define OP_Bool 68 /* synopsis: r[P2]=P1 */
-#define OP_Int64 69 /* synopsis: r[P2]=P4 */
-#define OP_String 70 /* synopsis: r[P2]='P4' (len=P1) */
-#define OP_Null 71 /* synopsis: r[P2..P3]=NULL */
-#define OP_SoftNull 72 /* synopsis: r[P1]=NULL */
-#define OP_Blob 73 /* synopsis: r[P2]=P4 (len=P1, subtype=P3) */
-#define OP_Variable 74 /* synopsis: r[P2]=parameter(P1,P4) */
+#define OP_Yield 34
+#define OP_MustBeInt 35
+#define OP_Jump 36
+#define OP_Once 37
+#define OP_If 38
+#define OP_IfNot 39
+#define OP_SeekLT 40 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekLE 41 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekGE 42 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekGT 43 /* synopsis: key=r[P3 at P4] */
+#define OP_NoConflict 44 /* synopsis: key=r[P3 at P4] */
+#define OP_NotFound 45 /* synopsis: key=r[P3 at P4] */
+#define OP_Found 46 /* synopsis: key=r[P3 at P4] */
+#define OP_Last 47
+#define OP_SorterSort 48
+#define OP_Sort 49
+#define OP_Rewind 50
+#define OP_IdxLE 51 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxGT 52 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxLT 53 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxGE 54 /* synopsis: key=r[P3 at P4] */
+#define OP_Program 55
+#define OP_FkIfZero 56 /* synopsis: if fkctr[P1]==0 goto P2 */
+#define OP_IfPos 57 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
+#define OP_IfNotZero 58 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
+#define OP_DecrJumpZero 59 /* synopsis: if (--r[P1])==0 goto P2 */
+#define OP_Init 60 /* synopsis: Start at P2 */
+#define OP_Return 61
+#define OP_EndCoroutine 62
+#define OP_HaltIfNull 63 /* synopsis: if r[P3]=null halt */
+#define OP_Halt 64
+#define OP_Integer 65 /* synopsis: r[P2]=P1 */
+#define OP_Bool 66 /* synopsis: r[P2]=P1 */
+#define OP_Int64 67 /* synopsis: r[P2]=P4 */
+#define OP_String 68 /* synopsis: r[P2]='P4' (len=P1) */
+#define OP_Null 69 /* synopsis: r[P2..P3]=NULL */
+#define OP_SoftNull 70 /* synopsis: r[P1]=NULL */
+#define OP_Blob 71 /* synopsis: r[P2]=P4 (len=P1, subtype=P3) */
+#define OP_Variable 72 /* synopsis: r[P2]=parameter(P1,P4) */
+#define OP_Move 73 /* synopsis: r[P2 at P3]=r[P1 at P3] */
+#define OP_Copy 74 /* synopsis: r[P2 at P3+1]=r[P1 at P3+1] */
#define OP_String8 75 /* same as TK_STRING, synopsis: r[P2]='P4' */
-#define OP_Move 76 /* synopsis: r[P2 at P3]=r[P1 at P3] */
-#define OP_Copy 77 /* synopsis: r[P2 at P3+1]=r[P1 at P3+1] */
-#define OP_SCopy 78 /* synopsis: r[P2]=r[P1] */
-#define OP_IntCopy 79 /* synopsis: r[P2]=r[P1] */
-#define OP_ResultRow 80 /* synopsis: output=r[P1 at P2] */
-#define OP_CollSeq 81
-#define OP_Function0 82 /* synopsis: r[P3]=func(r[P2 at P5]) */
-#define OP_Function 83 /* synopsis: r[P3]=func(r[P2 at P5]) */
-#define OP_AddImm 84 /* synopsis: r[P1]=r[P1]+P2 */
-#define OP_RealAffinity 85
-#define OP_Cast 86 /* synopsis: affinity(r[P1]) */
-#define OP_Permutation 87
-#define OP_Compare 88 /* synopsis: r[P1 at P3] <-> r[P2 at P3] */
-#define OP_Column 89 /* synopsis: r[P3]=PX */
-#define OP_Affinity 90 /* synopsis: affinity(r[P1 at P2]) */
-#define OP_MakeRecord 91 /* synopsis: r[P3]=mkrec(r[P1 at P2]) */
-#define OP_Count 92 /* synopsis: r[P2]=count() */
-#define OP_FkCheckCommit 93
-#define OP_TTransaction 94
-#define OP_ReadCookie 95
-#define OP_SetCookie 96
-#define OP_ReopenIdx 97 /* synopsis: root=P2 */
-#define OP_OpenRead 98 /* synopsis: root=P2 */
-#define OP_OpenWrite 99 /* synopsis: root=P2 */
-#define OP_OpenTEphemeral 100 /* synopsis: nColumn = P2 */
-#define OP_SorterOpen 101
-#define OP_SequenceTest 102 /* synopsis: if (cursor[P1].ctr++) pc = P2 */
-#define OP_OpenPseudo 103 /* synopsis: P3 columns in r[P2] */
-#define OP_Close 104
-#define OP_ColumnsUsed 105
-#define OP_Sequence 106 /* synopsis: r[P2]=cursor[P1].ctr++ */
-#define OP_NextId 107 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
-#define OP_NextIdEphemeral 108 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
-#define OP_FCopy 109 /* synopsis: reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)] */
-#define OP_Delete 110
-#define OP_ResetCount 111
-#define OP_SorterCompare 112 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
-#define OP_SorterData 113 /* synopsis: r[P2]=data */
-#define OP_RowData 114 /* synopsis: r[P2]=data */
+#define OP_SCopy 76 /* synopsis: r[P2]=r[P1] */
+#define OP_IntCopy 77 /* synopsis: r[P2]=r[P1] */
+#define OP_ResultRow 78 /* synopsis: output=r[P1 at P2] */
+#define OP_CollSeq 79
+#define OP_Function0 80 /* synopsis: r[P3]=func(r[P2 at P5]) */
+#define OP_Function 81 /* synopsis: r[P3]=func(r[P2 at P5]) */
+#define OP_AddImm 82 /* synopsis: r[P1]=r[P1]+P2 */
+#define OP_RealAffinity 83
+#define OP_Cast 84 /* synopsis: affinity(r[P1]) */
+#define OP_Permutation 85
+#define OP_Compare 86 /* synopsis: r[P1 at P3] <-> r[P2 at P3] */
+#define OP_Column 87 /* synopsis: r[P3]=PX */
+#define OP_Affinity 88 /* synopsis: affinity(r[P1 at P2]) */
+#define OP_MakeRecord 89 /* synopsis: r[P3]=mkrec(r[P1 at P2]) */
+#define OP_Count 90 /* synopsis: r[P2]=count() */
+#define OP_FkCheckCommit 91
+#define OP_TTransaction 92
+#define OP_ReadCookie 93
+#define OP_SetCookie 94
+#define OP_ReopenIdx 95 /* synopsis: root=P2 */
+#define OP_OpenRead 96 /* synopsis: root=P2 */
+#define OP_OpenWrite 97 /* synopsis: root=P2 */
+#define OP_OpenTEphemeral 98 /* synopsis: nColumn = P2 */
+#define OP_SorterOpen 99
+#define OP_SequenceTest 100 /* synopsis: if (cursor[P1].ctr++) pc = P2 */
+#define OP_OpenPseudo 101 /* synopsis: P3 columns in r[P2] */
+#define OP_Close 102
+#define OP_ColumnsUsed 103
+#define OP_Sequence 104 /* synopsis: r[P2]=cursor[P1].ctr++ */
+#define OP_NextId 105 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
+#define OP_NextIdEphemeral 106 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
+#define OP_FCopy 107 /* synopsis: reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)] */
+#define OP_Delete 108
+#define OP_ResetCount 109
+#define OP_SorterCompare 110 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
+#define OP_SorterData 111 /* synopsis: r[P2]=data */
+#define OP_RowData 112 /* synopsis: r[P2]=data */
+#define OP_NullRow 113
+#define OP_SorterInsert 114 /* synopsis: key=r[P2] */
#define OP_Real 115 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
-#define OP_NullRow 116
-#define OP_SorterInsert 117 /* synopsis: key=r[P2] */
-#define OP_IdxReplace 118 /* synopsis: key=r[P2] */
-#define OP_IdxInsert 119 /* synopsis: key=r[P2] */
-#define OP_IdxDelete 120 /* synopsis: key=r[P2 at P3] */
-#define OP_Destroy 121
-#define OP_Clear 122
-#define OP_ResetSorter 123
-#define OP_ParseSchema2 124 /* synopsis: rows=r[P1 at P2] */
-#define OP_ParseSchema3 125 /* synopsis: name=r[P1] sql=r[P1+1] */
-#define OP_RenameTable 126 /* synopsis: P1 = root, P4 = name */
-#define OP_LoadAnalysis 127
-#define OP_DropTable 128
-#define OP_DropIndex 129
-#define OP_DropTrigger 130
-#define OP_Param 131
-#define OP_FkCounter 132 /* synopsis: fkctr[P1]+=P2 */
-#define OP_OffsetLimit 133 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
-#define OP_AggStep0 134 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
-#define OP_AggStep 135 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
-#define OP_AggFinal 136 /* synopsis: accum=r[P1] N=P2 */
-#define OP_Expire 137
-#define OP_IncMaxid 138
-#define OP_Noop 139
-#define OP_Explain 140
+#define OP_IdxReplace 116 /* synopsis: key=r[P2] */
+#define OP_IdxInsert 117 /* synopsis: key=r[P2] */
+#define OP_IdxDelete 118 /* synopsis: key=r[P2 at P3] */
+#define OP_Destroy 119
+#define OP_Clear 120
+#define OP_ResetSorter 121
+#define OP_ParseSchema2 122 /* synopsis: rows=r[P1 at P2] */
+#define OP_ParseSchema3 123 /* synopsis: name=r[P1] sql=r[P1+1] */
+#define OP_RenameTable 124 /* synopsis: P1 = root, P4 = name */
+#define OP_LoadAnalysis 125
+#define OP_DropTable 126
+#define OP_DropIndex 127
+#define OP_DropTrigger 128
+#define OP_Param 129
+#define OP_FkCounter 130 /* synopsis: fkctr[P1]+=P2 */
+#define OP_OffsetLimit 131 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
+#define OP_AggStep0 132 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
+#define OP_AggStep 133 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
+#define OP_AggFinal 134 /* synopsis: accum=r[P1] N=P2 */
+#define OP_Expire 135
+#define OP_IncMaxid 136
+#define OP_Noop 137
+#define OP_Explain 138
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
@@ -154,23 +152,23 @@
#define OPFLG_OUT3 0x20 /* out3: P3 is an output */
#define OPFLG_INITIALIZER {\
/* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x26, 0x26, 0x12,\
-/* 8 */ 0x01, 0x01, 0x01, 0x00, 0x10, 0x03, 0x03, 0x0b,\
+/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x0b,\
/* 16 */ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x01, 0x26, 0x26,\
/* 24 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
-/* 32 */ 0x01, 0x12, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01,\
-/* 40 */ 0x03, 0x03, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
-/* 48 */ 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
-/* 56 */ 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x02,\
-/* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10,\
-/* 72 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
-/* 80 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
-/* 88 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10,\
+/* 32 */ 0x01, 0x12, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03,\
+/* 40 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x01,\
+/* 48 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
+/* 56 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x02, 0x02, 0x08,\
+/* 64 */ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\
+/* 72 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\
+/* 80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\
+/* 88 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 104 */ 0x00, 0x00, 0x10, 0x20, 0x00, 0x10, 0x00, 0x00,\
-/* 112 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x04,\
-/* 120 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 128 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x1a, 0x00, 0x00,\
-/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00,}
+/* 104 */ 0x10, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
+/* 112 */ 0x00, 0x00, 0x04, 0x10, 0x00, 0x04, 0x00, 0x10,\
+/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 128 */ 0x00, 0x10, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00,\
+/* 136 */ 0x00, 0x00, 0x00,}
/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode. The smaller the maximum
@@ -178,4 +176,4 @@
** generated this include file strives to group all JUMP opcodes
** together near the beginning of the list.
*/
-#define SQLITE_MX_JUMP_OPCODE 62 /* Maximum JUMP opcode */
+#define SQLITE_MX_JUMP_OPCODE 60 /* Maximum JUMP opcode */
diff --git a/src/box/sql/os.c b/src/box/sql/os.c
index d34b7c3fb..ecb437ff0 100644
--- a/src/box/sql/os.c
+++ b/src/box/sql/os.c
@@ -85,7 +85,7 @@ int sqlite3_open_file_count = 0;
#if defined(SQLITE_TEST)
int sqlite3_memdebug_vfs_oom_test = 1;
#define DO_OS_MALLOC_TEST(x) \
- if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3JournalIsInMemory(x))) { \
+ if (sqlite3_memdebug_vfs_oom_test && !x) { \
void *pTstAlloc = sqlite3Malloc(10); \
if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \
sqlite3_free(pTstAlloc); \
diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c
index 1fb777857..56c1c7e91 100644
--- a/src/box/sql/os_unix.c
+++ b/src/box/sql/os_unix.c
@@ -254,7 +254,6 @@ static pid_t randomnessPid = 0;
*/
#define UNIXFILE_EXCL 0x01 /* Connections from one process only */
#define UNIXFILE_RDONLY 0x02 /* Connection is read only */
-#define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */
#ifndef SQLITE_DISABLE_DIRSYNC
#define UNIXFILE_DIRSYNC 0x08 /* Directory sync needed */
#else
@@ -599,8 +598,8 @@ unixNextSystemCall(sqlite3_vfs * p, const char *zName)
* 0644) as modified by the system umask. If m is not 0, then
* make the file creation mode be exactly m ignoring the umask.
*
- * The m parameter will be non-zero only when creating -wal, -journal,
- * and -shm files. We want those files to have *exactly* the same
+ * The m parameter will be non-zero only when creating
+ * -shm files. We want those files to have *exactly* the same
* permissions as their original database, unadulterated by the umask.
* In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a
* transaction crashes and leaves behind hot journals, then any
@@ -1511,7 +1510,7 @@ unixLock(sqlite3_file * id, int eFileLock)
/* Set up the transaction-counter change checking flags when
* transitioning from a SHARED to a RESERVED lock. The change
* from SHARED to RESERVED marks the beginning of a normal
- * write operation (not a hot journal rollback).
+ * write operation.
*/
if (rc == SQLITE_OK
&& pFile->eFileLock <= SHARED_LOCK && eFileLock == RESERVED_LOCK) {
@@ -2865,14 +2864,6 @@ unixRead(sqlite3_file * id, void *pBuf, int amt, sqlite3_int64 offset)
assert(offset >= 0);
assert(amt > 0);
- /* If this is a database file (not a journal, master-journal or temp
- * file), the bytes in the locking range should never be read or written.
- */
-#if 0
- assert(pFile->pUnused == 0
- || offset >= PENDING_BYTE + 512 || offset + amt <= PENDING_BYTE);
-#endif
-
#if SQLITE_MAX_MMAP_SIZE>0
/* Deal with as much of this read request as possible by transfering
* data from the memory mapping using memcpy().
@@ -2982,18 +2973,9 @@ unixWrite(sqlite3_file * id, const void *pBuf, int amt, sqlite3_int64 offset)
assert(id);
assert(amt > 0);
- /* If this is a database file (not a journal, master-journal or temp
- * file), the bytes in the locking range should never be read or written.
- */
-#if 0
- assert(pFile->pUnused == 0
- || offset >= PENDING_BYTE + 512 || offset + amt <= PENDING_BYTE);
-#endif
-
#ifdef SQLITE_DEBUG
- /* If we are doing a normal write to a database file (as opposed to
- * doing a hot-journal rollback or a write to some file other than a
- * normal database file) then record the fact that the database
+ /* If we are doing a normal write to a database file,
+ * then record the fact that the database
* has changed. If the transaction counter is modified, record that
* fact too.
*/
@@ -3459,10 +3441,6 @@ unixFileControl(sqlite3_file * id, int op, void *pArg)
SimulateIOErrorBenign(0);
return rc;
}
- case SQLITE_FCNTL_PERSIST_WAL:{
- unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int *)pArg);
- return SQLITE_OK;
- }
case SQLITE_FCNTL_POWERSAFE_OVERWRITE:{
unixModeBit(pFile, UNIXFILE_PSOW, (int *)pArg);
return SQLITE_OK;
@@ -4384,10 +4362,10 @@ getFileMode(const char *zFile, /* File name */
* In most cases, this routine sets *pMode to 0, which will become
* an indication to robust_open() to create the file using
* SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask.
- * But if the file being opened is a WAL or regular journal file, then
+ * But if the file being opened is a regular journal file, then
* this function queries the file-system for the permissions on the
* corresponding database file and sets *pMode to this value. Whenever
- * possible, WAL and journal files are created using the same permissions
+ * possible, journal files are created using the same permissions
* as the associated database file.
*
* If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the
@@ -4407,44 +4385,7 @@ findCreateFileMode(const char *zPath, /* Path of file (possibly) being created *
*pMode = 0;
*pUid = 0;
*pGid = 0;
- if (flags & (SQLITE_OPEN_WAL | SQLITE_OPEN_MAIN_JOURNAL)) {
- char zDb[MAX_PATHNAME + 1]; /* Database file path */
- int nDb; /* Number of valid bytes in zDb */
-
- /* zPath is a path to a WAL or journal file. The following block derives
- * the path to the associated database file from zPath. This block handles
- * the following naming conventions:
- *
- * "<path to db>-journal"
- * "<path to db>-wal"
- * "<path to db>-journalNN"
- * "<path to db>-walNN"
- *
- * where NN is a decimal number. The NN naming schemes are
- * used by the test_multiplex.c module.
- */
- nDb = sqlite3Strlen30(zPath) - 1;
- while (zPath[nDb] != '-') {
-#ifndef SQLITE_ENABLE_8_3_NAMES
- /* In the normal case (8+3 filenames disabled) the journal filename
- * is guaranteed to contain a '-' character.
- */
- assert(nDb > 0);
- assert(sqlite3Isalnum(zPath[nDb]));
-#else
- /* If 8+3 names are possible, then the journal file might not contain
- * a '-' character. So check for that case and return early.
- */
- if (nDb == 0 || zPath[nDb] == '.')
- return SQLITE_OK;
-#endif
- nDb--;
- }
- memcpy(zDb, zPath, nDb);
- zDb[nDb] = '\0';
-
- rc = getFileMode(zDb, pMode, pUid, pGid);
- } else if (flags & SQLITE_OPEN_DELETEONCLOSE) {
+ if (flags & SQLITE_OPEN_DELETEONCLOSE) {
*pMode = 0600;
} else if (flags & SQLITE_OPEN_URI) {
/* If this is a main database file and the file was opened using a URI
@@ -4514,9 +4455,7 @@ unixOpen(sqlite3_vfs * pVfs, /* The VFS for which this is the xOpen method */
* a file-descriptor on the directory too. The first time unixSync()
* is called the directory file descriptor will be fsync()ed and close()d.
*/
- int syncDir = (isCreate && (eType == SQLITE_OPEN_MASTER_JOURNAL
- || eType == SQLITE_OPEN_MAIN_JOURNAL
- || eType == SQLITE_OPEN_WAL));
+ int syncDir = isCreate;
/* If argument zPath is a NULL pointer, this function is required to open
* a temporary file. Use this buffer to store the file name in.
@@ -4537,23 +4476,6 @@ unixOpen(sqlite3_vfs * pVfs, /* The VFS for which this is the xOpen method */
assert(isExclusive == 0 || isCreate);
assert(isDelete == 0 || isCreate);
- /* The main DB, main journal, WAL file and master journal are never
- * automatically deleted. Nor are they ever temporary files.
- */
- assert((!isDelete && zName) || eType != SQLITE_OPEN_MAIN_DB);
- assert((!isDelete && zName) || eType != SQLITE_OPEN_MAIN_JOURNAL);
- assert((!isDelete && zName) || eType != SQLITE_OPEN_MASTER_JOURNAL);
- assert((!isDelete && zName) || eType != SQLITE_OPEN_WAL);
-
- /* Assert that the upper layer has set one of the "file-type" flags. */
- assert(eType == SQLITE_OPEN_MAIN_DB || eType == SQLITE_OPEN_TEMP_DB
- || eType == SQLITE_OPEN_MAIN_JOURNAL
- || eType == SQLITE_OPEN_TEMP_JOURNAL
- || eType == SQLITE_OPEN_SUBJOURNAL
- || eType == SQLITE_OPEN_MASTER_JOURNAL
- || eType == SQLITE_OPEN_TRANSIENT_DB
- || eType == SQLITE_OPEN_WAL);
-
/* Detect a pid change and reset the PRNG. There is a race condition
* here such that two or more threads all trying to open databases at
* the same instant might all reset the PRNG. But multiple resets
@@ -4588,7 +4510,7 @@ unixOpen(sqlite3_vfs * pVfs, /* The VFS for which this is the xOpen method */
} else if (!zName) {
/* If zName is NULL, the upper layer is requesting a temp file. */
- assert(isDelete && !syncDir);
+ assert(isDelete);
rc = unixGetTempname(pVfs->mxPathname, zTmpname);
if (rc != SQLITE_OK) {
return rc;
@@ -4623,8 +4545,6 @@ unixOpen(sqlite3_vfs * pVfs, /* The VFS for which this is the xOpen method */
rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
if (rc != SQLITE_OK) {
assert(!p->pUnused);
- assert(eType == SQLITE_OPEN_WAL
- || eType == SQLITE_OPEN_MAIN_JOURNAL);
return rc;
}
fd = robust_open(zName, openFlags, openMode);
@@ -6249,10 +6169,7 @@ proxyFileControl(sqlite3_file * id, int op, void *pArg)
int isProxyStyle = (pFile->pMethod == &proxyIoMethods);
if (pArg == NULL || (const char *)pArg == 0) {
if (isProxyStyle) {
- /* turn off proxy locking - not supported. If support is added for
- * switching proxy locking mode off then it will need to fail if
- * the journal mode is WAL mode.
- */
+ /* turn off proxy locking - not supported. */
rc = SQLITE_ERROR
/*SQLITE_PROTOCOL? SQLITE_MISUSE? */
;
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 2331e6e68..f969c2eea 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -180,24 +180,6 @@ actionName(u8 action)
}
#endif
-/*
- * Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants
- * defined in pager.h. This function returns the associated lowercase
- * journal-mode name.
- */
-const char *
-sqlite3JournalModename(int eMode)
-{
- static char *const azModeName[] = {
- "delete", "persist", "off", "truncate", "memory"
- };
- assert(eMode >= 0 && eMode <= ArraySize(azModeName));
-
- if (eMode == ArraySize(azModeName))
- return 0;
- return azModeName[eMode];
-}
-
/*
* Locate a pragma in the aPragmaName[] array.
*/
diff --git a/src/box/sql/sqlite3.h b/src/box/sql/sqlite3.h
index 5c7584866..f8c6c7706 100644
--- a/src/box/sql/sqlite3.h
+++ b/src/box/sql/sqlite3.h
@@ -540,15 +540,10 @@ sqlite3_exec(sqlite3 *, /* An open database */
#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
-#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
-#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
-#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
-#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
-#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
/* Reserved: 0x00F00000 */
@@ -813,13 +808,7 @@ struct sqlite3_io_methods {
* <li>[[SQLITE_FCNTL_FILE_POINTER]]
* The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
* to the [sqlite3_file] object associated with a particular database
- * connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
- *
- * <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
- * The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
- * to the [sqlite3_file] object associated with the journal file (either
- * the [rollback journal] or the [write-ahead log]) for a particular database
- * connection. See also [SQLITE_FCNTL_FILE_POINTER].
+ * connection.
*
* <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
* No longer in use.
@@ -846,21 +835,6 @@ struct sqlite3_io_methods {
* [sqlite3_file_control()] with this opcode as doing so may disrupt the
* operation of the specialized VFSes that do require it.
*
- * <li>[[SQLITE_FCNTL_PERSIST_WAL]]
- * ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
- * persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
- * write ahead log and shared memory files used for transaction control
- * are automatically deleted when the latest connection to the database
- * closes. Setting persistent WAL mode causes those files to persist after
- * close. Persisting the files is useful when other processes that do not
- * have write permission on the directory containing the database file want
- * to read the database file, as the WAL and shared memory files must exist
- * in order for the database to be readable. The fourth parameter to
- * [sqlite3_file_control()] for this opcode should be a pointer to an integer.
- * That integer is 0 to disable persistent WAL mode or 1 to enable persistent
- * WAL mode. If the integer is -1, then it is overwritten with the current
- * WAL persistence setting.
- *
* <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
* ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
* persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting
@@ -968,13 +942,6 @@ struct sqlite3_io_methods {
* on whether or not the file has been renamed, moved, or deleted since it
* was first opened.
*
- * <li>[[SQLITE_FCNTL_WAL_BLOCK]]
- * The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
- * be advantageous to block on the next WAL lock if the lock is not immediately
- * available. The WAL subsystem issues this signal during rare
- * circumstances in order to fix a problem with priority inversion.
- * Applications should <em>not</em> use this file-control.
- *
* <li>[[SQLITE_FCNTL_ZIPVFS]]
* The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
* VFS should return SQLITE_NOTFOUND for this opcode.
@@ -993,7 +960,6 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_CHUNK_SIZE 6
#define SQLITE_FCNTL_FILE_POINTER 7
#define SQLITE_FCNTL_SYNC_OMITTED 8
-#define SQLITE_FCNTL_PERSIST_WAL 9
#define SQLITE_FCNTL_OVERWRITE 10
#define SQLITE_FCNTL_VFSNAME 11
#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 12
@@ -1005,11 +971,9 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_HAS_MOVED 18
#define SQLITE_FCNTL_SYNC 19
#define SQLITE_FCNTL_COMMIT_PHASETWO 20
-#define SQLITE_FCNTL_WAL_BLOCK 21
#define SQLITE_FCNTL_ZIPVFS 22
#define SQLITE_FCNTL_RBU 23
#define SQLITE_FCNTL_VFS_POINTER 24
-#define SQLITE_FCNTL_JOURNAL_POINTER 25
#define SQLITE_FCNTL_PDB 26
/*
@@ -1098,13 +1062,8 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
*
* <ul>
* <li> [SQLITE_OPEN_MAIN_DB]
- * <li> [SQLITE_OPEN_MAIN_JOURNAL]
* <li> [SQLITE_OPEN_TEMP_DB]
- * <li> [SQLITE_OPEN_TEMP_JOURNAL]
* <li> [SQLITE_OPEN_TRANSIENT_DB]
- * <li> [SQLITE_OPEN_SUBJOURNAL]
- * <li> [SQLITE_OPEN_MASTER_JOURNAL]
- * <li> [SQLITE_OPEN_WAL]
* </ul>)^
*
* The file I/O implementation can use the object type flags to
@@ -6611,61 +6570,6 @@ sqlite3_wal_hook(sqlite3 *,
int (*)(void *, sqlite3 *,
const char *, int), void *);
-/*
- * CAPI3REF: Configure an auto-checkpoint
- * METHOD: sqlite3
- *
- * ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
- * [sqlite3_wal_hook()] that causes any database on [database connection] D
- * to automatically [checkpoint]
- * after committing a transaction if there are N or
- * more frames in the [write-ahead log] file. ^Passing zero or
- * a negative value as the nFrame parameter disables automatic
- * checkpoints entirely.
- *
- * ^The callback registered by this function replaces any existing callback
- * registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
- * using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
- * configured by this function.
- *
- * ^The [wal_autocheckpoint pragma] can be used to invoke this interface
- * from SQL.
- *
- * ^Checkpoints initiated by this mechanism are
- * [sqlite3_wal_checkpoint_v2|PASSIVE].
- *
- * ^Every new [database connection] defaults to having the auto-checkpoint
- * enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
- * pages. The use of this interface
- * is only necessary if the default setting is found to be suboptimal
- * for a particular application.
-*/
-SQLITE_API int
-sqlite3_wal_autocheckpoint(sqlite3 * db, int N);
-
-/*
- * CAPI3REF: Checkpoint a database
- * METHOD: sqlite3
- *
- * ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
- * [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
- *
- * In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
- * [write-ahead log] for database X on [database connection] D to be
- * transferred into the database file and for the write-ahead log to
- * be reset. See the [checkpointing] documentation for addition
- * information.
- *
- * This interface used to be the only way to cause a checkpoint to
- * occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
- * interface was added. This interface is retained for backwards
- * compatibility and as a convenience for applications that need to manually
- * start a callback but which do not need the full power (and corresponding
- * complication) of [sqlite3_wal_checkpoint_v2()].
-*/
-SQLITE_API int
-sqlite3_wal_checkpoint(sqlite3 * db);
-
/*
* CAPI3REF: Checkpoint Mode Values
* KEYWORDS: {checkpoint mode}
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index a25116a3f..3d7164c32 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -3504,7 +3504,6 @@ int sqlite3Reprepare(Vdbe *);
void sqlite3ExprListCheckLength(Parse *, ExprList *, const char *);
struct coll *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);
int sqlite3TempInMemory(const sqlite3 *);
-const char *sqlite3JournalModename(int);
#ifndef SQLITE_OMIT_CTE
With *sqlite3WithAdd(Parse *, With *, Token *, ExprList *, Select *);
void sqlite3WithDelete(sqlite3 *, With *);
@@ -3577,15 +3576,6 @@ void sqlite3EndBenignMalloc(void);
#define IN_INDEX_LOOP 0x0004 /* IN operator used as a loop */
int sqlite3FindInIndex(Parse *, Expr *, u32, int *, int *, int *);
-int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);
-int sqlite3JournalSize(sqlite3_vfs *);
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
-int sqlite3JournalCreate(sqlite3_file *);
-#endif
-
-int sqlite3JournalIsInMemory(sqlite3_file * p);
-void sqlite3MemJournalOpen(sqlite3_file *);
-
void sqlite3ExprSetHeightAndFlags(Parse * pParse, Expr * p);
#if SQLITE_MAX_EXPR_DEPTH>0
int sqlite3SelectExprHeight(Select *);
diff --git a/src/box/sql/sqliteLimit.h b/src/box/sql/sqliteLimit.h
index 76ca71d26..548b7320b 100644
--- a/src/box/sql/sqliteLimit.h
+++ b/src/box/sql/sqliteLimit.h
@@ -142,14 +142,6 @@ enum {
#define SQLITE_DEFAULT_CACHE_SIZE -2000
#endif
-/*
- * The default number of frames to accumulate in the log file before
- * checkpointing the database in WAL mode.
- */
-#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
-#define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
-#endif
-
/*
* The maximum number of attached databases. This must be between 0
* and 125. The upper bound of 125 is because the attached databases are
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index a53685a07..46106d735 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -5401,87 +5401,6 @@ case OP_AggFinal: {
break;
}
-#ifndef SQLITE_OMIT_WAL
-/* Opcode: Checkpoint P1 P2 * * *
- *
- * Checkpoint the database. This is a no-op if it is not currently in
- * WAL mode. Parameter P1 is one of SQLITE_CHECKPOINT_PASSIVE, FULL,
- * RESTART, or TRUNCATE. Write 1 or 0 into mem[P2] if the checkpoint returns
- * SQLITE_BUSY or not, respectively. Write the number of pages in the
- * WAL after the checkpoint into mem[P2+1] and the number of pages
- * in the WAL that have been checkpointed after the checkpoint
- * completes into mem[P3+2]. However on an error, mem[P2+1] and
- * mem[P2+2] are initialized to -1.
- */
-case OP_Checkpoint: {
- int i; /* Loop counter */
- int aRes[3]; /* Results */
- Mem *pMem; /* Write results here */
-
- assert(p->readOnly==0);
- aRes[0] = 0;
- aRes[1] = aRes[2] = -1;
- assert(pOp->p1==SQLITE_CHECKPOINT_PASSIVE
- || pOp->p1==SQLITE_CHECKPOINT_FULL
- || pOp->p1==SQLITE_CHECKPOINT_RESTART
- || pOp->p1==SQLITE_CHECKPOINT_TRUNCATE
- );
- /* Tarantool: SQLite native WAL is removed. Probably whole opcode
- needs to be removed. Or adopt Tarantool's WAL for this op. */
- /* rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]); */
- sqlite3VdbeError(p, "OP-code Checkpoint is not implemented yet.");
- rc = SQLITE_ERROR;
- goto abort_due_to_error;
-
- if (rc) {
- if (rc!=SQLITE_BUSY) goto abort_due_to_error;
- rc = SQLITE_OK;
- aRes[0] = 1;
- }
- for(i=0, pMem = &aMem[pOp->p2]; i<3; i++, pMem++) {
- sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]);
- }
- break;
-};
-#endif
-
-#ifndef SQLITE_OMIT_PRAGMA
-/* Opcode: JournalMode P1 P2 P3 * *
- *
- * Change the journal mode of database P1 to P3. P3 must be one of the
- * PAGER_JOURNALMODE_XXX values. If changing between the various rollback
- * modes (delete, truncate, persist, off and memory), this is a simple
- * operation. No IO is required.
- *
- * If changing into or out of WAL mode the procedure is more complicated.
- *
- * Write a string containing the final journal-mode to register P2.
- */
-case OP_JournalMode: { /* out2 */
- int eNew; /* New journal mode */
-
- pOut = out2Prerelease(p, pOp);
- eNew = pOp->p3;
- /* assert(eNew==PAGER_JOURNALMODE_DELETE
- || eNew==PAGER_JOURNALMODE_TRUNCATE
- || eNew==PAGER_JOURNALMODE_PERSIST
- || eNew==PAGER_JOURNALMODE_OFF
- || eNew==PAGER_JOURNALMODE_MEMORY
- || eNew==PAGER_JOURNALMODE_WAL
- || eNew==PAGER_JOURNALMODE_QUERY
- ); */
- assert(pOp->p1==0);
- assert(p->readOnly==0);
-
- pOut->flags = MEM_Str|MEM_Static|MEM_Term;
- pOut->z = (char *)sqlite3JournalModename(eNew);
- pOut->n = sqlite3Strlen30(pOut->z);
- if (rc) goto abort_due_to_error;
- break;
-};
-#endif /* SQLITE_OMIT_PRAGMA */
-
-
/* Opcode: Expire P1 * * * *
*
* Cause precompiled statements to expire. When an expired statement
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 4802e69d7..6622a11a8 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -684,14 +684,6 @@ resolveP2Values(Vdbe * p, int *pMaxFuncArgs)
p->bIsReader = 1;
break;
}
-#ifndef SQLITE_OMIT_WAL
- case OP_Checkpoint:
-#endif
- case OP_JournalMode:{
- p->readOnly = 0;
- p->bIsReader = 1;
- break;
- }
case OP_Next:
case OP_NextIfOpen:
case OP_SorterNext:{
diff --git a/src/box/sql/vdbesort.c b/src/box/sql/vdbesort.c
index a8497ddad..080f2460b 100644
--- a/src/box/sql/vdbesort.c
+++ b/src/box/sql/vdbesort.c
@@ -1262,7 +1262,6 @@ vdbeSorterOpenTempFile(sqlite3 * db, /* Database handle doing sort */
if (sqlite3FaultSim(202))
return SQLITE_IOERR_ACCESS;
rc = sqlite3OsOpenMalloc(db->pVfs, 0, ppFd,
- SQLITE_OPEN_TEMP_JOURNAL |
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
SQLITE_OPEN_EXCLUSIVE |
SQLITE_OPEN_DELETEONCLOSE, &rc);
--
2.14.1
More information about the Tarantool-patches
mailing list