Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pullThresholdSizeForTopic invalid #814

Merged
merged 3 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,27 +658,28 @@ func (dc *defaultConsumer) updateProcessQueueTable(topic string, mqs []*primitiv
dc.processQueueTable.Range(func(key, value interface{}) bool {
mq := key.(primitive.MessageQueue)
pq := value.(*processQueue)
if mq.Topic == topic {
if !mqSet[mq] {
pq.WithDropped(true)
if dc.removeUnnecessaryMessageQueue(&mq, pq) {
dc.processQueueTable.Delete(key)
changed = true
rlog.Debug("remove unnecessary mq when updateProcessQueueTable", map[string]interface{}{
rlog.LogKeyConsumerGroup: dc.consumerGroup,
rlog.LogKeyMessageQueue: mq.String(),
})
}
} else if pq.isPullExpired() && dc.cType == _PushConsume {
pq.WithDropped(true)
if dc.removeUnnecessaryMessageQueue(&mq, pq) {
dc.processQueueTable.Delete(key)
changed = true
rlog.Debug("remove unnecessary mq because pull was paused, prepare to fix it", map[string]interface{}{
rlog.LogKeyConsumerGroup: dc.consumerGroup,
rlog.LogKeyMessageQueue: mq.String(),
})
}
if mq.Topic != topic {
ShannonDing marked this conversation as resolved.
Show resolved Hide resolved
return false
}
if !mqSet[mq] {
pq.WithDropped(true)
if dc.removeUnnecessaryMessageQueue(&mq, pq) {
dc.processQueueTable.Delete(key)
changed = true
rlog.Debug("remove unnecessary mq when updateProcessQueueTable", map[string]interface{}{
rlog.LogKeyConsumerGroup: dc.consumerGroup,
rlog.LogKeyMessageQueue: mq.String(),
})
}
} else if pq.isPullExpired() && dc.cType == _PushConsume {
pq.WithDropped(true)
if dc.removeUnnecessaryMessageQueue(&mq, pq) {
dc.processQueueTable.Delete(key)
changed = true
rlog.Debug("remove unnecessary mq because pull was paused, prepare to fix it", map[string]interface{}{
rlog.LogKeyConsumerGroup: dc.consumerGroup,
rlog.LogKeyMessageQueue: mq.String(),
})
}
}
return true
Expand Down
1 change: 1 addition & 0 deletions consumer/push_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ func (pc *pushConsumer) messageQueueChanged(topic string, mqAll, mqDivided []*pr
rlog.LogKeyValueChangedFrom: pc.option.PullThresholdSizeForTopic,
rlog.LogKeyValueChangedTo: newVal,
})
pc.option.PullThresholdSizeForTopic = newVal
}
}
pc.client.SendHeartbeatToAllBrokerWithLock()
Expand Down