Skip to content

fix: ensure integer comparison for disk fsync latency in etcd validation#3085

Merged
kubesphere-prow[bot] merged 1 commit into
kubesphere:mainfrom
redscholar:etcd_disk_wal
Apr 23, 2026
Merged

fix: ensure integer comparison for disk fsync latency in etcd validation#3085
kubesphere-prow[bot] merged 1 commit into
kubesphere:mainfrom
redscholar:etcd_disk_wal

Conversation

@redscholar

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?

none

Additional documentation, usage docs, etc.:


@kubesphere-prow kubesphere-prow Bot added kind/bug Categorizes issue or PR as related to a bug. release-note-none labels Apr 23, 2026
@kubesphere-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: redscholar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubesphere-prow kubesphere-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 23, 2026
@kubesphere-prow kubesphere-prow Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 23, 2026
Signed-off-by: redscholar <blacktiledhouse@gmail.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the ETCD disk fsync latency assertion by adding integer casting to the comparison. The review highlights two critical issues: the task was incorrectly moved out of its conditional block, which may lead to template errors if dependencies are missing, and the comparison logic uses 'ge' instead of 'le', meaning the check currently fails when latency is acceptable and passes when it exceeds the maximum allowed threshold.

Comment on lines 45 to 49
- name: ETCD | Assert disk fsync latency meets requirements
assert:
that: (index (.fio_result.stdout.jobs | first) "sync" "lat_ns" "percentile" "90.000000") | ge .cluster_require.etcd_disk_wal_fysnc_duration_seconds
that: (index (.fio_result.stdout.jobs | first) "sync" "lat_ns" "percentile" "90.000000") | int | ge (int .cluster_require.etcd_disk_wal_fysnc_duration_seconds)
fail_msg: >-
The 90th percentile fsync latency is {{ index (.fio_result.stdout.jobs | first) "sync" "lat_ns" "percentile" "90.000000" }}ns, which exceeds the maximum allowed: {{ .cluster_require.etcd_disk_wal_fysnc_duration_seconds }}ns.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

There are two critical issues introduced or maintained in this change:

  1. Indentation/Logic Flow: The assertion task has been moved out of the conditional block (line 38). Since it depends on .fio_result (registered at line 43), it will now cause a template error if fio is not installed or the test is skipped. It should remain indented within the inner block to ensure it only runs when the test results are available.
  2. Comparison Logic: The use of ge (greater than or equal) is incorrect for a performance check where a maximum latency is specified. The assertion currently passes if the latency is higher than the limit and fails if it is lower. It should use le (less than or equal) to ensure the measured latency does not exceed the threshold.

While the addition of integer casting correctly addresses the type mismatch issue, these structural and logic errors must be resolved.

        - name: ETCD | Assert disk fsync latency meets requirements
          assert:
            that: (index (.fio_result.stdout.jobs | first) "sync" "lat_ns" "percentile" "90.000000") | int | le (int .cluster_require.etcd_disk_wal_fysnc_duration_seconds)
            fail_msg: >-
              The 90th percentile fsync latency is {{ index (.fio_result.stdout.jobs | first) "sync" "lat_ns" "percentile" "90.000000" }}ns, which exceeds the maximum allowed: {{ .cluster_require.etcd_disk_wal_fysnc_duration_seconds }}ns.

@redscholar redscholar added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@kubesphere-prow kubesphere-prow Bot merged commit cf54711 into kubesphere:main Apr 23, 2026
4 checks passed
@redscholar redscholar deleted the etcd_disk_wal branch April 24, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant