8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Remove FileSystemCacheThreshold setting (#7983)

This commit is contained in:
Vlad Khorsun 2024-01-29 22:15:53 +02:00 committed by GitHub
parent 6cae9e5853
commit 55fd220006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 60 deletions

View File

@ -287,32 +287,6 @@
#UseFileSystemCache = true
# ----------------------------
# File system cache threshold
#
# The threshold value that determines if Firebird will use the file system
# cache. File system caching is used if database cache size in pages
# (configured explicitly in the database header or via DefaultDbCachePages setting)
# is less than the value of FileSystemCacheThreshold.
#
# To always use the file system cache, set FileSystemCacheThreshold to a large value.
# To bypass the file system cache for all databases, set FileSystemCacheThreshold to
# zero.
#
# CAUTION!
# This setting is deprecated and will be removed in future Firebird versions.
# Consider using UseFileSystemCache setting instead.
# If UseFileSystemCache is set, the value of FileSystemCacheThreshold is ignored.
# If UseFileSystemCache is not set, and FileSystemCacheThreshold is set, the value
# of FileSystemCacheThreshold is in use and accounted by the engine.
#
# Type: integer, measured in database pages
#
# Per-database configurable.
#
#FileSystemCacheThreshold = 64K
# ----------------------------
# File system cache size
#

View File

@ -415,8 +415,6 @@ void Config::checkValues()
values[KEY_SERVER_MODE] = defaults[KEY_SERVER_MODE];
}
checkIntForLoBound(KEY_FILESYSTEM_CACHE_THRESHOLD, 0, true);
checkIntForLoBound(KEY_SNAPSHOTS_MEM_SIZE, 1, true);
checkIntForHiBound(KEY_SNAPSHOTS_MEM_SIZE, MAX_ULONG, true);
@ -726,12 +724,6 @@ int Config::getWireCrypt(WireCryptMode wcMode) const
return wcMode == WC_CLIENT ? WIRE_CRYPT_ENABLED : WIRE_CRYPT_REQUIRED;
}
bool Config::getUseFileSystemCache(bool* pPresent) const
{
DECLARE_PER_DB_KEY(KEY_USE_FILESYSTEM_CACHE);
return getBool(key, pPresent);
}
/// class FirebirdConf

View File

@ -152,7 +152,6 @@ enum ConfigKey
KEY_GC_POLICY,
KEY_REDIRECTION,
KEY_DATABASE_GROWTH_INCREMENT,
KEY_FILESYSTEM_CACHE_THRESHOLD,
KEY_TRACE_CONFIG,
KEY_MAX_TRACELOG_SIZE,
KEY_FILESYSTEM_CACHE_SIZE,
@ -256,7 +255,6 @@ constexpr ConfigEntry entries[MAX_CONFIG_KEY] =
{TYPE_STRING, "GCPolicy", false, nullptr}, // garbage collection policy
{TYPE_BOOLEAN, "Redirection", true, false},
{TYPE_INTEGER, "DatabaseGrowthIncrement", false, 128 * 1048576}, // bytes
{TYPE_INTEGER, "FileSystemCacheThreshold", false, 65536}, // page buffers
{TYPE_STRING, "AuditTraceConfigFile", true, ""}, // location of audit trace configuration file
{TYPE_INTEGER, "MaxUserTraceLogSize", true, 10}, // maximum size of user session trace log
{TYPE_INTEGER, "FileSystemCacheSize", true, 0}, // percent
@ -572,8 +570,6 @@ public:
CONFIG_GET_PER_DB_INT(getDatabaseGrowthIncrement, KEY_DATABASE_GROWTH_INCREMENT);
CONFIG_GET_PER_DB_INT(getFileSystemCacheThreshold, KEY_FILESYSTEM_CACHE_THRESHOLD);
CONFIG_GET_GLOBAL_KEY(FB_UINT64, getFileSystemCacheSize, KEY_FILESYSTEM_CACHE_SIZE, getInt);
CONFIG_GET_GLOBAL_STR(getAuditTraceConfigFile, KEY_TRACE_CONFIG);
@ -619,7 +615,7 @@ public:
CONFIG_GET_PER_DB_STR(getDataTypeCompatibility, KEY_DATA_TYPE_COMPATIBILITY);
bool getUseFileSystemCache(bool* pPresent = nullptr) const;
CONFIG_GET_PER_DB_BOOL(getUseFileSystemCache, KEY_USE_FILESYSTEM_CACHE);
CONFIG_GET_PER_DB_KEY(ULONG, getInlineSortThreshold, KEY_INLINE_SORT_THRESHOLD, getInt);

View File

@ -1147,7 +1147,9 @@ void PAG_header(thread_db* tdbb, bool info)
dbb->dbb_creation_date.utc_timestamp = *(ISC_TIMESTAMP*) header->hdr_creation_date;
dbb->dbb_creation_date.time_zone = TimeZoneUtil::GMT_ZONE;
if (header->hdr_flags & hdr_read_only)
const bool readOnly = header->hdr_flags & hdr_read_only;
if (readOnly)
{
// If Header Page flag says the database is ReadOnly, gladly accept it.
dbb->dbb_flags &= ~DBB_being_opened_read_only;
@ -1155,7 +1157,7 @@ void PAG_header(thread_db* tdbb, bool info)
}
// If hdr_read_only is not set...
if (!(header->hdr_flags & hdr_read_only) && (dbb->dbb_flags & DBB_being_opened_read_only))
if (!readOnly && (dbb->dbb_flags & DBB_being_opened_read_only))
{
// Looks like the Header page says, it is NOT ReadOnly!! But the database
// file system permission gives only ReadOnly access. Punt out with
@ -1166,34 +1168,22 @@ void PAG_header(thread_db* tdbb, bool info)
}
bool present;
bool useFSCache = dbb->dbb_config->getUseFileSystemCache(&present);
const bool useFSCache = dbb->dbb_config->getUseFileSystemCache();
const bool forceWrite = header->hdr_flags & hdr_force_write;
if (!present)
if (forceWrite || !useFSCache)
{
useFSCache = dbb->dbb_bcb->bcb_count <
ULONG(dbb->dbb_config->getFileSystemCacheThreshold());
}
if ((header->hdr_flags & hdr_force_write) || !useFSCache)
{
dbb->dbb_flags |=
(header->hdr_flags & hdr_force_write ? DBB_force_write : 0) |
(useFSCache ? 0 : DBB_no_fs_cache);
const bool forceWrite = dbb->dbb_flags & DBB_force_write;
const bool notUseFSCache = dbb->dbb_flags & DBB_no_fs_cache;
dbb->dbb_flags |= (forceWrite ? DBB_force_write : 0) |
(useFSCache ? 0 : DBB_no_fs_cache);
PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
for (jrd_file* file = pageSpace->file; file; file = file->fil_next)
{
PIO_force_write(file,
forceWrite && !(header->hdr_flags & hdr_read_only),
notUseFSCache);
PIO_force_write(file, forceWrite && !readOnly, !useFSCache);
}
if (dbb->dbb_backup_manager->getState() != Ods::hdr_nbak_normal)
dbb->dbb_backup_manager->setForcedWrites(forceWrite, notUseFSCache);
dbb->dbb_backup_manager->setForcedWrites(forceWrite, !useFSCache);
}
if (header->hdr_flags & hdr_no_reserve)