mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 12:19:56 -05:00
### Does this PR have any customer impact? ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) ### Are you introducing any new config? If yes, do you have tests with and without them being set? ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description ---- #### AI description (iteration 1) #### PR Classification Enhancement and bug fix to improve the stability and management of file-based cursors. #### PR Summary This pull request refactors and bolsters file-based cursor management by introducing shared memory support, improved cleanup, error handling, and configuration changes. It also adds new API endpoints and logging for better cursor lifecycle control. - **`cursor_store.c` and related files:** Added shared memory functions (e.g., `FileCursorShmemSize`, `InitializeFileCursorShmem`), cursor count regulation (with `IncrementCursorCount`/`DecrementCursorCount`), and cleanup routines to ensure stable cursor file operations. - **Test and expected output files:** Updated regression tests and expected outputs to cover scenarios like duplicate cursor creation, cursor deletion limits, and error reporting when the file cursor capacity is reached. - **API enhancements:** Introduced new UDFs (e.g., `command_delete_cursors`) and tenant client methods for killing and deleting cursors, improving session management. - **Configuration updates:** Renamed and added GUC parameters (e.g., `MaxAllowedCursorIntermediateFileSizeMB`, `MaxCursorFileCount`, and cursor expiry settings) to control file-based cursor behavior. - **Logging and metrics improvements:** Enhanced logging in `mdsd_logger.c` to report current cursor counts and related metrics for operational insight. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
28 lines
1.0 KiB
C
28 lines
1.0 KiB
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/aggregation/aggregation_commands.h
|
|
*
|
|
* Exports for the aggregation external commands.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef DOCUMENTDB_AGGREGATION_COMMANDS_H
|
|
#define DOCUMENTDB_AGGREGATION_COMMANDS_H
|
|
|
|
#include <utils/array.h>
|
|
|
|
extern Datum delete_cursors(ArrayType *cursorArray);
|
|
extern Datum find_cursor_first_page(text *database, pgbson *findSpec, int64_t cursorId);
|
|
extern Datum aggregate_cursor_first_page(text *database, pgbson *aggregationSpec,
|
|
int64_t cursorId);
|
|
extern Datum aggregation_cursor_get_more(text *database, pgbson *getMoreSpec,
|
|
pgbson *cursorSpec, AttrNumber
|
|
maxResponseAttributeNumber);
|
|
|
|
extern Datum list_collections_first_page(text *database, pgbson *listCollectionsSpec);
|
|
extern Datum list_indexes_first_page(text *database, pgbson *listIndexesSpec);
|
|
|
|
#endif
|