Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Fix CheramiCommitter to allow setting the final level at zero (#195)
Browse files Browse the repository at this point in the history
* Allow final level at zero in cheramiCommitter

* Update cherami-thrift to latest

* remove trailing space
  • Loading branch information
Guillaume Bailey authored and Kiran RG committed May 8, 2017
1 parent 49e4b82 commit 8dc96ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/outputhost/cheramiCommitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type cheramiCommitter struct {
commitLevel CommitterLevel
readLevel CommitterLevel
finalLevel CommitterLevel
finalSet bool
metaclient metadata.TChanMetadataService
isMultiZone bool
tClients common.ClientFactory
Expand All @@ -63,6 +64,7 @@ func (c *cheramiCommitter) SetReadLevel(l CommitterLevel) {

// SetFinalLevel just updates the last possible read level
func (c *cheramiCommitter) SetFinalLevel(l CommitterLevel) {
c.finalSet = true
c.finalLevel = l
}

Expand All @@ -83,7 +85,7 @@ func (c *cheramiCommitter) UnlockAndFlush(l sync.Locker) error {
ReadLevelSeqNo: common.Int64Ptr(int64(c.readLevel.seqNo)),
}

if c.finalLevel != CommitterLevel(CommitterLevel{}) { // If the final level has been set
if c.finalSet { // If the final level has been set
if c.finalLevel.address == c.readLevel.address && c.readLevel.address == c.commitLevel.address { // And final==read==commit
oReq.Status = common.CheramiConsumerGroupExtentStatusPtr(shared.ConsumerGroupExtentStatus_CONSUMED)
}
Expand Down

0 comments on commit 8dc96ea

Please sign in to comment.