Configures the system according to the given specifications in order to run simulation under the correct conditions
| 1891 | // Configures the system according to the given specifications in order to run |
| 1892 | // simulation under the correct conditions |
| 1893 | void setupSimulatedSystem(std::vector<Future<Void>>* systemActors, |
| 1894 | std::string baseFolder, |
| 1895 | int* pTesterCount, |
| 1896 | Optional<ClusterConnectionString>* pConnString, |
| 1897 | Standalone<StringRef>* pStartingConfiguration, |
| 1898 | std::string whitelistBinPaths, |
| 1899 | TestConfig testConfig, |
| 1900 | ProtocolVersion protocolVersion, |
| 1901 | TenantMode tenantMode) { |
| 1902 | // SOMEDAY: this does not test multi-interface configurations |
| 1903 | SimulationConfig simconfig(testConfig); |
| 1904 | if (testConfig.logAntiQuorum != -1) { |
| 1905 | simconfig.db.tLogWriteAntiQuorum = testConfig.logAntiQuorum; |
| 1906 | } |
| 1907 | |
| 1908 | simconfig.db.tenantMode = tenantMode; |
| 1909 | |
| 1910 | StatusObject startingConfigJSON = simconfig.db.toJSON(true); |
| 1911 | std::string startingConfigString = "new"; |
| 1912 | if (testConfig.configureLocked) { |
| 1913 | startingConfigString += " locked"; |
| 1914 | } |
| 1915 | auto& g_knobs = IKnobCollection::getMutableGlobalKnobCollection(); |
| 1916 | if (testConfig.disableRemoteKVS) { |
| 1917 | g_knobs.setKnob("remote_kv_store", KnobValueRef::create(bool{ false })); |
| 1918 | TraceEvent(SevDebug, "DisableRemoteKVS"); |
| 1919 | } |
| 1920 | if (testConfig.disableEncryption) { |
| 1921 | g_knobs.setKnob("enable_encryption", KnobValueRef::create(bool{ false })); |
| 1922 | g_knobs.setKnob("enable_tlog_encryption", KnobValueRef::create(bool{ false })); |
| 1923 | TraceEvent(SevDebug, "DisableEncryption"); |
| 1924 | } |
| 1925 | auto configDBType = testConfig.getConfigDBType(); |
| 1926 | for (auto kv : startingConfigJSON) { |
| 1927 | if ("tss_storage_engine" == kv.first) { |
| 1928 | continue; |
| 1929 | } |
| 1930 | if ("perpetual_storage_wiggle_locality" == kv.first) { |
| 1931 | if (deterministicRandom()->random01() < 0.25) { |
| 1932 | int dcId = deterministicRandom()->randomInt(0, simconfig.datacenters); |
| 1933 | startingConfigString += " " + kv.first + "=" + "data_hall:" + std::to_string(dcId); |
| 1934 | } |
| 1935 | continue; |
| 1936 | } |
| 1937 | startingConfigString += " "; |
| 1938 | if (kv.second.type() == json_spirit::int_type) { |
| 1939 | startingConfigString += kv.first + ":=" + format("%d", kv.second.get_int()); |
| 1940 | } else if (kv.second.type() == json_spirit::str_type) { |
| 1941 | if ("storage_migration_type" == kv.first || "tenant_mode" == kv.first) { |
| 1942 | startingConfigString += kv.first + "=" + kv.second.get_str(); |
| 1943 | } else { |
| 1944 | startingConfigString += kv.second.get_str(); |
| 1945 | } |
| 1946 | } else if (kv.second.type() == json_spirit::array_type) { |
| 1947 | startingConfigString += kv.first + "=" + |
| 1948 | json_spirit::write_string(json_spirit::mValue(kv.second.get_array()), |
| 1949 | json_spirit::Output_options::none); |
| 1950 | } else { |
no test coverage detected