Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: sql/connection.cc

Issue 2830263002: [sql] Remove mmap before Raze(). (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sql/connection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | sql/connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698