sql: Replace Database::set_mmap_alt_status() with DatabaseOptions member
This database operation parameter should be immutable during database
operation. Moving to DatabaseOptions makes this explicit.
This CL also makes it clear that the mmap alternative status feature is
discouraged, so new feature designers will use the supported alternative
(meta tables).
The alternative status storage method is discouraged because the status
is stashed in the database schema, and changing it invalidates all
precompiled statements.
Bug: 1126968
Change-Id: I3530721f13e0e2192369d79b03df86ac7a67cf90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3019891
Reviewed-by: Alex Ilin <[email protected]>
Reviewed-by: David Van Cleve <[email protected]>
Reviewed-by: Reilly Grant <[email protected]>
Reviewed-by: Marijn Kruisselbrink <[email protected]>
Commit-Queue: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#901145}
diff --git a/sql/database.h b/sql/database.h
index eea1380..7c49ba5 100644
--- a/sql/database.h
+++ b/sql/database.h
@@ -131,6 +131,16 @@
// TODO(pwnall): Replace the default with an invalid value after all
// sql::Database users explicitly initialize page_size.
int cache_size = 0;
+
+ // Stores mmap failures in the SQL schema, instead of the meta table.
+ //
+ // This option is strongly discouraged for new databases, and will eventually
+ // be removed.
+ //
+ // If this option is true, the mmap status is stored in the database schema.
+ // Like any other schema change, changing the mmap status invalidates all
+ // pre-compiled SQL statements.
+ bool mmap_alt_status_discouraged = false;
};
// Handle to an open SQLite database.
@@ -181,11 +191,6 @@
// Returns whether a database will be opened in WAL mode.
bool UseWALMode() const;
- // Call to use alternative status-tracking for mmap. Usually this is tracked
- // in the meta table, but some databases have no meta table.
- // TODO(shess): Maybe just have all databases use the alt option?
- void set_mmap_alt_status() { mmap_alt_status_ = true; }
-
// Opt out of memory-mapped file I/O.
void set_mmap_disabled() { mmap_disabled_ = true; }
@@ -761,9 +766,6 @@
// databases.
bool poisoned_ = false;
- // |true| to use alternate storage for tracking mmap status.
- bool mmap_alt_status_ = false;
-
// |true| if SQLite memory-mapped I/O is not desired for this database.
bool mmap_disabled_;