/ Check-in [94a20047]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add new extended error codes for the atomic write file-controls.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | batch-atomic-write
Files: files | file ages | folders
SHA3-256: 94a2004756ffe027b3495be91366750135c294a9c460edc9a1b4b9422dcc33bd
User & Date: drh 2017-07-28 13:18:35
Context
2017-07-28
18:16
More precise determination of when an in-memory journal needs to be spilled to disk. check-in: 6a505bdd user: drh tags: batch-atomic-write
13:18
Add new extended error codes for the atomic write file-controls. check-in: 94a20047 user: drh tags: batch-atomic-write
11:05
Add new test file test/atomic.test. check-in: f9213e48 user: dan tags: batch-atomic-write
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  3792   3792   */
  3793   3793   static int unixFileControl(sqlite3_file *id, int op, void *pArg){
  3794   3794     unixFile *pFile = (unixFile*)id;
  3795   3795     switch( op ){
  3796   3796   #if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
  3797   3797       case SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: {
  3798   3798         int rc = osIoctl(pFile->h, F2FS_IOC_START_ATOMIC_WRITE);
  3799         -      return rc ? SQLITE_ERROR : SQLITE_OK;
         3799  +      return rc ? SQLITE_IOERR_BEGIN_ATOMIC : SQLITE_OK;
  3800   3800       }
  3801   3801       case SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: {
  3802   3802         int rc = osIoctl(pFile->h, F2FS_IOC_COMMIT_ATOMIC_WRITE);
  3803         -      return rc ? SQLITE_ERROR : SQLITE_OK;
         3803  +      return rc ? SQLITE_IOERR_COMMIT_ATOMIC : SQLITE_OK;
  3804   3804       }
  3805   3805       case SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: {
  3806   3806         int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
  3807         -      return rc ? SQLITE_ERROR : SQLITE_OK;
         3807  +      return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
  3808   3808       }
  3809   3809   #endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
  3810   3810   
  3811   3811       case SQLITE_FCNTL_LOCKSTATE: {
  3812   3812         *(int*)pArg = pFile->eFileLock;
  3813   3813         return SQLITE_OK;
  3814   3814       }

Changes to src/sqlite.h.in.

   490    490   #define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
   491    491   #define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))
   492    492   #define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
   493    493   #define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
   494    494   #define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))
   495    495   #define SQLITE_IOERR_VNODE             (SQLITE_IOERR | (27<<8))
   496    496   #define SQLITE_IOERR_AUTH              (SQLITE_IOERR | (28<<8))
          497  +#define SQLITE_IOERR_BEGIN_ATOMIC      (SQLITE_IOERR | (29<<8))
          498  +#define SQLITE_IOERR_COMMIT_ATOMIC     (SQLITE_IOERR | (30<<8))
          499  +#define SQLITE_IOERR_ROLLBACK_ATOMIC   (SQLITE_IOERR | (31<<8))
   497    500   #define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
   498    501   #define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
   499    502   #define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
   500    503   #define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
   501    504   #define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
   502    505   #define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
   503    506   #define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))