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

Side by Side Diff: sql/recovery.cc

Issue 1414563010: [sql] Disable memory-mapping under sql::Recovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sql/recovery.h" 5 #include "sql/recovery.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 r->Shutdown(POISON); 134 r->Shutdown(POISON);
135 } 135 }
136 136
137 Recovery::Recovery(Connection* connection) 137 Recovery::Recovery(Connection* connection)
138 : db_(connection), 138 : db_(connection),
139 recover_db_() { 139 recover_db_() {
140 // Result should keep the page size specified earlier. 140 // Result should keep the page size specified earlier.
141 if (db_->page_size_) 141 if (db_->page_size_)
142 recover_db_.set_page_size(db_->page_size_); 142 recover_db_.set_page_size(db_->page_size_);
143 143
144 // Files with I/O errors cannot be safely memory-mapped.
145 recover_db_.set_mmap_disabled();
146
144 // TODO(shess): This may not handle cases where the default page 147 // TODO(shess): This may not handle cases where the default page
145 // size is used, but the default has changed. I do not think this 148 // size is used, but the default has changed. I do not think this
146 // has ever happened. This could be handled by using "PRAGMA 149 // has ever happened. This could be handled by using "PRAGMA
147 // page_size", at the cost of potential additional failure cases. 150 // page_size", at the cost of potential additional failure cases.
148 } 151 }
149 152
150 Recovery::~Recovery() { 153 Recovery::~Recovery() {
151 Shutdown(RAZE_AND_POISON); 154 Shutdown(RAZE_AND_POISON);
152 } 155 }
153 156
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 525 }
523 return false; 526 return false;
524 } 527 }
525 528
526 RecordRecoveryEvent(RECOVERY_SUCCESS_META_VERSION); 529 RecordRecoveryEvent(RECOVERY_SUCCESS_META_VERSION);
527 *version = recovery_version.ColumnInt(0); 530 *version = recovery_version.ColumnInt(0);
528 return true; 531 return true;
529 } 532 }
530 533
531 } // namespace sql 534 } // namespace sql
OLDNEW
« sql/connection.cc ('K') | « sql/connection.cc ('k') | sql/recovery_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698