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

Unified Diff: sql/connection.cc

Issue 2225333003: Recreate the WebData database on a catastrophic SQL error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: derat's comments Created 4 years, 4 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
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index 9c7cb7d4099a811bc78b314070ab2fd1eebb1eb4..1238662c948cdcd299e7f9b5440bc21d9a726d96 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -31,6 +31,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
#include "sql/connection_memory_dump_provider.h"
+#include "sql/error_delegate_util.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "third_party/sqlite/sqlite3.h"
@@ -1700,8 +1701,13 @@ bool Connection::OpenInternal(const std::string& file_name,
// land is. If it's mostly SQLITE_NOTADB, then the database should
// be razed.
err = ExecuteAndReturnErrorCode("PRAGMA auto_vacuum");
- if (err != SQLITE_OK)
+ if (err != SQLITE_OK) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.OpenProbeFailure", err);
+ if (IsErrorCatastrophic(err)) {
+ OnSqliteError(err, nullptr, "PRAGMA auto_vacuum");
+ return false;
afakhry 2016/08/09 21:36:17 shess@, I need your advice about this code. The r
Scott Hess - ex-Googler 2016/08/10 17:16:19 I'm not sure what your question is. I wouldn't ex
afakhry 2016/08/11 17:32:54 I'm forcing a corruption in the Web Data file on a
+ }
+ }
#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
// The version of SQLite shipped with iOS doesn't enable ICU, which includes

Powered by Google App Engine
This is Rietveld 408576698