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: decrease ctrlr_loss_timeout_sec for base bdev #170

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

derekbit
Copy link
Member

Which issue(s) this PR fixes:

Issue longhorn/longhorn#9874

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

@derekbit derekbit self-assigned this Nov 28, 2024
Copy link

coderabbitai bot commented Nov 28, 2024

Walkthrough

The changes modify several constants in the pkg/types/types.go file related to timeout configurations. Specifically, DefaultCtrlrLossTimeoutSec has been changed from 30 to 15 seconds, while DefaultFastIOFailTimeoutSec has been reduced from 15 to 10 seconds. The comment associated with DefaultReconnectDelaySec has been updated to clarify that it cannot exceed DefaultFastIOFailTimeoutSec. Additionally, the .gitignore file has been updated to include go-spdk-helper and to reorganize the position of the *.ipr entry.

Changes

File Change Summary
pkg/types/types.go Updated DefaultCtrlrLossTimeoutSec from 30 to 15 seconds; updated DefaultFastIOFailTimeoutSec from 15 to 10 seconds; updated comment for DefaultReconnectDelaySec.
.gitignore Added entry go-spdk-helper and moved *.ipr entry within the file.

Assessment against linked issues

Objective Addressed Explanation
The v2 volume shouldn't enter ERROR state after deleting a replica (#9874)

Possibly related PRs

Suggested reviewers

  • innobead
  • c3y1huang
  • DamiaSan

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7c2d5ea and 94b3330.

📒 Files selected for processing (2)
  • .gitignore (2 hunks)
  • pkg/types/types.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .gitignore
  • pkg/types/types.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: 3

🧹 Outside diff range and nitpick comments (2)
app/cmd/basic/bdev_nvme.go (2)

Line range hint 150-170: Misleading CLI interface

The command still accepts ctrlr-loss-timeout-sec, reconnect-delay-sec, and fast-io-fail-timeout-sec flags, but these values are not used in the BdevNvmeSetOptions call. This creates a confusing interface where users might think they're configuring these timeouts when they're actually not.

Consider either:

  1. Restoring the timeout parameters in the BdevNvmeSetOptions call, or
  2. Removing these unused flags from the CLI interface

If option 1 is chosen, modify line 239 to:

-    result, err := spdkCli.BdevNvmeSetOptions(int32(c.Int("transport-ack-timeout")), int32(c.Int("keep_alive_timeout_ms")))
+    result, err := spdkCli.BdevNvmeSetOptions(
+        int32(c.Int("transport-ack-timeout")),
+        int32(c.Int("keep_alive_timeout_ms")),
+        int32(c.Int("ctrlr-loss-timeout-sec")),
+        int32(c.Int("reconnect-delay-sec")),
+        int32(c.Int("fast-io-fail-timeout-sec")),
+    )

239-239: Summary: Implementation needs revision

The current changes deviate significantly from the PR's objective of decreasing the ctrlr_loss_timeout_sec value. Instead of removing the timeout parameters completely, consider:

  1. Keeping the parameters but adjusting the default value of ctrlr_loss_timeout_sec
  2. Documenting the rationale for any removed parameters
  3. Ensuring CLI flags accurately reflect the available options
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c396ae7 and a0fbefe.

📒 Files selected for processing (3)
  • app/cmd/basic/bdev_nvme.go (1 hunks)
  • pkg/spdk/client/basic.go (1 hunks)
  • pkg/types/types.go (1 hunks)
🔇 Additional comments (2)
app/cmd/basic/bdev_nvme.go (1)

Line range hint 239-244: Document the new default values

Since the timeout parameters are no longer configurable through this interface, please document:

  1. What are the new default values?
  2. Where are these defaults set?
  3. How do these changes affect error handling and recovery?

Let's check where these defaults might be defined:

✅ Verification successful

Based on the gathered information, I can now provide a final response about the timeout parameters:

Default timeout values are defined in the codebase

The default values are defined in pkg/types/types.go:

  • DefaultCtrlrLossTimeoutSec = 30 (controller loss timeout in seconds)
  • DefaultTransportAckTimeout is 14 (which results in 2^14 = 16384 msec = 16.384 sec)

The timeouts are set in the SPDK client (pkg/spdk/client/basic.go) and have the following characteristics:

  • transportAckTimeout: Time to wait for acknowledgment until retransmission for RDMA or connection close for TCP (Range 0-31 where 0 means use default)
  • keepAliveTimeoutMs: Keep alive timeout in milliseconds

These parameters can only be set before SPDK subsystems are initialized or any bdev NVMe has been created.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for default timeout definitions
rg "DefaultCtrlrLossTimeout|default.*timeout" -g '*.go'

# Look for related configuration files
fd -e yaml -e json -x grep -l "timeout"

Length of output: 558


Script:

#!/bin/bash
# Let's check the full context of the default timeout definitions
cat pkg/types/types.go | grep -A 10 -B 10 "DefaultCtrlr"

# Let's also check the implementation of BdevNvmeSetOptions
ast-grep --pattern 'func BdevNvmeSetOptions($$$) {
  $$$
}'

Length of output: 877


Script:

#!/bin/bash
# Let's check the implementation details in the SPDK client
rg "BdevNvmeSetOptions" -A 10

# Let's also look for any documentation about these timeouts
fd README -x cat {}

Length of output: 53663

pkg/spdk/client/basic.go (1)

776-779: Verify the impact of removing timeout parameters.

The removal of ctrlrLossTimeoutSec, reconnectDelaySec, and fastIOFailTimeoutSec parameters from BdevNvmeSetOptions could affect I/O error resiliency. While this change aligns with fixing the race condition mentioned in issue #9874, we should ensure:

  1. The default timeout values used by SPDK are appropriate for the use case
  2. The removal doesn't introduce new issues in error recovery scenarios

Let's verify the usage and impact:

pkg/types/types.go Outdated Show resolved Hide resolved
pkg/types/types.go Outdated Show resolved Hide resolved
app/cmd/basic/bdev_nvme.go Outdated Show resolved Hide resolved
@innobead
Copy link
Member

Build AMD64 PR check failed.

Downloading dapper
.dapper.tmp version v0.6.0
./.dapper ci
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
time="2024-11-28T11:51:35Z" level=fatal msg="exit status 1"
make: *** [Makefile:11: ci] Error 1
Error: Process completed with exit code 2.

@derekbit
Copy link
Member Author

Build AMD64 PR check failed.

Downloading dapper
.dapper.tmp version v0.6.0
./.dapper ci
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
time="2024-11-28T11:51:35Z" level=fatal msg="exit status 1"
make: *** [Makefile:11: ci] Error 1
Error: Process completed with exit code 2.

Yes, environmental issue. Waiting for @yangchiu fix it.

Copy link
Member

@innobead innobead left a comment

Choose a reason for hiding this comment

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

go-spdk-helper binary accidentally added?

pkg/types/types.go Outdated Show resolved Hide resolved
pkg/spdk/client/basic.go Outdated Show resolved Hide resolved
pkg/spdk/client/basic.go Outdated Show resolved Hide resolved
@derekbit
Copy link
Member Author

go-spdk-helper binary accidentally added?

Yes..
Added go-spdk-helper to .gitignore

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.89%. Comparing base (c396ae7) to head (94b3330).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #170   +/-   ##
=======================================
  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.

pkg/types/types.go Outdated Show resolved Hide resolved
@derekbit derekbit merged commit 5dae730 into longhorn:main Nov 28, 2024
9 checks passed
@derekbit derekbit deleted the issue-9874 branch November 28, 2024 15:35
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