1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Merge enhancements from trunk.

FossilOrigin-Name: d1731385c077f298b0cf654d6183ed40f7e5c07e4e2ab7f69109cf951ce99d9e
This commit is contained in:
drh
2020-04-02 12:24:08 +00:00
14 changed files with 120 additions and 58 deletions

View File

@@ -1569,9 +1569,21 @@ static int sqliteDefaultBusyCallback(
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
if( sqlite3OsFileControl(pFile,SQLITE_FCNTL_LOCK_TIMEOUT,&tmout)==SQLITE_OK ){
if( count ){
tmout = 0;
sqlite3OsFileControl(pFile, SQLITE_FCNTL_LOCK_TIMEOUT, &tmout);
return 0;
/* If this is the second or later invocation of the busy-handler,
** but tmout==0, then code in wal.c must have disabled the blocking
** lock before the SQLITE_BUSY error was hit. In this case, no delay
** occurred while waiting for the lock, so fall through to the xSleep()
** code below to delay a while before retrying the lock.
**
** Alternatively, if tmout!=0, then SQLite has already waited
** sqlite3.busyTimeout ms for a lock. In this case, return 0 to
** indicate that the lock should not be retried and the SQLITE_BUSY
** error returned to the application. */
if( tmout ){
tmout = 0;
sqlite3OsFileControl(pFile, SQLITE_FCNTL_LOCK_TIMEOUT, &tmout);
return 0;
}
}else{
return 1;
}
@@ -1721,7 +1733,7 @@ void sqlite3_interrupt(sqlite3 *db){
return;
}
#endif
db->u1.isInterrupted = 1;
AtomicStore(&db->u1.isInterrupted, 1);
}
@@ -2343,7 +2355,7 @@ int sqlite3_wal_checkpoint_v2(
/* If there are no active statements, clear the interrupt flag at this
** point. */
if( db->nVdbeActive==0 ){
db->u1.isInterrupted = 0;
AtomicStore(&db->u1.isInterrupted, 0);
}
sqlite3_mutex_leave(db->mutex);