|
24 | 24 | update/2, |
25 | 25 | update_txn/1, |
26 | 26 | config_default/0, |
27 | | - config_upgrade_to_76/1]). |
| 27 | + config_upgrade_to_76/1, |
| 28 | + config_upgrade_to_morpheus/1]). |
28 | 29 |
|
29 | 30 | -export([cfg_key/0, |
30 | 31 | is_enabled/0, |
31 | 32 | known_settings/0, |
32 | 33 | on_update/2]). |
33 | 34 |
|
34 | 35 | -import(json_settings_manager, |
35 | | - [id_lens/1]). |
| 36 | + [id_lens/1, |
| 37 | + config_upgrade_settings/5]). |
36 | 38 |
|
37 | 39 | -define(QUERY_CONFIG_KEY, {metakv, <<"/query/settings/config">>}). |
38 | 40 |
|
@@ -77,12 +79,18 @@ config_default() -> |
77 | 79 | maps:new(), |
78 | 80 | known_settings(?MIN_SUPPORTED_VERSION))}. |
79 | 81 |
|
| 82 | + |
| 83 | +config_upgrade_to_morpheus(Config) -> |
| 84 | + config_upgrade_settings(?MODULE, Config, |
| 85 | + general_settings_defaults(?VERSION_76), |
| 86 | + general_settings_defaults(?VERSION_MORPHEUS), |
| 87 | + known_settings(?VERSION_MORPHEUS)). |
| 88 | + |
80 | 89 | config_upgrade_to_76(Config) -> |
81 | | - NewSettings = general_settings_defaults(?VERSION_76) -- |
82 | | - general_settings_defaults(?MIN_SUPPORTED_VERSION), |
83 | | - json_settings_manager:upgrade_existing_key( |
84 | | - ?MODULE, Config, [{generalSettings, NewSettings}], |
85 | | - known_settings(?VERSION_76), fun functools:id/1). |
| 90 | + config_upgrade_settings(?MODULE, Config, |
| 91 | + general_settings_defaults(?VERSION_72), |
| 92 | + general_settings_defaults(?VERSION_76), |
| 93 | + known_settings(?VERSION_76)). |
86 | 94 |
|
87 | 95 | known_settings() -> |
88 | 96 | known_settings(cluster_compat_mode:get_ns_config_compat_version()). |
@@ -147,19 +155,27 @@ general_settings(Ver) -> |
147 | 155 | {queryCleanupClientAttempts, "cleanupclientattempts", true}, |
148 | 156 | {queryCleanupLostAttempts, "cleanuplostattempts", true}, |
149 | 157 | {queryCleanupWindow, "cleanupwindow", <<"60s">>}, |
150 | | - {queryNumAtrs, "numatrs", 1024}] ++ |
151 | | - case cluster_compat_mode:is_version_76(Ver) of |
152 | | - true -> |
153 | | - [{queryNodeQuota, "node-quota", ?QUERY_NODE_QUOTA_DEFAULT}, |
154 | | - {queryUseReplica, "use-replica", <<"unset">>}, |
155 | | - {queryNodeQuotaValPercent, |
156 | | - "node-quota-val-percent", 67}, |
157 | | - {queryNumCpus, "num-cpus", 0}, |
158 | | - {queryCompletedMaxPlanSize, |
159 | | - "completed-max-plan-size", 262144}]; |
160 | | - false -> |
161 | | - [] |
162 | | - end ++ n1ql_feature_ctrl_setting(Ver). |
| 158 | + {queryNumAtrs, "numatrs", 1024}] |
| 159 | + ++ case cluster_compat_mode:is_version_76(Ver) of |
| 160 | + true -> |
| 161 | + [{queryNodeQuota, "node-quota", ?QUERY_NODE_QUOTA_DEFAULT}, |
| 162 | + {queryUseReplica, "use-replica", <<"unset">>}, |
| 163 | + {queryNodeQuotaValPercent, |
| 164 | + "node-quota-val-percent", 67}, |
| 165 | + {queryNumCpus, "num-cpus", 0}, |
| 166 | + {queryCompletedMaxPlanSize, |
| 167 | + "completed-max-plan-size", 262144}]; |
| 168 | + false -> |
| 169 | + [] |
| 170 | + end |
| 171 | + ++ case cluster_compat_mode:is_version_morpheus(Ver) of |
| 172 | + true -> |
| 173 | + [{queryCompletedStreamSize, |
| 174 | + "completed-stream-size", 0}]; |
| 175 | + false -> |
| 176 | + [] |
| 177 | + end |
| 178 | + ++ n1ql_feature_ctrl_setting(Ver). |
163 | 179 |
|
164 | 180 | curl_whitelist_settings_len_props() -> |
165 | 181 | [{queryCurlWhitelist, id_lens(<<"query.settings.curl_whitelist">>)}]. |
@@ -211,7 +227,13 @@ config_upgrade_test() -> |
211 | 227 | "\"use-replica\":\"unset\"}">>, |
212 | 228 | Data1), |
213 | 229 |
|
214 | | - meck:unload(config_profile). |
| 230 | + meck:unload(config_profile), |
| 231 | + |
| 232 | + CmdList2 = config_upgrade_to_morpheus([]), |
| 233 | + [{set, {metakv, Meta2}, Data2}] = CmdList2, |
| 234 | + ?assertEqual(<<"/query/settings/config">>, Meta2), |
| 235 | + ?assertEqual(<<"{\"completed-stream-size\":0}">>, |
| 236 | + Data2). |
215 | 237 |
|
216 | 238 | create_test_config_n1ql_quotas(NodeQuotaValue) when is_number(NodeQuotaValue) -> |
217 | 239 | WOutNodeQuota = proplists:delete(queryNodeQuota, |
|
0 commit comments