Skip to content

Commit 2ab7809

Browse files
committed
MB-65809 Use default setting for plan stability if not present
In addition to UNSET of the entire plan_stability field for system:settings, it is also possible to UNSET one of the individual settings: UPDATE system:settings UNSET plan_stability.error_policy; In such cases we need to use default setting for the individual setting as well. Change-Id: I1a02824defe2581706481de9eb9d7597580a9267 Reviewed-on: https://review.couchbase.org/c/query/+/242515 Tested-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com> Reviewed-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>
1 parent 0fcdb5b commit 2ab7809

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

settings/plan_stability_ee.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ func updatePlanStabilitySetting(requestId string, val interface{}) errors.Error
7777
if !ok {
7878
return errors.NewSettingsInvalidValue(PLAN_STABILITY, "map[string]interface{}", val)
7979
}
80+
81+
// use default value if not present in the new settings (e.g. UNSET used)
82+
if _, ok := psMap["mode"]; !ok {
83+
psMap["mode"] = PS_MODE_OFF
84+
}
85+
if _, ok := psMap["error_policy"]; !ok {
86+
psMap["error_policy"] = PS_ERROR_MODERATE
87+
}
88+
8089
// GetPlanStabilitySetting() returns a copy of the settings
8190
planStability, err := GetPlanStabilitySetting()
8291
if err != nil {

0 commit comments

Comments
 (0)