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 transport_ack_timeout #251

Merged
merged 2 commits into from
Dec 4, 2024
Merged

Conversation

derekbit
Copy link
Member

@derekbit derekbit commented Dec 1, 2024

Which issue(s) this PR fixes:

Issue longhorn/longhorn#9874

Signed-off-by: Derek Su [email protected]

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

Copy link

coderabbitai bot commented Dec 1, 2024

Walkthrough

The changes in this pull request involve modifying two constants related to timeout settings in the SPDK package. Specifically, the diskTransportAckTimeout in pkg/spdk/disk/nvme/nvme.go and the replicaTransportAckTimeout in pkg/spdk/types.go have both been updated from 14 seconds to 10 seconds. These adjustments are intended to affect the timeout behavior for disk transport acknowledgments and replica management, respectively. No other significant changes to logic or functionality are present in the affected files.

Changes

File Path Change Summary
pkg/spdk/disk/nvme/nvme.go Updated constant diskTransportAckTimeout from 14 to 10.
pkg/spdk/types.go Updated constant replicaTransportAckTimeout from 14 to 10.

Assessment against linked issues

Objective Addressed Explanation
Ensure v2 volume does not enter ERROR state after deleting a replica (#9874) The changes do not address the race condition described in the issue.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e9de501 and 2559c18.

⛔ Files ignored due to path filters (4)
  • go.mod is excluded by !go.mod
  • go.sum is excluded by !**/*.sum, !go.sum
  • vendor/github.com/longhorn/go-spdk-helper/pkg/types/types.go is excluded by !vendor/**
  • vendor/modules.txt is excluded by !vendor/**
📒 Files selected for processing (2)
  • pkg/spdk/disk/nvme/nvme.go (1 hunks)
  • pkg/spdk/types.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/spdk/types.go
  • pkg/spdk/disk/nvme/nvme.go

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
pkg/spdk/types.go (1)

52-52: LGTM! Timeout reduction aligns with documented strategy

The reduction of replicaTransportAckTimeout from 14s to 10s aligns perfectly with the documented timing strategy in the comments:

  1. NVMe-oF initiator ctrl-loss-tmo: 30s
  2. Replica controller loss timeout: 15s
  3. Fast I/O fail timeout: 10s
  4. Transport ACK timeout: 10s (new value)

This creates a clear timing hierarchy that should help prevent the race condition where the initiator incorrectly determines target failure.

The timing hierarchy ensures:

  1. Transport issues are detected within 10s
  2. I/O failures are triggered within 10s
  3. Base bdev removal occurs after 15s
  4. Controller loss is determined at 30s

This layered approach should provide better failure detection and recovery.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bfa1d21 and b2fb481.

⛔ Files ignored due to path filters (4)
  • go.mod is excluded by !go.mod
  • go.sum is excluded by !**/*.sum, !go.sum
  • vendor/github.com/longhorn/go-spdk-helper/pkg/types/types.go is excluded by !vendor/**
  • vendor/modules.txt is excluded by !vendor/**
📒 Files selected for processing (2)
  • pkg/spdk/disk/nvme/nvme.go (1 hunks)
  • pkg/spdk/types.go (1 hunks)
🔇 Additional comments (1)
pkg/spdk/disk/nvme/nvme.go (1)

23-23: LGTM! Verify timeout hierarchy alignment

The reduction of diskTransportAckTimeout from 14s to 10s aligns well with the timeout hierarchy:

  • diskCtrlrLossTimeoutSec: 30s (main timeout)
  • diskFastIOFailTimeoutSec: 15s (half of controller loss)
  • diskTransportAckTimeout: 10s (new value)

This change should help fail faster in case of connection issues, potentially preventing the race condition described in issue #9874.

Let's verify if this timeout is used consistently across the codebase:

Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 8.38%. Comparing base (46dd200) to head (2559c18).
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #251   +/-   ##
=====================================
  Coverage   8.38%   8.38%           
=====================================
  Files         21      21           
  Lines       7159    7159           
=====================================
  Hits         600     600           
  Misses      6478    6478           
  Partials      81      81           
Flag Coverage Δ
unittests 8.38% <ø> (ø)

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.

@derekbit
Copy link
Member Author

derekbit commented Dec 2, 2024

@DamiaSan This is ready for review. Thank you.

@DamiaSan
Copy link
Contributor

DamiaSan commented Dec 2, 2024

Just one question: shouldn't we modify also the constants defined in go-spdk-helper\pkg\nvme\nvmecli.go?

@derekbit
Copy link
Member Author

derekbit commented Dec 2, 2024

Just one question: shouldn't we modify also the constants defined in go-spdk-helper\pkg\nvme\nvmecli.go?

Which const?

@DamiaSan
Copy link
Contributor

DamiaSan commented Dec 2, 2024

Just one question: shouldn't we modify also the constants defined in go-spdk-helper\pkg\nvme\nvmecli.go?

Which const?

	defaultCtrlLossTmo    = 30
	defaultKeepAliveTmo   = 5
	defaultReconnectDelay = 2

These are used by the nvme cli initiator, shouldn't it be affected by the same issue?

@derekbit
Copy link
Member Author

derekbit commented Dec 2, 2024

These are used by the nvme cli initiator, shouldn't it be affected by the same issue?

No, the change of transport_ack_timeout is for the SPDK's transport layer and is nothing to do with the three parameters you mentioned.

Longhorn 9874

Signed-off-by: Derek Su <[email protected]>
Decreasing transport_ack_timeout value for imporving the error detection
of the transport layer.

Longhorn 9874

Signed-off-by: Derek Su <[email protected]>
@derekbit derekbit merged commit bbd88c0 into longhorn:main Dec 4, 2024
10 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