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

Improve retry for scalardb test #131

Merged
merged 4 commits into from
Oct 29, 2024
Merged

Conversation

komamitsu
Copy link
Contributor

@komamitsu komamitsu commented Oct 25, 2024

Description

Recently, scalardb.transfer$read_all_with_retry often failed when there are many records to be lazy-recovered more than the max retry (8). To mitigate the failure, this PR increases the max retry. But just increasing it causes too long wait duration. For instance, increasing the max retry up to 10 will result in 1024 seconds wait. So, this PR also introduces an upper limit of wait duration (32 seconds) since too long retry duration doesn't make sense basically.

With the current retry logic and the max retry, the total wait duration until timeout is 510 seconds.

irb(main):006:0> 8.times.inject(0) {|acc, x| acc + 1000 * (2 ** (x + 1))}                                                                                                                                       
=> 510000

So, this PR increases the max retry to 20 so that total wait duration (542 seconds) is similar to the original one

irb(main):017:0> 20.times.inject(0) {|acc, x| acc + [1000 * (2 ** (x + 1)), 32000].min}                                                                                                                         
=> 542000

(Actually if the max retry is 19, the total wait duration is 510 seconds as same as the original one. But 19 seems a bit weird to me, and I set it to 20. But I don't have a strong opinion on it.)

Related issues and/or PRs

#97

Changes made

  • Introduced an upper limit for the retry in scalardb test
  • Increased the max retry up to 20
  • Updated the unit test

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

None

Copy link
Member

@yito88 yito88 left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!
I left a trivial comment.

Comment on lines 153 to 154
(is (spy/called-n-times? scalar/exponential-backoff 20))
(is (spy/called-n-times? scalar/prepare-storage-service! 7)))))
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the constants like other parts?

Copy link
Contributor

@inv-jishnu inv-jishnu left a comment

Choose a reason for hiding this comment

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

LGTM!
Thank you.

Copy link
Contributor

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@komamitsu komamitsu merged commit 8b2757d into master Oct 29, 2024
3 checks passed
@komamitsu komamitsu deleted the improve-retry-for-scalardb-test branch October 29, 2024 02:22
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