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

Fixed bug #7927 : Some default values is set incorrectly for SC\CS architectures

This commit is contained in:
Vlad Khorsun 2023-12-19 09:34:04 +02:00
parent ffa70491af
commit e62b51134e
2 changed files with 43 additions and 17 deletions

View File

@ -152,7 +152,7 @@ Config::Config(const ConfigFile& file)
: valuesSource(*getDefaultMemoryPool()),
notifyDatabase(*getDefaultMemoryPool()),
serverMode(-1),
defaultConfig(false)
defaultConfig(true)
{
memset(sourceIdx, 0, sizeof(sourceIdx));
valuesSource.add(NULL);
@ -180,6 +180,7 @@ Config::Config(const ConfigFile& file)
}
loadValues(file, CONFIG_FILE);
fixDefaults();
}
Config::Config(const ConfigFile& file, const char* srcName, const Config& base, const PathName& notify)
@ -294,7 +295,7 @@ static const char* txtServerModes[6] =
void Config::setupDefaultConfig()
{
defaultConfig = true;
fb_assert(defaultConfig);
for (unsigned i = 0; i < MAX_CONFIG_KEY; i++)
defaults[i] = entries[i].default_value;
@ -305,28 +306,47 @@ void Config::setupDefaultConfig()
serverMode = bootBuild ? MODE_CLASSIC : MODE_SUPER;
pDefault->strVal = txtServerModes[2 * serverMode];
pDefault = &defaults[KEY_TEMP_CACHE_LIMIT];
if (pDefault->intVal < 0)
pDefault->intVal = (serverMode != MODE_SUPER) ? 8388608 : 67108864; // bytes
defaults[KEY_REMOTE_FILE_OPEN_ABILITY].boolVal = bootBuild;
pDefault = &defaults[KEY_DEFAULT_DB_CACHE_PAGES];
if (pDefault->intVal < 0)
pDefault->intVal = (serverMode != MODE_SUPER) ? 256 : 2048; // pages
pDefault = &defaults[KEY_GC_POLICY];
if (!pDefault->strVal)
{
pDefault->strVal = (serverMode == MODE_SUPER) ? GCPolicyCombined : GCPolicyCooperative;
}
//pDefault = &entries[KEY_WIRE_CRYPT].default_value;
// if (!*pDefault)
// *pDefault == (ConfigValue) (xxx == WC_CLIENT) ? WIRE_CRYPT_ENABLED : WIRE_CRYPT_REQUIRED;
}
void Config::fixDefaults()
{
fb_assert(defaultConfig);
ConfigValue* pDefault = &defaults[KEY_TEMP_CACHE_LIMIT];
ConfigValue* pValue = &values[KEY_TEMP_CACHE_LIMIT];
if (pDefault->intVal < 0)
pDefault->intVal = (serverMode != MODE_SUPER) ? 8388608 : 67108864; // bytes
if (pValue->intVal < 0)
pValue->intVal = pDefault->intVal;
pDefault = &defaults[KEY_DEFAULT_DB_CACHE_PAGES];
pValue = &values[KEY_DEFAULT_DB_CACHE_PAGES];
if (pDefault->intVal < 0)
pDefault->intVal = (serverMode != MODE_SUPER) ? 256 : 2048; // pages
if (pValue->intVal < 0)
pValue->intVal = pDefault->intVal;
pDefault = &defaults[KEY_GC_POLICY];
pValue = &values[KEY_GC_POLICY];
if (!pDefault->strVal)
{
pDefault->strVal = (serverMode == MODE_SUPER) ? GCPolicyCombined : GCPolicyCooperative;
}
if (!pValue->strVal)
pValue->strVal = pDefault->strVal;
}
void Config::checkIntForLoBound(ConfigKey key, SINT64 loBound, bool setDefault)
{
fb_assert(entries[key].data_type == TYPE_INTEGER);

View File

@ -320,9 +320,15 @@ private:
static ConfigValue specialProcessing(ConfigKey key, ConfigValue val);
void loadValues(const ConfigFile& file, const char* srcName);
void setupDefaultConfig();
void checkValues();
// set default ServerMode and default values that didn't depends on ServerMode
void setupDefaultConfig();
// set default values that depends on ServerMode and actual values that was
// not set in config file
void fixDefaults();
// helper check-value functions
void checkIntForLoBound(ConfigKey key, SINT64 loBound, bool setDefault);
void checkIntForHiBound(ConfigKey key, SINT64 hiBound, bool setDefault);