diff --git a/pkg/config/manager.go b/pkg/config/manager.go index 29dc6ffb9c..5672042457 100644 --- a/pkg/config/manager.go +++ b/pkg/config/manager.go @@ -132,19 +132,15 @@ func (m *Manager) CASCachedValue(key string, origin string, value interface{}) b func (m *Manager) EvictCachedValue(key string) { m.cacheMutex.Lock() defer m.cacheMutex.Unlock() - delete(m.configCache, key) + // cause param'value may rely on other params, so we need to evict all the cached value when config is changed + clear(m.configCache) } func (m *Manager) EvictCacheValueByFormat(keys ...string) { m.cacheMutex.Lock() defer m.cacheMutex.Unlock() - - set := typeutil.NewSet(keys...) - for key := range m.configCache { - if set.Contain(formatKey(key)) { - delete(m.configCache, key) - } - } + // cause param'value may rely on other params, so we need to evict all the cached value when config is changed + clear(m.configCache) } func (m *Manager) GetConfig(key string) (string, error) { diff --git a/pkg/util/paramtable/component_param_test.go b/pkg/util/paramtable/component_param_test.go index 101ed92e14..cb5c463c24 100644 --- a/pkg/util/paramtable/component_param_test.go +++ b/pkg/util/paramtable/component_param_test.go @@ -648,4 +648,12 @@ func TestCachedParam(t *testing.T) { assert.Equal(t, 1*time.Hour, params.DataCoordCfg.GCInterval.GetAsDuration(time.Second)) assert.Equal(t, 1*time.Hour, params.DataCoordCfg.GCInterval.GetAsDuration(time.Second)) + + params.Save(params.QuotaConfig.DiskQuota.Key, "192") + assert.Equal(t, float64(192*1024*1024), params.QuotaConfig.DiskQuota.GetAsFloat()) + assert.Equal(t, float64(192*1024*1024), params.QuotaConfig.DiskQuotaPerCollection.GetAsFloat()) + params.Save(params.QuotaConfig.DiskQuota.Key, "256") + assert.Equal(t, float64(256*1024*1024), params.QuotaConfig.DiskQuota.GetAsFloat()) + assert.Equal(t, float64(256*1024*1024), params.QuotaConfig.DiskQuotaPerCollection.GetAsFloat()) + params.Save(params.QuotaConfig.DiskQuota.Key, "192") }