Commit Graph
28 Commits
Author SHA1 Message Date
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