Skip to content

Commit 4c7ed18

Browse files
authored
Merge pull request #1956 from tursodatabase/dont-ignore-resultcode-from-checkpoint-finish-cb
wal.c: do not ignore the result code of xCb in walCheckpoint
2 parents 701a8cf + 90f0751 commit 4c7ed18

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67644,9 +67644,11 @@ static int walCheckpoint(
6764467644
if (xCb) {
6764567645
rc = (xCb)(pCbData, mxSafeFrame, NULL, 0, 0, 0);
6764667646
}
67647-
i64 szDb = pWal->hdr.nPage*(i64)szPage;
67648-
testcase( IS_BIG_INT(szDb) );
67649-
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
67647+
if( rc==SQLITE_OK ){
67648+
i64 szDb = pWal->hdr.nPage*(i64)szPage;
67649+
testcase( IS_BIG_INT(szDb) );
67650+
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
67651+
}
6765067652
if( rc==SQLITE_OK ){
6765167653
rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags));
6765267654
}

libsql-sqlite3/src/wal.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,9 +2134,11 @@ static int walCheckpoint(
21342134
if (xCb) {
21352135
rc = (xCb)(pCbData, mxSafeFrame, NULL, 0, 0, 0);
21362136
}
2137-
i64 szDb = pWal->hdr.nPage*(i64)szPage;
2138-
testcase( IS_BIG_INT(szDb) );
2139-
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
2137+
if( rc==SQLITE_OK ){
2138+
i64 szDb = pWal->hdr.nPage*(i64)szPage;
2139+
testcase( IS_BIG_INT(szDb) );
2140+
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
2141+
}
21402142
if( rc==SQLITE_OK ){
21412143
rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags));
21422144
}

0 commit comments

Comments
 (0)