mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: the system rejects all queries and never recovers if enabled read rate limit (#30061)
fix #30060 Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
parent
91aa81b4d7
commit
0d4e781f69
@ -25,7 +25,7 @@ type counter struct {
|
||||
values map[string]int64
|
||||
}
|
||||
|
||||
func (c *counter) Inc(label string, value int64) {
|
||||
func (c *counter) Add(label string, value int64) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
@ -38,17 +38,12 @@ func (c *counter) Inc(label string, value int64) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *counter) Dec(label string, value int64) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
func (c *counter) Inc(label string) {
|
||||
c.Add(label, 1)
|
||||
}
|
||||
|
||||
v, ok := c.values[label]
|
||||
if !ok {
|
||||
c.values[label] = -value
|
||||
} else {
|
||||
v -= value
|
||||
c.values[label] = v
|
||||
}
|
||||
func (c *counter) Dec(label string) {
|
||||
c.Add(label, -1)
|
||||
}
|
||||
|
||||
func (c *counter) Set(label string, value int64) {
|
||||
|
@ -39,7 +39,7 @@ func (suite *CounterTestSuite) TestBasic() {
|
||||
suite.Equal(int64(0), value)
|
||||
|
||||
// get after inc
|
||||
suite.counter.Inc(suite.label, 3)
|
||||
suite.counter.Add(suite.label, 3)
|
||||
value = suite.counter.Get(suite.label)
|
||||
suite.Equal(int64(3), value)
|
||||
|
||||
@ -49,7 +49,7 @@ func (suite *CounterTestSuite) TestBasic() {
|
||||
suite.Equal(int64(0), value)
|
||||
|
||||
// get after dec
|
||||
suite.counter.Dec(suite.label, 3)
|
||||
suite.counter.Add(suite.label, -3)
|
||||
value = suite.counter.Get(suite.label)
|
||||
suite.Equal(int64(-3), value)
|
||||
|
||||
|
@ -232,13 +232,13 @@ func (s *scheduler) exec() {
|
||||
s.getPool(t).Submit(func() (any, error) {
|
||||
// Update concurrency metric and notify task done.
|
||||
metrics.QueryNodeReadTaskConcurrency.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Inc()
|
||||
collector.Counter.Inc(metricsinfo.ExecuteQueueType, 1)
|
||||
collector.Counter.Inc(metricsinfo.ExecuteQueueType)
|
||||
|
||||
err := t.Execute()
|
||||
|
||||
// Update all metric after task finished.
|
||||
metrics.QueryNodeReadTaskConcurrency.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Dec()
|
||||
collector.Counter.Dec(metricsinfo.ExecuteQueueType, -1)
|
||||
collector.Counter.Dec(metricsinfo.ExecuteQueueType)
|
||||
|
||||
// Notify task done.
|
||||
t.Done(err)
|
||||
|
Loading…
Reference in New Issue
Block a user