-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 deleteRecord #1425
fix deleteRecord #1425
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,28 @@ func (err ConfigurationError) Error() string { | |
// See https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ErrorCodes | ||
type KError int16 | ||
|
||
// MultiError is used to contain multi error. | ||
type MultiError struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason to add this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently the delete record request is sent to leader by leader. Thus we may receive multi error response and probably the errors are not the same. I use MultiError to contain the array of error. |
||
Errors *[]error | ||
} | ||
|
||
func (mErr MultiError) Error() string { | ||
var errString = "" | ||
for _, err := range *mErr.Errors { | ||
errString += err.Error() + "," | ||
} | ||
return errString | ||
} | ||
|
||
// ErrDeleteRecords is the type of error returned when fail to delete the required records | ||
type ErrDeleteRecords struct { | ||
MultiError | ||
} | ||
|
||
func (err ErrDeleteRecords) Error() string { | ||
return "kafka server: failed to delete records " + err.MultiError.Error() | ||
} | ||
|
||
// Numeric error codes returned by the Kafka server. | ||
const ( | ||
ErrNoError KError = 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting looks strange, can you please run gofmt again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gofmt again but nothing changed. Can you please tell me what's the format problem. I'll fix it manually.