Files
documentdb/pg_documentdb/sql/udfs/commands_diagnostic/current_op--latest.sql
T
Vinod Sridharan d2a7669a25 Merged PR 1566832: [OSS] Enable support for current_op aggregation stage in DocumentDB
### Does this PR have any customer impact?
Yes

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No

### Are you introducing any new config? If yes, do you have tests with and without them being set?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Enable support for current_op aggregation stage in OSS.
Still pending: support for getting locking pids and index builds.
----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request enables support for the `current_op` aggregation stage in DocumentDB.
- Added new functions in `current_op--0.101-0.sql` and `current_op--latest.sql` to support the `current_op` aggregation stage.
- Modified `current_op.c` to handle new attributes and improve the `current_op` command processing.
- Updated `system_configs.c` to include a new configuration variable for tracking the application name in `current_op`.
- Adjusted test cases in `bson_aggregation_pipeline_tests_coll_agnostic.sql` and related expected output files to validate the new feature.
- Updated `metadata_cache.c` to correctly reference the `current_op_aggregation` function.
2025-02-06 09:18:21 -08:00

16 lines
913 B
SQL

/* Add functions for the currentOp aggregation stage */
/* Spec contains { allUsers: <boolean>, idleConnections: <boolean>, idleCursors: <boolean>, idleSessions: <boolean>, localOps: <boolean> } */
DROP FUNCTION IF EXISTS __API_SCHEMA_INTERNAL_V2__.current_op_aggregation;
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.current_op_aggregation(p_spec __CORE_SCHEMA_V2__.bson, OUT document __CORE_SCHEMA_V2__.bson)
RETURNS SETOF __CORE_SCHEMA_V2__.bson
LANGUAGE c
VOLATILE STRICT ROWS 100
AS 'MODULE_PATHNAME', $function$command_current_op_aggregation$function$;
DROP FUNCTION IF EXISTS __API_SCHEMA_INTERNAL_V2__.current_op_worker;
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.current_op_worker(p_spec __CORE_SCHEMA_V2__.bson, OUT document __CORE_SCHEMA_V2__.bson)
RETURNS __CORE_SCHEMA_V2__.bson
LANGUAGE c
VOLATILE STRICT
AS 'MODULE_PATHNAME', $function$command_current_op_worker$function$;