Skip to content

STORM-2607: Storm-kafka-client never commits the last message on a partition.#2367

Merged
asfgit merged 2 commits into
apache:masterfrom
srdo:STORM-2607-fixup
Oct 14, 2017
Merged

STORM-2607: Storm-kafka-client never commits the last message on a partition.#2367
asfgit merged 2 commits into
apache:masterfrom
srdo:STORM-2607-fixup

Conversation

@srdo

@srdo srdo commented Oct 10, 2017

Copy link
Copy Markdown
Contributor

This finishes up #2181, which has been blocked on a rebase for a while. It was suggested on the mailing list that we finish this up quickly since the fix should ideally go in 1.1.2.

I've squashed the commits as much as possible without mixing up which changes were made by @tiodollar and which were made by me. Let me know if squashing is not okay in this case, and I'll rebase on the commits in the original PR.

if the topic is compacted or deleted), the consumer should jump to
the next logical point in the topic. Next logical offset should be the
first element after committedOffset in the ascending ordered emitted set.
first element after nextEarliestUncommittedOffset in the ascending ordered emitted set.

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.

The field nextEarliestUncommittedOffset looks removed in the patch and this comment refers it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, fixed.

@srdo
srdo force-pushed the STORM-2607-fixup branch from 83de52b to 1d728a4 Compare October 11, 2017 05:20
@HeartSaVioR

Copy link
Copy Markdown
Contributor

+1
Would this be a clean merge to 1.x version lines?

this.committedOffset = initialFetchOffset - 1;
LOG.debug("Instantiated {}", this);
this.committedOffset = initialFetchOffset;
LOG.debug("Instantiated {}", this.toString());

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.

toString() is redundant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but I get a warning about leaking this from the constructor, which this fixes.

@hmcl hmcl Oct 11, 2017

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.

This is not a big deal, but can you tell me what kinda warning you are talking about? I never heard of such a thing. When you concatenate a string with an object reference, the toString() method of that object reference is called. I am not sure why both approaches are any different.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The warning I get is just "leaking this in constructor", Netbeans has the following description: "Using this as parameter can be dangerous in the contructor because the object is not fully initialized.". IntelliJ and Eclipse have similar warnings I believe.

It's basically saying not to use this as a parameter from the constructor, because the called method may use fields that aren't initialized. I agree that leaking this from the constructor is not dangerous here, because sfl4j just calls toString, but I'd still like to get rid of the warning. The reason this is flagged is because this is used as a parameter to LOG.debug, and not as part of a string concatenation. The IDE can't tell whether this is used unsafely in LOG.debug, so it's flagged as a warning.

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 for the explanation. I just noticed that this is called within its own constructor, and therefore makes sense. However, IntelliJ does not give me this warning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not enabled by default in IntelliJ. If you go to settings -> editor -> inspections and search for "this", there's one called "'this' reference escaped in object construction"

@srdo

srdo commented Oct 11, 2017

Copy link
Copy Markdown
Contributor Author

@HeartSaVioR No, it doesn't look like it. I'll put up a 1.x and 1.1.x version.

@hmcl

hmcl commented Oct 11, 2017

Copy link
Copy Markdown
Contributor

@srdo I understand that you want to keep the commit history for @tiodollar but I don't think we should have 4 commits for such a simple change. This patch should be one commit only, either yours or @tiodollar 's . Can either you or @tiodollar please squash the commits. Thanks.

@srdo

srdo commented Oct 11, 2017

Copy link
Copy Markdown
Contributor Author

@hmcl I agree that this many commits is not ideal. The issue is with being able to track who contributed what code. If I squash we can't tell which parts of this PR was contributed by me, and which were contributed by @tiodollar. It's my impression that we need to keep the history of who contributed what intact.

@hmcl

hmcl commented Oct 11, 2017

Copy link
Copy Markdown
Contributor

@srdo in my opinion the most important thing is to keep the project, and in particular the git log clean. I often have to cherry-pick changes from Apache branch into my own branch, and multiple commits for a JIRA turn branch maintenance nightmare. Several Apache projects have a strict rule of one JIRA one Git commit, which I believe is very beneficial.

If you feel really strongly about differentiating yours and his contributions, this patch must have at most two commits. One has all his contributions, and another yours. You can squash the commits and put @tiodollar as author as described in here.

@srdo
srdo force-pushed the STORM-2607-fixup branch from 1d728a4 to 85d464a Compare October 11, 2017 17:07
@srdo

srdo commented Oct 11, 2017

Copy link
Copy Markdown
Contributor Author

@hmcl It's not that I feel strongly about keeping the contributions separate, but I think it's a rule for Apache projects that it must be possible to tell who contributed what, even historically. I can't recall where it says so though.

Squashed to two commits.

LOG.debug("Committed [{}] offsets in the range [{}-{}] for topic-partition [{}].",
numCommittedOffsets, preCommitCommittedOffsets + 1, this.committedOffset, tp);
LOG.debug("Committed [{}] offsets in the range [{}-{}] for topic-partition [{}]."
+ " Processing will resume at [{}] if the spout restarts.",

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.

at offset [{}] in case of a spout restart.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will fix

@srdo srdo mentioned this pull request Oct 11, 2017
… instead of last committed offset for compatibility with commitSync consumer API
@srdo
srdo force-pushed the STORM-2607-fixup branch from 85d464a to d7bdc2d Compare October 11, 2017 17:27
@hmcl

hmcl commented Oct 11, 2017

Copy link
Copy Markdown
Contributor

@srdo are you on Gitter or some sort of chat room where I could ask you a few questions? Thanks.

@srdo

srdo commented Oct 11, 2017

Copy link
Copy Markdown
Contributor Author

@hmcl Just signed in on Gitter, feel free to message me.

@srdo

srdo commented Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

I'll merge this weekend if I no one brings up more concerns.

@HeartSaVioR

Copy link
Copy Markdown
Contributor

I read a mail at dev@ from @hmcl and the talk was not relevant to this patch. +1 again.

@srdo

srdo commented Oct 14, 2017

Copy link
Copy Markdown
Contributor Author

Merged, thanks for the reviews guys.

@asfgit
asfgit merged commit d7bdc2d into apache:master Oct 14, 2017
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.

4 participants