Skip to content

KAFKA-3641: Fix RecordMetadata constructor backward compatibility#1292

Closed
granthenke wants to merge 1 commit into
apache:trunkfrom
granthenke:recordmeta-compat
Closed

KAFKA-3641: Fix RecordMetadata constructor backward compatibility#1292
granthenke wants to merge 1 commit into
apache:trunkfrom
granthenke:recordmeta-compat

Conversation

@granthenke
Copy link
Copy Markdown
Member

No description provided.

@granthenke
Copy link
Copy Markdown
Member Author

cc @gwenshap


@Deprecated
public RecordMetadata(TopicPartition topicPartition, long baseOffset, long relativeOffset) {
this(topicPartition, baseOffset, relativeOffset, Record.NO_TIMESTAMP, -1, -1, -1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Any chance of adding record.NO_CHECKSUM and record.NO_SIZE?

We have several places in the code where we call the constructor with -1 and I think this will improve readability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add them if you like. Since they would only be used in the case of a deprecated method (or tests that don't care) I didn't add them thinking the would just be removed when the constructor is removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually fix compatibility? I don't think we used relative offsets before, so even though it will compile, it won't behave correctly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ijuma The behavior here matches that of 0.9 branch: https://github.com/apache/kafka/blob/0.9.0/clients/src/main/java/org/apache/kafka/clients/producer/RecordMetadata.java#L35

I am not sure how or why people would be using this constructor, perhaps in unit tests or something, but I would prefer to keep it compatible and follow a deprecation cycle since its public.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should keep it, I was just unsure if semantics had been maintained. Seems like it's fine. Thanks for the references.

@granthenke granthenke closed this Apr 29, 2016
@granthenke granthenke reopened this Apr 29, 2016
@gwenshap
Copy link
Copy Markdown
Contributor

LGTM.

@asfgit asfgit closed this in 096b8b8 Apr 29, 2016
gfodor pushed a commit to AltspaceVR/kafka that referenced this pull request Jun 3, 2016
Author: Grant Henke <granthenke@gmail.com>

Reviewers: Gwen Shapira, Ismael Juma

Closes apache#1292 from granthenke/recordmeta-compat
mumrah pushed a commit to mumrah/kafka that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants