Skip to content

[2.10] [MOD-11155] Create basic query pause debug command#7624

Merged
meiravgri merged 5 commits into2.10from
backport-7579-to-2.10
Dec 9, 2025
Merged

[2.10] [MOD-11155] Create basic query pause debug command#7624
meiravgri merged 5 commits into2.10from
backport-7579-to-2.10

Conversation

@meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Dec 3, 2025

backport #6750 to 2.10


Note

Adds a pause-capable debug result processor and QUERY_CONTROLLER commands, and extends _FT.DEBUG to pause before/after specific RP types with INTERNAL_ONLY handling.

  • Debug query controls:
    • Add QUERY_CONTROLLER subcommands: SET_PAUSE_RP_RESUME, GET_IS_RP_PAUSED, PRINT_RP_STREAM.
    • Introduce QueryDebugCtx (global) to track pause state and current debug RP.
  • Result Processor (RP) debug support:
    • New debug RP RP_PAUSE that pauses after N results; single active debug RP enforced.
    • RP insertion helpers to add processors before/after specific RP types; expose StringToRPType.
    • Refactor timeout RP insertion; extend ResultProcessorType to separate normal vs debug RPs.
  • _FT.DEBUG query args:
    • Add PAUSE_BEFORE_RP_N <RP_TYPE> <N> [INTERNAL_ONLY] and PAUSE_AFTER_RP_N <RP_TYPE> <N> [INTERNAL_ONLY].
    • Validate RP type, count, workers requirement, and coordinator vs shard with INTERNAL_ONLY.
    • Tighten INTERNAL_ONLY usage validation for all debug args.
  • Docs/tests/utilities:
    • Update aggregate debug docs/comments for pause behavior and coordinator timeout note.
    • Add test helpers (build debug args, pause/resume across shards) and comprehensive tests for pause/QUERY_CONTROLLER in SA and cluster.

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

implment for coordinator level

backport 7546 + #7605 fix uv thread test MOD-12823
}

self->remaining--;
return base->upstream->Next(base->upstream, r);
Copy link

Choose a reason for hiding this comment

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

Bug: Unsigned integer underflow after pause in RPPauseAfterCount_Next

In RPPauseAfterCount_Next, when remaining is 0, the function pauses but then unconditionally decrements remaining afterward. Since remaining is a uint32_t, decrementing from 0 causes an unsigned integer underflow, wrapping to UINT32_MAX. This breaks the pause functionality for subsequent calls since remaining will never reach 0 again. The RPTimeoutAfterCount_Next function handles this correctly by returning early after the condition is met without decrementing.

Fix in Cursor Fix in Web

@meiravgri meiravgri changed the title WIP: [2.10] [MOD-11155] Create basic query pause debug command Dec 3, 2025
@meiravgri meiravgri requested a review from lerman25 December 3, 2025 16:21
if (internal_only) {
QueryError_SetError(status, QUERY_EPARSEARGS, "INTERNAL_ONLY is not supported without TIMEOUT_AFTER_N or PAUSE_AFTER_RP_N/PAUSE_BEFORE_RP_N");
return REDISMODULE_ERR;
}
Copy link

Choose a reason for hiding this comment

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

Bug: Missing return statement causes undefined behavior

The parseAndCompileDebug function has a missing return statement at the end. When no debug parameters like TIMEOUT_AFTER_N or PAUSE_*_RP_N are provided, and internal_only is false, the function falls through without returning a value. Since the function returns int, this causes undefined behavior and the caller will receive garbage or an unpredictable value instead of REDISMODULE_OK.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 98.97959% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.41%. Comparing base (16035ec) to head (3243098).
⚠️ Report is 3 commits behind head on 2.10.

Files with missing lines Patch % Lines
src/aggregate/aggregate_debug.c 93.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             2.10    #7624      +/-   ##
==========================================
+ Coverage   89.40%   89.41%   +0.01%     
==========================================
  Files         210      210              
  Lines       35841    35992     +151     
==========================================
+ Hits        32043    32183     +140     
- Misses       3798     3809      +11     
Flag Coverage Δ
flow 84.06% <98.97%> (-0.14%) ⬇️
unit 41.89% <0.00%> (-0.18%) ⬇️

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.

lerman25
lerman25 previously approved these changes Dec 3, 2025
lerman25
lerman25 previously approved these changes Dec 4, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 4, 2025
* [2.10] [MOD-11155] Create basic query pause debug command
#7624

* fix test

* remove empty line
}

bool before = AC_IsInitialized(&pauseBeforeArgs);
ArgsCursor *pauseArgs = before ? &pauseBeforeArgs : &pauseAfterArgs;
Copy link

Choose a reason for hiding this comment

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

Bug: Second pause argument silently ignored when both provided

When both PAUSE_BEFORE_RP_N and PAUSE_AFTER_RP_N are provided in the same command, the condition at line 124 uses || to enter the block if either is initialized, but the logic inside only processes one of them. If pauseBeforeArgs is initialized, it takes priority and pauseAfterArgs is completely ignored without any error or warning. User-provided arguments for the second pause point are silently discarded, which can lead to unexpected behavior where the user believes two pause points were created but only one actually exists.

Fix in Cursor Fix in Web

@meiravgri meiravgri enabled auto-merge December 8, 2025 17:35
@meiravgri meiravgri added this pull request to the merge queue Dec 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 8, 2025
@meiravgri meiravgri added this pull request to the merge queue Dec 9, 2025
Merged via the queue into 2.10 with commit 698c3bb Dec 9, 2025
17 checks passed
@meiravgri meiravgri deleted the backport-7579-to-2.10 branch December 9, 2025 05:45
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