Skip to content

INT-3087:Fix MongoDbMessageStore removeMessage bug - #831

Closed
jodiestjohn wants to merge 1 commit into
spring-projects:masterfrom
jodiestjohn:INT-3087
Closed

jodiestjohn wants to merge 1 commit into
spring-projects:masterfrom
jodiestjohn:INT-3087

Conversation

@jodiestjohn

Copy link
Copy Markdown

Added new query so the same message found in pollMessageFromGroup is the
one which gets deleted.

See jira for more details: https://jira.springsource.org/browse/INT-3087

Cherry-pick for 2.2.x

Added new query so the same message found in pollMessageFromGroup is the
one which gets deleted.

See jira for more details: https://jira.springsource.org/browse/INT-3087

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.

Jodie, thanks for your contribution.

Is there some reason you feel this should be public? We probably don't want it called from outside of removeMessgeFromGroup(), in which case it should be private. There might be an argument to make it protected final but I don't think we even want subclasses to call it discretely.

@artembilan

Copy link
Copy Markdown
Member

Hi, Jodie! I don't know, if you signed the CLA: https://support.springsource.com/spring_committer_signup, but it's good that community wants to contribute, thanks.
Nevertheless, it whould be greate, if you try to follow with canonical Contributor guidelines from Spring: https://github.com/SpringSource/spring-framework/blob/master/CONTRIBUTING.md.
My general concern here, you don't have tests on the matter.

@artembilan

Copy link
Copy Markdown
Member

As we know MongoDB doesn't support transactions, so we should make DB operations as less as possible.
I think in the MongoDbMessageStore we may move away its high-level API and try to use Mongo 'atomic operations' where it is possible.
So, IMO pollMessageFromGroup has to use MongoTemplate.findAndRemove without call of removeMessageFromGroup. There is still another out of atomic scope operation - updateGroup, but it updates just _group_update_timestamp property: it won't produce a lot of issues within multy-threaded polling.

I'm now working under MongoDbMessageStore improvement (https://jira.springsource.org/browse/INT-3070): artembilan@eff5eb2
But I didn't think, that it may be possible to place the same Message in different groups. Thank you that you pointed it out!
Even if your commit may be changed within my Mongo JIRAs it's very valuable to have any feedbacks from community.

@jodiestjohn

Copy link
Copy Markdown
Author

Hi Gary & Artem,

To answer some of your questions. Yes, that method should be private. Yes I signed the CLA. yes, I should have unit tests. I didn't read the main spring Contributing doc. I only read the spring-intergation Contributing doc and tried to follow everything in there.

Should I just close this pull request if you guys will be addressing this issue elsewhere? It's not a big deal to me if my particular commits don't get accepted as long as the issue gets fixed. For now my team is just going to run off a fork I made of 2.2.4 with my changes until a more permanent fix is put in place.

Please let me know if you want me to continue updating this pull request with the changes you asked for.

Thanks for the feedback.

@artembilan

Copy link
Copy Markdown
Member

Hi, Jodie!
Sorry for delay.
I take responsibility for this issue 😄
So,

  • rework, please, removeMessageFromGroup to use MongoTemplate.findAndRemove
  • add unit test to the MongoDbMessageGroupStoreTests on the matter - if we had had it before, we haven't got this issue at all...
  • Squash commits and actualize the commit message

And that's all. Thank you very much for your contribution

@garyrussell

Copy link
Copy Markdown
Contributor

Artem, I added the changes you suggested here garyrussell@43b23dc

Please review; thanks.

@artembilan

Copy link
Copy Markdown
Member

Hi, Gary!

garyrussell/spring-integration@43b23dc

LGTM, but I think there is no reason to have private Message<?> removeMessage(UUID id, Object groupId)...

@garyrussell

Copy link
Copy Markdown
Contributor

Hi Artem; I don't understand - sure, the change to pollMessageFromGroup() no longer needs that fix, but direct calls to removeMessageFromGroup() would.

What am I missing?

@artembilan

Copy link
Copy Markdown
Member

Sorry, Gary, for delay: Internet issues 😄

but direct calls to removeMessageFromGroup() would.

Right. But it is only one place where this new Jodie's method is used. I mean: make its logic within removeMessageFromGroup() and that's all.

@garyrussell

Copy link
Copy Markdown
Contributor

ok; thanks; will merge today

@garyrussell

Copy link
Copy Markdown
Contributor

Merged with polish

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