Commit Graph
611 Commits
Author SHA1 Message Date
Shuai Tian a1ce474e5e Update regress_tests.yml to remove ubuntu-20.04 (#75) 2025-02-21 12:51:50 -08:00
Hari Krishna Sunder 8e2bb657ea Fix error message in pg_documentdb_core.c (#70) 2025-02-20 22:32:19 -08:00
shuaitian 3d4041925d DocumentDB sync sha=af52bf2d4 2025-02-19 17:00:35 +08:00
Santiago Fernandez Madero 322fba0605 Merged PR 1566855: [OSS] Fix TTL indexes in documentdb
### Does this PR have any customer impact?

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

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

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

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

### Description

[OSS] Fix TTL indexes in documentdb

This moves the function to C and instead of querying the indexes and then getting the collection shards from pg_dist_shard table, it uses the C hook to get the table shards where for non-distributed it returns the base table and then uses that information to drop the expired records.

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

#### PR Summary
This pull request addresses issues with TTL indexes in DocumentDB by refactoring and optimizing the deletion of expired rows.
- `ttl_index.c`: Refactored the function to delete expired rows, added a new function `delete_expired_rows`, and optimized the deletion process.
- `ttl_support_functions--latest.sql` and `delete_expired_rows--latest.sql`: Replaced PL/pgSQL procedures with C language implementations for better performance.
- `collection.c`: Moved the function `GetMongoCollectionShardOidsAndNames` from `coll_stats.c` to `collection.c` for better organization.
2025-02-19 17:00:35 +08:00
Jayanta Mondal 4d5d15992c Merged PR 1582153: [Engine] Adding feature counter for sort by id
### Does this PR have any customer impact?

No

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

Feature counter

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

No

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
No

### Description

Adding feature counter for sort by id to make decisions about sort by id pushdown to primary key optimization.
2025-02-19 17:00:35 +08:00
Zinan Ren 1d3b47c814 Merged PR 1573602: [Vector] Add "exact" search parameter to enable enn search
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature, Perf
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

### Introduce new field "**exact**" in vector search spec to specify whether to run ENN or ANN search.
[exact field spec](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#fields)

### Value can be one of the following, defaults to false.
- false - to run ANN search
- true - to run ENN search

### Example
`{ "k": 1, "path": "vect", "filter": {"attr": {"$eq":1}}, "exact": true, "efSearch": 40 }`
----
#### AI description  (iteration 1)
#### PR Classification
Code enhancement for filter selectivity in vector search queries.

#### PR Summary
This pull request enhances the filter selectivity mechanism in vector search queries by adding new functions and improving existing ones.
- `bson_aggregation_vector_search.c`: Added functions to calculate filter selectivity and handle vector search options, including `AddEmptySearchParamFunctionToQuery` and `GetFilterSelectivity`.
- `index_support.c`: Added logic to identify vector search queries in the planner.
- `system_configs.c`: Introduced new configuration variables for maximum filter selectivity and document count.
- `documents_planner.c`: Enhanced planner to handle vector search queries based on selectivity.
- `vector_common.h`: Declared new configuration variables for vector filter runtime sort selectivity and document count.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-19 17:00:35 +08:00
Shuai Tian 1d8bc4fdac Merged PR 1576536: cleanup of duplicated definition of BSON_MAX_ALLOWED_SIZE
### Does this PR have any customer impact?
No

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

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

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

cleanup of duplicated definition of BSON_MAX_ALLOWED_SIZE

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to remove duplicated definitions.

#### PR Summary
This pull request removes duplicated definitions of `BSON_MAX_ALLOWED_SIZE` to improve code maintainability.
- Removed `#define BSON_MAX_ALLOWED_SIZE` from `configs/testing_configs.c`
- Removed `#define BSON_MAX_ALLOWED_SIZE` from `configs/system_configs.c`
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-19 17:00:35 +08:00
Andrew Khoma 88d540f206 Merged PR 1578484: Deprecate the enableIndexBuildBackground option
### 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, removing the old one

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
deprecate the enableIndexBuildBackground from the code base, but leave the create_indexes and drop_indexes for backward compatibility

----
#### AI description  (iteration 1)
#### PR Classification
Deprecation

#### PR Summary
This pull request deprecates the `enableIndexBuildBackground` option in the codebase.
- `PostgresClient.cs`: Removed `enableIndexBuildBackground` parameter from `DropIndexesAsync` and `CreateIndexesAsync` methods.
- `TenantConfigurationBase.cs`: Removed `EnableIndexBuildBackground` property and related constants.
- `CreateIndexTests.cs`: Removed test configurations related to `enableIndexBuildBackground`.
- `indexing.rs`: Removed checks and configurations for `enableIndexBuildBackground`.
- Configuration files and scripts: Removed `enableIndexBuildBackground` settings.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->

Related work items: #3759102
2025-02-19 17:00:35 +08:00
Deepak Bisht 83e22d92f3 Merged PR 1573978: Improve Let with Lookup
### Does this PR have any customer impact?
No

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

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

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
Improve Perf in $lookup with let stage with nested join pipeline

### Description
Today the pipeline `$match` stage is not inlined with lookup right collection query in case it has `$expr` and let expression. Move this to right query if `$match` is the first non-inlined stage.

This improves the JOIN criteria and fetches lesser documents from right collection. We have seen cx cases where very small set of docucments can breach the 100 MB document limit otherwise.

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

#### PR Summary
This pull request improves the handling of `$let` with `$lookup` in the aggregation pipeline by simplifying and optimizing the code.
- Removed the `QueryDocumentHasExpr` function and simplified the `CanInlineLookupStageMatch` function in `bson_aggregation_pipeline.c`.
- Enhanced the `OptimizeLookup` function to build and use `$let` expressions more efficiently in `bson_aggregation_nested_pipeline.c`.
- Simplified the `ProcessLookupCoreWithLet` function to directly use variables from the left query in `bson_aggregation_nested_pipeline.c`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-19 17:00:35 +08:00
Andrew Khoma 4dee5a8d5e Merged PR 1553896: [Gateway][SinglePool] Implement rest of DMLs and explains
### 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, creating new UDFs:
- `mongo_api_internal.run_explain_as_user`
- `list_databases`

### Are you introducing any new config? If yes, do you have tests with and without them being set?
yes, gating the explain experience behind the `pgmongo.enableExplainsInSharedUserPool`

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

### Description
Port the rest of the DML commands and explains to the backend.
Update all of the test coverage for explains for the new changes too.
Move ListDatabases command from Gateway to backend

Related work items: #3759098
2025-02-19 17:00:35 +08:00
Siddhesh Vethe 8cb3861a3c DocumentDB sync sha=8e9bffeed 2025-02-13 17:09:16 -08:00
Patty Chow ea3c32e7c5 Merged PR 1577369: Updated CHANGELOG.md to mark v0.101-0 as released
### Does this PR have any customer impact?

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

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

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

Updated CHANGELOG.md to mark v0.101-0 as released

----
#### AI description  (iteration 1)
#### PR Classification
Documentation

#### PR Summary
Updated the changelog to mark the release date of version v0.101-0.
- `oss/CHANGELOG.md`: Marked v0.101-0 as released on February 12, 2025.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Jayanta Mondal c58c166417 Merged PR 1578348: [Engine] Putting push down sort by _id to primary key behind a feature flag and setting it off by default.
### Does this PR have any customer impact?

We had a regression in 1.24, this reverts that by putting it behind a flag and setting it off. The tests are ran using the config being set to on for quick turnaround.  We have one test with the flag set to off.

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

### 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?
Not yet

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

We had a regression in 1.24, this reverts that by putting it behind a flag and setting it off. The tests are ran using the config being set to on for quick turnaround.  We have one test with the flag set to off.

Will follow up with a proper fix and tests.

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

Putting Pushing down sort by _id to primary key behind a feature flag.

which was implemented in.
https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1525883

#### PR Summary
This pull request introduces a new feature flag to enable or disable pushing down sort by ID to the primary key.
- `configs/feature_flag_configs.c`: Added a new feature flag `EnableSortbyIdPushDownToPrimaryKey`.
- `bson_aggregation_pipeline.c`: Modified sort handling to respect the new feature flag.
- `postgresql.conf` files: Updated configurations to include the new feature flag.
- `utils.sh`: Added the new feature flag to the setup script.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Vinod Sridharan b0ddee67fe Merged PR 1577306: [Vector] Iterative search take 2: Parser changes
### Does this PR have any customer impact?
No

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

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

### Description
To do iterative search, this is a different approach and trying to see if we can do it better to load fewer documents. This change introduces only the parser changes behind a feature switch to do a different iterative search. The remaining planner and exec changes will be done in subsequent PRs.

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Parser changes for iterative search using Vector DiskANN.

#### PR Summary
This pull request introduces parser changes to support iterative search using Vector DiskANN.
- Added `bson_aggregation_pipeline_vector_diskann_planner.out` with test cases for inserting and querying documents using Vector DiskANN.
- Added `bson_aggregation_pipeline_vector_diskann_planner.sql` with SQL scripts for creating functions, inserting documents, and performing search operations using Vector DiskANN.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Santiago Fernandez Madero d5939dd4a3 Merged PR 1577877: Fix wrong offset for single path options for index
### Does this PR have any customer impact?

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

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

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

Fix wrong offset for single path options for index

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

#### PR Summary
This pull request fixes an incorrect offset for single path options in the index.
- `oss/pg_documentdb/src/opclass/bson_gin_entrypoint.c`: Corrected the offset from `BsonGinWildcardProjectionPathOptions` to `BsonGinSinglePathOptions`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Vinod Sridharan 2856f55e44 Merged PR 1576168: Fix vector search for OSS & add support for force pushdown of vector index.
### 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?
Yes
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
- Vector search pushdown to vector index was broken in OSS.
- Add option to force push vector search to vector index.

----
#### AI description  (iteration 2)
#### PR Classification
Bug fix and new feature.

#### PR Summary
This pull request fixes vector search for OSS and adds support for force pushdown of vector index.
- Added new test files `bson_aggregation_pipeline_tests_vector_hnsw_planner.out` and `bson_aggregation_pipeline_tests_vector_hnsw_planner.sql` for vector search and HNSW index.
- Updated `index_support.c` to include support for vector index pushdown, including new functions `UpdateIndexListForVector`, `MatchIndexPathForVector`, and `ThrowNoVectorIndexFound`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Vinod Sridharan 8e6210ca46 Merged PR 1574183: [Vector] Clean up dead vector code
### 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?

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
Clean up dead vector code - the score calculation is now embedded in the document.

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

#### PR Summary
This pull request removes dead vector code from the project, simplifying the codebase and improving maintainability.
- Removed `CreateFCInfoForScoreCalculation` and related logic from `src/vector/vector_utilities.c`.
- Deleted `SearchQueryEvalDataWorker` struct and associated functions from `include/vector/vector_utilities.h`.
- Cleaned up vector search data handling in `src/customscan/custom_query_scan.c`.
- Removed vector search query data extraction logic from `src/opclass/index_support.c`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-13 17:09:16 -08:00
Cornelius Boateng b0289c3bf3 Merged PR 1518085: [engine] $$NOW in Aggregate and Find with Cursor Support
### Does this PR have any customer impact? No

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

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

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

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

### Description
Store the value of $$NOW in the variable spec as  `now`.
Pass it through the ParseAggregationContext to be utilized by operators that implement the new aggregation framework.
Persist value in the cursor's continuation document to be used for get_more queries.

Enable/Disable with `EnableNowSystemVariable` GUC.

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

#### PR Summary
This pull request introduces the `NOW_SYS_VARIABLE` to the BSON aggregation pipeline, allowing the use of the current timestamp in aggregation operations.
- Modified `bson_aggregation_pipeline_tests_add_to_set_group.out` to include `NOW_SYS_VARIABLE` in the BSON expressions for various aggregation operations.

Related work items: #3613264, #3613268
2025-02-13 17:09:16 -08:00
Siddhesh Vethe edb40b6d04 DocumentDB sync sha=97abb373c 2025-02-10 14:08:55 -08:00
Javier Figueroa 1ce14b116c Merged PR 1572551: Updating schema to release 1.101
### Does this PR have any customer impact?
No

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

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

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

### Description
Updating schema to release 1.101

----
#### AI description  (iteration 1)
#### PR Classification
Schema update for new release version.

#### PR Summary
This pull request updates the schema to release version 1.101, including version bumps and minor SQL adjustments.
- Updated `default_version` in `documentdb_distributed.control`, `documentdb.control`, and `documentdb_core.control` to `0.102-0`.
- Updated `default_version` in `pgmongo.control` to `1.101-0`.
- Added new SQL file `pgmongo--1.101-0--1.102-0.sql` with search path settings.
- Updated SHA1 checksums for various `pgmongo` SQL files.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-10 14:08:55 -08:00
Amit Prabhudesai d95c1e3717 Merged PR 1519739: Fix mongorestore for collections with text indexes
### 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
To be updated. Meanwhile, please see the text_indexes.md file in the changeset for what motivated this change, and also a brief description of the same.

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

#### PR Summary
This pull request fixes the `mongorestore` functionality for collections with text indexes by handling the `_fts` and `_ftsx` metadata terms correctly.
- Added documentation on text indexes in `PGMongo` in `docs/pgmongo/design_docs/data_plane/indexing/text_indexes.md`.
- Updated `oss/pg_helio_api/src/metadata/index.c` to handle `_fts` and `_ftsx` terms in index specifications.
- Modified `oss/pg_helio_api/src/commands/create_indexes.c` to correctly generate index expressions and handle text index options.
- Updated `docs/pgmongo/design_docs/data_plane/indexing/toc.yml` to include the new text indexes documentation.
v0.101-0
2025-02-10 14:08:55 -08:00
Rajesh Kumar Thandapani 762d962035 Merged PR 1539952: allChangesForCluster option for change streams
### Does this PR have any customer impact?
Yes. This PR provides the option of "allChangesForCluster" to be able to track all the changes happening in the cluster with a change stream cursor.

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

first version of allChangesForCluster implementation

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

#### PR Summary
Implemented the first version of the `allChangesForCluster` feature in the change stream.
- `change_stream_wal_utils.c`: Added logic to track changes for the entire cluster and refactored relation ID retrieval.
- `change_stream_aggregation_stage.c`: Updated context initialization to handle `allChangesForCluster` and added error handling for missing collections.
- `change_stream_decoding_utils.c`: Enhanced event building to support cluster-wide change tracking and added a function to get collection by relation ID.
- `change_stream.h`: Extended `ChangeStreamEvent` and `ChangeStreamSpec` structures to include cluster-wide tracking.
- Updated tests in `pgmongo_change_stream_crud_tests.sql` and `pgmongo_change_stream_crud_tests.out` to reflect the new feature.
2025-02-10 14:08:55 -08:00
Deepak Bisht c9b76507ef Merged PR 1572151: [Part1] Add the bson_dollar_merge_documents override function to accept mutating nested arrays
### 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)
Yes

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

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
Because of N-1 tests we can't update the sql UDF and start using it in documentdb at the same release. This 1 of 2 PRs to add the schema changes in release 0.101 and next PR will start using these UDF in documentdb in 0.102

Bug description: `bson_dollar_merge_documents` UDF today doesn't override nested arrays for projection with conflicting path and add the new projection entities inside each element of array which is not required in few places
e.g. $lookup, $graphlookup etc

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

#### PR Summary
This pull request introduces a new function to handle mutating nested arrays in BSON documents.
- Added `bson_dollar_merge_documents` function with an override flag in `bson_projection--0.101-0.sql`.
- Implemented `MergeDocumentWithArrayOverride` function in `bson_project.c` to support the new feature.
- Updated test cases in `bson_aggregation_stage_lookup_tests.sql` and corresponding expected output files.
- Included the new SQL file in `documentdb--0.100-0--0.101-0.sql` and `pgmongo--1.24-0--1.101-0.sql`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-10 14:08:55 -08:00
Vinod Sridharan f25d15c777 Merged PR 1570516: [OSS] Add changelog file to track major commits within a release
### Does this PR have any customer impact?
No

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

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

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

### Description
Add changelog file that tracks major changes for OSS releases

----
#### AI description  (iteration 1)
#### PR Classification
Documentation

#### PR Summary
This pull request adds a changelog file to track major commits within a release.
- Added `oss/CHANGELOG.md` to document major changes and releases.
- Updated `/.azuredevops/pull_request_template.md` to reference the new changelog file.
- Modified `/docs/sop/deployment/full-release-process.md` to include updating the changelog as part of the release process.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-10 14:08:55 -08:00
Siddhesh Vethe fd184eeaf0 DocumentDB sync sha=019defce0 2025-02-06 09:18:21 -08:00
James Broadhead ef50a1fb50 Parse cpuinfo on aarch64 machines (#53)
- Note this will reduce the number of threads used on x86 to 1:processor
  rather than 1:core
2025-02-06 09:18:21 -08:00
Marco Slot b54f0ce538 Fix compiler warnings (#14)
* Do not use PG_RETURN_NULL in non-UDF

* Use conventional struct initializer syntax
2025-02-06 09:18:21 -08:00
Vinod Sridharan 5d4ee953fc Merged PR 1568551: Improve group performance with large docs
### 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

Improve group performance with large docs

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

#### PR Summary
This pull request aims to improve the performance of group operations with large documents.
- `bson_aggregation_pipeline_tests_facet_group.out`: Added new test cases to validate performance improvements in group operations.
- `bson_aggregation_pipeline_tests_bucket.out`: Updated test cases to reflect changes in group and bucket operations.
- `bson_aggregation_pipeline.c`: Introduced a new function `GetDocumentExprForGroupAccumulatorValue` to optimize group accumulator expressions by evaluating constants statically.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-02-06 09:18:21 -08:00
Parag Jain de314b0b03 Merged PR 1567549: [perf] Reduce Call of MongoQueryFlagsWalker in INSERT PATH
### 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
Optimize Insert Query try to reduce call of MongoQueryFlagsWalker in INSERT PATH

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

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

#### PR Summary
This pull request optimizes the planner by reducing unnecessary calls to `MongoQueryFlags` during the INSERT command path.
- `src/planner/documents_planner.c`: Added a condition to skip calling `MongoQueryFlags` if the command type is `CMD_INSERT`.
2025-02-06 09:18:21 -08:00
Vinod Sridharan d2a7669a25 Merged PR 1566832: [OSS] Enable support for current_op aggregation stage in DocumentDB
### Does this PR have any customer impact?
Yes

### 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?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Enable support for current_op aggregation stage in OSS.
Still pending: support for getting locking pids and index builds.
----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request enables support for the `current_op` aggregation stage in DocumentDB.
- Added new functions in `current_op--0.101-0.sql` and `current_op--latest.sql` to support the `current_op` aggregation stage.
- Modified `current_op.c` to handle new attributes and improve the `current_op` command processing.
- Updated `system_configs.c` to include a new configuration variable for tracking the application name in `current_op`.
- Adjusted test cases in `bson_aggregation_pipeline_tests_coll_agnostic.sql` and related expected output files to validate the new feature.
- Updated `metadata_cache.c` to correctly reference the `current_op_aggregation` function.
2025-02-06 09:18:21 -08:00
Vinod Sridharan c6396e5fea Merged PR 1566979: [OSS] Fix tests to run properly
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Tests
### 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
As part of porting tests to OSS, some of the schemas were mangled and this caused the tests to test nothing and the baselines to be checked in incorrectly.

Fix those and add validation to prevent this specific type of error

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for failing tests.

#### PR Summary
This pull request addresses issues with failing tests by correcting line references in the expected output files.
- `oss/internal/pg_documentdb_distributed/src/test/regress/expected/bson_query_operator_tests_index.out`: Updated line numbers in error messages to match the correct references in the SQL test files.
2025-02-06 09:18:21 -08:00
James Broadhead 7eeddee36d Parse cpuinfo on aarch64 machines (#53)
- Note this will reduce the number of threads used on x86 to 1:processor
  rather than 1:core
2025-02-04 20:35:30 -08:00
Marco Slot 77ac932af8 Fix compiler warnings (#14)
* Do not use PG_RETURN_NULL in non-UDF

* Use conventional struct initializer syntax
2025-02-04 09:35:31 -08:00
b30e538639 DocumentDB sync 20250131 (#48)
* Merged PR 1565985: [OSS] Enable DBStats and CollStats in documentdb

### Does this PR have any customer impact?
Yes

### 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
Enable DBStats, CollStats and indexStats in DocumentDB. These were partially broken due to their dependence on Citus. Add appropriate hooks to ensure that Distributed continues to work.

Also clean up the code reuse of run_command_on_all_nodes across the 4 diagnostic commands.

CurrentOp and index builds are also broken but will be tackled in a separate change.

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

#### PR Summary
This pull request enables the `DBStats` and `CollStats` commands in DocumentDB.
- `db_stats.c` and `coll_stats.c`: Refactored functions to retrieve shard OIDs and names, returning boolean status.
- `distributed_hooks.c`: Added core function to get shard IDs and names for a collection.
- Added new regression tests in `bson_aggregation_pipeline_diagnostic_command_tests.out` to validate `DBStats` and `CollStats` functionality.

* Merged PR 1565678: Updated README to remove architecture images per PGCA guidelines

### Does this PR have any customer impact?
No.

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

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

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

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

### Description
Per PGCA guidelines, we are temporarily removing the architecture image and replacing it with an approved one soon.

----
#### AI description  (iteration 1)
#### PR Classification
Documentation update

#### PR Summary
This pull request updates the README to comply with PGCA guidelines by removing architecture images.
- `oss/README.md`: Removed the architecture image.

* DocumentDB sync sha=f3b8a6ec5

---------

Co-authored-by: Vinod Sridharan <visridha@microsoft.com>
Co-authored-by: Patty Chow <patty.chow@microsoft.com>
2025-01-31 13:01:15 -08:00
Siddhesh Vethe 4bc928e236 DocumentDB sync sha=79d72e3c8 2025-01-30 12:32:22 -08:00
Vinod Sridharan e3c7e3c71f Merged PR 1564344: [OSS] Add validation scripts into the OSS set up as well
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Infra
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
We have validation scripts we run internally. Run a subset of them on OSS

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

#### PR Summary
This pull request adds validation scripts to the OSS setup to ensure code quality and consistency.
- Added `oss/scripts/validate_extension_file_state.sh` to validate no Citus references and check SQL file versions.
- Updated `/.pipelines/templates/oss_documentdb_build.yml` to include the new validation script in the build process.
- Modified `/oss/.github/workflows/regress_tests.yml` to run the new validation script during regression tests.
- Updated messages in `oss/scripts/validate_headers.sh` for clarity.
2025-01-30 10:35:08 -08:00
Deepak Bisht 2f8e8792a4 Merged PR 1563785: [OSS] Fix scripts/start_oss_server script, -c option always tends to break
### 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

Fixed OSS issue: https://github.com/microsoft/documentdb/issues/40

`start_oss_server script -c` option is broken.

Once the `search_path` is set in ~/.psqlrc that is used for creating the extensions until unless an override is provided the install location for dependent extension started deviating from `public`

```SQL
SELECT e.extname AS extension_name,
       n.nspname AS schema_name
FROM pg_extension e
JOIN pg_namespace n ON e.extnamespace = n.oid
WHERE e.extname IN  ('documentdb', 'documentdb_core', 'pg_cron', 'tsm_system_rows', 'vector', 'postgis', 'rum');
 extension_name  |   schema_name
-----------------+-----------------
 documentdb_core | public
 pg_cron         | pg_catalog
 tsm_system_rows | documentdb_core
 vector          | documentdb_core
 postgis         | documentdb_core
 rum             | documentdb_core
 documentdb      | public
(7 rows)
```

Always `CREATE EXTENSION` without psqlrc shell overrides for deterministic behavior.

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

#### PR Summary
This pull request fixes the `-c` option in the `scripts/start_oss_server` script which was causing issues.
- `oss/scripts/utils.sh`: Added `SCHEMA public` to the `CREATE EXTENSION` command to ensure proper schema usage.
2025-01-30 10:35:08 -08:00
Deepak Bisht 49bc988202 Merged PR 1563572: [OSS][BugFix] Fix pointer assignment
### 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
fix pointer assignment

----
#### AI description  (iteration 1)
#### PR Classification
https://github.com/microsoft/documentdb/issues/32 bug fix issue.
We are assigning bool to a pointer which is wrong, it doesn't impact any callers today because all the callers assign the flag to be `false` before passing it in. This change makes sure even if it wrongly set to `true` in future the function will override it for these cases

#### PR Summary
This pull request addresses a bug related to pointer assignment in the `AddInt64ToValue` function.
- `oss/pg_documentdb_core/src/io/pgbson_utils.c`: Corrected the assignment of the `overflowedFromInt64` pointer to ensure it is properly set to `false` after adding values.
2025-01-30 10:35:08 -08:00
Parag Jain e9aed9bd3f Merged PR 1561462: [oss-bug-fix] Merge Stage not working properly
### 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

In absence of citus we figured out that there were few issue in AST, we were building for merge.

Below values were incorrect In AST which due to that when target is empty there was no row in join we need to do left outer join for insertions and for target collection targetList should be NIL.
1. `query->mergeUseOuterJoin = true;`
2. `query->targetList = NIL;`
fixed in this PR.
issue link : https://github.com/microsoft/documentdb/issues/20

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

#### PR Summary
This pull request addresses an issue where the merge stage was not functioning correctly.
- `oss/pg_documentdb/src/aggregation/bson_aggregation_output_pipeline.c`: Fixed the merge stage by setting `mergeUseOuterJoin` to true and initializing `targetList` to NIL.
2025-01-30 10:35:08 -08:00
Cornelius Boateng f202efc65d Merged PR 1563091: [OSS] Duplicate fix
### Does this PR have any customer impact? No

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

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

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

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

### Description

Remove duplicate if-condition check.

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

#### PR Summary
This pull request addresses a bug related to error handling in the `create_indexes_background` command.
- `oss/pg_documentdb/src/commands/create_indexes_background.c`: Removed a redundant check for `ERRCODE_DOCUMENTDB_INTERNALERROR` in the `IsSkippableError` function.
2025-01-30 10:35:08 -08:00
Deepak Bisht 146c434041 Merged PR 1562390: Snap 0.101 branch for OSS, 0.100 is already released
### Does this PR have any customer impact?
No

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

### 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
Snap 0.101 branch for OSS, 0.100 is already released and can no longer accept changes in schema

----
#### AI description  (iteration 1)
#### PR Classification
Version update.

#### PR Summary
This pull request updates the version number for the DocumentDB API and core API surface for PostgreSQL.
- `oss/pg_documentdb/documentdb.control`: Updated `default_version` to '0.101-0'.
- `oss/pg_documentdb_core/documentdb_core.control`: Updated `default_version` to '0.101-0'.
2025-01-30 10:35:08 -08:00
Deepak Bisht 3d2e448bc5 Merged PR 1562446: [Flakey Test] Fix bson_sort_index_pushdown flakey test
### Does this PR have any customer impact?
No

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

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

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

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

### Description
`bson_sort_index_pushdown` fix flakey test

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for a flakey test.

#### PR Summary
This pull request addresses a flakey test issue in the `bson_sort_index_pushdown` test by updating expected output and SQL scripts.
- Updated expected output in `oss/internal/pg_documentdb_distributed/src/test/regress/expected/bson_sort_index_pushdown.out` to reflect correct index scans and task counts.
- Modified SQL script in `oss/internal/pg_documentdb_distributed/src/test/regress/sql/bson_sort_index_pushdown.sql` to include settings for `citus.explain_all_tasks` and `citus.max_adaptive_executor_pool_size`.
- Updated expected output in `pgmongo/src/test/docdb_compat/expected/bson_sort_index_pushdown.out` to match the correct index scans and task counts.
2025-01-30 10:35:08 -08:00
Vinod Sridharan a97a0d9932 Merged PR 1562355: [BugFix] Fix cleaning cursors that are left behind
### 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?

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

### Description
Cleaning up dirty cursors left behind from abandoned cursors

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

#### PR Summary
This pull request addresses an issue with cleaning up cursors that are left behind in the system.
- `cursors.c`: Added logic to close open held portals and clean up cursor state to prevent reuse of old cursors.
- `bson_aggregation_cursor_tests.out` and `bson_aggregation_cursor_tests.sql`: Added tests to verify the new cursor cleanup behavior.
- `bson_aggregation_stage_out_tests_2.out`: Updated expected test outputs to reflect the new cursor cleanup notices.
2025-01-30 10:35:08 -08:00
Deepak Bisht 6f293a05f2 Merged PR 1553295: Lookup and unwind optimization Part 2
### Does this PR have any customer impact?
No

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

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

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

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

### Description

- support preserveNullAndEmptyArrays of unwind for lookup optimization with LEFT JOIN and COALESCE expression while merging so that we don't end up with NULL values for rows that don't have matching rows

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

#### PR Summary
This pull request optimizes the lookup and unwind stages in the aggregation pipeline by allowing certain lookups to be inlined with unwind stages.
- `bson_aggregation_nested_pipeline.c`: Added logic to check if lookup stage can be inlined with unwind stage, including handling of various unwind options.
- `bson_aggregation_stage_lookup_tests.out`: Added new test cases to verify the inlining behavior of lookup and unwind stages.
2025-01-30 10:35:08 -08:00
Patty a0c44348fb changing crlf to lf (#38) 2025-01-28 22:33:16 -08:00
Vinod Sridharan 82dc1aad15 Revert "Merged PR 1477339: Add initial structure for documentation with comments on functions"
This reverts commit 9cba49c0bcf117332fd7e1a648ddb1d8f76fc398.
2025-01-27 14:50:58 -08:00
Deepak Bisht 43ad739efc Merged PR 1560040: [Performance] Push $graphlookup recursive CTE JOIN filters to index
### Does this PR have any customer impact?
No

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

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

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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Push Recursive CTE JOIN condition to index with lookup style filters for $graphLookup stage, providing ~24x improvement from runtime filters

### Description
The existing `bson_dollar_in` operator used in `graphlookup` today is not pushed to index because both the arguments are VARs, we had similar issue for `lookup` for which we created an index supported filter UDF `bson_dollar_lookup_join_filter` which supports pushing both the VARs (document and query) to the applicable index.
Graphlookup now uses the same optimized JOIN Filter `bson_dollar_lookup_join_filter` to leverage index

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement by pushing `$graphlookup` recursive CTE JOIN filters to index.

#### PR Summary
This pull request enhances the performance of `$graphlookup` operations by pushing recursive CTE JOIN filters to the index.
- Modified `bson_aggregation_pipeline_tests_graphlookup.out` to include new test cases for `$graphlookup` with `restrictSearchWithMatch`.
- Added multiple `insert_one` operations to set up test data for performance validation.
- Included `EXPLAIN` output to demonstrate the query plan and performance improvements.

Related work items: #3811339
2025-01-27 14:50:58 -08:00
Jayanta Mondal 97ce252058 Merged PR 1560375: Removing expireAfterSeconds from ignored command list
### Does this PR have any customer impact?
No

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Minor bug/documentation fix

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

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

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

### Description

We have a ignored list of commands that we don't support but we did not want to throw error. Now that expireAfterSeconds is supported we can remove this.

It is not a bug because the command options is handled in sequence using `else-if` flow, and the condition to check the ignored command option list is done at the last, i.e., after handling all supported command options.

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

#### PR Summary
This pull request removes the `expireAfterSeconds` field from the list of ignored command specifications.
- `commands_common.c`: Removed `expireAfterSeconds` from the `IgnoredCommonSpecFields` array.
2025-01-27 14:50:58 -08:00
Sena Gungor f27742a288 Merged PR 1477339: Add initial structure for documentation with comments on functions
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Docs
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

This PR includes updates to add base Doxygen comments within SQL files, setting up initial documentation structure for functions. Additionally, it includes Doxygen configuration files (Doxyfile, etc.) tailored to support SQL file parsing and documentation generation.

----
#### AI description  (iteration 1)
#### PR Classification
Documentation

#### PR Summary
This pull request adds Doxygen comments to various `helio_api` functions to improve code documentation.
- Added Doxygen comments to functions in `sql/udfs/commands_crud/query_cursors_single_page--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/utils/extension_version_utils--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/auth/auth_scram--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/commands_crud/delete--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/schema_mgmt/create_collection_view--latest.sql`
2025-01-27 14:50:58 -08:00
Siddhesh Vethe b12859c3f0 Updating CODEOWNERS to add required reviewers for engine (#28) 2025-01-27 14:14:43 -08:00