Commit Graph
455 Commits
Author SHA1 Message Date
Lusen Dong 3f4fc51e8b Merged PR 1502018: [Bugfix] oss compilation error on Ubuntu 24.04
### 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
2024-11-12 18:48:09 +08:00
Parag Jain 48f3e026c2 Merged PR 1506658: [Bug-Fix] setting merge whenMatched default option to merge from replace
### 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
![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1506658/attachments/image.png)

----
#### 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.
2024-11-12 18:48:09 +08:00
Jia Hu 778bc161e3 Merged PR 1452968: [schema validation] apply on general update
### 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.
2024-11-12 18:48:09 +08:00
Santiago Fernandez Madero 48aefab508 Merged PR 1504921: Add hooks to load specific index handler and multiandbitmap 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

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.
2024-11-12 18:48:09 +08:00
Cornelius Boateng 962996b8ce Merged PR 1490665: [engine] Collation Support for $graphLookup
### 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
2024-11-12 18:48:09 +08:00
Duan Pei✨ ce79fc0ac5 Merged PR 1501001: [Fix] add memory check for maxN/minN accumulator
### 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
![image (2).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1501001/attachments/image%20%282%29.png)
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.
2024-11-04 17:14:58 +08:00
Santiago Fernandez Madero 6f9ec2f60c Merged PR 1501766: [HELIO_GIN] Port rum fast scan improvements and PoC new features
### 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.
2024-11-04 17:14:58 +08:00
Lucas Borges Fernandes 179da8cded Merged PR 1499631: Scripts for unique index truncation opclass
### 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.
2024-11-04 17:14:58 +08:00
Ujjwal Agrawal 37681b511b Merged PR 1493190: Update error codes from pg to helio and add missing sql tests
### 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
2024-11-04 17:14:58 +08:00
Shuai Tian 🚀 8fad30b687 Merged PR 1495735: Update bson_aggregation_date_operators_tests to fix errors
### 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
2024-11-04 17:14:58 +08:00
Shuai Tian 🚀 5918fdc82a Merged PR 1495556: move 2 tests depending on custom rum back to pgmongo
### 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
2024-11-04 17:14:58 +08:00
Vinod Sridharan 055383c27d Merged PR 1483236: Truncation GUC and unique part 1
### 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.
2024-11-04 17:14:58 +08:00
Jayanta Mondal 4374c44df7 Merged PR 1497598: [Engine] Flushing error data in the PG_CATCH after Multipdate failure
### 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.
2024-11-04 17:14:58 +08:00
Jia Hu 👻 0fa4669612 Merged PR 1494340: [DBRef] fix index issue
### 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.
2024-11-04 17:14:58 +08:00
Ujjwal Agrawal 5e68dee1bc Merged PR 1467812: [BugFix] $setOnInsert no-op instead of error with upsert: false
### 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
2024-11-04 17:14:58 +08:00
Cornelius Boateng ee9c5de90c Merged PR 1453287: [Perf] Type Aggregation Ops
### 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
2024-11-04 17:14:58 +08:00
Deepak Pemmaraju f7d07bb884 Merged PR 1493950: Fixing a syntax error in cluster upgrade
### 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`.
2024-11-04 17:14:58 +08:00
Shuai Tian f8c366966d Revert "HelioDB Push 2024-10-31" (#76)
Reverts microsoft/heliodb#75, redo the merge instead of squash merge
which discarded the commit history
2024-11-04 14:38:52 +08:00
69edcc3556 HelioDB Push 2024-10-31 (#75)
Co-authored-by: Deepak Pemmaraju <deepakpe@microsoft.com>
Co-authored-by: Cornelius Boateng <cboateng@microsoft.com>
Co-authored-by: Ujjwal Agrawal <uagrawal@microsoft.com>
Co-authored-by: Jia Hu 👻 <jiahu2@microsoft.com>
Co-authored-by: Jayanta Mondal <jmondal@microsoft.com>
Co-authored-by: Vinod Sridharan <visridha@microsoft.com>
2024-10-31 16:09:00 +08:00
Shuai Tian 🚀 96bf4da91f Merged PR 1494403: Updated users.c and remove unnecessary dependency
### 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.
2024-10-25 09:11:39 +03:00
Cornelius Boateng 894e98f0db Merged PR 1461699: [Perf] Array Aggregation Operators
### 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
2024-10-25 09:11:39 +03:00
Deepak Pemmaraju b6b29dd261 Merged PR 1488041: Fixing default salt length and forAllDBs
### 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.
2024-10-25 09:11:39 +03:00
Deepak Bisht 1225b7ea85 Merged PR 1490664: [InternalError] [Fix] Too many args
### 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
For `$group` and `$setWindowFields` we tend to create `bson_repath_and_build` function expression with the path and values as arguments to the function, if this argument list goes beyond 100 its an internal error.

So with this PR huge number of aggregates are broken down using functions expression of `bson_dollar_merge` and `bson_repath_and_build`.
e.g If there are 110 groupby operators then the projector will be of this form.

```
bson_dollar_merge_documents(
    bson_repath_and_build(<50 operators>),
    bson_dollar_merge_documents(
        bson_repath_and_build(<50 operators>),
        bson_repath_and_build(<10 operators>)
    )
)
```

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
This pull request addresses an issue with handling too many arguments in aggregation functions by introducing a new method to manage large numbers of arguments.
- `bson_aggregation_pipeline.c`: Added `GenerateMultiExpressionRepathExpression` function to handle cases where the number of arguments exceeds `FUNC_MAX_ARGS`.
- `bson_aggregation_pipeline.c`: Updated `HandleGroup` to use the new function for generating repath expressions.
- `setwindowfields_and_group_compliance.sql`: Added tests to verify the handling of multiple arguments in aggregation functions.
- `bson_aggregation_window_operators.c`: Modified `HandleSetWindowFieldsCore` to use the new function for repath expressions.
- `bson_aggregation_pipeline_private.h`: Declared the new function for generating multi-expression repath expressions.
2024-10-25 09:11:39 +03:00
Vinod Sridharan 965b2a01bc Merged PR 1491491: [Perf] Fix filter on _id $in queries
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
[Perf] Fix  filter on _id $in queries

When you have queries of `{ "_id": { "$in": [ 1, 2, 3 ] }` This formed a query of
`document @*= '{ "_id": [ 1, 2, 3 ] }' AND object_id ANY= '{ 1, 2, 3 ]'::bson[]`
These are redundant if it's pushed to the primary key index. In this case, remove the $in filter to reduce runtime filters.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to improve performance of `_id $in` queries.

#### PR Summary
This pull request optimizes the handling of `_id $in` queries to improve performance by refining the query planning logic.
- `planner.c`: Added functions to handle `FuncExpr` and `ScalarArrayOpExpr` for `_id` filters, and updated logic to correctly identify and process these expressions.
- `bson_query_operator_object_id_tests.out`: Updated expected output to reflect the optimized query plans.
- `bson_query_operator_tests_explain_index.out` and `bson_query_operator_tests_explain_runtime.out`: Adjusted expected rows and query plans to match the new logic.
2024-10-25 09:11:39 +03:00
Parag Jain f801b9e7a3 Merged PR 1490550: [Bug Fix] $merge bug fix while checking presence of compound index on target collection
### 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 PR contains 2 fixes
- In $merge `on` field cannot contain duplicate element:    `{ "$merge" :  {"on" : [a,a] }`
- we were missing a case while validating on field against index array.

```
let's say indexSpec :  { "x" : 1, "y" : 1, "z" : 1}
then below cases also expected to be fail as index array has extra element.
 `{ "$merge" :  {"on" : [x,z] }`
 `{ "$merge" :  {"on" : [x,y] }`
```

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
Fixes a bug in the `$merge` operation by ensuring proper detection of compound unique indexes and handling duplicate fields.
- `bson_aggregation_output_pipeline.c`: Corrected logic to check for compound unique indexes and added error handling for duplicate fields.
- `bson_aggregation_stage_merge_tests.sql` and related test output files: Added tests to verify the detection of duplicate fields and proper index checking.
- `helio_conversion_codes.c`: Added a new error code for duplicate field detection.
- Updated error code mappings in `mongoerrors.csv`, `helioerrors.csv`, `helio_codes.txt`, and `mongo_codes.csv`.
2024-10-25 09:11:39 +03:00
Parag Jain b755d9924f Merged PR 1490793: [OSS] Test migrations: Part 15 [ parallelizing tests]
### 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
[OSS] Test migrations: Last One [ parallelizing tests]

----
#### AI description  (iteration 1)
#### PR Classification
Test enhancement for parallelizing tests.

#### PR Summary
This pull request updates test output files to support parallel execution of tests.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_query_operator_tests_index.out`: Adjusted line numbers in error messages to align with changes in the test SQL file.
2024-10-25 09:11:39 +03:00
Vinod Sridharan a8ec5e464c Merged PR 1490191: [OSS] Fix compiler error seen in Ubuntu 24.04
### Does this PR have any customer impact?
No

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

### 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 compiler error - looks like that compiler seems to be a bit aggressive on uninitialize - the code is correct but fails to compile on 24-04 and PG16. Fix the initialization.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address a compiler error in Ubuntu 24.04.

#### PR Summary
This pull request fixes a compiler error encountered in Ubuntu 24.04 by making necessary code adjustments.
- Modified `oss/Makefile.cflags` to remove an unnecessary compiler flag.
- Updated `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c` to initialize `nConst` to `NULL` before usage.
2024-10-25 09:11:39 +03:00
Deepak Bisht 1921ac37ee Merged PR 1490629: [Infra] Fix dist-minimal test step, and add compat-minimal too
### Does this PR have any customer impact?
no

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

### 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))
NA

### Description
fix dist-minimal

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for a failing test step in the infrastructure.

#### PR Summary
This pull request addresses an issue in the `dist-minimal` test step by modifying the test schedule configuration.
- `oss/internal/pg_helio_distributed/src/test/regress/Makefile`: Updated the `check-dist-minimal` target to include both `basic_schedule` and `minimal_schedule` in the test execution.
2024-10-25 09:11:39 +03:00
Vinod Sridharan 4165e5ce47 Merged PR 1489183: [Infra] Add PG16 to dev container, add dist-minimal to run individual tests
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Infra
### 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 PG16 to dev container, add dist-minimal to run individual tests

----
#### AI description  (iteration 1)
#### PR Classification
Infrastructure update to add PostgreSQL 16 to the development container and introduce a minimal distribution for running individual tests.

#### PR Summary
This pull request updates the development environment to support PostgreSQL 16 and adds a new target for running minimal tests.
- `.devcontainer/Dockerfile`: Added installation steps for PostgreSQL 16.
- `Makefile` and `oss/internal/pg_helio_distributed/Makefile`: Introduced `check-dist-minimal` target for running minimal tests.
- `oss/internal/pg_helio_distributed/src/test/regress/Makefile`: Added `check-dist-minimal` target and updated test schedules.
- `scripts/install_setup_postgres.sh`: Modified script to handle PostgreSQL version-specific directories.
- `oss/internal/pg_helio_distributed/src/test/regress/sql/helio_distributed_test_helpers.sql`: Added tests for native colocation feature.
2024-10-25 09:11:39 +03:00
Deepak Bisht cb8964171d Merged PR 1487560: [Oss] Test migrations part 14 [9 tests]
### 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))
Test migration

### Description
Move miscellaneous tests from pgmongo to helio_distributed

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request adds a new test file to validate collection management functionalities.
- Added `oss/internal/pg_helio_distributed/src/test/regress/expected/collection_management.out` to test various collection operations such as creation, insertion, querying, renaming, and dropping collections.
2024-10-25 09:11:39 +03:00
Parag Jain d3db854dae Merged PR 1485054: [Perf] [Update] Query Positional Update 10x faster for 1 Lakh Elements
### 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
query :
`
db.test.updateOne(
    { _id: ObjectId("670e3a9f9b192eb7f2f1cce7"), "items.id": 99999},
    { $set: { "items.$.status": "asdasasasddd" } }
)`

num elements in array items: `100000`

Time taken before: `120265 Ms'
Time taken after improvement: `250 Ms'
**Perf Gain: 10 x**.

**Changes Description:**
Previously, for each element in the array of the source document (O(n)), we were attempting to match it against positional qualifiers, which was also O(n), resulting in a total complexity of O(n²).

However, now we evaluate and find the index only the first time we encounter a positional node, and then reuse that index for all subsequent elements in the source document, reducing the complexity to O(n).

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement

#### PR Summary
This pull request optimizes the query positional update process, making it 10x faster for handling 1 lakh elements.
- `bson_update_operators_workflow.c`: Added `indexOfPositionalTypeQueryFilter` parameter to various functions to avoid redundant evaluations and improve performance.
2024-10-25 09:11:39 +03:00
Cornelius Boateng aa43200a75 Merged PR 1486812: [OSS] Tests Migration Part 13 [1 Test]
### Does this PR have any customer impact? No

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

### 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

Tests migration to OSS
2024-10-25 09:11:39 +03:00
Vinod Sridharan 27496ae4d2 Merged PR 1487161: Support $comment operator
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Support parsing and ignoring the $comment query operator.

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request adds support for the `$comment` operator in MongoDB queries.
- Added `$comment` operator to `QueryOperators` in `mongo_query_operator.c`.
- Updated `query_operator.c` to handle and ignore `$comment` during query processing.
- Added tests for `$comment` operator in `bson_aggregation_pipeline_tests.sql` and `bson_aggregation_pipeline_tests.out`.
- Defined `QUERY_OPERATOR_COMMENT` in `mongo_query_operator.h`.
2024-10-25 09:11:39 +03:00
Vinod Sridharan 0489b4dce6 Merged PR 1486731: [Perf] Improve update performance by preparing the update candidate
### 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
Performance improvement.

#### PR Summary
This pull request aims to enhance the performance of the update operation by preparing the update candidate more efficiently.
- `src/commands/update.c`: Added logic to use precompiled query plans for update operations, reducing execution time.
- `include/infrastructure/helio_plan_cache.h`: Defined new query plan IDs for selecting update candidates.
2024-10-17 11:43:08 +03:00
Zinan Ren 🐾 1222508d23 Merged PR 1485084: [Vector Search][DiskANN] Re-order search results after filtering
### 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
The results of vector search + filtering on the DiskANN index might become unordered after iterative searches. It's necessary to re-order the results.

Adds a wrapper select query to the join query and re-order by the orderVar.
To force the planner to re-order the query,

`SELECT document FROM (JOIN c1 ON c1.ctid = c2.ctid limit k) ORDER BY c1.orderVal + 0`

----
#### AI description  (iteration 1)
#### PR Classification
Enhancement to re-order search results after filtering in vector search using DiskANN.

#### PR Summary
This pull request introduces a mechanism to re-order search results after applying filters in vector search using DiskANN.
- `src/aggregation/bson_aggregation_vector_search.c`: Added a new function `ReorderQueryResults` to wrap the join query and re-order results by a specified variable.
- `src/test/regress/expected/bson_aggregation_pipeline_tests_vector_diskann.out`: Updated expected output to reflect the new query structure and re-ordering logic.
2024-10-17 11:43:08 +03:00
Deepak Bisht d325973fd0 Merged PR 1424623: $text and $geoNear index support enhancement for mandatory index usage
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
- $geoNear, $near and $nearSphere queries will require suitable geospatial indexes to be present in the collection.

### Description
Make $geoNear require index and fail if no suitable index is found.
Also move $text to same infrastructure to mandate index usage

Steps:
- Check if the index paths are created for Geonear and Text queries in the planner.
- If not update the query tree to only have quals needed to generate the index path and again try to create index path using
`create_index_paths`.
- If the index paths are created then revert back to original query but retain the index path created and allow the query.
- else return error that the indexes were not found for the query
- Clean customsetup.js to not pass key if key is missing is JStest that is handled on the backend now

----
#### AI description  (iteration 1)
#### PR Classification
Enhancement for mandatory index usage in `$text` and `$geoNear` queries.

#### PR Summary
This pull request enhances the support for mandatory index usage in `$text` and `$geoNear` queries by ensuring the appropriate index paths are enforced.
- `planner.c`: Added functions `ProcessQueryOperatorsWithSortClauses` and `ForceIndexForQueryOperators` to handle index path enforcement for special query operators.
- `metadata_cache.c`: Introduced functions `BsonGistGeographyOperatorFamily` and `BsonGistGeometryOperatorFamily` to fetch OIDs for BSON GIST spherical geometries.
- `helio_bson_text_gin.h`: Added `ForceIndexQueryOperatorData` struct to manage index enforcement for special query operators.
- `index_support.c`: Updated `ProcessRestrictionInfoAndRewriteFuncExpr` to set `QUERY_OPERATOR_TEXT` type and handle text index enforcement.
- Removed legacy test cases for `$nearSphere` with coordinate pairs from `bson_query_operator_near_nearsphere.out`.
2024-10-17 11:43:08 +03:00
Parag Jain 267a6bf954 Merged PR 1483724: [OSS] Test migration PART 11 [6 test]
### 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
[OSS] Test migration PART 11 [6 test]

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request is part of an ongoing effort to migrate tests, specifically addressing the deletion of an outdated test file.
- Deleted `pgmongo/src/test/regress/expected/commands_create_indexes_text.out`
2024-10-17 11:43:08 +03:00
Vinod Sridharan ca6d81e4c9 Merged PR 1485934: [Perf] Reduce calls to GetVectorIndexDefinitionByIndexAmOid
### 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?

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Calls to GetVectorIndexDefinitionByIndexAmOid show up in 2% of profiles in update/insert workloads.
Fix this by only calling it if htere's index order by

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement.

#### PR Summary
This pull request reduces unnecessary calls to `GetVectorIndexDefinitionByIndexAmOid` to improve performance.
- `src/opclass/index_support.c`: Moved the call to `GetVectorIndexDefinitionByIndexAmOid` inside a conditional block to ensure it is only called when there is an order by clause.
- `src/opclass/index_support.c`: Removed redundant calls to `GetVectorIndexDefinitionByIndexAmOid` and adjusted the logic to set `context->hasVectorSearchQuery` appropriately.
2024-10-17 11:43:08 +03:00
Deepak Bisht e4c8dafb54 Merged PR 1484057: [OSS] Test migration PART 12 [9 test]
### 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
Move misc tests to OSS mostly includes
- index truncation
- mongo feature counters
- libpq permissioning

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request continues the migration of tests, specifically focusing on TTL (Time-To-Live) index tests.
- Moved `bson_query_operator_in_opt.out` from `regress/expected` to `helio_compat/expected`.
- Added new test file `oss/internal/pg_helio_distributed/src/test/regress/sql/commands_create_ttl_indexes.sql` with comprehensive TTL index tests.
- Deleted `pgmongo/src/test/regress/sql/commands_create_ttl_indexes.sql`.
- Deleted `pgmongo/src/test/regress/sql/mongo_feature_counters.sql`.
2024-10-17 11:43:08 +03:00
Cornelius Boateng caf2c7834d Merged PR 1448751: [let 3/n] Let Support for $groupBy on Sharded Collections
### 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

let support for group by on sharded collections
For now, we wrap the `bson_expression_get` with a `helio_core_bson_to_bson` function

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Support for `$groupBy` on sharded collections.

#### PR Summary
This pull request introduces support for the `$groupBy` aggregation operation on sharded collections, along with various enhancements and tests for aggregation pipeline operations.
- Added new test cases in `/pgmongo/src/test/regress/sql/bson_aggregation_pipeline_tests_let.sql` to validate `$groupBy` and other aggregation operations on sharded collections.
- Introduced `helio_core_bson_to_bson` function in `/oss/pg_helio_api/src/aggregation/bson_aggregation_pipeline.c` for BSON type conversion.
- Updated metadata cache in `/oss/pg_helio_api/src/metadata/metadata_cache.c` to include OID for the new BSON conversion function.
- Created SQL scripts for BSON coercion compatibility in `/oss/pg_helio_api/sql/udfs/aggregation/bson_coercion_compat--1.22-0.sql` and `/oss/pg_helio_api/sql/udfs/aggregation/bson_coercion_compat--latest.sql`.
- Updated control files to new versions in `/oss/pg_helio_api/pg_helio_api.control`, `/oss/pg_helio_core/pg_helio_core.control`, and `/pgmongo/pgmongo.control`.
2024-10-17 11:43:08 +03:00
Deepak Bisht 722108b788 Merged PR 1483658: [OSS] Test migration geospatial PART 10
### 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
Move geospatial tests to oss

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request is part of a series to migrate geospatial test files to a new directory structure for better organization.
- Moved multiple geospatial test output files from `pgmongo/src/test/regress/expected/` to `pgmongo/src/test/helio_compat/expected/` without any code changes.
2024-10-17 11:43:08 +03:00
Xiaochun Liang 3661d4ffbb Merged PR 1480961: Refactor expMovingAvg calculation
### 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
Refactor expMovingAvg calculation by using bson calculation methods in pgbson_utils.c

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
Refactored the `CalculateExpMovingAvg` function to simplify the calculation of exponential moving averages.
- `bson_aggregation_statistics.c`: Changed `CalculateExpMovingAvg` to return `void` and refactored the function to use `ArithmeticOperationFunc` for arithmetic operations.
- Removed redundant error handling and simplified the logic in `bson_exp_moving_avg`.
- Added `OperationSource_ExpMovingAvg` to `ArithmeticOperationErrorSource` enum and updated error handling accordingly.
2024-10-17 11:43:08 +03:00
Parag Jain 5cc1108c87 Merged PR 1482297: [OSS] Test migration Part 9 [Text Search Rum Index Utility]
### 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
Migration of text search related functions.

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request introduces a new text search utility using RUM indexes for BSON data.
- Added `bson_dollar_text`, `bson_text_tsquery`, and `bson_text_meta_qual` functions in `sql/udfs/query/bson_dollar_text--1.24-0.sql` and `sql/udfs/query/bson_dollar_text--latest.sql`.
- Created `bson_rum_text_path_ops` operator class in `sql/udfs/rum/bson_rum_text_path_ops--1.24-0.sql` and `sql/udfs/rum/bson_rum_text_path_ops--latest.sql`.
- Added `rum_bson_single_path_extract_tsvector` and `rum_bson_text_path_options` functions in `sql/udfs/rum/bson_rum_text_path_funcs--1.24-0.sql` and `sql/udfs/rum/bson_rum_text_path_funcs--latest.sql`.
- Updated regression tests in `src/test/regress/expected/bson_index_truncation_index_tests.out` and `src/test/regress/expected/public_api_schema.out`.
- Modified `Makefile` to include the RUM extension in `src/test/regress/Makefile` and `pg_helio_api/src/test/regress/Makefile`.
2024-10-17 11:43:08 +03:00
Vinod Sridharan dd58525877 Merged PR 1482107: [Perf] Fix local shard pushdown not working in all cases
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
When looking at the local shard, if the collection was cached when the table was created then the local shard was never registered and those backends saw degraded perf - this fixes it.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address local shard pushdown not working in all cases.

#### PR Summary
This pull request fixes issues with local shard pushdown by ensuring proper handling of shard names and remote shard status.
- `src/metadata/collection.c`: Added `TrySetCollectionShard` function to handle shard name setting and remote status.
- `src/distribution/distributed_hooks.c`: Updated `TryGetShardNameForUnshardedCollectionCore` to return empty string instead of NULL in specific cases and added logging.
- `include/metadata/collection.h`: Added `isShardRemote` field to `MongoCollection` struct.
- `include/api_hooks.h`: Updated documentation for `TryGetShardNameForUnshardedCollection` to reflect new return values.
- `src/commands/aggregation_commands.c`: Minor change to use `DatumGetTextPP` instead of `DatumGetTextP`.
2024-10-17 11:43:08 +03:00
Vinod Sridharan 24d78660f1 Merged PR 1469696: [RBAC] Support per command
### 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

Per command rbac

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request introduces per-command role-based access control (RBAC) for MongoDB commands executed through PostgreSQL.
- Added `pgmongo_run_command_as_user` and `pgmongo_run_query_as_user` functions in the new file `pgmongo/src/infrastructure/command_funcs.c` to handle command execution with user roles.
- Updated `PostgresClientProvider.cs` to build client options for user and system contexts.
- Modified `PostgresClient.cs` to include user context in command execution and added `GetFirstPageCoreAsUserAsync` method.
- Enhanced `oid_cache.c` to cache OIDs for new MongoDB commands.
- Refactored command execution in `PostgresClient.cs` to use the new RBAC functions.

Related work items: #3531096
2024-10-17 11:43:08 +03:00
Parag Jain 5ac55fcfb9 Merged PR 1481325: [OSS] Test migration part 8 [5 tests]
### 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
[OSS] Test migration part 8 [5 tests]

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request continues the migration of tests by removing an obsolete test file.
- Deleted `pgmongo/src/test/regress/sql/bson_index_truncation_index_tests.sql`
2024-10-17 11:43:08 +03:00
Parag Jain c0edf1f83c Merged PR 1478629: [OSS] Test migration part 7 [6 tests]
### Does this PR have any customer impact?
NA

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

### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Migration of test to oss part-7 covers moslty vector releated tests.

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request migrates several test files and adds new test cases for validating collection commands.
- Moved `bson_aggregation_pipeline_tests_vector_ivf.sql` and `bson_aggregation_pipeline_tests_vector_hnsw.sql` to `oss/internal/pg_helio_distributed/src/test/regress/sql/`.
- Added new test cases in `pgmongo/src/test/helio_compat/expected/commands_validate.out` for validating collection commands.
- Added new test cases in `oss/internal/pg_helio_distributed/src/test/regress/expected/list_metadata_cursor_tests.out` for listing metadata with cursors.
- Moved `bson_aggregation_pipeline_tests_vector_ivf.out`, `bson_aggregation_pipeline_tests_vector_hnsw.out`, and `bson_aggregation_pipeline_tests_vector_mongo.out` to `pgmongo/src/test/helio_compat/expected/`.
2024-10-17 11:43:08 +03:00
Gledis Zeneli d71209bd01 Add policheck to sync pipeline for now (#69)
Add policheck to the sync pipeline for now
2024-10-10 17:38:49 +03:00
Parag Jain 45b6958171 Merged PR 1479514: [Cleanup] : "helio_api_internal" to HelioApiInternalSchemaName
### 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
[Cleanup] : "helio_api_internal" to ApiMainInternalSchemaName

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request refactors the code by introducing a new variable `ApiMainInternalSchemaName` to replace hardcoded instances of "helio_api_internal".
- `metadata_cache.c`: Added `ApiMainInternalSchemaName` and replaced hardcoded "helio_api_internal" with the new variable.
- `delete.c`, `insert.c`, `update.c`: Updated SQL queries to use `ApiMainInternalSchemaName` instead of hardcoded schema name.
- `current_op.c`, `mongo_query_operator.c`: Replaced hardcoded "helio_api_internal" with `ApiMainInternalSchemaName`.
- `metadata_cache.h`: Declared the new variable `ApiMainInternalSchemaName`.
2024-10-10 11:17:14 +03:00
Zinan Ren 🐾 5a91bdffbc Merged PR 1438545: [Vector Search][DiskANN Part 4 - Backend] Add diskann index to pgmongo
### 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
New feature: Add DiskANN index support to pgmongo for vector search.

#### PR Summary
This pull request introduces DiskANN index support to the pgmongo backend, enabling efficient vector search capabilities.
- Added extensive SQL tests for DiskANN index creation, parameter validation, and search operations in `bson_aggregation_pipeline_tests_vector_diskann.sql`.
- Implemented new test cases in `SearchTests.cs` to validate DiskANN index functionality, including index creation, search operations, and error handling.
- Updated expected output in `bson_aggregation_pipeline_tests_vector_prefilter.out` to reflect new DiskANN index tests and results.
2024-10-10 11:17:14 +03:00