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

fix the issue that release messages might be missed in certain scenarios #3819

Merged
merged 1 commit into from Jul 22, 2021

Conversation

nobodyiam
Copy link
Member

What's the purpose of this PR

fix the issue that release messages might be missed in certain scenarios

Which issue(s) this PR fixes:

Fixes #3806

Brief changelog

  1. record the missing release messages when scanning
  2. try to reload and notify the missing release messages for certain amount of times

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2021

Codecov Report

Merging #3819 (970a608) into master (9bd4703) will increase coverage by 0.09%.
The diff coverage is 90.62%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3819      +/-   ##
============================================
+ Coverage     50.07%   50.16%   +0.09%     
- Complexity     2457     2466       +9     
============================================
  Files           483      483              
  Lines         14891    14922      +31     
  Branches       1515     1520       +5     
============================================
+ Hits           7456     7486      +30     
  Misses         6908     6908              
- Partials        527      528       +1     
Impacted Files Coverage Δ
...work/apollo/biz/message/ReleaseMessageScanner.java 82.89% <90.62%> (+9.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bd4703...970a608. Read the comment docs.

zouyx
zouyx previously approved these changes Jul 19, 2021
Comment on lines +154 to +161
for (ReleaseMessage message : messages) {
long currentId = message.getId();
if (currentId - startId > 1) {
for (long i = startId + 1; i < currentId; i++) {
missingReleaseMessages.putIfAbsent(i, 1);
}
}
startId = currentId;
Copy link
Contributor

Choose a reason for hiding this comment

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

If startId = 2,
a sequence of currentIds in List<ReleaseMessage> messages are [5, 4, 3]

then the for loop will be resolve to

      if (5 - 2 > 1) {
        for (long i = 2 + 1; i < 5; i++) {
          missingReleaseMessages.putIfAbsent(i, 1);
        }
      }

i.e 3 and 4 will put to the missingReleaseMessages though they are in parameter List<ReleaseMessage> messages.

Is this acceptable here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@nobodyiam nobodyiam merged commit f9c69db into apolloconfig:master Jul 22, 2021
@nobodyiam nobodyiam deleted the fix-3806 branch July 22, 2021 00:09
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2021
@nobodyiam nobodyiam added this to the 1.9.0 milestone Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MessageScanner扫描偶尔跳过个别messageId导致配置发布不生效的问题
4 participants