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

Add error response for Ack func #775

Merged
merged 3 commits into from
May 23, 2022

Conversation

wolfstudy
Copy link
Member

@wolfstudy wolfstudy commented May 20, 2022

Motivation

There are mainly two problems fixed in this pr.

  1. The first one is to return some error information when the Go SDK handles Ack by itself to the user. Note: This is not the error information returned by the Broker side, but some errors that may occur in the Go SDK itself when processing the Ack command link. If we ignore these possible Errors here, then when the user calls Ack, because there is no return value, the user will think that the current Ack request has been successful, but in fact the Ack command may have failed when the Go SDK requested, resulting in this The Ack status of a message is lost and it becomes a hollow message. This will cause the backlog size on the broker side to continuously increase until the threshold of the backlog is triggered and the message sending fails.

For example a place where an error might occur:

func (pc *partitionConsumer) internalAck(req *ackRequest) {
        .....
	err := pc.client.rpcClient.RequestOnCnxNoWait(pc._getConn(), pb.BaseCommand_ACK, cmdAck)
	if err != nil {
		pc.log.Error("Connection was closed when request ack cmd")
		req.err = err
	}
}

In this case, the ack fails because the current connection is closed, but the user cannot capture this error message and think that the ack has succeeded, so an ack hole will occur.

Modifications

  • Add error response for Ack func.

Signed-off-by: xiaolongran <xiaolongran@tencent.com>
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@wolfstudy wolfstudy added this to the v0.9.0 milestone May 20, 2022
@wolfstudy wolfstudy self-assigned this May 20, 2022
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@wolfstudy wolfstudy merged commit 5108332 into apache:master May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants