From 238c4bb7927424f907c397df112df8f1edf7e5ae Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 18 Sep 2020 21:13:01 +0300 Subject: [PATCH] sql: set PRAGMA temp_store=memory On Android, there is to /tmp directory, so SQLite may throw SQLITE_IOERR_GETTEMPPATH when trying to find a place for temporary files. Storing temporary files in memory is a workaround that always works (until out of memory). See https://github.com/mozilla/mentat/issues/505 for discussion of a similar issue. --- src/sql.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql.rs b/src/sql.rs index 81e4a9807..c0e90ecc1 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -678,7 +678,10 @@ async fn open( .with_flags(open_flags) .with_init(|c| { c.execute_batch(&format!( - "PRAGMA secure_delete=on; PRAGMA busy_timeout = {};", + "PRAGMA secure_delete=on; + PRAGMA busy_timeout = {}; + PRAGMA temp_store=memory; -- Avoid SQLITE_IOERR_GETTEMPPATH errors on Android + ", Duration::from_secs(10).as_millis() ))?; Ok(())