Commit Graph
185 Commits
Author SHA1 Message Date
Deepak Bisht a19d90fef0 Merged PR 1371674: [pgmongo] - Fix distinct / findAndModify to consider all sort clauses,
### 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. $near/ $nearSphere add sort clause and target entry to the query AST which is needed to be pushed down to a subquery in a distinct call.

2. Remove the requirement of `Query` node to build the `near/nearSphere` in query_operators.c. Added 2 new fields to `BsonQueryOperatorContext` that holds referrence to the `sort clauses` and `target entries` for the sort clauses which can be added back to the `Query` node.

Related work items: #3248030
2024-06-21 18:21:38 +03:00
Jayanta Mondal d2bb6e4486 Merged PR 1374316: [Bugs] Fix lookup crash on _id ForeignField on a target sharded collection
### Does this PR have any customer impact?
Yes

### 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?
N/A

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

### Description

Fix lookup crash. We can't push down when joining on "_id" when target collection is sharded.

Push down introduced in this:https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1325613

Related work items: #3279580
2024-06-21 18:21:38 +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
Deepak Pemmaraju c44eb4ae23 Merged PR 1359979: Adding a read only role in the backend
### Does this PR have any customer impact?
By default, no. Not unless they choose to use the read only role.

### 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))
New Feature

### Description
Adding a readonly role in the backend. The goal is to enable native readonly users in Mongo VCore

Related work items: #3141137, #3158558
2024-06-21 18:21:38 +03:00
Ujjwal Agrawal dfaad4c544 Merged PR 1365793: Update radius of earth
### 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

change radius of earth to fix - bug #3051673

Results before fix -
```
mongos> db.coll.find({geo: {$geoWithin: {$centerSphere: [[0,0],  0.017453292519943295]}}})
{ "_id" : ObjectId("665823821a4e2ed433cb590f"), "geo" : [ 0, 0 ], "d" : 0 }
{ "_id" : ObjectId("665823ad1a4e2ed433cb5915"), "geo" : [ 0, 1 ], "d" : 0.017453292519943295 }
{ "_id" : ObjectId("665823b11a4e2ed433cb5917"), "geo" : [ 0, -1 ], "d" : 0.017453292519943295 }
```

Results after fix -

```
mongos> db.coll.find({geo: {$geoWithin: {$centerSphere: [[0,0],  0.017453292519943295]}}})
{ "_id" : ObjectId("665823821a4e2ed433cb590f"), "geo" : [ 0, 0 ], "d" : 0 }
{ "_id" : ObjectId("6658239e1a4e2ed433cb5911"), "geo" : [ -1, 0 ], "d" : 0.017453292519943295 }
{ "_id" : ObjectId("665823a81a4e2ed433cb5913"), "geo" : [ 1, 0 ], "d" : 0.017453292519943295 }
{ "_id" : ObjectId("665823ad1a4e2ed433cb5915"), "geo" : [ 0, 1 ], "d" : 0.017453292519943295 }
{ "_id" : ObjectId("665823b11a4e2ed433cb5917"), "geo" : [ 0, -1 ], "d" : 0.017453292519943295 }
```

Related work items: #3051673
2024-06-21 18:21:38 +03:00
Lucas Borges Fernandes 025a9452dc Merged PR 1321307: Merge Objects accumulator for group by aggregation
### Description

Implementation of the $mergeObjects accumulator.

Reference: https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/

Related work items: #2988409
2024-06-21 18:21:38 +03:00
Deepak Bisht 05c3a40f06 Merged PR 1316036: [GeoNear] Part 2 - GeoNear JSTest infra and added new distance range operator that is pushed to indexes
### 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))
Added support for $geoNear aggregation stage pipeline.

### Description
Part 2  for supporting geoNear stage

This fixes following TODOs from the last PR:

1. Push `$minDistance` and `$maxDistance` to index similar to mongo. ✅
=================
Created a new range distance query operator `@|><|` which is supported by both `2d` and `2dsphere` indexes. $geoNear now uses this instead of float8 distance less than / greater than comparisions.

1. [TODO] Make the stage require an index always. ❌
=================
$geoNear queries always require a geo index in mongo

1. Fix projection for nested array fields. ✅
=================
$geoNear projection for `distanceField` or `includeLocs` overrides the intermediate array nodes instead of recursing into arrays and updating each element.

1. Make common test setup for running $geoNear queries in JSTests which don't require key in mongo. ✅
=================
Mongo JSTests mostly create single geo index on the collection and misses the `key` option for $geoNear stage, so we override couple of mongo functions to make sure if we are using the $geoNear stage then we can update the pipeline to contain the respective `key` field, so that tests can run without failure.

1. More testing and validations with other stages that can use $geoNear. ✅
1. Test batching and cursor support. ✅
1. Overall testing and validations ✅
1. $geoNear Tests passed: **Out of 23 test dependent on $geonear now 9 are passing**, and rest are again dependednt on $near and $nearSphere which is a subset of $geonear

Related work items: #2782870, #2782872
2024-06-03 13:12:17 +03:00
Vinod Sridharan b9db5b64cb Merged PR 1366049: Fix cursor cost with streaming cursors
### 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)

### 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
- SingleBatch cursors with streaming cursors still had the custom scans and overhead
- Primary key lookup with custom streaming scans had the issue of potentially picking SeqScan due to costs changing after converting index scan -> bitmap scan.

Fix both these scenarios.

Support adding EXPLAIN with cursors to track these easier with tests.
2024-06-03 13:12:17 +03:00
Vinod Sridharan 2a2bc2d8a0 Merged PR 1365133: Fix take 3: Push the fix into the 1.16 schema hotfix train
### 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)
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
Push the $lookup fix into the 1.16 schema hotfix train
2024-06-03 13:12:17 +03:00
Ayush Saluja f09abd69e9 Merged PR 1363060: [pgmongo]$replaceAll Bug fix
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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 bug for $replaceAll.

When we try to replace this

t.aggregate([{$project: {replacedText: { $replaceAll: { input: "foo bar", find: "o", replacement: "O" } }}}])
{ "_id" : ObjectId("6654594ae0e0158ce47550f6"), "replacedText" : "fOobar" }

Output should be
{ "_id" : ObjectId("6654594ae0e0158ce47550f6"), "replacedText" : "fOObar" }

Related work items: #3220469
2024-06-03 13:12:17 +03:00
Vinod Sridharan 6a7883c578 Merged PR 1364352: [Prep] Hotfix Prep for changes for $lookup internal errors
### 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

Allow the $lookup changes to happen in 1.17-1
2024-06-03 13:12:17 +03:00
Vinod Sridharan 67519437d4 Merged PR 1362229: Fix lookup for paths that have operator like syntax
### 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)
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
Fix scenarios where the documents may have $prefixed nested fields.
When doing lookup this was treated as an operator instead of a field throwing an error
Introduce a bson_dollar_merge_documents which ignores operators and simply merges the documents directly.
2024-06-03 13:12:17 +03:00
Santiago Fernandez Madero 73e78bd4aa Merged PR 1358512: [let 2/n] Add $let 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

This PR adds support for `$let` aggregation operator, it also includes some bugfixes around variables at variable name validation and reverts flowing the variable context at parse time since there was a way to do it without flowing it.

Split in 2 commits to make easier reviewing, one for $let support and the other one to revert flowing the variable context at parse time.
2024-06-03 13:12:17 +03:00
Vinod Sridharan 8b8e029699 Merged PR 1360629: [Perf] Skip/Limit + RUM scan perf improvements
### Does this PR have any customer impact?
Yes

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

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

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

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

### Description

1) When Skip: 0 & Limit: 0 this means that skip and limit are unset. We did this correctly, but that case is streamable as a cursor. We treat this as a persistent cursor leading to connection usage being less optimal. This fixes that to make skip/limit being streamable
2) Log extension versions every hour so that we can track this in Flex
3) For Bitmap scans with compare partial we use a tuplestore and store the Tids for the matching entries. While this is good, a TidBitmap is more efficient in storing TIDs. a tuple store stores it as (Block, Offset), (Block, Offset) ....
vs TIDBitmap stores it as (Block, Offset; Offset;Offset;Offset) (Block, Offset;Offset;) which is more efficient but also makes it lossy to preserve memory. In cases where the size fits in memory (under ~65K pages touched) this performs better than a tuplesort. After that, it still performs better if the intersection of the terms is small. Switch to this mode for tidbitmap where the bitmap is already lossy.

For certain bitmap scans, this brought the runtime from 1.2s to ~280ms.
2024-06-03 13:12:17 +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
John Pao d6b42eaf88 Merged PR 1355152: Enable installation of Mongo C driver for containers
### 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

### 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
Enable installation of Mongo C driver for containers

Related work items: #3141377
2024-05-24 10:41:23 +03:00
Javier Figueroa 1123f4f2a2 Merged PR 1356960: Bumping schema version for 1.17 release
### 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

### 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
Bumping schema version for 1.17 release
2024-05-24 10:41:23 +03:00
Santiago Fernandez Madero d075283e14 Merged PR 1345825: [let 1/n] - Make variables part of aggregation expression data and support expressions as the variable value
### 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 variables part of aggregation expression data and support expressions as the variable value. Also this flows the variable context through projection tree which is needed to support lookup let and also let on update and find (top level let).

Once this is in, next PR will be to support the $let aggregation operator, which will set the variable context at parse time for it's child expressions.
2024-05-24 10:41:23 +03:00
Ayush Saluja 4025aef053 Merged PR 1344944: [pgmongo] DateFromString implemntation Part 1
### 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 aims to support $dateFromString operator.
Since this has multiple parts and complexity to it this part of the pr will take care of handling all the input strings and parsing them with the given input format and incase format is not specified we use for now Default format to parse the dateString. If not parseable we throw error.

In next set of pr we will aim to parse the string  when format is not specified with even more format checks

Related work items: #2019204
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
Ayush Saluja e2f0854313 Merged PR 1337174: [pgmongo] dateTrunc custom jstest and adding more sql tests
### Does this PR have any customer impact?

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

### 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 bug for dateTrunc startOfweek handling and adding more sql tests
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
Xing Fan ⛳ 20f5955f87 Merged PR 1337657: add aggregation array operator $zip
### 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
Add array operator: $zip

Related work items: #2019134
2024-05-24 10:41:23 +03:00
Rajesh Kumar Thandapani a781d0e3fe Merged PR 1299301: Change Stream aggregation stage implementation
### Does this PR have any customer impact?
   No. It does not have any customer impact, since the UDF is not exposed to users in this PR.

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
   Feature. It introduces infrastructure and an UDF for implementing Change Streams.

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
   Change Stream Aggergation stage UDF(change_stream_aggregation) has been added in this PR.

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
 The release notes for this feature is available here:
 docs/pgmongo/design_docs/data_plane/change_streams/change_stream_release_notes.md

### Description

### Description
This PR implements the change stream aggregation UDF `change_stream_aggregation`
 It adds some unit tests for testing change stream.

# Supported Features
    Currently, the $changeStream aggregation supports only these features:
    1) Watching a collection for the following change events:
        a) INSERT
        b) UPDATE:
            NOTE: UPDATe event always provides the new document after update.
                  The update_description field is not supported yet.
        c) DELETE
    2) Resuming the change stream from a particular event using the "_id" field in the change event
    or the "postBatchResumeToken" field in the change stream cursor.

# Current Limitations:
    1) The following events are not supported:
        a) create
        b) createIndexes
        c) drop
        d) dropDatabase
        e) dropIndexes
        f) invalidate
        g) refineCollectionShardKey
        h) rename
        i) replace: NOTE: this event is published as "UPDATE" currently.
        j) reshardCollection
        k) shardCollection

        NOTE: Expanded Events:
            The above list includes expanded events also. The option "showExpandedEvents" is not supported.

    2) Unsupported change stream pipeline options:
        All the options other than "resumeAfter" is not currently supported, and will result in an error.

        NOTE:  Hisstorical change stream events are not supported "startAtOperationTime"
        So change streams can be created from the current time only.

    3) Change Stream targets:
        Currently, $changestream aggregation can be applied at collection level only. Not at the database/cluster level. But Multiple change streams can be opened on multiple collections.
        But the current default maximum limit on parallel change streams by default is "5".

    4) Support for multi node clusters.
         Change Streams are supported only at the single node clusters.
2024-05-24 10:41:23 +03:00
Vinod Sridharan 664f510924 Merged PR 1352385: [1.16] Deployment internal error fixes
### 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))
N/A
### Description

- Fix Lookup error with _id performance fix
    - if lookup had a $sort/$group as an inner pipeline, then this would return a function not found error
- Attempt to fix spurious column needs to be in group by to be used in aggregate
- Attempt to fix $collStats errors with Cache Lookup Failed
      - Unable to repro but the error kicks in on template tuple_desc creation so ensure that the values are correct (they were incorrectly constructed). Not sure why this pops up now.
2024-05-24 10:41:23 +03:00
Vinod Sridharan 3a19bd21b0 Merged PR 1349692: Cursor changes
### Does this PR have any customer impact?
Yes

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

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

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

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

### Description
This covers a few issues uncovered in customer investigations:
1) Explain doesn't show the new $not operators and instead uses $unknown
2) For streaming cursors we can't support parallel scans since that could reorder the tuples and make us miss results. If we have a streaming cursors - remove the parallel plan altogether
3) For non-streaming cursors, always prefer index paths over parallel seqscans - this is because our statistics aren't great and on large docs (esp with LIMIT) the selectivity makes the planner think a parallel path can be faster. We can re-evaluate this with statistics later
4) For non-streaming cursors with LIMIT, allow index scans instead of bitmap scans with a GUC. This also needs to be paired with the RUM enable_semifast_gettuple - this is behind a GUC to allow for validation of correctness. Outside of LIMIT scenarios do not allow this yet.

Note: This is not yet enabled for TTL purger since we want to improve that case with an improvement inside amgettuple first.
2024-05-13 13:23:03 +03:00
Vinod Sridharan a9ce9d1c81 Merged PR 1348551: Cursor fixes: Fix non-determinism of SeqScan
### 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
SeqScan paths aren't deterministic with large collections and caching. With Buffer caching, seqscans start in the middle and wrap around and change arbitrarily with every seqscan call.

Our cursor implementation assumes increasing order of TIDs.

Convert SeqScan to a TIDRangeScan with initial scan being >= (0,0) and subsequent calls with >= ContinuationTOken.

This also allows for us to more efficiently skip pages on getmore calls making the overall calls faster.
2024-05-13 13:23:03 +03:00
Lucas Borges Fernandes 533dc34b1a Merged PR 1347886: Moving $addToSet to 1.15-1
Adding $addToSet in 1.15-1.
Removing it from 1.14-7.
2024-05-13 13:23:03 +03:00
Lucas Borges Fernandes 51042e6473 Merged PR 1334895: AddToSet accumulator for group by aggregation stage
### Description
Implementation of the $addToSet group accumulator.

Reference: https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/

Related work items: #2988403
2024-05-13 13:23:03 +03:00
Vinod Sridharan 7625068b45 Merged PR 1343473: [Negation] Prep Negation Operators for hotfix into 1.14
### 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)
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))
N/A
### Description
Prep the sql changes for hotfixing into 1.14-6
2024-05-03 13:34:41 +03:00
Javier Figueroa 01d68d4efa Merged PR 1343345: Commit 7e3533e6: Bumping schema for 1.17 release
### 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

### 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
Commit 7e3533e6: Bumping schema for 1.17 release
2024-05-03 13:34:41 +03:00
Vinod Sridharan 4bad70837f Merged PR 1341129: Enable index builds without connection limits
### 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))
N/A
### Description
Don't let citus.max_client_connections affect LibPQ connections by marking these connections as internal
2024-05-03 13:34:41 +03:00
Jayanta Mondal 7fc11c2dd8 Merged PR 1339203: Vector Index error message fix
### Does this PR have any customer impact?
No

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

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

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

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

### Description

This is a minor bug in our code that we caught during writing some release validation specs.  Existing and request indexes were flipped.
2024-05-03 13:34:41 +03:00
Jayanta Mondal fe6dd724f3 Merged PR 1337682: Text Index error code/message fix
### Does this PR have any customer impact?
May be.

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

Mongo allows only one text index. We also allowed once. But when someone created the second index, we said that an equivalent index exists instead of saying one can't create more than one text index.
2024-05-03 13:34:41 +03:00
Vinod Sridharan d4d9f5cda9 Merged PR 1333485: [Negation] Add support for pushdown of the $not operator sometimes
### 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))
Adds index pushdown for $not operators
### Description
Adds index pushdown for $not operators
2024-04-26 16:19:32 +03:00
Vinod Sridharan cf88b82fe7 Merged PR 1332248: Selectivity Part 1: Implement operator statistics behind a flag
### 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))
N/A
### Description
Implement statistics for bson Dollar functions behind a feature flag. This uses the default Postgres operator statistics using Most Common Value and Histogram stats if available to compute.

As a fallback it also uses operator data to provide default values if needed.

Sets up an ANALYZE function on bson so that this can be improved (since the ANALYZE is not there yet). This will be done in a subsequent change.
2024-04-26 16:19:32 +03:00
Vinod Sridharan 6da56e4c27 Merged PR 1326035: Performance fixes for nativeColocation & Shard pushdown
### Does this PR have any customer impact?
No (Behind a feature flag)

### 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
Improve perf for single node - go for the shard directly if it’s available improving single node perf.

For perf results we see
YCSB Read: 8000 reads/sec. (Up from 6300)
YCSB Update: 1745 ops/sec ( from 1550)
YCSB Insert: 1760 ops/sec (from 1550)
2024-04-26 16:19:32 +03:00
Vinod Sridharan 63b7efe545 Merged PR 1332139: [RUM] Delete non fast scan code (and other code cleanups)
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Delete the non-fast scan code since the faster scan code has been made default everywhere. Also remove some of the old CLusterVersionisAtleast() paths
2024-04-26 16:19:32 +03:00
Lucas Borges Fernandes 4d82761118 Merged PR 1328531: Ignoring returnKey parameter when set to false
### Description
TODO
2024-04-26 16:19:32 +03:00
Mehmet YILMAZ 3b71f63ea9 Update heliodb-oss-sync.yml for Azure Pipelines 2024-04-26 14:15:42 +03:00
Mehmet YILMAZ 47753dc08f Update heliodb-oss-sync.yml for Azure Pipelines 2024-04-26 13:51:01 +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
Santiago Fernandez Madero e8ff45b702 Merged PR 1325618: Treat path expressions as CURRENT.path as that should be the behavior
### 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

CURRENT is a system variable that points to ROOT (current document) unless it is overridden, if it is overridden, path expressions should point to that value rather than ROOT, which means "$a" is equivalent to "$$CURRENT.a".

This PR changes path expressions to be `CURRENT.path` rather than just `path`.

This hasn't been a problem since we don't support $let yet, however, now that we're adding expressions that can define variables, like `$map` this showed up on JS Tests.
2024-04-19 12:03:52 +03:00
Ujjwal Agrawal 7a010db2d7 Merged PR 1304026: [Bugfix] Some self intersecting polygons don't throw error
### 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 jstest for self intersecting polygons

Related work items: #2894103
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
Jia Hu 👻 f7fc1d3bfd Merged PR 1315834: add array operator: $map, $reduce
### 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 array operator: $map, $reduce

Related work items: #2019117, #2019128
2024-04-19 12:03:52 +03:00
Vinod Sridharan 09e47359ba Merged PR 1327595: [Lookup Hotfix] Prep for the Lookup Hotfix
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor/Hotfix
### 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 the schema for a $lookup perf hotfix.
2024-04-19 12:03:52 +03:00
Vinod Sridharan 8c7173a2d9 Merged PR 1325613: Lookup Index pushdown
### 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
Lookup Index pushdown: Allow index pushdown of lookup queries for both left and right queries.
For _id joins, push to the B-tree index and use the object_id column.
For RUM indexes, introduce a new function and support that allows pushing to the index based on the specified path rather than the document itself.

This caused a customer $lookup query to go from taking 45+ mins and timing out to finishing in under 3 mins
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