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

feat: decrease the reconnect delay of v2 volume nvme initiator #164

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

derekbit
Copy link
Member

Which issue(s) this PR fixes:

Issue longhorn/longhorn#9818

What this PR does / why we need it:

The current default value for --reconnect-delay is 10 seconds. We can reduce this value to 2 seconds.

  • Advantages: Faster IO resumption post-upgrade
  • Disadvantages: Increased frequency of retries

Special notes for your reviewer:

Additional documentation or context

The current default value for --reconnect-delay is 10 seconds.
We can reduce this value to 2 seconds.

- Advantages: Faster IO resumption post-upgrade
- Disadvantages: Increased frequency of retries

Longhorn 9818

Signed-off-by: Derek Su <[email protected]>
@derekbit derekbit self-assigned this Nov 15, 2024
Copy link

coderabbitai bot commented Nov 15, 2024

Walkthrough

The changes in this pull request involve modifying the defaultReconnectDelay constant in the pkg/nvme/nvmecli.go file from 10 seconds to 2 seconds. This adjustment affects the reconnect delay behavior within the connect function of the NVMe CLI. No new functions were introduced, and existing functionalities related to NVMe device management, including command execution and error handling, remain unchanged.

Changes

File Change Summary
pkg/nvme/nvmecli.go Updated defaultReconnectDelay constant from 10 to 2

Assessment against linked issues

Objective Addressed Explanation
Decrease the reconnect delay of v2 volume NVMe initiator (#9818)

Possibly related PRs

  • chore: update nvme-cli to v2.10.2 #159: The changes in this PR involve updating the nvme-cli tool, which is directly related to the functionality of the pkg/nvme/nvmecli.go file where the defaultReconnectDelay constant is modified, impacting the reconnect behavior of the NVMe CLI.

Suggested reviewers

  • DamiaSan
  • innobead

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a878ed0 and 9ef1e51.

📒 Files selected for processing (1)
  • pkg/nvme/nvmecli.go (1 hunks)
🔇 Additional comments (1)
pkg/nvme/nvmecli.go (1)

22-22: LGTM with considerations for monitoring

The reduction of defaultReconnectDelay from 10s to 2s aligns with the goal of faster IO resumption after upgrades. While this change will improve recovery speed, it may lead to increased retry frequency.

Consider:

  1. Adding monitoring/metrics for reconnection attempts to track the impact of this change
  2. Adding a comment explaining the rationale for the 2-second value to help future maintainers understand the trade-off decision

Let's verify if there are any other timeouts or delays that might need adjustment to work harmoniously with this change:

✅ Verification successful

Based on the verification results, I can now generate the final response:

Verified: Reconnect delay change is safe and isolated

The change to defaultReconnectDelay is used solely as a parameter for the NVMe connect command and works in conjunction with other timeout parameters (ctrl-loss-tmo and keep-alive-tmo). The reduced delay of 2 seconds is a reasonable value that doesn't conflict with other timing configurations.

  • The change is properly scoped to the NVMe connect command in pkg/nvme/nvmecli.go
  • No other components or timeouts in the codebase depend on this value
  • The value is passed directly to the NVMe CLI without any derived calculations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for related timeout/delay configurations
rg -n '(timeout|delay|tmo).*=.*[0-9]+' --type go

# Search for any existing monitoring of reconnection attempts
rg -n '(reconnect|retry).*metrics?' --type go

Length of output: 694


Script:

#!/bin/bash
# Let's search for the usage of defaultReconnectDelay and any related connection parameters
ast-grep --pattern 'defaultReconnectDelay'

# Search for nvme connect command usage and parameters
rg -n 'nvme.*connect.*-.*delay' --type go -A 3 -B 3

# Search for any retry or reconnect logic
rg -n 'func.*(connect|reconnect)' --type go -A 5

Length of output: 34845


Script:

#!/bin/bash
# Let's search for any other timeout or delay configurations in the NVMe related code
rg -n '(timeout|delay).*=.*[0-9]+' pkg/nvme/ -A 2 -B 2

# Search for any comments or documentation about reconnection behavior
rg -n 'reconnect' pkg/nvme/ --type go -A 2 -B 2

Length of output: 415


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.89%. Comparing base (a878ed0) to head (9ef1e51).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #164   +/-   ##
=======================================
  Coverage   22.89%   22.89%           
=======================================
  Files          34       34           
  Lines        4813     4813           
=======================================
  Hits         1102     1102           
  Misses       3537     3537           
  Partials      174      174           
Flag Coverage Δ
unittests 22.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@DamiaSan DamiaSan left a comment

Choose a reason for hiding this comment

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

It's ok for me, 2 is also the default value we have in go-spdk-helper for BdevNvmeAttachController.

@derekbit derekbit merged commit af0134e into longhorn:main Nov 15, 2024
8 of 9 checks passed
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.

2 participants