MCPcopy Create free account
hub / github.com/apple/foundationdb / generateNormalConfig

Method generateNormalConfig

fdbserver/SimulatedCluster.actor.cpp:1856–1889  ·  view source on GitHub ↗

Generates and sets an appropriate configuration for the database according to the provided testConfig. Some attributes are randomly generated for more coverage of different combinations

Source from the content-addressed store, hash-verified

1854// the provided testConfig. Some attributes are randomly generated for more coverage
1855// of different combinations
1856void SimulationConfig::generateNormalConfig(const TestConfig& testConfig) {
1857 set_config("new");
1858 // Some of these options will overwrite one another so the ordering is important.
1859 // This is a bit inefficient but separates the different types of option setting paths for better readability.
1860 setDatacenters(testConfig);
1861
1862 // These 3 sets will only change the settings with trivial logic and low coupling with
1863 // other portions of the configuration. The parameters that are more involved and use
1864 // complex logic will be found in their respective "set----" methods following after.
1865 setRandomConfig();
1866 if (testConfig.simpleConfig) {
1867 setSimpleConfig();
1868 }
1869 setSpecificConfig(testConfig);
1870
1871 setStorageEngine(testConfig);
1872 setReplicationType(testConfig);
1873 if (generateFearless || (datacenters == 2 && deterministicRandom()->random01() < 0.5)) {
1874 setRegions(testConfig);
1875 }
1876 setMachineCount(testConfig);
1877 setCoordinators(testConfig);
1878
1879 if (testConfig.minimumReplication > 1 && datacenters == 3) {
1880 // low latency tests in 3 data hall mode need 2 other data centers with 2 machines each to avoid waiting for
1881 // logs to recover.
1882 machine_count = std::max(machine_count, 6);
1883 coordinators = 3;
1884 }
1885
1886 setProcessesPerMachine(testConfig);
1887 setTss(testConfig);
1888 setConfigDB(testConfig);
1889}
1890
1891// Configures the system according to the given specifications in order to run
1892// simulation under the correct conditions

Callers

nothing calls this directly

Calls 3

deterministicRandomFunction · 0.85
setConfigDBFunction · 0.85
random01Method · 0.80

Tested by

no test coverage detected