Write-Ahead Logging mode which may provide some disk i/o benefits,
see https://www.sqlite.org/wal.html for more details and note that
SQLite 3.22.0 or later is required to support read-only operations
+ - Show warning in log if writing cached data to database is slow
2.2 / 28-Apr-2018
#define IS64BIT -2
#define WALDB 0
#define WALDBCHECKPOINTINTERVALMINS 240
+#define SLOWDBFLUSHWARNLIMIT 3.0
/* no transparency by default */
#define TRANSBG 0
void flushcachetodisk(DSTATE *s)
{
int ret;
+ double used_secs = 0.0;
uint32_t logcount = 0;
datacache *iterator = s->dcache;
xferlog *logiterator;
interfaceinfo info;
- timeused_debug(__func__, 1);
+ timeused(__func__, 1);
if (!db_begintransaction()) {
handledatabaseerror(s);
} else {
db_rollbacktransaction();
}
- timeused_debug(__func__, 0);
+ used_secs = timeused(__func__, 0);
+ if (used_secs > SLOWDBFLUSHWARNLIMIT) {
+ snprintf(errorstring, 1024, "Writing cached data to database took %.2f seconds.", used_secs);
+ printe(PT_Warning);
+ }
}
void handledatabaseerror(DSTATE *s)