mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
If an SQLITE_IOERR error is encountered as part of an atomic commit on an F2FS
file-system, retry the commit in legacy journal mode. FossilOrigin-Name: 1c41250f67ac5de423b0426ef2ab8fe3303278a270225920033933ca9609592a
This commit is contained in:
@@ -133,8 +133,9 @@ struct Testvfs {
|
||||
#define TESTVFS_UNLOCK_MASK 0x00020000
|
||||
#define TESTVFS_LOCK_MASK 0x00040000
|
||||
#define TESTVFS_CKLOCK_MASK 0x00080000
|
||||
#define TESTVFS_FCNTL_MASK 0x00100000
|
||||
|
||||
#define TESTVFS_ALL_MASK 0x000FFFFF
|
||||
#define TESTVFS_ALL_MASK 0x001FFFFF
|
||||
|
||||
|
||||
#define TESTVFS_MAX_PAGES 1024
|
||||
@@ -517,7 +518,8 @@ static int tvfsCheckReservedLock(sqlite3_file *pFile, int *pResOut){
|
||||
** File control method. For custom operations on an tvfs-file.
|
||||
*/
|
||||
static int tvfsFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
TestvfsFd *p = tvfsGetFd(pFile);
|
||||
TestvfsFd *pFd = tvfsGetFd(pFile);
|
||||
Testvfs *p = (Testvfs *)pFd->pVfs->pAppData;
|
||||
if( op==SQLITE_FCNTL_PRAGMA ){
|
||||
char **argv = (char**)pArg;
|
||||
if( sqlite3_stricmp(argv[1],"error")==0 ){
|
||||
@@ -535,11 +537,34 @@ static int tvfsFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
return rc;
|
||||
}
|
||||
if( sqlite3_stricmp(argv[1], "filename")==0 ){
|
||||
argv[0] = sqlite3_mprintf("%s", p->zFilename);
|
||||
argv[0] = sqlite3_mprintf("%s", pFd->zFilename);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
}
|
||||
return sqlite3OsFileControl(p->pReal, op, pArg);
|
||||
if( p->pScript && (p->mask&TESTVFS_FCNTL_MASK) ){
|
||||
struct Fcntl {
|
||||
int iFnctl;
|
||||
const char *zFnctl;
|
||||
} aF[] = {
|
||||
{ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, "BEGIN_ATOMIC_WRITE" },
|
||||
{ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, "COMMIT_ATOMIC_WRITE" },
|
||||
};
|
||||
int i;
|
||||
for(i=0; i<sizeof(aF)/sizeof(aF[0]); i++){
|
||||
if( op==aF[i].iFnctl ) break;
|
||||
}
|
||||
if( i<sizeof(aF)/sizeof(aF[0]) ){
|
||||
int rc = 0;
|
||||
tvfsExecTcl(p, "xFileControl",
|
||||
Tcl_NewStringObj(pFd->zFilename, -1),
|
||||
Tcl_NewStringObj(aF[i].zFnctl, -1),
|
||||
0, 0
|
||||
);
|
||||
tvfsResultCode(p, &rc);
|
||||
if( rc ) return rc;
|
||||
}
|
||||
}
|
||||
return sqlite3OsFileControl(pFd->pReal, op, pArg);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1160,6 +1185,7 @@ static int SQLITE_TCLAPI testvfs_obj_cmd(
|
||||
{ "xUnlock", TESTVFS_UNLOCK_MASK },
|
||||
{ "xLock", TESTVFS_LOCK_MASK },
|
||||
{ "xCheckReservedLock", TESTVFS_CKLOCK_MASK },
|
||||
{ "xFileControl", TESTVFS_FCNTL_MASK },
|
||||
};
|
||||
Tcl_Obj **apElem = 0;
|
||||
int nElem = 0;
|
||||
|
Reference in New Issue
Block a user