| 2032 | } |
| 2033 | |
| 2034 | void DatabaseContext::setOption(FDBDatabaseOptions::Option option, Optional<StringRef> value) { |
| 2035 | int defaultFor = FDBDatabaseOptions::optionInfo.getMustExist(option).defaultFor; |
| 2036 | if (defaultFor >= 0) { |
| 2037 | ASSERT(FDBTransactionOptions::optionInfo.find((FDBTransactionOptions::Option)defaultFor) != |
| 2038 | FDBTransactionOptions::optionInfo.end()); |
| 2039 | transactionDefaults.addOption((FDBTransactionOptions::Option)defaultFor, value.castTo<Standalone<StringRef>>()); |
| 2040 | } else { |
| 2041 | switch (option) { |
| 2042 | case FDBDatabaseOptions::LOCATION_CACHE_SIZE: |
| 2043 | locationCacheSize = (int)extractIntOption(value, 0, std::numeric_limits<int>::max()); |
| 2044 | break; |
| 2045 | case FDBDatabaseOptions::MACHINE_ID: |
| 2046 | clientLocality = |
| 2047 | LocalityData(clientLocality.processId(), |
| 2048 | value.present() ? Standalone<StringRef>(value.get()) : Optional<Standalone<StringRef>>(), |
| 2049 | clientLocality.machineId(), |
| 2050 | clientLocality.dcId()); |
| 2051 | if (clientInfo->get().commitProxies.size()) |
| 2052 | commitProxies = makeReference<CommitProxyInfo>(clientInfo->get().commitProxies); |
| 2053 | if (clientInfo->get().grvProxies.size()) |
| 2054 | grvProxies = makeReference<GrvProxyInfo>(clientInfo->get().grvProxies, BalanceOnRequests::True); |
| 2055 | server_interf.clear(); |
| 2056 | locationCache.insert(allKeys, Reference<LocationInfo>()); |
| 2057 | break; |
| 2058 | case FDBDatabaseOptions::MAX_WATCHES: |
| 2059 | maxOutstandingWatches = (int)extractIntOption(value, 0, CLIENT_KNOBS->ABSOLUTE_MAX_WATCHES); |
| 2060 | break; |
| 2061 | case FDBDatabaseOptions::DATACENTER_ID: |
| 2062 | clientLocality = |
| 2063 | LocalityData(clientLocality.processId(), |
| 2064 | clientLocality.zoneId(), |
| 2065 | clientLocality.machineId(), |
| 2066 | value.present() ? Standalone<StringRef>(value.get()) : Optional<Standalone<StringRef>>()); |
| 2067 | if (clientInfo->get().commitProxies.size()) |
| 2068 | commitProxies = makeReference<CommitProxyInfo>(clientInfo->get().commitProxies); |
| 2069 | if (clientInfo->get().grvProxies.size()) |
| 2070 | grvProxies = makeReference<GrvProxyInfo>(clientInfo->get().grvProxies, BalanceOnRequests::True); |
| 2071 | server_interf.clear(); |
| 2072 | locationCache.insert(allKeys, Reference<LocationInfo>()); |
| 2073 | break; |
| 2074 | case FDBDatabaseOptions::SNAPSHOT_RYW_ENABLE: |
| 2075 | validateOptionValueNotPresent(value); |
| 2076 | snapshotRywEnabled++; |
| 2077 | break; |
| 2078 | case FDBDatabaseOptions::SNAPSHOT_RYW_DISABLE: |
| 2079 | validateOptionValueNotPresent(value); |
| 2080 | snapshotRywEnabled--; |
| 2081 | break; |
| 2082 | case FDBDatabaseOptions::USE_CONFIG_DATABASE: |
| 2083 | validateOptionValueNotPresent(value); |
| 2084 | useConfigDatabase = true; |
| 2085 | break; |
| 2086 | case FDBDatabaseOptions::TEST_CAUSAL_READ_RISKY: |
| 2087 | verifyCausalReadsProp = double(extractIntOption(value, 0, 100)) / 100.0; |
| 2088 | break; |
| 2089 | default: |
| 2090 | break; |
| 2091 | } |
nothing calls this directly
no test coverage detected