Skip to content

[MOD-12414] Add Internal cursor reads metric to cluster FT.PROFILE output#7709

Merged
meiravgri merged 5 commits intomasterfrom
meriavg_profile_cursor_reads
Dec 10, 2025
Merged

[MOD-12414] Add Internal cursor reads metric to cluster FT.PROFILE output#7709
meiravgri merged 5 commits intomasterfrom
meriavg_profile_cursor_reads

Conversation

@meiravgri
Copy link
Copy Markdown
Collaborator

@meiravgri meiravgri commented Dec 10, 2025

Summary

Adds a new metric Internal cursor reads to FT.PROFILE shard profiles that tracks the number of cursor reads performed during distributed aggregate operations.

Changes

Feature: Track internal cursor reads

  • Added cursor_reads field to AREQ struct to count cursor read operations
  • Increment counter in runCursor() for each cursor read (initial + subsequent reads)
  • Print "Internal cursor reads" in shard profile output when IsCursor(req) is true

Bug Fix

Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set, preventing earlier cursor read warnings from being lost in final output.


Note

Add shard-level Internal cursor reads metric to FT.PROFILE AGGREGATE and ensure timeout state persists across cursor reads.

  • Feature: FT.PROFILE AGGREGATE (cluster)
    • Track and expose shard-level Internal cursor reads in profile output.
    • Add AREQ::cursor_reads and increment in runCursor(); print metric in Profile_Print() when IsCursor(req).
  • Reliability
    • Preserve timeout state across cursor reads: use req->has_timedout |= has_timedout and pass req->has_timedout to profile context in both RESP2/RESP3 paths.
  • Tests
    • Add RESP2/RESP3 tests for Internal cursor reads, including timeout scenarios and coordinator behavior.
    • Update RESP3 expected shard profile schema to include Internal cursor reads.
    • Adjust indices in existing profile-based tests to account for new field.

Written by Cursor Bugbot for commit 21f2b68. This will update automatically on new commits. Configure here.

update in runCursor

print in Profile_Print if cursor
@meiravgri meiravgri changed the title add cursor_reads to req struct [MOD-12414] add cursor_reads to req struct Dec 10, 2025
@meiravgri meiravgri requested a review from GuyAv46 December 10, 2025 09:32
@meiravgri meiravgri changed the title [MOD-12414] add cursor_reads to req struct [MOD-12414] Add Internal cursor reads metric to cluster FT.PROFILE output Dec 10, 2025
Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.
@meiravgri meiravgri enabled auto-merge December 10, 2025 10:13
env.assertEqual(len(res[0]) - 1, num_docs)

shards_profile = get_shards_profile(env, res)
env.assertEqual(len(shards_profile), env.shardsCount)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider adding the shards_profile as a message on failure

res = env.cmd('FT.PROFILE', 'idx', 'AGGREGATE', 'QUERY', '*')

shards_profile = get_shards_profile(env, res)
env.assertEqual(len(shards_profile), env.shardsCount)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider adding the shards_profile as a message on failure

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.83%. Comparing base (2402970) to head (21f2b68).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7709      +/-   ##
==========================================
- Coverage   84.84%   84.83%   -0.02%     
==========================================
  Files         349      349              
  Lines       54413    54551     +138     
  Branches    14500    14632     +132     
==========================================
+ Hits        46169    46278     +109     
- Misses       8049     8076      +27     
- Partials      195      197       +2     
Flag Coverage Δ
flow 85.18% <100.00%> (-0.17%) ⬇️
unit 51.96% <0.00%> (+0.09%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@meiravgri meiravgri added this pull request to the merge queue Dec 10, 2025
Merged via the queue into master with commit 005186a Dec 10, 2025
26 checks passed
@meiravgri meiravgri deleted the meriavg_profile_cursor_reads branch December 10, 2025 16:48
@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-7709-to-2.8 origin/2.8
cd .worktree/backport-7709-to-2.8
git switch --create backport-7709-to-2.8
git cherry-pick -x 005186a403e44e718c6094925a55ad651afc05cf

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 2.10, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.10
git worktree add -d .worktree/backport-7709-to-2.10 origin/2.10
cd .worktree/backport-7709-to-2.10
git switch --create backport-7709-to-2.10
git cherry-pick -x 005186a403e44e718c6094925a55ad651afc05cf

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 8.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.2
git worktree add -d .worktree/backport-7709-to-8.2 origin/8.2
cd .worktree/backport-7709-to-8.2
git switch --create backport-7709-to-8.2
git cherry-pick -x 005186a403e44e718c6094925a55ad651afc05cf

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 8.4, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.4
git worktree add -d .worktree/backport-7709-to-8.4 origin/8.4
cd .worktree/backport-7709-to-8.4
git switch --create backport-7709-to-8.4
git cherry-pick -x 005186a403e44e718c6094925a55ad651afc05cf

meiravgri added a commit that referenced this pull request Dec 10, 2025
…output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)
meiravgri added a commit that referenced this pull request Dec 10, 2025
…output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
…OFILE output (#7709) (#7736)

* [MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)

* fix IsCursor
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2025
…OFILE output (#7737)

[MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)
meiravgri added a commit that referenced this pull request Dec 11, 2025
…output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2025
…ROFILE output (#7746)

* [MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)

* fix test

* fix test

* fix test
meiravgri added a commit that referenced this pull request Dec 11, 2025
[MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)
meiravgri added a commit that referenced this pull request Dec 11, 2025
…ROFILE output (#7746)

* [MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)

* fix test

* fix test

* fix test

(cherry picked from commit 1911f5b)
github-merge-queue bot pushed a commit that referenced this pull request Dec 14, 2025
…OFILE output (#7751)

* cp master

[MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)

* [2.10] [MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7746)

* [MOD-12414] Add `Internal cursor reads` metric to cluster FT.PROFILE output (#7709)

* add cursor_reads to req struct

update in runCursor

print in Profile_Print if cursor

* Fix: Preserve timeout flag across cursor reads in cluster FT.PROFILE

Use |= instead of = to ensure has_timedout remains true once set,
preventing earlier cursor read warnings from being lost in final output.

* fix test

* fix test

* add message to the test

(cherry picked from commit 005186a)

* fix test

* fix test

* fix test

(cherry picked from commit 1911f5b)

* minimal test for timeout

* remove new code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants