Skip to content

[8.4] [MOD-12627] Add Debug Support for FT.PROFILE Command#7573

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7510-to-8.4
Nov 30, 2025
Merged

[8.4] [MOD-12627] Add Debug Support for FT.PROFILE Command#7573
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7510-to-8.4

Conversation

@redisearch-backport-pull-request
Copy link
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Nov 30, 2025

Description

Backport of #7510 to 8.4.


Note

Adds debug-mode execution for FT.PROFILE (SEARCH/AGGREGATE) in SA and cluster, with wrappers, plumbing, and tests; profile output now skips debug RPs and surfaces timeout warnings.

  • Debug/Profiling:
    • Add debug wrappers for FT.PROFILE (FT.PROFILE and _FT.PROFILE) in src/debug_commands.c with shard/coord variants.
    • Refactor RSProfileCommandRSProfileCommandImp(..., isDebug); route to DEBUG_execCommandCommon when in debug mode.
    • Propagate debug flag through DistSearchCommandImp, DistAggregateCommandImp, and ProfileCommandHandlerImp.
    • Implement DEBUG_execCommandCommon to parse debug params and execute query without debug args.
  • Profile Output:
    • Guard profile printing to skip debug-only RPs (introduce RP_MAX_DEBUG); ensure timeout warning reported in profile/results.
  • Headers/APIs:
    • Export new ...Imp(..., bool isDebug) signatures in module.h.
    • Update docs in aggregate_debug.h (remove FT.PROFILE limitation).
  • Tests/Utils:
    • Add SA and cluster tests for FT.PROFILE debug (RESP2/RESP3) validating structure, RP types, and timeout warnings.
    • Add countFlatElements helper in tests.

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

* imp debug profile for SA:

introduce in mocule.h: RSProfileCommandImp
RSProfileCommand calls RSProfileCommandImp(isDebug = false) for regular execution
ProfileCommandCommand_DebugWrapper mcalls it with isDebug=true and skips _FT.DEBUG

introduce entrypoint for _FT.DEBUG FT.PROFILE in debug_commands:
ProfileCommandCommand_DebugWrapper

RSProfileCommandImp calls DEBUG_execCommandCommon is its debug

_recursiveProfilePrint skips printing debug RP

* pass is debug instead of extracting:

module.h:
replace declaration: DistAggregateCommand
DistSearchCommand
with Imp version that receives isDebug

expose ProfileCommandHandlerImp

align debug_commands

introducr _FT.DEBUG _FT.PROFILE

* add test for cluster

* return res

* augi fixes

* fix spell check

* fix for real

* fix test

* skip tests according to env

* revrt test_profile changes

* reove changes from internal_only

(cherry picked from commit 00ca3cf)

case RP_PROFILE:
case RP_MAX:
default:
Copy link

Choose a reason for hiding this comment

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

Bug: Missing RP types in profile switch statement

The switch statement in _recursiveProfilePrint doesn't handle RP_VECTOR_NORMALIZER, RP_HYBRID_MERGER, and RP_DEPLETER result processor types. These are valid non-debug RP types (defined before RP_MAX in the enum) that can appear in pipelines, especially in hybrid queries. When profiling encounters any of these types, it hits the default case which calls RS_ABORT("RPType error"), causing the process to abort. The early return added at line 79-82 only skips debug RPs (those > RP_MAX), so these three types still reach the switch statement.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.89%. Comparing base (5c03444) to head (18f6854).
⚠️ Report is 1 commits behind head on 8.4.

Files with missing lines Patch % Lines
src/debug_commands.c 83.33% 2 Missing ⚠️
src/profile.c 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #7573      +/-   ##
==========================================
- Coverage   85.94%   85.89%   -0.06%     
==========================================
  Files         331      331              
  Lines       52593    52612      +19     
  Branches    12004    12004              
==========================================
- Hits        45203    45190      -13     
- Misses       7223     7255      +32     
  Partials      167      167              
Flag Coverage Δ
flow 84.46% <91.17%> (-0.18%) ⬇️
unit 52.45% <2.94%> (-0.03%) ⬇️

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.

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Nov 30, 2025
Merged via the queue into 8.4 with commit 482de54 Nov 30, 2025
29 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request bot deleted the backport-7510-to-8.4 branch November 30, 2025 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant