### Does this PR have any customer impact? No
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Support collation with comparison of `array` and `document` values.
Also adds support for `$in` on nested arrays and documents.
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds support for collation-aware hashing of arrays and documents in BSON.
#### PR Summary
This pull request introduces collation-aware hashing for BSON arrays and documents, enhancing the handling of collation in hash sets. It refactors existing hash functions to accommodate collation strings and recursive hashing of nested BSON structures.
- `hashset_utils.c`: Implements collation-aware hashing functions for BSON values, including recursive handling of arrays and documents.
- `bson_expression_set_operators.c`: Replaces existing hash set creation with collation-aware hash set creation.
- `bson_dollar_operators.c`: Updates logic to use collation-aware hash sets for `$in` queries, removing unsupported scenarios.
- `hashset_utils.h`: Adds a new struct `BsonValueHashEntry` to store BSON values with collation strings.
- `collation.h`: Moves `IsBsonTypeCollationAware` function to handle collation applicability checks.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4111861, #4115239
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature/POC
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Fix up runtime index recheck function support to reduce loading documents.
This should reduce the number of runtime rechecks that are needed for documents and trust the index more as we will evaluate these clauses directly on the index first.
Also add option to trigger jstest coverage for the new opclass - and set them to run on the MX jstests - this is still disabled right now since there are some failing tests but will be enabled separately.
----
#### AI description (iteration 1)
#### PR Classification
New feature: This pull request introduces runtime functions for composite index operations and enhances test coverage.
#### PR Summary
This pull request enables runtime functions for composite index operations, improving the flexibility and efficiency of index handling. It also adds test coverage to ensure the reliability of these new features.
- `bson_gin_composite_entrypoint.c`: Refactored comparison logic to support runtime functions for index rechecks.
- `bson_gin_composite_core.c`: Implemented `IsValidForIndexValue` function to handle various BSON index strategies with runtime rechecks.
- `create_indexes.c`: Modified index creation logic to conditionally enable new composite index opclass based on configuration.
- `bson_gin_composite_private.h`: Added `IndexRecheckArgs` structure to support runtime recheck strategies.
- `testing_configs.c`: Introduced configuration options for enabling the new composite index opclass by default.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
- The asserts enabled build fails for missing permsInfo on planned statement, add it while creating the Point read plan
----
#### AI description (iteration 1)
#### PR Classification
Bug fix: Add permission information to planned statements for PostgreSQL versions greater than 16.
#### PR Summary
This pull request addresses a bug in the point read path by adding permission information to planned statements for PostgreSQL versions 16 and above. This change is part of optimizing the read hotpath as per the linked work item.
- In `/oss/pg_documentdb/src/planner/documents_custom_planner.c`, added `permInfos` to the planned statement for PostgreSQL versions 16 and above.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4157027
### 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)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
- add cursor result type for UDFs, this helps PG to not always try to figure out the `OUT` variables and form a tuple descriptor

----
#### AI description (iteration 1)
#### PR Classification
Performance improvement and API change.
#### PR Summary
This pull request introduces performance improvements for point reads by adding a new cursor type for SQL functions. It modifies existing functions to return a structured type instead of a record, enhancing efficiency and clarity.
- `query_cursors_aggregate--latest.sql`: Added `cursor_result` type and updated several functions to return this type instead of a record.
- `query_cursors_aggregate--0.103-0.sql`: Newly added file with similar changes as `query_cursors_aggregate--latest.sql`.
- `documentdb--0.102-1--0.103-0.sql` and `pgmongo--1.102-1--1.103-0.sql`: Updated to include the new `query_cursors_aggregate--0.103-0.sql` file.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4157027
### Does this PR have any customer impact?
No
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Now that diskann supports Pg17, enable consumption of diskann in pg17.
----
#### AI description (iteration 1)
#### PR Classification
Infrastructure update to enable the `diskann` extension on PostgreSQL 17.
#### PR Summary
This pull request removes previous restrictions and enables the `diskann` extension to be built and packaged for PostgreSQL 17, addressing compatibility issues.
- Removed conditional checks in `oid_cache.c` and `process_utility_hook.c` that prevented `diskann` support for PG17.
- Updated `pipeline_create_setup_packages.sh` and `install_setup_pg_diskann.sh` to allow packaging and installation of `pg_diskann` for PG17.
- Modified `pipeline_build_extension_core.sh` to remove PG17-specific build skips for `diskann`.
- Adjusted test configurations in `test_mutate_17` by removing specific test skips related to `diskann`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
With the release of [pgvector 0.8.0](https://github.com/pgvector/pgvector/tree/5bc7937715c67add21c8bcc0d4284162c7a0174f?tab=readme-ov-file#iterative-index-scans), which supports iterative scan for HNSW and IVF, we enable it in filtering search to support pre-filtering(currently it is post-filtering)
- Pass the new parameter "iterativeScan" through the function bson_search_param from the coordinator to the worker.
Example : { "efSearch" : 10, "iterativeScan" : "relaxed_order"}
- Enable iterative scan for hnsw/ivf index on workers:
SET LOCAL hnsw.iterative_scan = relaxed_order;
SET LOCAL ivfflat.iterative_scan = relaxed_order;
relaxed_order by default, which allows results to be slightly out of order by distance, but provides better recall.
After iterative search, re-ordering will be applied to the results.
- Set iterative scan for diskann index to relaxed_order
SET LOCAL diskann.iterative_search = relaxed_order;
- Check the availability of iterative scan in pgvector
The pgvector iterative scan is available from version 0.8.0. Currently, if the pgvector extension has not been upgraded to 0.8.0, the iterative scan will be disabled in those clusters until pgvector is upgraded to 0.8.0.
###Related GUCs
**documentdb.vectorPreFilterIterativeScanMode**: enable iterative index scans, which will automatically scan more of the index until enough results are found (relaxed_order by default)
- off, disable iterative scan
- relaxed_order, allows results to be slightly out of order by distance, but provides better recall
- strict_order, ensures results are in the exact order by distance
####GUCs from pgvector
**hnsw.max_scan_tuples**: Specify the max number of tuples to visit (20,000 by default)
**hnsw.scan_mem_multiplier**: Specify the max amount of memory to use, as a multiple of work_mem (1 by default)
**ivfflat.max_probes**: Specify the max number of probes(32768 by default)
###Mongo Command(no change in this PR)
```
db.testing_hnsw_vector_collection.aggregate(
[
{
"$search": {
"cosmosSearch": {
"vector": [ 3.0, 4.9, 1.0 ],
"path": "vect",
"filter": {"meta.a": [ { "b" : 3 } ]},
"k": 4,
"efSearch": 100
},
}
},
{
"$project": {
"rank": {
"$floor": [{"$multiply": [{ "$meta": "searchScore"},100000]}]
}
}
}
])
```
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces iterative index scans for HNSW and IVF in filtering searches, enhancing the pre-filtering capabilities of vector searches...
### 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
Moved Cipher Map out of OSS. The cipher map is needed for internal logging purposes only so it is moved to the native gateway and moved out of the OSS gateway.
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and refactoring.
#### PR Summary
This pull request refactors the code by moving the cipher list out of the open-source section of the codebase, as it is only used for telemetry purposes.
- Added `get_cipher_type` function in `gateway/native/src/main.rs` to handle cipher mapping.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4053610
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Documentation
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
Push pg_documentdb_gw for documentdb connections
### Description
add line to changelog
----
#### AI description (iteration 1)
#### PR Classification
Documentation update.
#### PR Summary
This pull request updates the changelog to include a new feature related to `pg_documentdb_gw`.
- Updated `/oss/CHANGELOG.md` to document the addition of `pg_documentdb_gw` for DocumentDB connections.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Set default prefilter feature flag to true
----
#### AI description (iteration 1)
#### PR Classification
Enable prefiltering by default for vector search, addressing the iterative filtering search work item.
#### PR Summary
This pull request modifies the vector search functionality to enable prefiltering by default, optimizing query execution by utilizing index scans instead of sequential scans and sorting. This change is expected to improve performance and efficiency in vector search operations.
- Changes in `/pgmongo/src/test/docdb_compat/expected/bson_aggregation_pipeline_tests_vector_hnsw_planner.out`: Replaced sequential scans and sorts with index scans for vector search queries.
- Changes in `/oss/internal/pg_documentdb_distributed/src/test/regress/expected/bson_aggregation_pipeline_tests_vector_mongo.out`: Updated to use index scans, improving query performance.
- Changes in `/pgmongo/src/test/docdb_compat/expected/bson_aggregation_pipeline_tests_vector_mongo.out`: Enabled index-based filtering, replacing unsupported filter errors with index checks.
- Changes in `/oss/internal/pg_documentdb_distributed/src/test/regress/expected/bson_aggregation_pipeline_tests_vector_ivf.out`: Reduced the number of returned rows by using index scans for vector searches.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #3612471
### Does this PR have any customer impact?
Yes, by this PR, $toDate could process string case
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Enhancement for exsiting operator
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
N/A
### Are you introducing any new config? If yes, do you have tests with and without them being set?
N/A
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
Add string case support for '$toDate' operator
### Description
Before this PR, `$toDate` could not parse a string to datetime. With this PR, we leverage the ability of `$dateFromString` to finish the support of string case for `$toDate` operator
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for string case conversion in the `$toDate` operator.
- Added `StringToDateWithDefaultFormat` function in `bson_expression_date_operators.c` to handle string to date conversion.
- Updated `ProcessDollarToDate` in `bson_expression_type_operators.c` to utilize the new string conversion function.
- Added tests for string case conversion in `$toDate` operator in `bson_aggregation_type_operators_tests.sql`.
- Updated documentation and release notes to reflect the new feature.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
No
### 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?
Yes
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Adding support Product Quantization (PQ) compression in vector index, which is a popular method for dramatically compressing high-dimensional vectors to use less memory, and for making nearest-neighbor search faster.
Note: currently, this PQ compression is only supported by the Diskann index.
### Related GUCs
**documentdb.enableVectorCompressionPQ**: Enables vector PQ compression (enabled by default).
### Create index spec:
- **compression**(optional):
- "half": half-precision vector, which using 16 bits floats.
- "pq": product quantization compression.
- **pqCompressedDims**(optional): indicates the dimensions after compression. If not specified, it will be automatically calculated based on the original dimensions.
- Minimum: 1
- Maximum: 8000
- **pqSampleSize**(optional):Indicates the number of samples PQ uses to generate the initial centroids. The default value is 1000.
- Minimum: 1000
- Maximum: 100000
**Note**: It is recommended to create the index after the collection has some data.. If the collection is empty, random vectors within the range [-1, 1] are used to generate the initial centroids and create the index. If the number of documents is less than pqSampleSize, the training data is padded with random data within the range [min, max] from the sampled vector data.
### Command example
```
db.runCommand(
{ "createIndexes": "testing_vector_collection", "indexes":
[{
"key": { "v": "cosmosSearch" },
"name": "hsnw_index",
"cosmosSearchOptions":
{
"kind": "vector-diskann",
"similarity": "L2",
"dimensions": 1536,
"compression": "pq",
"pqCompressedDims": 96,
"pqSampleSize": 2000
}
}]
} )
```
### Search spec:
No changes
----
#### AI description (iteration 1)
#### PR Classification
New feature: This pull request adds support for Product Quantization (PQ) compression in the Diskann index.
#### PR Summary
This pull request introduces support for PQ compression in the Diskann index, enhancing vector search capabilities. It includes error handling for unsupported compression types and validation for PQ parameters.
- Updated `/pgmongo/src/test/regress/expected/bson_aggregation_pipeline_tests_vector_diskann.out` to include tests for PQ compression, error cases, and validation of PQ parameters such as `pqCompressedDims` and `pqSampleSize`.
- Added tests for vector search with PQ compression, including L2, cosine, and IP similarity measures.
- Implemented checks for maximum dimensions and resource limits during PQ index creation.
<!-- GitOpsUserAgent=GitOps.Apps.S...
### 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
Changing max user limit to 500
----
#### AI description (iteration 1)
#### PR Classification
Configuration change to increase the maximum user limit.
#### PR Summary
This pull request increases the maximum user limit from 10 to 500 in the system configuration and related test files.
- Updated `MAX_USER_LIMIT` from 10 to 500 in `/oss/pg_documentdb/src/configs/system_configs.c`.
- Modified `/oss/pg_documentdb/src/test/regress/sql/user_crud_commands.sql` to reflect the new user limit in test cases.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
We are adding the following constraints for username and password:
**Username**
- The username length must be greater than 0 and less than or equal to 63 characters.
**Password**
- The password length must be between 8 and 256 characters (inclusive).
- The password must satisfy at least 3 of the following 4 conditions:
- Contains at least one lowercase letter.
- Contains at least one uppercase letter.
- Contains at least one digit.
- Contains at least one special (non-alphanumeric) character.
- The password must not contain any 3-character substring of the username (case-insensitive).
Related work items: #3916282
### 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
Enabling pgmongo.enableWriteProcedures In pipeline with fixing issue.
If maxTimeMS is provided we should not run write procedure instead we should use write functions.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to improve high concurrency write performance.
#### PR Summary
This pull request addresses performance issues related to high concurrency updates by enabling write procedures and refining transaction handling.
- In `PostgresClient.cs`, added a condition to check for `CommandTimeout` before executing requests with write procedures.
- In `utils.sh`, enabled the `pgmongo.enableWriteProcedures` configuration to support the use of write procedures.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4093126
### 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
Version update for the release of version 103.
#### PR Summary
This pull request updates the version numbers across several control files and adds release notes for version 1.103 and 1.104. It also includes changes to SQL files and their corresponding SHA1 checksums.
- `/oss/internal/pg_documentdb_distributed/documentdb_distributed.control`, `/oss/pg_documentdb/documentdb.control`, `/oss/pg_documentdb_core/documentdb_core.control`, and `/pgmongo/pgmongo.control`: Updated default version numbers.
- `/docs/release_notes/pgmongo_1.103.md` and `/docs/release_notes/pgmongo_1.104.md`: Added release notes for versions 1.103 and 1.104.
- `/pgmongo/sql/pgmongo--1.103-1--1.104-1.sql`: Added new SQL file for version transition.
- `/docs/release_notes/toc.yml`: Updated table of contents to include new release notes.
- `/oss/CHANGELOG.md`: Added entry for documentdb v0.104-0.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4140262
### 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
Removing Insert dead code
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes dead code related to the `TryInsertOne` function, which is no longer needed in the codebase.
- Removed the `TryInsertOne` function from `src/commands/insert.c`.
- Deleted the `TryInsertOne` function declaration from `include/commands/insert.h`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
- Add a new section for tracking feature flags
- Add a feature counter to track customers whoc an benefit from the new rum_index_scan.
----
#### AI description (iteration 1)
#### PR Classification
Refactoring and feature enhancement with added tracking capabilities.
#### PR Summary
This pull request refactors feature flags and introduces new tracking capabilities for feature usage. It reorganizes the feature flag sections and adds new flags for various functionalities.
- Refactored and added new feature flags in `feature_flag_configs.c`, including indexing, planner, and aggregation features.
- Updated `custom_scan_continuation.c` to improve index scan handling and added feature usage reporting.
- Modified `insert.c` to handle snapshot management more effectively.
- Enhanced feature usage tracking in `feature_counter.c` and `feature_counter.h` by adding a new feature counter for index scans with limits.
- Updated test expectations in multiple files to reflect the new feature tracking changes.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
For the Update stored procedure for an unsharded collection on a remote node, we would typically delegate the entire request to the worker and process it there.
With a SPROC, we can't delegate the whole thing to the worker. At the same time we can't make it request by request doing RPC to the worker. This change strikes a balance between the two, where we get batches of batchWriteInternalSubTransactionCount (~512) requests, and call update worker with it. Each batch is run as a single transaction on the worker, parsed, evaluated and Commited within the function. And then the outer Sproc commits the whole thing.
This balances between minimizing RPCs and Committing Frequently.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces support for unsharded remote collections in the update procedure, enhancing the functionality of batch updates. Key changes include:
- `update.c`: Added functions to deserialize writer errors and upserted results, serialize update batch parameters, and process batch updates non-transactionally for unsharded collections.
- `commands_update_bulk.out`: Updated expected test outputs to reflect changes in batch update behavior.
- `commands_update_bulk.sql`: Modified SQL tests to disable local writes and test batch update functionality with remote collections.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4093126
### 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
Currently bulk insert run as a function which means that the entire execution runs as a single transaction. Each batch insert is handled as a subtransaction and rolled back to a save point if it fails.
This means that document locks are held for longer, and we can hit limits w.r.t. max documents updated per transaction.
In multi-node setups this also means distributed transactions are held longer causing loss of connection pools.
This change introduces a stored procedure for bulk insert that periodically "Commits" the state to WAL and starts a new transaction. This more mirrors what the non-atomic bulk update is supposed to do. The old function is retained to be used within transactions.
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for write commands.
#### PR Summary
This pull request introduces a new procedure for handling write commands, enhancing performance by optimizing user-specific command execution. It includes the addition of new functions and procedures to manage MongoDB operations more efficiently.
- Added new SQL functions and procedures in `/pgmongo/sql/udfs/gateway_funcs/command_funcs--1.103-0.sql` for running commands, queries, DDL, and write operations as a specific user.
- Introduced new insert functions and procedures in `/oss/pg_documentdb/sql/udfs/commands_crud/insert--0.103-0.sql` to handle MongoDB insert operations.
- Implemented `pgmongo_run_write_procedure_as_user` and `ExecuteWriteCommandCore` in `/pgmongo/src/infrastructure/command_funcs.c` to manage write commands with user context.
- Added `CommitOuterInsertTransactions` function in `/oss/pg_documentdb/src/commands/insert.c` to handle transaction commits outside of transaction blocks.
- Introduced a feature flag `EnableWriteProcedure` in `/oss/pg_documentdb/src/configs/feature_flag_configs.c` to control the enabling of write procedures.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
dependency library upgrade
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
upgrade dependency rust libraries in GW to solve vulnerability alert in github repo.
----
#### AI description (iteration 1)
#### PR Classification
Dependency upgrade.
#### PR Summary
This pull request upgrades several Rust library dependencies to their latest versions to ensure compatibility and security improvements.
- `Cargo.lock`: Updated versions for multiple packages including `ring`, `cc`, `openssl`, `tokio`, and removed `spin`.
- `Cargo.toml`: Updated `openssl` version from `0.10.64` to `0.10.72`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact? No
### 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? No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Add a new bson_expression_get that appends the collationString to the got value, if a valid collationString is passed to it.
This will be used as a helper function to operations that rely on bson_expression_get to pass down collation such as bson_lookup_join_filter.
If no collation string is passed as an arg, we simply return the got value.
----
#### AI description (iteration 1)
#### PR Classification
New feature to support `$graphLookup` in the engine with collation.
#### PR Summary
This pull request adds support for `$graphLookup` with collation in the engine.
- Added new functions in `oss/pg_documentdb/sql/udfs/aggregation/bson_lookup_functions--0.103-0.sql` for `$graphLookup` operations.
- Modified `oss/pg_documentdb/src/aggregation/bson_aggregation_nested_pipeline.c` to handle collation in `$graphLookup` join filters.
- Updated `oss/pg_documentdb/src/operators/bson_expression.c` to remove collation handling from `bson_expression_get`.
- Added `BsonDollarLookupJoinFilterWithCollationFunctionOid` in `oss/pg_documentdb/src/metadata/metadata_cache.c`.
- Adjusted collation handling in `oss/pg_documentdb/src/query/bson_dollar_operators.c` for `$graphLookup`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4104899
### Does this PR have any customer impact?
No
### 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?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Currently bulk updates run as a function which means that the entire execution runs as a single transaction. Each batch update is handled as a subtransaction and rolled back to a save point if it fails.
This means that document locks are held for longer, and we can hit limits w.r.t. max documents updated per transaction.
In multi-node setups this also means distributed transactions are held longer causing loss of connection pools.
This change introduces a stored procedure for bulk update that periodically "Commits" the state to WAL and starts a new transaction. This more mirrors what the non-atomic bulk update is supposed to do. The old function is retained to be used within transactions.
Still TODO:
For unsharded collections in a multi-node setup, we need to send batches of updates to the worker. This is not wired up in this change.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces a new bulk update feature for handling non-transactional updates in the MongoDB wire-protocol. It adds new functions and procedures to support bulk updates and modifies existing update logic to accommodate this new functionality.
- Added `update_bulk` procedure and related functions in `sql/udfs/commands_crud/update--0.103-0.sql` for non-transactional bulk updates.
- Implemented `command_update_bulk` in `src/commands/update.c` to handle bulk updates outside of transactions.
- Enhanced `ProcessBatchUpdateCore` in `src/commands/update.c` to support transactional and non-transactional updates.
- Updated feature tracking in `include/utils/feature_counter.h` and `src/infrastructure/feature_counter.c` to include `FEATURE_COMMAND_UPDATE_BULK`.
- Modified SQL scripts `documentdb--0.102-1--0.103-0.sql` and `pgmongo--1.102-1--1.103-0.sql` to include the new update functionality.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
[oss] add copyright headers for pg_documentdb_gw
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request adds copyright headers to multiple source files in the `pg_documentdb_gw` project to ensure proper attribution and legal compliance.
- Added copyright headers to all source files in the `pg_documentdb_gw` directory, including `src/auth.rs`, `src/bson.rs`, and `src/configuration` modules.
- Updated files in the `src/context`, `src/explain`, `src/postgres`, `src/processor`, `src/protocol`, `src/requests`, and `src/responses` directories with copyright headers.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Direct user related queries to coordinator
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request enables user operations (create, drop, update) to be executed from any node in the cluster.
- `users.c`: Added logic to forward user operations to the metadata coordinator if the current node is not the coordinator.
- `users.c`: Implemented error handling and response formatting for distributed user operations.
- `users.c`: Included necessary header `api_hooks.h` for the new functionality.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
- pgbsonelement today copies the bson_value_t buffer always, use the referrence in critical places to avoid copy
Before the fix

After the fix

----
#### AI description (iteration 1)
#### PR Classification
Code optimization
#### PR Summary
This pull request introduces optimizations for point reads by avoiding the copying of BSON value buffers.
- `include/io/pgbsonelement.h`: Added `pgbsonelementref` struct and `BsonIterToPgbsonElementRef` function.
- `src/query/bson_compare.c`: Updated comparisons to use `pgbsonelementref` instead of `pgbsonelement`.
- `src/io/pgbsonelement.c`: Implemented `BsonIterToPgbsonElementRef` function.
- `src/query/bsonquery_compare.c`: Modified query comparison logic to utilize `pgbsonelementref`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
Yes
### 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?
Yes
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Improve index build and insert performance (especially for wildcard indexes).
The current wildcard indexes are heavily bloated - for 50 GB of data that is very array/document heavy, we could end up producing a 300 GB index in some cases.
To improve this, there's considerations of parallel index builds (introduced in PG17+), but also there's something to be said about reducing index bloat. This PR does that in two ways:
1) Given that index truncation happens at ~2500 bytes (or less), the possibility of compression for index terms is low. Therefore, even if the primary document is compressable, the index isn't. This introduces compression for index entries with a custom GUC that manages that. Especially for larger arrays and documents this yields a non-trivial saving.
2) There's a realization that with wildcard indexes and arrays, there's term duplication: An path `"a": [ 1, 2, 3 ]` generates
```
{ "a": [ 1, 2, 3 ] }
{ "a": 1 }
{ "a": 2 }
{ "a": 3 }
{ "a.0": 1 }
{ "a.1": 2 }
{ "a.2": 3 }
```
where the last 3 terms can be made redundant with the first 3. this attempts to remove those extra terms by now only generating:
```
{ "a": [ 1, 2, 3 ] }
{ "a": 1 }
{ "a": 2 }
{ "a": 3 }
```
Query plans that query a.0 will not be pushed to this index currently.
However, in the future this can be removed by querying a.0 as 'a' and running a runtime recheck.
Given that this only impacts queries that explicitly query by integer keys, and on wildcard indexes, this is deemed acceptable for the improvement in size reduction on the index.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces support for wildcard terms in the indexing system, enhancing query capabilities and performance.
- Refactored `SerializeBsonIndexTermCore` in `gin_index_term.c` to use a new helper function `BuildSerializedIndexTerm`.
- Added `SerializeBsonIndexTermWithCompression` function in `gin_index_term.c` for handling compressed index terms.
- Implemented `QueryPathHasDigits` and `FailIfQueryPathHasDigitsForWildcard` functions in `bson_gin_entrypoint.c` to validate query paths for wildcard indexes.
- Updated various query extraction functions in `bson_gin_core.c` to use `filterElement` from `BsonExtractQueryArgs` instead of directly accessing the query.
- Enhanced `GenerateIndexExprStr` in `create_indexes.c` to include options for reduced wildcard terms and generating not-found terms.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
No
### 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?
Yes
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
With the release of pgvector 0.7.0, which supports [Half-Precision Indexing](https://github.com/pgvector/pgvector?tab=readme-ov-file#half-precision-indexing), vectors can have up to 4,000 dimensions
###Related GUCs
**documentdb.enableVectorCompressionHalf**: enable vector compression(enabled by default)
- off, disable vector compression
- on, enable vector compression
###New parameters
- Create index spec: "compression": string
"half": half-precision vector, which using 16 bits float
- Search spec: "oversampling": double
Oversampling factor: Oversampling retrieval from half index to compensate for the loss of precision.
Minimum value is 1. This parameter is only permitted when a compression method is used on the vector index.
For example, if oversampling=1.5 and k=10, then oversampling*k=15 vectors from a compressed index. Then, the full 32-bits vector will be used for the subsequent ordering and scoring,
###Mongo Command
```
db.runCommand(
{ "createIndexes": "testing_vector_collection", "indexes":
[{
"key": { "v": "cosmosSearch" },
"name": "hsnw_index",
"cosmosSearchOptions":
{
"kind": "vector-hnsw",
"similarity": "L2",
"dimensions": 3,
"compression": "half"
}
}]
} )
```
```
db.testing_hnsw_vector_collection.aggregate(
[
{
"$search": {
"cosmosSearch": {
"vector": [ 3.0, 4.9, 1.0 ],
"path": "vect",
"filter": {"meta.a": [ { "b" : 3 } ]},
"k": 4,
"efSearch": 100,
"oversampling": 2.0
},
}
},
{
"$project": {
"rank": {
"$floor": [{"$multiply": [{ "$meta": "searchScore"},100000]}]
}
}
}
])
```
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for half-precision vector indexing in the vector search functionality.
- `metadata_cache.c`: Added functions for half-precision vector similarity operators and functions.
- `SearchTests.cs`: Added integration tests to validate half-precision vector search, including error cases and index creation scenarios.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
No
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
This pr adds a Rust gateway for documentdb in the pg_documentdb_gw folder
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
- Add insert command duplicate field backend test
----
#### AI description (iteration 1)
#### PR Classification
New feature and documentation.
#### PR Summary
This pull request adds tests for inserting documents with duplicate fields and documents the server behavior regarding such inserts.
- Added tests in `commands_insert.out` and `commands_insert.sql` to verify the server does not deduplicate documents with duplicate fields.
- Updated `insert.c` to document that the server does not attempt to deduplicate documents during insertion.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
ppa:ubuntugis/ppa is a Personal Package Archive (PPA) maintained by the UbuntuGIS project. Change to use official ubuntu packages(https://pkgs.org/search/?q=libgeos) to improve stabilities and align versions for different arch types.
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request updates the source of `libgeos` to use the official Ubuntu packages.
- Updated `/.devcontainer/Dockerfile` to remove specific versions of `libgeos` and use the official Ubuntu packages.
- Updated `/oss/.devcontainer/Dockerfile` to remove specific versions of `libgeos` and use the official Ubuntu packages.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### 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
Add support of pushing down $in queries to indexes with a partial filter expression that is applicable in a lower schema version.
----
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Other
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
NA
### Description
- cleanup Oss.
- Remove referrences of `vCore` or `aka.ms` short links
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes references to 'vCore' and aka.ms short links from the codebase.
- `scripts/validate_helio_extension_state.sh`: Added checks to ensure no 'vCore' or aka.ms links are present.
- `pgmongo/src/infrastructure/logger_hooks.c`: Removed aka.ms link from error messages and added a function to update errors.
- `oss/pg_documentdb/src/commands/users.c`: Removed aka.ms link from user count limit error message.
- `oss/internal/pg_documentdb_distributed/src/test/regress/sql/bson_aggregation_string_operators_tests.sql`: Updated test cases to replace 'vcore' with 'v_core'.
- `pgmongo/src/test/regress/expected/user_crud_commands.out`: Adjusted error messages to remove aka.ms links.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact? No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Aggregation stages which do not support collation yet:
`bucket, group, setWindowFields, fill, geoNear, sortByCount`
If collation is provided for an aggregation whose pipeline has any of these stages, the aggregation fails with `FEATURE_NOT_SUPPORTED`
----
#### AI description (iteration 1)
#### PR Classification
Code enhancement to handle unsupported aggregation stages with collation.
#### PR Summary
This pull request adds error handling for unsupported aggregation stages when collation is applied.
- `bson_aggregation_pipeline.c`, `bson_aggregation_nested_pipeline.c`, `bson_aggregation_window_operators.c`: Added checks and error messages for unsupported collation in stages like `$bucket`, `$replaceWith`, `$geoNear`, `$fill`, `$group`, `$documents`, `$setWindowFields`, and `$sortByCount`.
- `bson_dollar_ops_collation_tests_runtime.sql`: Added test cases for unsupported aggregation stages with collation.
- `bson_dollar_ops_collation_tests_runtime.out`: Updated expected output to include error messages for unsupported collation in various stages.
- `bson_query.h`: Refactored `IsBsonTypeCollationAware` function for better readability.
- `bson_dollar_operators.c`: Simplified collation applicability check using `IsBsonTypeCollationAware`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4022806
### Does this PR have any customer impact?
Yes
### 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?
Yes
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
1) InitializeBsonIndexTerm called BsonValueToPgbsonElement that was using the bson_iter_next a lot. This is a lot of overhead when we know it's a single element. Use an unsafe variant of it to generate a pgbsonelement
2) Introduce a MatchAndRecurse option for index paths that allows the term generation logic to know whether it's an exact match or if the child paths also match. This is currently unused, but will be used in a subsequent change.
----
#### AI description (iteration 1)
#### PR Classification
Code improvement for term generation in wildcard index.
#### PR Summary
This pull request enhances the term generation process for wildcard indexes by introducing an unsafe transformation method and refining index traversal options.
- `pgbsonelement.c`: Added `FillPgbsonElementUnsafe` and `BsonValueToPgbsonElementUnsafe` functions for unsafe BSON element transformation.
- `bson_gin_entrypoint.c`: Introduced `IndexTraverse_MatchAndRecurse` option to improve path matching and recursion.
- `feature_flag_configs.c`: Added feature flag `indexTermUseUnsafeTransform` to enable unsafe transformation.
- `gin_index_term.c`: Utilized the unsafe transformation method based on the new feature flag.
- `bson_gin_core.c`: Updated term path generation to handle the new traversal option.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact? No
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Support for $documents and $replaceWith operations with collation in the aggregation pipeline.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for collation with `$documents` and `$replaceWith` aggregation stages.
- Added collation support for `$documents` and `$replaceWith` stages in `bson_aggregation_pipeline` in `bson_dollar_ops_collation_tests_runtime.out` and `bson_dollar_ops_collation_tests_runtime.sql`.
- Updated `pg_documentdb/src/aggregation/bson_aggregation_nested_pipeline.c` to handle collation strings in the context.
- Updated documentation in `docs/release_notes/pgmongo_1.103.md` and `oss/CHANGELOG.md` to reflect the new features.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4095421, #4095425
### Does this PR have any customer impact?
No
### 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?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
In this pull request, update the Makefile.versions and scripts/generate_extension_version.sh to avoid build failures when using a tarball from tags.
In release tarball there is no .git/index file, so we need to check if the file exists before using it. If the file does not exist, we will set some variables to unknown and use the version from the control file.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to avoid build failure with tarball from tags.
#### PR Summary
This pull request updates the build scripts to handle cases where the build is performed from a tarball without a Git repository.
- `oss/scripts/generate_extension_version.sh`: Added checks to handle builds outside a Git repository by using version information from a control file.
- `oss/Makefile.versions`: Modified to pass the Git index directory to the version generation script and removed dependency on the Git index file.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
Yes
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
1) For wildcard term generation, we were iterating every array twice (once for the array term and once for the array path term). Instead, iterate the array once and generate the terms together
2) We were also enumerating every array a 3rd time to count the keys - estimate key term count by using a log2(size)
3) Add the new stages for currentOp index tracking
4) Use dynamic_library_path to avoid specifying load library path in hosted environments (this also fixes parallel build for the internal index POC)
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and performance improvement.
#### PR Summary
This pull request focuses on improving the indexing mechanism for BSON documents in the Gin index.
- `bson_gin_core.c`: Refactored `GenerateTermsCore` function to split logic into `GenerateArrayPath` and `GenerateTermPath` for better readability and maintainability.
- Enhanced term generation for arrays and nested documents to optimize index lookup and query performance.
- Improved memory management by using `StringInfo` for path construction and ensuring proper buffer allocation.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
PoC
### 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
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
Implement ordered scan in the index layer - leverage GIN extensibility points to do so.
Allow order by pushdown to the index.
Still doesn't work:
- Truncation
- Array terms and order by
Still needs improvement:
- Performance when there's disjoint index trees to be scanned.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces the ability to push down the `ORDER BY` clause to the index under a feature flag.
- `pgmongo_rum/src/rumget.c`: Added functions `MoveScanForward`, `scanGetItemOrdered`, and `startOrderedScanEntries` to handle ordered scans.
- `pgmongo/src/test/regress/expected/internal_bson_composite_order_by_index_tests.out`: Added tests to validate the new ordered index scan feature, including correctness and edge cases.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->