Skip to content

Commit 55fd220

Browse files
authored
Remove FileSystemCacheThreshold setting (#7983)
1 parent 6cae9e5 commit 55fd220

File tree

4 files changed

+12
-60
lines changed

4 files changed

+12
-60
lines changed

builds/install/misc/firebird.conf

-26
Original file line numberDiff line numberDiff line change
@@ -287,32 +287,6 @@
287287
#UseFileSystemCache = true
288288

289289

290-
# ----------------------------
291-
# File system cache threshold
292-
#
293-
# The threshold value that determines if Firebird will use the file system
294-
# cache. File system caching is used if database cache size in pages
295-
# (configured explicitly in the database header or via DefaultDbCachePages setting)
296-
# is less than the value of FileSystemCacheThreshold.
297-
#
298-
# To always use the file system cache, set FileSystemCacheThreshold to a large value.
299-
# To bypass the file system cache for all databases, set FileSystemCacheThreshold to
300-
# zero.
301-
#
302-
# CAUTION!
303-
# This setting is deprecated and will be removed in future Firebird versions.
304-
# Consider using UseFileSystemCache setting instead.
305-
# If UseFileSystemCache is set, the value of FileSystemCacheThreshold is ignored.
306-
# If UseFileSystemCache is not set, and FileSystemCacheThreshold is set, the value
307-
# of FileSystemCacheThreshold is in use and accounted by the engine.
308-
#
309-
# Type: integer, measured in database pages
310-
#
311-
# Per-database configurable.
312-
#
313-
#FileSystemCacheThreshold = 64K
314-
315-
316290
# ----------------------------
317291
# File system cache size
318292
#

src/common/config/config.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,6 @@ void Config::checkValues()
415415
values[KEY_SERVER_MODE] = defaults[KEY_SERVER_MODE];
416416
}
417417

418-
checkIntForLoBound(KEY_FILESYSTEM_CACHE_THRESHOLD, 0, true);
419-
420418
checkIntForLoBound(KEY_SNAPSHOTS_MEM_SIZE, 1, true);
421419
checkIntForHiBound(KEY_SNAPSHOTS_MEM_SIZE, MAX_ULONG, true);
422420

@@ -726,12 +724,6 @@ int Config::getWireCrypt(WireCryptMode wcMode) const
726724
return wcMode == WC_CLIENT ? WIRE_CRYPT_ENABLED : WIRE_CRYPT_REQUIRED;
727725
}
728726

729-
bool Config::getUseFileSystemCache(bool* pPresent) const
730-
{
731-
DECLARE_PER_DB_KEY(KEY_USE_FILESYSTEM_CACHE);
732-
return getBool(key, pPresent);
733-
}
734-
735727

736728
/// class FirebirdConf
737729

src/common/config/config.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ enum ConfigKey
152152
KEY_GC_POLICY,
153153
KEY_REDIRECTION,
154154
KEY_DATABASE_GROWTH_INCREMENT,
155-
KEY_FILESYSTEM_CACHE_THRESHOLD,
156155
KEY_TRACE_CONFIG,
157156
KEY_MAX_TRACELOG_SIZE,
158157
KEY_FILESYSTEM_CACHE_SIZE,
@@ -256,7 +255,6 @@ constexpr ConfigEntry entries[MAX_CONFIG_KEY] =
256255
{TYPE_STRING, "GCPolicy", false, nullptr}, // garbage collection policy
257256
{TYPE_BOOLEAN, "Redirection", true, false},
258257
{TYPE_INTEGER, "DatabaseGrowthIncrement", false, 128 * 1048576}, // bytes
259-
{TYPE_INTEGER, "FileSystemCacheThreshold", false, 65536}, // page buffers
260258
{TYPE_STRING, "AuditTraceConfigFile", true, ""}, // location of audit trace configuration file
261259
{TYPE_INTEGER, "MaxUserTraceLogSize", true, 10}, // maximum size of user session trace log
262260
{TYPE_INTEGER, "FileSystemCacheSize", true, 0}, // percent
@@ -572,8 +570,6 @@ class Config : public RefCounted, public GlobalStorage
572570

573571
CONFIG_GET_PER_DB_INT(getDatabaseGrowthIncrement, KEY_DATABASE_GROWTH_INCREMENT);
574572

575-
CONFIG_GET_PER_DB_INT(getFileSystemCacheThreshold, KEY_FILESYSTEM_CACHE_THRESHOLD);
576-
577573
CONFIG_GET_GLOBAL_KEY(FB_UINT64, getFileSystemCacheSize, KEY_FILESYSTEM_CACHE_SIZE, getInt);
578574

579575
CONFIG_GET_GLOBAL_STR(getAuditTraceConfigFile, KEY_TRACE_CONFIG);
@@ -619,7 +615,7 @@ class Config : public RefCounted, public GlobalStorage
619615

620616
CONFIG_GET_PER_DB_STR(getDataTypeCompatibility, KEY_DATA_TYPE_COMPATIBILITY);
621617

622-
bool getUseFileSystemCache(bool* pPresent = nullptr) const;
618+
CONFIG_GET_PER_DB_BOOL(getUseFileSystemCache, KEY_USE_FILESYSTEM_CACHE);
623619

624620
CONFIG_GET_PER_DB_KEY(ULONG, getInlineSortThreshold, KEY_INLINE_SORT_THRESHOLD, getInt);
625621

src/jrd/pag.cpp

+11-21
Original file line numberDiff line numberDiff line change
@@ -1147,15 +1147,17 @@ void PAG_header(thread_db* tdbb, bool info)
11471147
dbb->dbb_creation_date.utc_timestamp = *(ISC_TIMESTAMP*) header->hdr_creation_date;
11481148
dbb->dbb_creation_date.time_zone = TimeZoneUtil::GMT_ZONE;
11491149

1150-
if (header->hdr_flags & hdr_read_only)
1150+
const bool readOnly = header->hdr_flags & hdr_read_only;
1151+
1152+
if (readOnly)
11511153
{
11521154
// If Header Page flag says the database is ReadOnly, gladly accept it.
11531155
dbb->dbb_flags &= ~DBB_being_opened_read_only;
11541156
dbb->dbb_flags |= DBB_read_only;
11551157
}
11561158

11571159
// If hdr_read_only is not set...
1158-
if (!(header->hdr_flags & hdr_read_only) && (dbb->dbb_flags & DBB_being_opened_read_only))
1160+
if (!readOnly && (dbb->dbb_flags & DBB_being_opened_read_only))
11591161
{
11601162
// Looks like the Header page says, it is NOT ReadOnly!! But the database
11611163
// file system permission gives only ReadOnly access. Punt out with
@@ -1166,34 +1168,22 @@ void PAG_header(thread_db* tdbb, bool info)
11661168
}
11671169

11681170

1169-
bool present;
1170-
bool useFSCache = dbb->dbb_config->getUseFileSystemCache(&present);
1171+
const bool useFSCache = dbb->dbb_config->getUseFileSystemCache();
1172+
const bool forceWrite = header->hdr_flags & hdr_force_write;
11711173

1172-
if (!present)
1174+
if (forceWrite || !useFSCache)
11731175
{
1174-
useFSCache = dbb->dbb_bcb->bcb_count <
1175-
ULONG(dbb->dbb_config->getFileSystemCacheThreshold());
1176-
}
1177-
1178-
if ((header->hdr_flags & hdr_force_write) || !useFSCache)
1179-
{
1180-
dbb->dbb_flags |=
1181-
(header->hdr_flags & hdr_force_write ? DBB_force_write : 0) |
1182-
(useFSCache ? 0 : DBB_no_fs_cache);
1183-
1184-
const bool forceWrite = dbb->dbb_flags & DBB_force_write;
1185-
const bool notUseFSCache = dbb->dbb_flags & DBB_no_fs_cache;
1176+
dbb->dbb_flags |= (forceWrite ? DBB_force_write : 0) |
1177+
(useFSCache ? 0 : DBB_no_fs_cache);
11861178

11871179
PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
11881180
for (jrd_file* file = pageSpace->file; file; file = file->fil_next)
11891181
{
1190-
PIO_force_write(file,
1191-
forceWrite && !(header->hdr_flags & hdr_read_only),
1192-
notUseFSCache);
1182+
PIO_force_write(file, forceWrite && !readOnly, !useFSCache);
11931183
}
11941184

11951185
if (dbb->dbb_backup_manager->getState() != Ods::hdr_nbak_normal)
1196-
dbb->dbb_backup_manager->setForcedWrites(forceWrite, notUseFSCache);
1186+
dbb->dbb_backup_manager->setForcedWrites(forceWrite, !useFSCache);
11971187
}
11981188

11991189
if (header->hdr_flags & hdr_no_reserve)

0 commit comments

Comments
 (0)