Index: sql/connection.cc |
diff --git a/sql/connection.cc b/sql/connection.cc |
index 0511e11b5c5b22361bbdf24cc1230203749f272b..1ae09b5196824e9a92bc50ce72ed93a6f1e1cbfb 100644 |
--- a/sql/connection.cc |
+++ b/sql/connection.cc |
@@ -1112,6 +1112,12 @@ bool Connection::Raze() { |
// page_size" can be used to query such a database. |
ScopedWritableSchema writable_schema(db_); |
+ // On Windows, truncate silently fails when applied to memory-mapped files. |
+ // Disable memory-mapping so that the truncate succeeds. Note that other |
+ // connections may have memory-mapped the file, so this may not entirely |
+ // prevent the problem. |
pwnall
2017/04/21 11:00:14
Is there any reference for the Windows issue? I sa
Scott Hess - ex-Googler
2017/04/21 14:18:47
I haven't seen anything better than what SQLite sa
pwnall
2017/04/21 19:00:18
Oh, I was under the impression that the same conne
Scott Hess - ex-Googler
2017/04/23 03:36:08
I'm not aware of Raze() cases where the connection
|
+ ignore_result(Execute("PRAGMA mmap_size = 0")); |
+ |
const char* kMain = "main"; |
int rc = BackupDatabase(null_db.db_, db_, kMain); |
UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.RazeDatabase",rc); |