Commit Graph
43 Commits
Author SHA1 Message Date
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
Deepak Bisht 3eb64de267 Merged PR 1467661: [Cleanup][backend] Remove legacy errors and all referrences completely
### 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))
NA

### Description
remove legacy errors completely

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

#### PR Summary
This pull request removes legacy MongoDB error handling code and all related references.
- Deleted `mongo_errors.h`.
- Removed `CheckNoMongoErrorCodeHeader` function and related calls from `scripts/validate_helio_extension_state.sh`.
- Updated `error_utils.c` to remove legacy MongoDB error handling logic.
- Deleted deprecated functions from `helio_distributed_test_helpers.sql` and `pgmongo_test_helpers.sql`.
- Updated expected test outputs in `helio_distributed_test_helpers.out` and `pgmongo_test_helpers.out` to reflect the removal of deprecated functions.
2024-09-26 17:53:12 +03:00
Jinrui Zhang 55b25d9c55 Merged PR 1423500: Implementation of $fill stage
This PR includes two parts:

1. The design doc of $fill
2. The implementation of $fill using `rewrite` way. Refer design doc [here](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1423500?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_stages/fill.md).

3. Extract bson_expression_partition_by_fields_get() as a common method. So that, some related changes are:

     a. densify's parse stage is changed
     b. densify's unit tests is changed due to method name change
     c. densify's original method for partitionByFields is removed

**Noticed:**
This implementation is based on the impl of `$linearFill` and `$locf`.
2024-09-19 20:36:13 +03:00
Deepak Bisht 91e5f2226f Merged PR 1458099: [Final] [Port Errors] - Move all errors to helio_errors, remove all referrences to mongo_errors.h
### 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)
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))
na

### Description
1. Move all legacy errors to new helio errors
2. Remove all refs to mongo_errors.h excluding error_utils.c , there is function which needs backword compatibility
3. Update `scripts/validate_helio_extension_state.sh` to enforce all validations on oss/pg_helio_api parent directory instead of individual sub directories

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

#### PR Summary
This pull request moves all error handling to `helio_errors` and removes references to `mongo_errors.h`, deprecating certain functions.
- `error_utils.c`: Deprecated `command_throw_mongo_error` and `command_convert_mongo_error_to_postgres` functions.
- `mongo_errors.h`: Removed Mongo error handling code and redefined error code checks.
- `validate_helio_extension_state.sh`: Updated validation script to remove checks for `mongo_errors.h`.
- Added new SQL functions for database commands in `kill_op--1.22-0.sql`, `get_shard_key_value--1.22-0.sql`, and `reindex--1.22-0.sql`.
- Updated test files to reflect deprecation changes in error handling functions.
2024-09-19 20:36:13 +03:00
Deepak Bisht 68f0438c85 Merged PR 1436133: $densify aggregation stage
### 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?
Yes

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

### Description
$densify stage is implemented with all 3 modes
- range
- partition
- full

All 7 functional tests are passing, few tests which are explain specific will be pass in next PR with the changes

![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1436133/attachments/image.png)

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds a new `$densify` aggregation stage.

#### PR Summary
Introduces the `$densify` aggregation stage to create new documents where certain field values are missing.
- Added detailed documentation for `$densify` in `docs/pgmongo/design_docs/data_plane/aggregation_stages/densify.md`.
- Implemented core aggregation logic in `oss/pg_helio_api/src/aggregation/bson_densify.c`.
- Created SQL functions and aggregates for densify operations in `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--1.21-0.sql` and `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--latest.sql`.
- Updated versioning and inclusion of new SQL files in `oss/pg_helio_api/sql/pg_helio_api--1.20-0--1.21-0.sql` and `pgmongo/sql/pgmongo--1.20-0--1.21-0.sql`.

Related work items: #3436236
2024-09-12 13:51:02 +03:00
Ujjwal Agrawal 213287f350 Merged PR 1408344: $top(N)/$bottom(N) accumulator operators implementation
### 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?
No

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

### Description

$top, $topN, $bottom, $bottomN implementation for $group and $setWindowFields
----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added support for `$topN` and `$bottomN` group expression operators.

#### PR Summary
This pull request introduces the `$topN` and `$bottomN` group expression operators to the aggregation pipeline.
- `bson_aggregation_pipeline.c`: Added `ParseInputDocumentForTopAndBottom` function to parse input documents for `$topN` and `$bottomN` operators, and integrated it into the existing aggregation handling logic.
- `mongo_errors.h`: Defined new error codes for handling errors related to the new operators.

Related work items: #2151574, #2151576, #2151596, #2151597, #2988406, #2988407, #2988413, #2988415
2024-09-12 13:51:02 +03:00
Duan Pei✨ e0cd9853fc Merged PR 1405758: [Feature] $toHashedIndexkey operator implementation
### 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

https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/
2024-09-12 13:51:02 +03:00
Parag Jain 7740a1f014 Merged PR 1439695: [Feature] $out aggregation stage
### 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 for $out aggregation stage in aggregation pipeline

what we not support :
1. On Mult coordinator setup source and target can not be same

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

#### PR Summary
This pull request introduces the `$out` aggregation stage to the aggregation pipeline.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_output_pipeline.c`: Added `HandleOut` function to handle the `$out` stage, including parsing, validation, and query mutation for outputting results to a specified collection.

Related work items: #1798580
2024-09-12 13:51:02 +03:00
Vinod Sridharan c1e2dcba6c Merged PR 1450846: Port more errors to helio errors
### Does this PR have any customer impact?
No

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Port more errors to helio for more folders.

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to port error codes to Helio-specific error codes.

#### PR Summary
This pull request updates various error codes from Mongo-specific to Helio-specific error codes across multiple files.
- `vector_index_kind_impl.c`: Replaced `MongoBadValue` and `MongoFailedToParse` with `ERRCODE_HELIO_BADVALUE` and `ERRCODE_HELIO_FAILEDTOPARSE`.
- `shard_colocation.c`: Updated error codes from `MongoCommandNotSupported`, `MongoBadValue`, and `MongoFailedToParse` to Helio-specific equivalents.
- `bson_update_operators.c`: Changed error codes like `MongoTypeMismatch` and `MongoBadValue` to `ERRCODE_HELIO_TYPEMISMATCH` and `ERRCODE_HELIO_BADVALUE`.
- `parse_error.h`: Replaced `MongoTypeMismatch` with `ERRCODE_HELIO_TYPEMISMATCH`.
- `collection.c`: Updated error codes from `MongoBadValue` and `MongoInvalidNamespace` to Helio-specific equivalents.
2024-09-12 13:51:02 +03:00
Vinod Sridharan 3d3298c4b2 Merged PR 1448867: Move to helio errors in helio core
### Does this PR have any customer impact?
No

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

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

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

### Description
Move to helio error codes in pg-helio-core

Enforce hygiene in helio core

Move to helio errors

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

#### PR Summary
This pull request refactors error handling by replacing Mongo-specific error codes with Helio-specific error codes and updates error messages accordingly.
- Added `CheckNoMongoErrorCodes` function in `/scripts/validate_helio_extension_state.sh` to ensure no Mongo-specific error codes are used.
- Updated error codes and messages in `oss/pg_helio_core/src/query/bson_compare.c` to use Helio-specific codes.
- Modified error handling in `oss/pg_helio_core/src/types/pcre_regex.c` to replace Mongo error codes with Helio error codes.
- Replaced Mongo error codes with Helio error codes in `oss/pg_helio_core/src/io/pgbsonsequence.c`.
- Updated error codes in `oss/pg_helio_core/src/types/decimal128.c` to use Helio-specific codes.
2024-09-12 13:51:02 +03:00
Deepak Pemmaraju 544343380d Merged PR 1446395: Adding feature counters
### Does this PR have any customer impact?

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

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

### Are you introducing any new config? If yes, do you have tests with and without them being set?

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

### Description

Adding feature counters

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

#### PR Summary
This pull request adds feature usage counters for user-related operations.
- `feature_counter.c`: Added new feature mappings for user CRUD operations.
- `feature_counter.h`: Defined new feature types for user CRUD operations and updated the maximum feature count.
- `users.c`: Integrated feature usage reporting for user create, drop, update, and get operations.
2024-09-05 18:18:23 +03:00
Lusen Dong 0104f7cd3c Merged PR 1399748: [Feature] $sampleRate query operator
### 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))
Add aggregation operator: $sampleRate
### Description

Implementation for $sampleRate operator
2024-08-28 16:38:56 +03:00
Jayanta Mondal d3c5128254 Merged PR 1405332: Mongo collation support Part 1 ( Find/Aggregate queries with runtime collation)
### 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 (helio_api.enableCollation). Yes.

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

### Description

Runtime implementation of collation support in Mongo Find query.

We parse the Mongo collation spec and covert it to an ICU standard collation string. An example string is "und-u-ks-level1-kc-true  This string uniquely identify collation-based string comparison logic by Postgres.  See: https://www.postgresql.org/docs/current/collation.html

This document tracks the current support matrix for query operators

| Operator  | Runtime | Index Pushdown | Comments
| --------- | ---- | ----- | ----
|  $eq | Yes | No |
|  $gt | Yes |  No |
|  $gte | Yes | No |
|  $lt | Yes |  No |
|  $lte | Yes |  No |
|  $ne | Yes |  No |
|  $in | No* |  No | See below
|  $nin | No* |  No | Do
|  $and | Yes |  No |
|  $not | Yes |  No |
|  $nor | Yes |  No |
|  $or | Yes |  No |
|  $all | Yes |  No |
|  $elemMatch |  Yes   |  No |
|  $positional | N/A | N/A | positional query operators are only used in projections.
|  $regex | N/A |  N/A   | $regex ignores collations in Native Mongo
|  $exists | N/A  |   N/A   |
|  $size | N/A  |  N/A |
|  $type | N/A |   N/A |
|  $bitsAllClear | N/A  |  N/A  | Not relevant for Utf8
|  $bitsAnyClear | N/A  |  N/A  | Do
|  $bitsAllSet | N/A  |  N/A  | Do
|  $bitsAnySet |  N/A |  N/A  | Do
|  $mod | N/A  |  N/A  | Do
|  $range | N/A  |  N/A | Only applies to Number
|  $text | N/A  |  N/A  | Seprate Index, has its own collation spec
|  $geowithin | N/A   |  N/A  | Not relevant for Utf8
|  $geointersects | N/A    | N/A   | Do

* $in/$nin is implemented with HashMap that does not support collation friendly Hashkeys
* $regex : collations are ignored with
* $text: $text spec has collation specific parameters
* $rage: For numbers only

This document tracks the current support matrix for update operators/commands

| Operator  | Runtime | Index Pushdown |
| --------- | ---- | ----- |
|  find_and_modify | No | No |
|  updateOne | No |  No |
|  updateMany | No | No |
|  createIndex | No | No |

Tests:
1. All Gated Tests pass when Collation is enabled by default

TODO:
1. Index support [already implemented - but breaking down for easy review]
2. Persist collation info while collection created [already implemented - but breaking down for easy review]
3. $cond, $let

Related work items: #3412359
2024-08-26 13:12:13 +03:00
Xing Fan ⛳ ee50a64854 Merged PR 1405817: implement $unsetField
### 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
https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/
2024-08-16 18:24:51 +03:00
Rajesh Kumar Thandapani 24704eb978 Merged PR 1409491: Change Stream implementation with Direct WAL decoding (without replication slots)
### Does this PR have any customer impact?
 Yes, it provides support for $changeStream pipeline stage for creating change stream cursor and consuming events from it.

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Adds a new UDF for change_stream_aggregation

### Are you introducing any new config? If yes, do you have tests with and without them being set?
Adds a GUC for enabling ChangeStreams freature and tests have been added to test the feature. It is disabled by default.

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
../docs/pgmongo/design_docs/data_plane/change_streams/change_stream_release_notes.md

### Description

This PR implements the change stream tailing cursors using the direct WAL decoding. It avoids using replications slots for logical decoding because of the constraints in creating and decoding with replication slots.

Related work items: #2973720
2024-07-31 17:09:22 +03:00
Deepak Bisht 91b9946227 Merged PR 1383926: setWindowFields aggregation stage
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
- Support for `$setWindowFields` aggregation pipeline stage

### Description
This PR adds the support for `$setWindowFields` aggregation stage using the Postgres `Window aggregation` operators.

For the first PR it only adds support with `$sum` aggregation operator.
Next set of PRs will individually support all the other window aggregation operators supported by `$setWindowFields` stage.

[TODO] Currently $sum is used as is (the way $group uses it), there is way to optimize this using the `Inverse Transition` functions for Window aggregation which modifies the aggregated state in a way to accomodate rows leaving the group in a moving window, which will be done later (this is done to make review on smaller set of files)

Related work items: #2272584
2024-07-11 17:56:53 +03:00
Shuai Tian 🚀 4eb63103f3 Merged PR 1359786: Add $bucket stage doc and implementation
### 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
Add bucket aggregation stage

Query time comparison for $bucket between Atlas and vCore:
https://microsoftapc-my.sharepoint.com/❌/g/personal/shuaitian_microsoft_com/EduvH4BY2O9Dnt92siIPJlUBOF5DNKNeF4BSQ6NeyZO-iQ?e=xGAuIC

Related work items: #1798584
2024-07-05 13:16:04 +03:00
Vinod Sridharan 07c3bba78c Merged PR 1390575: [Toshiba fixes] Fix up version handling and code cleanups
### 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
- Delete dead configs
- Reduce number of calls to check version information
- Move ExtensionVersion checks to shared memory
2024-07-05 13:16:04 +03:00
Duan Pei✨ 9f977c084b Merged PR 1352447: $bitAnd/$bitOr/$bitXor/$bitNot operators
### 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))
No
### Description
Implementation of bitwise aggregation operators

### Error handling instructions:
#### bitk2 collection:
![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1352447/attachments/image.png)
#### bitNot:
##### [1,2,"$a"] and $c have different processing logic:
![image (3).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1352447/attachments/image%20%283%29.png)
##### Error messages for [2.1] and ["$c"]
![image (8).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1352447/attachments/image%20%288%29.png)

#### bitAnd (bitAnd bitOr bitXor error handling logic is consistent):
![image (5).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1352447/attachments/image%20%285%29.png)
2024-07-05 13:16:04 +03:00
Parag Jain 833980da3f Merged PR 1344998: [Feature] support for $merge aggregation stage part -1
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
No
### 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:

**Things this PR has:**
1. support for $merge stage for unsharded collection.
- whenNotMatched : support for `fail` , `discard` and `insert` option.
- whenMatched : support for `replace`, `fail` and `keep-existing` option.

**What next In upcoming PR's :**
1. support for 'merge' option whenMathced
2. support for 'pipeline' option whenMatched.
3. support for sharded collection.
4. support of co-located collection. (one case : when source and taget is same)
5. Index push down for join condition.
6. optimizations in case of sharded collection and unsharded collection for single aggregation stage when we can directly refer source shard_key_column.

Related work items: #3085830
2024-07-05 13:16:04 +03:00
Jia Hu 👻 7c1104ee62 Merged PR 1371339: Schema validation wave 1 - create/update/get for metadata
### 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
wave1 - create/update/get for schema validation metadata
2024-07-05 13:16:04 +03:00
Ujjwal Agrawal cabe123eee Merged PR 1358935: $near and $nearSphere impl
### 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

Related work items: #3116418, #3244312
2024-06-21 18:21:38 +03:00
Jia Hu 👻 8a67d6e2b3 Merged PR 1332883: vector search - add support for $vectorSearch
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
support for $vectorSearch in aggregation pipeline.
2024-06-21 18:21:38 +03:00
Vinod Sridharan ac2b3d7837 Merged PR 1353542: [Pgmongo|Index] Use sequential index builds for unsharded tables
### Does this PR have any customer impact?
Yes

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Perf/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 unsharded collections we create 32 connections per table for create indexes and only 1 of them does any work: Use sequential access to better utilize connections.
2024-05-24 10:41:23 +03:00
Xiaochun Liang 64083dd0b6 Merged PR 1337819: $sortArray (aggregation) operator
### 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
$sortArray (aggregation) operator

Related work items: #2019138
2024-05-24 10:41:23 +03:00
Duan Pei✨ 064173a3d7 Merged PR 1333172: $minN/maxN array operators
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
No
### Description
Add support for $maxN/ $minN aggregation array operator.

Related work items: #2019119, #2019127
2024-05-24 10:41:23 +03:00
Tanvi Bhandari f3857be909 Merged PR 1326506: [Index Build background] Reduce default value of cron job schedule and DropIndex change
### 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)

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

### Description
1. Reduce default value of cron job schedule to 2 seconds for Index Build background feature.
    Though, the Index Build background  feature is behind GUC (disabled by-default)
2. Disable cron job for upgrade test, we have seen flakiness in the test
3. DropIndexes should be able to cancel CreateIndexes as right owner so that execution of DROP INDEX CONCURRENTLY is cleaner and it does not conflict with CREATE INDEX CONCURRENTLY

Sample serverside logs for 3rd point

```
2024-04-16 16:54:34.990 UTC [40693] LOG:  Cancel existing index build request for 6 is completed.
2024-04-16 16:54:34.990 UTC [40693] STATEMENT:  CALL mongo_api_v1.drop_indexes_concurrently($1, $2)
**2024-04-16 16:54:34.991 UTC [40704] WARNING:  CONCURRENTLY-enabled index commands can fail partially, leaving behind an INVALID index.
         Use DROP INDEX CONCURRENTLY IF EXISTS to remove the invalid index.
2024-04-16 16:54:34.991 UTC [40704] ERROR:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] HINT:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] STATEMENT:  CREATE INDEX CONCURRENTLY documents_rum_index_6 ON mongo_data.documents_1 USING pgmongo_rum ( document mongo_catalog.bson_rum_single_path_ops(path='_id'), document mongo_catalog.bson_rum_single_path_ops(path='vendorItemId'))
2024-04-16 16:54:34.991 UTC [40705] ERROR:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40705] HINT:  canceling statement due to user request**
2024-04-16 16:54:34.991 UTC [40705] STATEMENT:  CREATE  INDEX CONCURRENTLY  documents_rum_index_6_102045 ON  mongo_data.documents_1_102045 USING pgmongo_rum (document mongo_catalog.bson_rum_single_path_ops (path = '_id' ) ,document mongo_catalog.bson_rum_single_path_ops (path = 'vendorItemId' ) )

Related work items: #3109561
2024-04-19 12:03:52 +03:00
Ayush Saluja 808ebb466f Merged PR 1324589: [pgmongo] $dateDiff operator 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)

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

### Description

Related work items: #2019195
2024-04-19 12:03:52 +03:00
Ayush Saluja 19f13d0fb9 Merged PR 1291177: [pgmongo] DateAdd datesubtract aggregation operators
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
DateAdd , dateSubtract aggregation operator pr

Related work items: #2019193, #2019208
2024-04-19 12:03:52 +03:00
Deepak Bisht 58afe0aa8f Merged PR 1275776: [Pgmongo] - Part 1 GeoNear aggregation stage, add documentation and necessary operators and functions
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Support $geoNear aggregation stage

### Description
Add the design doc and necessary operators and functions needed for $geoNear

Also,
1-  Implement the $geoNear aggregation stage skeleton and support all options.
     - `distanceField`,
     - `near` (both legacy, geojson point)
     -`includeLocs`,
     -`minDistance` & `maxDistance`
     - `distanceMultiplier`
     - `key`
2- Support index pushdown of the stage to `2d` and `2dspher` index.
    - spherical / non-spherical distance support for `2d` index.
    - spherical distance support for `2dsphere` index

Things still a TODO.
1- ~~Update the mongo explain plans for geonear stage~~.
2- Make the stage require an index always, currently it can be executed without index too.
3- Fix projection for nested array fields.
4- Make common test setup for running $geoNear queries in JSTests which don't require key in mongo.
5- More testing and validations with other stages that can use $geoNear.
6- Test batching and cursor support.
7- Overall testing and validations

Related work items: #3000189, #3065270
2024-04-19 12:03:52 +03:00
Vinod Sridharan 6f1ebc3957 Merged PR 1317779: [Colocation] Prep for Colocation Hotfix
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Prep to do schema hotfix for colocation. Port to 1.13 / 1.14
2024-04-05 13:43:51 +03:00
Shuai Tian 🚀 fa33a920c7 Merged PR 1310426: add timestamp operator: $tsSecond, $tsIncrement
### 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

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

### Description
add timestamp operator $tsSecond, $tsIncrement

Related work items: #3027168, #3027169, #3027170
2024-04-05 13:43:51 +03:00
Ayush Saluja 1a9dcdd00b Merged PR 1277272: $dateTrunc aggregation operator support
### 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

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

### Description
adding support for $dateTrunc mongo operator

Related work items: #2019212
2024-04-05 13:43:51 +03:00
Santiago Fernandez Madero 2ad7381f79 Merged PR 1291973: Add inverseMatch aggregation stage
### 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)

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

### Description

Add inverseMatch aggregation stage

Currently it supports a spec like:
```
{ path: <path>, input: <doc or array of docs/path expression>, defaultResult: [optional | <bool> ]}
```

So if we want to fetch the input to the document query from an external collection, a lookup stage would need to be added prior to the inverseMatch.

The next stage of this feature is to support a spec like:
```
{ path: <path>, fromCollection: <coll>, pipelines: [$match/$project/$limit], defaultResult: [optional | <bool> ]}
```
2024-03-29 10:49:37 +03:00
Lucas Borges Fernandes 5fdd275289 Merged PR 1252995: complete_upgrade UDF in C and initialize_cluster version check
This PR adds:

* complete_upgrade UDF in C;
* initialize_cluster version check
2024-03-29 10:49:37 +03:00
Vinod Sridharan 14827ac3f9 Merged PR 1307723: [Colocation: Part 1] Support basic colocation of tables
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
- Add support for colocating tables in Postgres using the citus colocation mechanisms.
- Add support for modifying colocation with collMod
- Add support for querying shardCount and colocationId of tables in Mongo

Do this in a way that extends Helio using hooks.
2024-03-29 10:49:37 +03:00
Vinod Sridharan 7c778c19f8 Merged PR 1296261: Graphlookup part2 - Enable Tests and fix up issues
### 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)

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

### Description

From the remaining TODOs handles the following:

- [Done] To handle arrays we do a `$unwind` - move that to doing an eq/in based on the input: This is done by adding a makeArray aggregation operator and using that with `$in` expression
- [Done] Think about cycles: Add a visited check and ignore nodes that are visited before.
- [Done] Need to handle maxDepth infinite recursion more gracefully with $graphLookup.
- [Done] Need to validate against jstests

Still TODO:
- More testing on dotted paths and arrays & reducing traversals
- Implement a hash aggregate operator class for BSON
2024-03-22 11:28:50 +03:00
Vinod Sridharan 6a699bcd46 Merged PR 1289862: Part 1: Skeleton for the GraphLookup aggregation Stage
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Implement the basic skeleton for $graphLookup under a feature flag.

Remaining TODOs:
1) To handle arrays we do a $unwind - move that to doing an $eq/$in based on the input
2) Implement a hash aggregate operator class for BSON so we can use a UNION query instead of UNION ALL
3) Need to validate against jstests
4) Need to handle maxDepth infinite recursion more gracefully with $graphLookup.
5) More testing on dotted paths and arrays
6) Think about cycles

Related work items: #1798581
2024-03-08 14:01:20 +03:00
Tanvi Bhandari 8d461c2b27 Merged PR 1271218: CurrentOp showing the progress for Index Build in background
### 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

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

### Description
Issue:
Since the owner of scheduled cron job for index build background is admin user i.e. 'postgres' in prod, the CREATE INDEX CONCURRETLY queries are owned by 'postgres' user in pg_stat_activity.
And non-admin user who requests for currentOp to get progress of running indexes, does not have enough privilege to read queries owned by admin user in pg_stat_activity.

Solutions:
From inside running cron-job, create LibPQ connection as the non-admin user for CREATE INDEX CONCURRENTLY. The pre-requisite for this approach is that we have the information of user-oid who has submitted the request in queue. I.e. This needs user_name column in index_queue table.

Related work items: #2961369
2024-03-01 17:24:28 +03:00
Vinod Sridharan d4018f7a46 Merged PR 1283033: [PG16] Part2: Enable backend tests for PG16
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Changes:
- Unify rum_tuplesort_get_estimated_itemcount between PG16/PG15
- Remove set local force_parallel_mode TO ON; - This flag is removed in PG16
- Remove legacy query generation for lookup tests
- Citus 12.1 made the default behavior not to push down filters - set htat GUC to true for the extension
2024-03-01 17:24:28 +03:00
Vinod Sridharan 37744ff32a Merged PR 1279725: [Flex] Enable Data plane metrics emission from the Extension
### Does this PR have any customer impact?
No

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

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

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

### Description

Add function to emit data plane metrics from teh extension. Add a cron job to publish that every min.
Register that function as a cron job in flex.

This first part publishes the FeatureCounter data into warm path config as so:
![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1279725/attachments/image.png)

Subsequent changes will be made to add more metrics into the emission path.
2024-02-23 14:49:18 +03:00
Vinod Sridharan 3775e5a27a Merged PR 1263670: Add more checks for OSS references
### 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)

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

### Description

Add more checks for OSS references
2024-02-07 23:20:07 +03:00
Vinod Sridharan d8671eb379 Initial commit for HelioDB 2024-01-12 19:10:20 +00:00