Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
update logsize
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Jan 24, 2019
1 parent 08a1a35 commit ec2860b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions monitor/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,14 @@ func (client *KafkaClient) offsetFetchImport() {
pmanager, _ := manager.ManagePartition(topic, parition)
offset, _ := pmanager.NextOffset()

msg.partitionMap[parition] = LogOffset{
logOffset := LogOffset{
Logsize: client.topicOffset[topic][parition],
Offset: offset,
}
if logOffset.Logsize < logOffset.Offset && logOffset.Logsize != 0 {
logOffset.Offset = logOffset.Logsize
}
msg.partitionMap[parition] = logOffset
}
if len(msg.partitionMap) > 0 {
client.importer.saveMsg(msg)
Expand All @@ -264,9 +268,7 @@ func (client *KafkaClient) MergeMaps(topicOffsetMap map[string]map[int32]int64)
client.topicOffset[topic] = topicOffset
} else {
for partition, offset := range topicOffset {
if _, ok2 := client.topicOffset[topic][partition]; !ok2 {
client.topicOffset[topic][partition] = offset
}
client.topicOffset[topic][partition] = offset
}
}
}
Expand Down

0 comments on commit ec2860b

Please sign in to comment.