summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorshess <shess@chromium.org>2015-06-01 18:31:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-02 01:31:28 +0000
commit2c21ecf224c91ff3d54c3be9bd8a2869a20cf729 (patch)
tree2a5388c34dc85fecac0355b4b6ed3d56ee8609ea /sql
parentc37f660d69ea92d3c5288bd0dc7a56325827b7e2 (diff)
downloadchromium_src-2c21ecf224c91ff3d54c3be9bd8a2869a20cf729.zip
chromium_src-2c21ecf224c91ff3d54c3be9bd8a2869a20cf729.tar.gz
chromium_src-2c21ecf224c91ff3d54c3be9bd8a2869a20cf729.tar.bz2
[sql] Don't persist data in journal files.
Using journal_mode=PERSIST in combination with secure_delete=ON is probably not quite right. Switch to journal_mode=TRUNCATE for now, while considering whether that combination should overwrite (or be forbidden). BUG=493008 Review URL: https://codereview.chromium.org/1159033004 Cr-Commit-Position: refs/heads/master@{#332309}
Diffstat (limited to 'sql')
-rw-r--r--sql/connection.cc10
-rw-r--r--sql/connection_unittest.cc2
2 files changed, 5 insertions, 7 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index b91234b..8720985 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -988,12 +988,10 @@ bool Connection::OpenInternal(const std::string& file_name,
// DELETE (default) - delete -journal file to commit.
// TRUNCATE - truncate -journal file to commit.
// PERSIST - zero out header of -journal file to commit.
- // journal_size_limit provides size to trim to in PERSIST.
- // TODO(shess): Figure out if PERSIST and journal_size_limit really
- // matter. In theory, it keeps pages pre-allocated, so if
- // transactions usually fit, it should be faster.
- ignore_result(Execute("PRAGMA journal_mode = PERSIST"));
- ignore_result(Execute("PRAGMA journal_size_limit = 16384"));
+ // TRUNCATE should be faster than DELETE because it won't need directory
+ // changes for each transaction. PERSIST may break the spirit of using
+ // secure_delete.
+ ignore_result(Execute("PRAGMA journal_mode = TRUNCATE"));
const base::TimeDelta kBusyTimeout =
base::TimeDelta::FromSeconds(kBusyTimeoutSeconds);
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc
index e3b9773..ed86eb0 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -692,7 +692,7 @@ TEST_F(SQLConnectionTest, Delete) {
db().Close();
// Should have both a main database file and a journal file because
- // of journal_mode PERSIST.
+ // of journal_mode TRUNCATE.
base::FilePath journal(db_path().value() + FILE_PATH_LITERAL("-journal"));
ASSERT_TRUE(base::PathExists(db_path()));
ASSERT_TRUE(base::PathExists(journal));