mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
Fix check time tick lag with no channel (#21737)
Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
parent
bba4db9668
commit
6e66c10114
@ -417,7 +417,7 @@ func (q *QuotaCenter) getTimeTickDelayFactor(ts Timestamp) float64 {
|
|||||||
|
|
||||||
t1, _ := tsoutil.ParseTS(ts)
|
t1, _ := tsoutil.ParseTS(ts)
|
||||||
for nodeID, metric := range q.queryNodeMetrics {
|
for nodeID, metric := range q.queryNodeMetrics {
|
||||||
if metric.Fgm.NumFlowGraph > 0 {
|
if metric.Fgm.NumFlowGraph > 0 && metric.Fgm.MinFlowGraphChannel != "" {
|
||||||
t2, _ := tsoutil.ParseTS(metric.Fgm.MinFlowGraphTt)
|
t2, _ := tsoutil.ParseTS(metric.Fgm.MinFlowGraphTt)
|
||||||
delay := t1.Sub(t2)
|
delay := t1.Sub(t2)
|
||||||
if delay.Nanoseconds() > curMaxDelay.Nanoseconds() {
|
if delay.Nanoseconds() > curMaxDelay.Nanoseconds() {
|
||||||
@ -430,7 +430,7 @@ func (q *QuotaCenter) getTimeTickDelayFactor(ts Timestamp) float64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for nodeID, metric := range q.dataNodeMetrics {
|
for nodeID, metric := range q.dataNodeMetrics {
|
||||||
if metric.Fgm.NumFlowGraph > 0 {
|
if metric.Fgm.NumFlowGraph > 0 && metric.Fgm.MinFlowGraphChannel != "" {
|
||||||
t2, _ := tsoutil.ParseTS(metric.Fgm.MinFlowGraphTt)
|
t2, _ := tsoutil.ParseTS(metric.Fgm.MinFlowGraphTt)
|
||||||
delay := t1.Sub(t2)
|
delay := t1.Sub(t2)
|
||||||
if delay.Nanoseconds() > curMaxDelay.Nanoseconds() {
|
if delay.Nanoseconds() > curMaxDelay.Nanoseconds() {
|
||||||
|
|||||||
@ -157,8 +157,9 @@ func TestQuotaCenter(t *testing.T) {
|
|||||||
quotaCenter.tsoAllocator = alloc
|
quotaCenter.tsoAllocator = alloc
|
||||||
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{
|
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{
|
||||||
1: {Fgm: metricsinfo.FlowGraphMetric{
|
1: {Fgm: metricsinfo.FlowGraphMetric{
|
||||||
MinFlowGraphTt: tsoutil.ComposeTSByTime(now, 0),
|
MinFlowGraphTt: tsoutil.ComposeTSByTime(now, 0),
|
||||||
NumFlowGraph: 1,
|
NumFlowGraph: 1,
|
||||||
|
MinFlowGraphChannel: "dml",
|
||||||
}}}
|
}}}
|
||||||
ts, err := quotaCenter.tsoAllocator.GenerateTSO(1)
|
ts, err := quotaCenter.tsoAllocator.GenerateTSO(1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -174,8 +175,9 @@ func TestQuotaCenter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{
|
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{
|
||||||
1: {Fgm: metricsinfo.FlowGraphMetric{
|
1: {Fgm: metricsinfo.FlowGraphMetric{
|
||||||
MinFlowGraphTt: tsoutil.ComposeTSByTime(now, 0),
|
MinFlowGraphTt: tsoutil.ComposeTSByTime(now, 0),
|
||||||
NumFlowGraph: 1,
|
NumFlowGraph: 1,
|
||||||
|
MinFlowGraphChannel: "dml",
|
||||||
}}}
|
}}}
|
||||||
ts, err = quotaCenter.tsoAllocator.GenerateTSO(1)
|
ts, err = quotaCenter.tsoAllocator.GenerateTSO(1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -210,7 +212,15 @@ func TestQuotaCenter(t *testing.T) {
|
|||||||
for i, c := range ttCases {
|
for i, c := range ttCases {
|
||||||
paramtable.Get().Save(Params.QuotaConfig.MaxTimeTickDelay.Key, fmt.Sprintf("%f", c.maxTtDelay.Seconds()))
|
paramtable.Get().Save(Params.QuotaConfig.MaxTimeTickDelay.Key, fmt.Sprintf("%f", c.maxTtDelay.Seconds()))
|
||||||
fgTs := tsoutil.ComposeTSByTime(c.fgTt, 0)
|
fgTs := tsoutil.ComposeTSByTime(c.fgTt, 0)
|
||||||
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{1: {Fgm: metricsinfo.FlowGraphMetric{NumFlowGraph: 1, MinFlowGraphTt: fgTs}}}
|
quotaCenter.queryNodeMetrics = map[UniqueID]*metricsinfo.QueryNodeQuotaMetrics{
|
||||||
|
1: {
|
||||||
|
Fgm: metricsinfo.FlowGraphMetric{
|
||||||
|
NumFlowGraph: 1,
|
||||||
|
MinFlowGraphTt: fgTs,
|
||||||
|
MinFlowGraphChannel: "dml",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
curTs := tsoutil.ComposeTSByTime(c.curTt, 0)
|
curTs := tsoutil.ComposeTSByTime(c.curTt, 0)
|
||||||
factor := quotaCenter.getTimeTickDelayFactor(curTs)
|
factor := quotaCenter.getTimeTickDelayFactor(curTs)
|
||||||
if math.Abs(factor-c.expectedFactor) > 0.000001 {
|
if math.Abs(factor-c.expectedFactor) > 0.000001 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user