### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Handling of wildcard text indexes when compounded with a non-wildcard field is broken. This bug is a **functional bug** affecting query results when used with a wildcard index (see JS test for repro).
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to correct the handling of compound wildcard text indexes.
#### PR Summary
This pull request addresses a bug in the handling of compound wildcard text indexes by adding additional tests and correcting the index creation and listing logic.
- Modified `commands_create_indexes_text.out` to include more tests and correct the handling of compound wildcard text indexes.
- Added new test file `text_indexes_wildcard.js` to verify the correct behavior of wildcard text indexes.
- Updated `commands_create_indexes_text.sql` to include additional test cases for compound wildcard text indexes.
### Does this PR have any customer impact?
Yes it implements the option `StartAtOperationTimeStamp` for change streams.
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This PR implements support for historical change streams using `StartAtOperationTimeStamp` option.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request implements historical change streams with direct WAL decoding for MongoDB.
- `change_stream_wal_utils.c`: Added functions to determine the oldest available WAL segment and to check if a transaction is later than a given timestamp.
- `change_stream.h`: Removed `ChangeStreamSpec` struct and added `startTimestamp` to `ChangeStreamContext`.
- `change_stream_aggregation_stage.c`: Added support for `startAtOperationTime` to start change streams from a specific operation time.
- `change_stream_decoding_utils.c`: Added function to convert BSON timestamp to `TimestampTz`.
Related work items: #2973720
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
adding a limit of 10 users for dataplane user crud api
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request enforces a limit of 10 users for the Dataplane user CRUD API.
- `oss/pg_helio_api/src/commands/users.c`: Added logic to check and enforce the maximum user limit before creating a new user.
- `oss/pg_helio_api/src/helio_api_init.c`: Introduced a new configuration variable `helio_api.maxUserLimit` to set the maximum number of users allowed.
- `pgmongo/src/test/regress/sql/user_crud_commands.sql` and `pgmongo/src/test/regress/expected/user_crud_commands.out`: Added tests to verify the user limit enforcement and behavior when the limit is exceeded.
Related work items: #3175767
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Push sort by _id down to the primary key index on unsharded or when we have a shard key
----
#### AI description (iteration 1)
#### PR Classification
Code optimization
#### PR Summary
This pull request optimizes the sorting mechanism by pushing the sort by `_id` down to the primary key index when applicable.
- Added `CanSortByObjectId` and `HasShardKeyFilterWalker` functions in `bson_aggregation_pipeline.c` to determine if sorting by `_id` can be optimized.
- Modified `HandleSort` function in `bson_aggregation_pipeline.c` to use the new optimization logic for sorting by `_id`.
- Updated function declarations in `bson_aggregation_pipeline.c` to include the new helper functions.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Fix up update to only do upsert if the query was exactly on _id. other cases should defer to insert (and fail on unique conflict)
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to ensure upsert operations are only performed when the query is on `_id`.
#### PR Summary
This pull request modifies the upsert logic to only perform upserts if the query is solely based on the `_id` field.
- Updated `update.c` to check for queries with only `_id` filters and renamed related variables for clarity.
- Added test cases in `commands_update.out` and `commands_update.sql` to verify upsert behavior and handle error cases.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bug fixes
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) send server group name in node metrics from backend
2) in collstats cap the avg obj size so it doesn’t go below storage size
3) skip run command on all nodes for single node
4) set the multinode behavior in distributed extension
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and enhancement for service debugging.
#### PR Summary
This pull request includes various improvements and cleanups identified during service debugging.
- `pg_helio_distributed/src/test/regress/expected/commands_update.out`: Updated SQL command execution notices to use `helio_api_internal.update_worker`.
- `pgmongo/src/infrastructure/mdsd_logger.c`: Added functions to load default dimensions and append server group details to logs. Removed the `append_internal_logs` function.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[Code cleanup] Remove dead code for old aggregation operator framework
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes dead code related to the old aggregation operator framework.
- Removed unused functions and variables in `src/operators/bson_expression.c`.
- Deleted legacy operator handling functions in `src/operators/bson_expression.c`.
- Cleaned up `include/operators/bson_expression_operators.h` by removing obsolete function declarations and typedefs.
- Updated `src/aggregation/bson_aggregation_nested_pipeline.c` to use the new aggregation expression evaluation functions.
- Removed legacy function declarations from `include/operators/bson_expression.h`.
### Does this PR have any customer impact?
no
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
testing
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Don't ignore spaces in OSS tests - honor space changes as diffs
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for OSS tests to ensure spaces are not ignored.
#### PR Summary
This pull request addresses the issue of spaces being ignored in OSS tests by correcting the expected output formatting.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_type_operators_tests.out`: Adjusted the expected output to include spaces in the `bson_dollar_project` results.
### Does this PR have any customer impact?
No
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Delete old feature flags that are default on for a while.
- Remove ClusterVersion checks < 1.19
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request focuses on cleaning up feature flags in the codebase.
- Removed feature flag checks and related code in `bson_aggregation_pipeline.c`.
- Updated test outputs in `bson_aggregation_stage_merge_tests.out` files.
- Removed feature flag settings in `bson_index_truncation_index_tests.sql`.
- Deleted unused function `GetMergeDocumentsFunctionOid` in `bson_aggregation_pipeline_private.h`.
- Removed feature flag definitions in `helio_api_init.c`.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
When the query filter includes only the _id field with either the $eq or $in operator, we aim to optimize the update selection query by creating only two qualifiers: one on the shard_key_value and the other on the object_id column, while skipping the match on the document column.
This optimization reduces a few unnecessary calls; however, it does not yield a noticeable performance improvement because the TrimPrimaryKeyQuals function already removes useless qualifiers after the initial planning stage.
example : `SELECT helio_api.update('update', '{"update":"updateme", "updates":[{"q":{"_id":{"$eq":1}},"u":{"$set":{"b":0 }},"multi":false}]}');`
- Before My Changes select query for update candidate
`SELECT ctid, object_id, document FROM mongo_data.documents_2_102046 WHERE shard_key_value = $1 AND document OPERATOR(mongo_catalog.@@) $2::mongo_catalog.bson AND object_id OPERATOR(mongo_catalog.=) $3`
- After My changes
`SELECT ctid, object_id, document FROM mongo_data.documents_2_102046 WHERE shard_key_value = $1 AND object_id OPERATOR(mongo_catalog.=) $3::mongo_catalog.bson LIMIT 1 FOR UPDATE`
----
Why there is no noticeable perf changes : As we already use `TrimPrimaryKeyQuals` function to remove useless quals after initial planning even without my changes if we look at explain plan of select query :
```
EXPLAIN SELECT ctid, object_id, document FROM mongo_data.documents_2_102046 WHERE shard_key_value = 2 AND document OPERATOR(mongo_catalog.@@) '{"_id" : {"$eq" : 1}}'::mongo_catalog.bson AND object_id OPERATOR(mongo_catalog.=) '{ "" : { "$numberInt" : "1" } }';
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------
Index Scan using _id_ on documents_2_102046 (cost=0.00..0.00 rows=1 width=40)
Index Cond: ((shard_key_value = 2) AND (object_id OPERATOR(mongo_catalog.=) '{ "" : { "$numberInt" : "1" } }'::mongo_catalog.bson))
(2 rows)
```
```
postgres=# EXPLAIN SELECT ctid, object_id, document FROM mongo_data.documents_2_102046 WHERE shard_key_value = 2 AND document OPERATOR(mongo_catalog.@@) '{"_id" : {"$gt" : 1}}'::mongo_catalog.bson AND object_id OPERATOR(mongo_catalog.=) '{ "" : { "$numberInt" : "1" } }';
QUERY PLAN
------------------------------------------------------------------------------------------...
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfixes
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) In CollStats/DbStats we were missing teh prefix "ERROR" when looking at error messages: In distributed setups when the remote node fails, we end up with an error message that is "ERROR: out of memory". The initial ERROR: was not trimmed and so the response was always categorized as internal error - trim the prefix before checking the error.
2) Add retries for NpgsqlOperationInProgressException to avoid internal errors for this case
3) Bump up Npgsql to 9.0 - this has changes needed for improving error handling for buffer read overflows on errors
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses internal error handling improvements and updates dependencies.
- `diagnostic_commands_common.c`: Added handling to strip "ERROR: " prefix from error messages.
- `PostgresClient.cs`: Added handling for `NpgsqlOperationInProgressException` to retry connections.
- `Packages.props`: Updated `Npgsql` package version from 8.0.3 to 9.0.1.
- `PostgresClientProvider.cs`: Changed type loading configuration to use `ConfigureTypeLoading`.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Fixes/Perf
### 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 - to turn off the features
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) If there's a $or with shard key - extract the shard key values into the top level filter
2) If there's an update with an upsert, only do Upsert if hte query was on _id
3) Fix the query plan cache for insert/upsert
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses issues related to sharding and updates with upsert functionality.
- `sharding.c`: Added functions to handle multi-value query predicates for shard keys, including `$and` and `$or` statements.
- `sharding.h`: Updated function declarations and added new functions for computing shard key expressions and creating shard key value filters.
- Added `query_sharding_tests.sql`: New test cases for various sharding scenarios.
- Updated `commands_update.out` and `helio_compat/commands_update.out`: Added tests for upsert error cases.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Retry deadlock errors on update for concurrent update resiliency.
a concurrent update of this nature would hit a deadlock:
t1-> update: {_id: 1, _id: 2}
t2-> update: {_id: 2, _id: 1}
While applications shouldn't do this, this adds resiliency, so tradeoff between latency vs errors.
Should we put this behind a GUC?
I'll add a test soon.
----
#### AI description (iteration 1)
#### PR Classification
New feature to enhance concurrent update resiliency by retrying deadlock errors.
#### PR Summary
This pull request introduces a mechanism to retry deadlock errors during updates to improve concurrent update resiliency.
- `PostgresClient.cs`: Added `retryDeadlock` parameter to handle deadlock retries in various methods.
- `delete.c`, `insert.c`, `update.c`: Introduced `rethrowDeadlock` flag to manage deadlock errors in batch operations.
- `commands_common.c`, `commands_common.h`: Updated `GetWriteErrorFromErrorData` to support `rethrowDeadlock` flag for deadlock error handling.
### Does this PR have any customer impact?
No.
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
N/A.
### 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?
No.
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Upgrading libbson dependency.
----
#### AI description (iteration 1)
#### PR Classification
Dependency upgrade
#### PR Summary
This pull request upgrades the `libbson` library to version 1.28.0 and updates related initialization code.
- Updated `MONGO_DRIVER_VERSION` to 1.28.0 in `oss/scripts/install_setup_libbson.sh`.
- Added a `NULL` entry to the `bson_mem_vtable_t` structure in `oss/pg_helio_core/src/bson_init.c`.
Related work items: #3468225
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Dependency version
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
upgrade pgvector version to 0.8.0
Temporarily comment out tests that have different results with new version, to avoid breaking the test pipelines after new docker image is used.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for failing tests due to different versions of pgvector.
#### PR Summary
This pull request upgrades the pgvector version to 0.8.0 to address failing tests.
- Modified `bson_aggregation_pipeline_tests_vector_ivf.out` in `pg_helio_distributed` and `pgmongo` to temporarily disable specific tests until the pgvector upgrade is complete.
- Updated `commands_create_indexes_background.out` to temporarily disable tests related to vector index creation until the pgvector upgrade is complete.
Related work items: #3612979
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Perf
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[Perf] Adding early check for unshraded collection so that we don't need to convert pgbsonToBsonValue for unsharded collection.
----
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Testing
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Add helio_distributed_test_helpers to helio_compat tests
Without this, tests that rely on `helio_distributed_test_helpers` (e.g., tests for background index builds) crap out with an error like so:
```
CALL helio_distributed_test_helpers.create_indexes_background('db', '{ "createIndexes": "LargeKeySize", "indexes": [ { "key" : { "a": 1 }, "name": "rumConstraint1"}] }');
- retval | ok
----------------------------------------------------------------------
- { "raw" : { "defaultShard" : { "numIndexesBefore" : { "$numberInt" : "1" }, "numIndexesAfter" : { "$numberInt" : "2" }, "createdCollectionAutomatically" : false, "ok" : { "$numberInt" : "1" } } }, "ok" : { "$numberInt" : "1" } } | t
-(1 row)
-
+ERROR: procedure helio_distributed_test_helpers.create_indexes_background(unknown, unknown) does not exist
+LINE 1: CALL helio_distributed_test_helpers.create_indexes_backgroun...
+ ^
+HINT: No procedure matches the given name and argument types. You might need to add explicit type casts.
```
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request updates the test setup for `helio_compat` by adding a new test helper.
- `pgmongo/src/test/helio_compat/helio_setup_schedule`: Added `helio_distributed_test_helpers` to the test setup.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
update
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for memory check in maxN/minN aggregation functions.
#### PR Summary
This pull request addresses a bug in the memory check for maxN/minN aggregation functions by adding size validation and handling large element sizes.
- `bson_aggregates.c`: Added size validation for intermediate documents and updated element type handling to support int64.
- `bson_aggregation_pipeline_tests_maxnminn_group.out`: Added tests to verify the 100 MB limit for $maxN and $minN operations.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
On Update with Upsert, convert the final insert to INSERT ON CONFLICT UPDATE
This is to handle a race condition where two threads do SELECT for update -> don't find the doc -> one does the insert, and the other will get a unique conflict when it should just succeed.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces a new feature to handle upserts by converting the final insert to `INSERT ON CONFLICT UPDATE`.
- `oss/pg_helio_api/src/commands/insert.c`: Added `InsertOrUpdateDocument` function to handle upserts.
- `oss/pg_helio_api/src/commands/update.c`: Updated functions to use `InsertOrUpdateDocument` for upsert operations.
- `oss/pg_helio_api/include/commands/insert.h`: Declared the new `InsertOrUpdateDocument` function.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/commands_update.out` and `pgmongo/src/test/helio_compat/expected/commands_update.out`: Added tests for the new upsert behavior.
- `oss/internal/pg_helio_distributed/src/test/regress/sql/commands_update.sql`: Added SQL tests for upsert functionality.
### Does this PR have any customer impact? Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature
### 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? No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Support let variables with inlin projection
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for inline projection in the aggregation pipeline.
- Modified `oss/pg_helio_api/src/aggregation/bson_project.c` to handle new function OIDs for inline projection and addFields with let variables.
- Updated test files `/oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_pipeline_tests_let.out` and `/pgmongo/src/test/helio_compat/expected/bson_aggregation_pipeline_tests_let.out` to include new test cases for the inline projection feature.
- Added new SQL test cases in `/oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_pipeline_tests_let.sql` to validate the new functionality.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
When check-dist-minimal initially was added it didn't include `helio_distributed_setup` so 2 commits in parallel attempted to fix this. One by including minimal_schedule to the make target: https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/commit/36ace0cb18d7aed12de01f5e14d8ae3898e051ac?refName=refs%2Fheads%2Fusers%2Fdeepakbisht%2FfixMinimal
The other one by running `helio_distributed_setup` on the `minimal_schedule`: https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/commit/6cb01bd1c3ca9ec2584e50b8fff6808562e660e1?refName=refs%2Fheads%2Fmain&path=%2Foss%2Finternal%2Fpg_helio_distributed%2Fsrc%2Ftest%2Fregress%2Fminimal_schedule&_a=compare
We should take the second one as for correctness `check-dist-minimal` should not use `basic_schedule` as that "runs more than just the actual setup + the extra test provided".
Also, this cleans up duplicated `check-dist-minimal` targets on the make files.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a bug in the `check-dist-minimal` target.
- Removed `check-dist-minimal` target from `oss/internal/pg_helio_distributed/Makefile`
- Removed `check-dist-minimal` target from `oss/internal/pg_helio_distributed/src/test/regress/Makefile`
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Memory leak
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Freeing copy of ErrorData objects after error message has been written into a palloced Response object.
We discovered this while investigating postgres crash caused by _S_TEMP_STR_ workload. The crash was solved by this: https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1497598
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
Fixes a memory leak issue by ensuring error data is properly freed after use.
- `src/commands/update.c`: Added `FreeErrorData(errorData)` to free error data after appending to `batchResult->writeErrors`.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Fix oss index with public RUM after adding hooks to load custom handlers
After the hook change, the missingOk argument to load the function was set to false always, but we need to consider scenarios where we're using the public RUM (OSS), so the custom multiandgetbimap function would not be available.

----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
Fixes the issue with the OSS index when using public RUM by adding hooks to load custom handlers.
- `api_hooks.c`: Modified `GetMultiAndBitmapIndexFunc` to accept a `missingOk` parameter.
- `rum_custom_join_scan.c`: Updated `RegisterRumJoinScanNodes` to pass `missingOk` to `GetMultiAndBitmapIndexFunc`.
- `api_hooks.h`: Updated function declaration of `GetMultiAndBitmapIndexFunc` to include `missingOk` parameter.
### Does this PR have any customer impact? Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature
### 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? No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Support for Let on $groupBy with sorted accumulators.
Cast intermediate stage output from helio bson to catalog bson
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
format
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
No
### Description
fix document format and debug error with inline function
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a wiki formatting issue and a debugging error with an inline function.
- `schema_validation.h`: Changed the `CheckSchemaValidationEnabled` function from `inline` to `static inline`.
- `reference.md`: Fixed formatting issues by removing and adding backticks.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### 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?
pgmongo.enableEmbeddingGeneration, default is false(feature disabled)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
The goal of this feature is enable an inline embedding generation in vCore based on [azure_ai extension]
(https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/generative-ai-azure-openai)
Related design doc [Inline embedding generation in vCore ](https://microsoftapc-my.sharepoint.com/:w:/g/personal/zhli2_microsoft_com/Ea2uDc0c0FBNr-fpoMdHIPUBJiA5yXZ-xRRNWGYEBqZ38Q?e=dQdU7i&ovuser=72f988bf-86f1-41af-91ab-2d7cd011db47%2Crongwa%40microsoft.com&clickparams=eyJBcHBOYW1lIjoiVGVhbXMtRGVza3RvcCIsIkFwcFZlcnNpb24iOiI0OS8yNDAzMTQxNDcxMiIsIkhhc0ZlZGVyYXRlZFVzZXIiOmZhbHNlfQ%3D%3D)

- Feature Flag
**pgmongo.enableEmbeddingGeneration**
- Feature counter
**update_operator_vector_gen_embeddings**
**search_vector_gen_embeddings**
- Onboard AOAI resource([Part 3 PR](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1478366))
```
SELECT create_distributed_table('azure_ai.settings','key');
SELECT azure_ai.set_setting('azure_openai.endpoint','https://localhost.openai.azure.com');
SELECT azure_ai.set_setting('azure_openai.subscription_key','<api-key-placeholder>');
ALTER SYSTEM SET pgmongo.azureOpenAIEmbeddingDeploymentName = 'text-embedding-ada-002';
SELECT pg_reload_conf();
SELECT run_command_on_workers('ALTER SYSTEM SET pgmongo.azureOpenAIEmbeddingDeploymentName = ''text-embedding-ada-002''');
SELECT run_command_on_workers('SELECT pg_reload_conf()');
```
- Update command
```
SELECT mongo_api_v1.update('db',
'{"update":"generate_embedding_pipeline",
"updates":[
{"q":{},"u":{"**$generateEmbeddings**":{"a":"embeddings"}}, "multi":true}
]}'
);
```
- Vector search
```
SELECT document FROM bson_aggregation_pipeline('db',
'{ "aggregate": "generate_embedding_pipeline",
"pipeline": [
{ "$search": {
"cosmosSearch": { "query": "some sentence", "k": 4, "path": "embeddings", "efSearch": 2 } }
} ,
{ "$count": "_id" }
],
"cursor": {}
}'
);
```
----
#### AI description (iteration 1)
#### PR Classification
Refactor to support non-OSS embedding generation and vector search.
#### PR Summary
This pull request refactors update operations and search specifications to support embedding generation in non-OSS environments.
- Added `vector_g...
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Create azure_ai extension if it is available( in flex cluster)
- Add mock aoai server
- Add local only tests which will never be run in CI pipeline
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request integrates the `azure_ai` extension and adds local tests for embedding generation using a mock AOAI server.
- Added `scripts/mock_aoai/aoai_mock_server.py` to mock AOAI API server for local testing.
- Added `pgmongo/src/test/regress/sql/bson_aggregation_pipeline_tests_vector_gen_embedding.sql` and `pgmongo/src/test/regress/expected/bson_aggregation_pipeline_tests_vector_gen_embedding.out` for embedding generation tests.
- Updated `pgmongo/src/infrastructure/process_utility_hook.c` to check and create the `azure_ai` extension if available.
- Added `scripts/mock_aoai/setup_and_start_mock_server.sh` to set up and start the mock AOAI server.
- Modified `pgmongo/src/test/regress/Makefile` to include embedding generation tests with the mock server.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
[Bugfix] address compilation error on Ubuntu 24.04
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a compilation error on Ubuntu 24.04.
- Modified `src/commands/delete.c` to remove redundant null checks for `collection->shardTableName`.
Related work items: #3584480
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[Bug-Fix] setting merge whenMatched default option to merge from replace

----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request fixes a bug by setting the default `whenMatched` option to `merge` instead of `replace` in the merge operation.
- Added tests in `bson_aggregation_stage_merge_tests.out` to verify the default `whenMatched` behavior.
- Updated shard key values in `bson_aggregation_stage_merge_tests.out` to reflect the new default behavior.
### Does this PR have any customer impact?
yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
apply schema validation on general update
####Comments to follow:https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/pgmongo/pullRequest/1452968#1729531108
----
#### AI description (iteration 1)
#### PR Classification
New feature: Schema validation applied on general update operations.
#### PR Summary
This pull request introduces schema validation for update operations, ensuring documents comply with defined schemas during updates.
- Added `command_schema_validation_against_update` function and `ValidateSchemaOnDocumentUpdate` in `schema_validation.c` to handle schema validation during updates.
- Updated `bson_expr_eval.h` to include `ExprEvalState` struct definition.
- Modified `update.c` to integrate schema validation logic into batch and single document update processes.
- Enhanced `schema_validation_insert.sql` with tests for update operations involving schema validation.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This adds 2 hooks.
1. To override the default index am routine for the index handler.
2. To override the multiandbitmap function.
Also, adds some explain improvements and pushes limit down to the multiandbitmap.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature
### 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? No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Enable support for collation with $graphlookup
----
#### AI description (iteration 1)
#### PR Classification
New feature: Collation support for `$graphLookup` in the engine.
#### PR Summary
This pull request adds collation support to the `$graphLookup` operator, enabling locale-specific string comparison.
- `src/operators/bson_expression.c`: Added logic to handle collation strings in BSON expressions and pass them to relevant functions.
- `src/aggregation/bson_aggregation_nested_pipeline.c`: Updated functions to include collation handling in aggregation pipelines.
- `src/collation/collation.c`: Fixed typos and improved comments related to locale string handling.
Related work items: #3431063
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary

This pull request adds a memory usage check for the `maxN` and `minN` accumulators to prevent excessive memory consumption.
- `oss/pg_helio_api/src/aggregation/bson_aggregates.c`: Added a memory check to ensure the total size does not exceed the allowed limit, raising an error if it does.
- `oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_pipeline_tests_maxnminn_group.sql`: Added test cases to verify the memory limit enforcement for `maxN` and `minN`.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_pipeline_tests_maxnminn_group.out`: Updated expected output to include error messages for exceeding memory limits.
- `pgmongo/src/test/helio_compat/expected/bson_aggregation_pipeline_tests_maxnminn_group.out`: Updated expected output to include error messages for exceeding memory limits.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This ports the RUM fast scan improvements we've made into our RUM clone into helio_gin and also adds improvements like:
- multibitmap and, which is a strategy to instead of building multiple bitmaps on filters on multiple indexes and then intersecting them, we share the information of each of the bitmaps as they're built between them to build a single bitmap that honors all the filters.
- push limit down to the index.
These features where worked by @<Vinod Sridharan> and @<Dmitri Melnikov> on:
https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1485843
Next step is to actually load helio_gin on pgmongo behind a GUC and run tests against it.
----
#### AI description (iteration 1)
#### PR Classification
New feature and performance improvement.
#### PR Summary
This pull request ports improvements to the fast scan functionality and introduces new features for the Helio Gin index.
- `helio_gin/src/helioginget.c`: Added `initScanCore` and `MultiAndGetNextMatch` functions to enhance scan initialization and matching logic.
- `helio_gin/src/helioginget.c`: Implemented `helio_gin_multiandgetbitmap` to handle multi-scan operations and bitmap collection.
- Removed outdated functions and replaced them with optimized versions to improve performance and maintainability.
### Does this PR have any customer impact?
Yes.
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature.
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes.
### 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
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces scripts for unique index truncation opclass and updates the extension upgrade process.
- Added `extension_upgrade_unique_index_opclass.sql` for testing unique index opclass during extension upgrades.
- Updated `upgrade_schedule` to include the new unique index opclass test.
- Added `pgmongo--1.21-0--1.21-1.sql`, `pgmongo--1.22-0--1.22-1.sql`, and `pgmongo--1.21-0--1.21-1.sql` for unique index opclass updates.
- Modified `pgmongo--1.23-0--1.24-0.sql` to include unique index opclass scripts.
- Updated SHA1 checksum files for the new and modified SQL scripts.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Bug fix to update error codes from Postgres to HelioDB-specific codes. Checking and updating error codes for each command. FerretDB reported bug.
Related work items: #3554201
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Testing
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This test has two cases failed on GitHub.
One related to timezone "Europe/Amsterdam" which has a historical shift from "Amsterdam Mean Time" to Central European time in 1940, update this case to reflect modern timezone rules used now. refer to https://en.wikipedia.org/wiki/Time_in_the_Netherlands
Second one is related to that postgre added a overflow check, but pgmongo is still depending on old versions (15.3 and 16.2). there is a ongoing bugfix for postgre which blocks us from bumping up versions used in pgmongo. For now, we can skip this case.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for failing tests.
#### PR Summary
This pull request addresses errors in the `bson_aggregation_date_operators_tests` by updating test cases to handle overflow checks introduced in newer PostgreSQL minor versions.
- `bson_aggregation_date_operators_tests.out`: Commented out test cases causing overflow errors and added TODOs for future updates.
- `bson_aggregation_date_operators_tests.sql`: Commented out overflow test cases and added TODOs for future updates.
- `helio_compat/expected/bson_aggregation_date_operators_tests.out`: Synchronized changes with the main test output file, including commenting out overflow test cases.
Related work items: #3572010
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Testing only
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
we have 2 tests failed due to different rums being used. In pgmogo we have custom rum, but on GitHub we use public rum instead. Before we publish custom rum to public, we need to keep related tests in pgmongo and not moving them into distributed tests.
----
#### AI description (iteration 1)
#### PR Classification
Failing test
#### PR Summary
This pull request addresses failing tests by moving two test files that depend on custom RUM back to the `pgmongo` directory.
- Deleted `bson_index_fast_scan_tests.out` and `bson_index_fast_join_scan_tests.out` from `oss/internal/pg_helio_distributed/src/test/regress/expected`.
- Moved `bson_index_fast_join_scan_tests.out` and `bson_index_fast_scan_tests.out` to `pgmongo/src/test/regress/expected`.
- Moved `bson_index_fast_join_scan_tests.sql` and `bson_index_fast_scan_tests.sql` to `pgmongo/src/test/regress/sql`.
- Updated `basic_schedule_core` to remove the moved tests.
- Updated `bson_schedule` to include the moved tests.
Related work items: #3572014
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature/Bugfix
### 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
Fix up truncation for unique indexes behind a flag.
- This is part 1 of many. This makes unique conflicts with truncation harder to hit with the hash of the untruncated value stored as a compound term with the shard_key.
- Subsequent changes should make it so that even on hash collision the values should be validated.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces support for creating unique indexes with truncation in the Helio API.
- `helio_api_init.c`: Added a new configuration `enable_large_unique_index_keys` to allow large unique index keys.
- `create_indexes.c`: Modified logic to support large unique index keys and handle truncation.
- `bson_unique_index.sql` and `bson_unique_index.out`: Added tests for creating unique indexes with and without truncation.
- `helio_distributed_test_helpers.sql` and `helio_distributed_test_helpers.out`: Added tests for native colocation settings.
- `Makefile` and related files: Added a new `check-dist-minimal` target for minimal distributed tests.
### Does this PR have any customer impact?
Maybe
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bug
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Flushing error data in the PG_CATCH after MultiUpdate failure
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
Fixes a potential memory leak issue when copying error data in the update command.
- `src/commands/update.c`: Added `FreeErrorData(errorData)` to ensure error data is properly freed after use.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses an issue with DBRef index handling in the query operator.
- `query_operator.c`: Simplified the creation of DBRef qualifiers by consolidating the `$ref`, `$id`, and `$db` fields into a single BSON value.
- `bson_aggregates_distinct_tests.out` and `bson_aggregates_distinct_tests.sql`: Added tests for inserting documents with DBRefs and creating indexes on these fields.
- `reference.md`: Updated documentation to reflect changes in DBRef handling and indexing.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
make setOnInsert no-op instead of error
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a bug where the `$setOnInsert` operator would cause an error instead of being a no-op when `upsert` is set to `false`.
For example,
mongos> coll.find()
{ "_id" : "double", "v" : 42.13 }
{ "_id" : "array", "v" : [ 42 ] }
mongos> db.runCommand({update: 'test', updates: [{q: {_id: 'double'}, u: {$setOnInsert: {'v.foo': NumberInt(1)}}}]})
{
"n" : 0,
"nModified" : 0,
"writeErrors" : [
{
"index" : 0,
"code" : 28,
"errmsg" : "Cannot create field 'v' in element {v : 42.13}"
}
],
"ok" : 1
}
mongo returns { "n" : 1, "nModified" : 0, "ok" : 1 }
Related work items: #3463180
### Does this PR have any customer impact? No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Perf
### 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? No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) No
### Description
Migrate `$isNumber`, `$type`, `$toBool`, `$toObjectId`, `$toInt`, `$toLong`, `$toString`, `$toDate`, `$toDouble`, `$toDecimal`, and `$convert` to the new aggregation framework.
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for type aggregation operations.
#### PR Summary
This pull request optimizes the handling of type aggregation operations, specifically focusing on the `$convert` and `$makeArray` expressions.
- `src/operators/bson_expression_type_operators.c`: Refactored the `$convert` expression to pre-parse and handle arguments more efficiently, reducing redundant evaluations and improving error handling.
- Added new functions to handle pre-parsed `$convert` and `$makeArray` expressions, ensuring better performance and cleaner code structure.
Related work items: #3458660
### Does this PR have any customer impact? It fixes an upgrade blocked due to a syntax error
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Fixing a syntax error in cluster upgrade
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a syntax error in the cluster upgrade process.
- Added new test files `extension_upgrade_add_role_creation_privileges_1.21-0.out` and `extension_upgrade_add_role_creation_privileges_1.21-0.sql` to validate the upgrade process.
- Fixed a syntax error in `cluster_operations.c` by changing `quote_literal_cstr` to `quote_identifier` for the `ClusterAdminRole`.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
remove duplicated dependency which caused build error on github, example error log:
In file included from src/commands/users.c:22:
/usr/include/postgresql/pg_config.h:35: error: "CONFIGURE_ARGS" redefined [-Werror]
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
Removed an unnecessary dependency to streamline the code.
- `users.c`: Removed the inclusion of `pg_config.h` as it was not needed.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
more
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for array aggregation operators.
#### PR Summary
This pull request optimizes the handling of array aggregation operators by refactoring and consolidating code.
- `src/operators/bson_expression_array_operators.c`: Refactored the `$filter` operator parsing and processing, including error handling and validation.
- Consolidated and optimized the `$slice`, `$isArray`, `$in`, `$size`, `$arrayElemAt`, `$first`, `$last`, `$objectToArray`, `$arrayToObject`, and `$concatArrays` operators.
- Improved error messages and validation checks for various array operations.
Related work items: #3458685
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1. Fixing the salt length used when prehashing passwords when creating secondary users.
2. Adding support for forAllDBs
3. Added a JS test
4. Disabled JS test for RUST and MultiCoordinator scenarios Work Item to add support for multi coordinator scenarios (https://msdata.visualstudio.com/CosmosDB/_workitems/edit/3575602)
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to ensure the default salt length does not exceed the maximum allowed length.
#### PR Summary
This pull request fixes the default salt length validation and introduces a new configuration variable for it.
- `src/commands/users.c`: Added validation for default salt length and implemented `pg_be_scram_build_secret` function.
- `src/helio_api_init.c`: Defined a new configuration variable `helio_api.scramDefaultSaltLen` and set its default value.