Repository navigation
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
some parts of the md document do not render correctly.
e.g:
"3.3 Lifetime / ownership of one cycle (no cursor)"
Also take into consideration depleters that can operate on an AREQ outside the thread worker lifetime(we are planning some optimizations in that area so a worker thread would unblock the client but depleters would continue running on the AREQ object)
I did a shallow review - don't have a lot of free time
will try and review more closely in the upcoming days.
|
Would it be possible to clarify the motivation to separate BlockedRequestCtx and BlockedClientCtx? Are their lifetimes different? |
|
This design should consider the mutex we are using for ASM to make sure we properly count the requests per keyspace version, we have also a mutex there attached to the lifetime of AREQ. |
…cCtx wrapper for unified refcounting. Enhance clarity on role responsibilities and streamline cross-thread interactions.
…p. Migrate existing fields and unify BlockedQueryNode and BlockedCursorNode into a single BlockedNode type. Update related APIs for consistency and clarity.
…ion to manage per-cycle spec-lock state. Introduce `runQueryCycle` wrapper for enhanced thread safety and state management during pipeline execution. Ensure cross-thread safety and maintain existing API signatures for lock operations.
…nization model post-refactor
- Renamed class definitions for clarity in the flowchart. - Enhanced descriptions of BlockedClientCtx and Cursor to reflect their roles more accurately. - Updated the ownership and lifetime details in the per-struct table for better understanding. - Introduced CycleOutcome enum to manage outcomes in BlockedClientCtx. - Clarified synchronization mechanisms and access patterns for various structures. - Consolidated changes to ensure BG threads handle cursor operations, moving them away from main thread interactions. - Improved documentation to reflect the new design and its implications on thread safety and data access.
… and synchronization - Updated the BlockedClientCtx diagram to clarify its contents and relationships. - Renamed SpecLockHolder to SpecLockState and adjusted its usage to enhance understanding of state transitions. - Improved documentation on the ownership and lifecycle of various structures, including RedisSearchCtx and ChunkReplyState. - Clarified synchronization mechanisms for shared structures, emphasizing the importance of thread safety during BCC cycles. - Streamlined the cursor management process, ensuring that cursor operations are safely handled within the main thread. - Enhanced the runRequestCycle wrapper to enforce state assertions and improve safety during background processing. - Updated the per-struct table to reflect changes in ownership and access patterns, ensuring consistency across the codebase.
…ips, clarifying ownership and refcounting rationale post-refactor.
- Updated the BlockedClientCtx (BCC) and RequestSyncCtx (RSC) descriptions for clarity on ownership and reference management. - Changed terminology from "holds" to "owns" to better reflect the ownership semantics in the context of BCC and CURS. - Clarified the ownership model for RSC, emphasizing single ownership and the transfer mechanism between BCC and Cursor. - Removed unnecessary references to refcounting in RSC, highlighting the single-owner-with-transfer model. - Enhanced the explanation of cursor management and its thread safety, focusing on the implications of the single-owner-with-transfer model. - Adjusted the table summarizing the relationships and access patterns for various components to align with the updated descriptions.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Document optimization opportunity enabled by the refactor: switching from per-arg `sdsnewlen` copies to `RedisModule_HoldString` refcount bumps. With the guarantee that `AREQ_Free` now runs only on main thread, we can safely use `HoldString`/`FreeString` instead of `sdsnew`/`sdsfree`, eliminating unnecessary string copies. The conversion affects a handful of readers that currently treat `req->args[i]` as `sds`/`char*` and applies
…Ctx retirement Step 6 now retires `ConcurrentCmdCtx`, `CoordRequestCtx`, and `_HandleRedisCommandEx` for AREQ-shaped coord paths by moving AREQ creation to main and replacing the BG handler signature. This makes the old Step 6 helper (`ConcurrentSearchBlockClientCtx`) obsolete, so Step 7 introduces a replacement `OpBlockClientCtx` for operational paths. Steps renumbered accordingly (old 7 → 8). Added follow-up notes on slimming `SearchCmdCtx` for the non-AREQ `FT.SEARCH` coord path and deferring `CurrentThread` slot cleanup since the RSC now holds a StrongRef end-to-end.
…eep Compile on worker Clarify that AREQ_New moves to main (eliminating the setReqLock race by binding the AREQ before BlockClient), while AREQ_Compile and prepareForExecution stay on the worker thread to preserve coord-side latency. Update error handling flow: compile errors land on areq->status and route through reply_cb (same path as today's useReplyCallback mode) rather than being returned synchronously. Document argv lifetime implications and reference the §9 HoldString follow-up for refcount-based capture.
…fecycle details, unify typedefs, and remove deprecated structures
…arity post-refactor
|
lerman25
left a comment
There was a problem hiding this comment.
Great work.
I think that we should address RETURN-STRICT+ FAIL cursors edge case, where the main thread replies (in reply/timeout+return-strict), but the background thread is still using the cursor. We are not stating what happens on another READ/DEL.
…actor - blockedClientReqCtx carries WeakRef spec_ref, not RedisModuleCtx* - clarify req->useReplyCallback is a bool on AREQ, not in storedReplyState - rename BCHCtx row to blockedClientHybridCtx; clarify CoordRequestCtx scope - refresh coordinator footgun refs to function names - resync stale file:line anchors (cursor.c, aggregate_exec.c, rmr.c, module.c)
…RICT Align the design with current master now that the RETURN_STRICT mechanism is complete (through MOD-16091 cursor depletion and MOD-16267 safe-loader GIL preempt): - Split today's embedded RequestSyncCtx: per-request RequestSyncState (timedOut + abort-wake, sub-AREQs included) stays embedded; the heap wrapper — renamed BlockedRequestCtx (BRC) — owns the request, hosts the RETURN_STRICT coordination verbatim, and carries the per-cycle blocked-client handle. - RETURN_STRICT protocol is an explicit non-goal: re-homed, never redesigned. New §4.3 documents the hosted claim/GIL-preempt/wait flow and the planned follow-up (main thread never waits; timeout callback drains a generic thread-safe result list), which brc->reply prepares for. - Timed-out cursors are always dropped (never parked) on master, so OnFree's park condition is !timedOut && !ITERDONE && !delete_mark and no timeout state crosses cursor cycles; the scattered disposal patch-ups collapse into OnFree. - §3.6: shard hybrid multi-cursor ownership resolved with no counting — StartCursors hands each sub-AREQ to its sub-cursor's BRC (duplicating the plan-borrowed args, severing latent container pointers) and the container dissolves at the end of the initial cycle, relying on the blocked-client reply_cb→OnFree ordering. - Coordinator sections updated to master (sticky timeoutPolicy → per-cycle brc field, isCursorReadReturnStrict derived, setReqLock / preRequestError retired by bind-on-main, KeepBlockedClient continuations need no plumbing, coord cursor bound on main). - Fixed internal inconsistencies: canonical BeginCycle sequence, OnFree cursor sourcing, Step 2/3 field split, stale registry-snapshot and ConcurrentSearchBlockClientCtx references, [sir] section links. Co-Authored-By: Claude Fable 5 <[email protected]>
|
|
This pull request is stale because it has been open for 60 days with no activity. |



Mark if applicable
Release Notes