Commit Graph
544 Commits
Author SHA1 Message Date
Manish Gaur f0f220023f Merged PR 1553968: version update 1.24
### 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

version update 1.24

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

#### PR Summary
This pull request updates the version numbers for various modules and adds corresponding SQL migration files.
- Updated version numbers in `.control` files for `pg_helio_api`, `pg_helio_core`, `pg_helio_distributed`, `pg_documentdb`, `pg_documentdb_core`, and `pgmongo`.
- Added new SQL migration files for version updates in `pg_helio_api`, `pg_helio_core`, `pg_helio_distributed`, `pg_documentdb`, `pg_documentdb_core`, and `pgmongo`.
- Moved release notes file from `pgmongo_1.25.md` to `pgmongo_1.100.md`.
- Updated `toc.yml` to include the new release notes for `pgmongo 1.100`.
2025-01-17 18:38:20 +00:00
Zinan Ren c283c892c3 Merged PR 1553363: [OSS] Move test files from pg_helio_distributed to pg_documentdb_distributed
Move test files from pg_helio_distributed to pg_documentdb_distributed
Clean up pg_documentdb

----
Code cleanup

This pull request cleans up the `helio_api` references and updates them to `documentdb`.
- `custom_query_scan.c` and `custom_scan_continuation.c`: Updated custom scan names from `HelioApi` to `DocumentDBApi`.
- Deleted `commands_coll_stats.out` and `commands_coll_stats.sql` test files.
- `start_oss_server.sh`: Removed `helio` server type and related logic.
- `setup_psqlrc.sh`: Updated search path and settings from `helio` to `documentdb`.
- `.devcontainer/Dockerfile` and `.github/containers/Build-Ubuntu/Dockerfile`: Updated user and labels from `heliodb` to `documentdb`.
2025-01-17 18:38:02 +00:00
Shuai Tian 3399d2a6b2 Merged PR 1553406: [OSS] fix dockerfile and update user/workdir
### 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 dockerfile and update user/workdir

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

#### PR Summary
This pull request fixes the Dockerfile and updates the user and working directory configurations.
- Changes in `/oss/.devcontainer/Dockerfile`:
  - Replaces `heliodb` user with `documentdb`.
  - Updates the working directory to `/home/documentdb`.
  - Adds PostgreSQL to the PATH for sudo commands.
2025-01-17 15:14:59 +08:00
Shuai Tian 30dcd6b5b8 Merged PR 1533455: [oss] Declare and use fixed version of packages
### 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 oss, we noticed frequently sql test result difference introduced by newer package minor versions (postgres, pgvector, postgis, etc).

To make oss CI integration stable and to make test result consistent in oss and pgmongo, we should specify fixed versions for packages in oss, and align with pgmongo.

Will depend on manual package version update after verifying the compatibility and meanwhile update test results.

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

#### PR Summary
This pull request declares and uses fixed versions of various packages to ensure consistency and reliability in the build environment.
- Updated `/oss/.devcontainer/Dockerfile` to declare and use fixed versions for multiple dependencies including PostgreSQL, Citus, libbson, PG_CRON, PG_VECTOR, Intel Decimal Math Library, PCRE2, and PostGIS.
- Modified `/.devcontainer/Dockerfile` to align with the fixed versioning approach and added necessary environment variables.
- Added `GetPostgresSourceRef` function in `oss/scripts/utils.sh` to map PostgreSQL versions to specific source references.
- Updated `oss/scripts/install_setup_intel_decimal_math_lib.sh` and `oss/scripts/install_setup_pcre2.sh` to accept version parameters.
- Moved several scripts from `/scripts` to `/oss/scripts` for better organization.

Related work items: #3571853
2025-01-17 15:14:59 +08:00
Xing Fan abdb8f36b3 Merged PR 1552880: update header
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
License
### 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

update bson_tdigest header with license

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

#### PR Summary
This pull request updates the header comments in the `bson_tdigest.c` file to include additional copyright and licensing information.
- `bson_tdigest.c`: Added detailed copyright and licensing information.
- `bson_tdigest.c`: Corrected the file path in the header comments.
2025-01-17 15:14:59 +08:00
Vinod Sridharan b685862864 Merged PR 1552485: [OSS] Move most of helio_api out of OSS
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Move most of helio_api out of OSS into internal.
Keep internal/pg_helio_distributed/src/test/regress for now until we port distributed tests over.

----
#### AI description  (iteration 1)
#### PR Classification
Code reorganization to move most of `helio_api` out of the OSS directory.

#### PR Summary
This pull request reorganizes the project structure by moving the `helio_api` components out of the OSS directory to a new `helio_api` directory.
- Deleted files `diff-filter`, `diff`, `normalize.sed`, and `expect_normalize.sed` from `oss/internal/pg_helio_distributed/src/test/regress/bin`.
- Updated paths in `.pipelines/templates/oss_build.yml` and `.pipelines/templates/oss_documentdb_build.yml` to reflect the new `helio_api` directory structure.
- Modified `Makefile` and `oss/Makefile` to update paths and add new targets for `helio_api`.
- Moved `pg_helio_api`, `pg_helio_core`, and `pg_helio_distributed` directories from `oss` to `helio_api`.
- Added new `helio_api/Makefile` and `helio_api/Makefile.inc` to manage the build process for the moved components.
2025-01-17 15:14:59 +08:00
Lucas Borges Fernandes 3c2848907f Merged PR 1540508: Pruning OSS tests
### Does this PR have any customer impact?
No.

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

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

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

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

### Description
Cleaning up OSS test codes.

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

#### PR Summary
This pull request removes obsolete test files to streamline the test suite.
- Deleted `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_index_truncation_nested_object_tests.out`
2025-01-17 15:14:59 +08:00
Zhe Li 2306ba6b91 Merged PR 1552447: [OSS] fix so library missing issue in oss
### 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)
no
### Are you introducing any new config? If yes, do you have tests with and without them being set?
yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

fix so library missing issue in oss

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address a missing library issue in the OSS build process.

#### PR Summary
This pull request fixes a missing library issue by updating the linker flags in the OSS build configuration.
- `oss/Makefile.cflags`: Added `-Wl,-rpath=$(shell pg_config --pkglibdir)` to `PG_LDFLAGS` to ensure the correct library path is included during linking.
2025-01-15 22:16:33 +00:00
Zinan Ren cfa58dc293 Merged PR 1552326: [OSS] Move pre_consistent back to helio and remove from documentdb schema
### 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

Move pre_consistent back to helio and remove from documentdb schema

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

#### PR Summary
This pull request moves the `pre_consistent` function back to the `helio` schema and removes it from the `documentdb` schema.
- `pgmongo/sql/pgmongo--1.4-0--1.4-1.sql`: Updated includes to reference `pg_helio_api` instead of `pg_documentdb`.
- `oss/pg_documentdb/sql/documentdb--0.24-0.sql`: Removed includes for `index_operator_classes_preconsistent` files.
2025-01-15 22:16:33 +00:00
Shuai Tian d11734352b Merged PR 1548309: [OSS] Migrate schema from helio_api_distributed to documentdb_api_distributed - part2
### Does this PR have any customer impact?

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

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

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

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

### Description

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

#### PR Summary
This pull request migrates the schema from `helio_api_distributed` to `documentdb_api_distributed`.
- Updated function definitions in `sql/udfs/clustermgmt/cluster_version_utils--0.21-0.sql` and `cluster_version_utils--latest.sql` to use `__API_SCHEMA_INTERNAL__`.
- Modified function definitions in `sql/udfs/rebalancer/rebalancer_operations--0.24-0.sql` and `rebalancer_operations--latest.sql` to use `__DISTRIBUTED_SCHEMA__`.
- Added schema creation and table initialization in `sql/documentdb_distributed--0.24-0.sql`.
- Updated `Makefile.cflags` and `Makefile` to include `DISTRIBUTED_SCHEMA_NAME` and related configurations.
- Adjusted test and validation scripts to reflect the new schema names.
2025-01-15 07:48:41 +00:00
Zinan Ren dcf3e2f721 Merged PR 1548926: [OSS] Migrate tests to documentdb and clean helio references from sources
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Migrate tests to documentdb and clean helio references from source

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup and migration of tests.

#### PR Summary
This pull request migrates tests from `helio` to `documentdb` and removes all references to `helio` from the source code.
- `oss/pg_documentdb/src/test/regress/expected/commands_update.out`: Replaced all `helio` references with `documentdb` and updated test cases accordingly.
2025-01-15 07:48:41 +00:00
Vinod Sridharan f505385088 Merged PR 1550572: [Cleanup] Remove dead feature flags in Pgmongo code
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?

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

### Description
- Refactor to remove dead features or features already enabled by default
- Remove any checks of cluster version < V21 that are not dependent on persistent storage.

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

#### PR Summary
This pull request removes dead feature flags and related code from the Pgmongo codebase.
- Removed the `OptimizeIndexExpressionsForDollarIn` function and related comments from `src/opclass/index_support.c`.
- Simplified the `ProcessLookupCoreWithLet` function in `src/aggregation/bson_aggregation_nested_pipeline.c` by removing conditional logic based on cluster version.
- Updated test cases in `src/test/regress/expected/conflicting_indexes.out` to reflect the removal of extended index filters and unsupported expressions in partial indexes.
2025-01-15 07:48:41 +00:00
Parag Jain 46c85d973f Merged PR 1542140: [perf] $mergeObject Optimization
### 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
$mergeObjects Operator performance Optimization. Earlier for merging two object we were creating bson tree and populating values on it which was time complex but now we are using hashmap to update existing values and linklist to maintain the order.

Numbers with collection has 1 document and array has 2 objects with different numbers of element in it.
![image (2).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1542140/attachments/image%20%282%29.png) ----
#### AI description  (iteration 1)
#### PR Classification
Performance optimization

#### PR Summary
This pull request optimizes the `$mergeObject` operation by introducing a new ordered hash set for BSON elements.
- `oss/pg_documentdb_core/src/utils/hashset_utils.c`: Added functions to create and manage an ordered hash set for BSON elements.
- `oss/pg_documentdb/src/aggregation/bson_aggregation_output_pipeline.c`: Removed redundant hash set creation and related functions.
- `oss/pg_documentdb/src/operators/bson_expression_object_operators.c`: Refactored to use the new ordered hash set for BSON elements, improving the `$mergeObject` operation.
- `oss/pg_documentdb_core/include/utils/hashset_utils.h`: Added definitions for the new ordered hash set structure and functions.
2025-01-15 07:48:41 +00:00
Deepak Pemmaraju b7d51c3013 Merged PR 1548298: Removing PII from user crud error messages
### Does this PR have any customer impact?

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

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

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

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

### Description

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to remove Personally Identifiable Information (PII) from user CRUD error messages.

#### PR Summary
This pull request ensures that PII is not leaked in error messages during user CRUD operations by only logging error hints for specific internal errors.
- `PostgresMongoClient.cs`: Added checks to log only error hints for error code "42710" to prevent PII leakage in `CreateUserAsync`, `UpdateUserAsync`, `DropUserAsync`, and `UsersInfoAsync` methods.
2025-01-15 07:48:41 +00:00
Xing Fan 722ef60784 Merged PR 1479858: $percentile & $median for $group accumulator
### Does this PR have any customer impact?

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

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

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

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

### Description

draft

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

#### PR Summary
This pull request introduces new aggregation functions and support for t-digest in the project.
- Added `bson_tdigest.c` to implement t-digest helper functions.
- Created new SQL aggregate functions in `group_aggregates--1.23-0.sql` and `group_aggregates_support--1.23-0.sql`.
- Updated `bson_aggregation_pipeline.c` to handle the new `$percentile` accumulator.
- Modified `metadata_cache.c` and `metadata_cache.h` to include OID for the new `BsonPercentileAggregateFunction`.
- Updated migration scripts `pg_helio_api--1.22-0--1.23-0.sql` and `pgmongo--1.22-0--1.23-0.sql` to include new SQL files.
2025-01-15 07:48:41 +00:00
Vinod Sridharan eed060110b Merged PR 1548193: [OSS] Move Helio_api tests under documentdb
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Move helio_api SQL files under documentdb. Does not change the output get but generates baselines.
The SQL files themselves will be changed in a subsequent change.

helio_distributed is left as-is.

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

#### PR Summary
This pull request moves the `Helio_api` tests under the `documentdb` directory.
- Deleted `oss/pg_helio_api/src/test/regress/expected/bson_update_document_tests.out`
2025-01-15 07:48:41 +00:00
Zinan Ren 4e093b2c9d Merged PR 1545484: [OSS] Porting udfs into documentdb - part 2
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Porting udfs into documentdb

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

#### PR Summary
This pull request continues the porting of UDFs into DocumentDB, updating and including various SQL files for better functionality and organization.
- Updated `documentdb--0.24-0.sql` to include new UDFs and operators, replacing old function references.
- Added new UDFs for query, projection, geospatial, aggregation, metadata, schema management, index management, CRUD commands, user management, schema validation, telemetry, TTL, vector search, extension version, diagnostic, and RBAC metadata.
- Removed outdated function definitions and replaced them with updated SQL includes.
2025-01-15 07:48:41 +00:00
Shuai Tian e3dc6c889e Merged PR 1404676: stage implementation: redact
### 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, UDF
### 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
Implement for stage redact

Related work items: #1798586
2025-01-15 07:48:41 +00:00
Deepak Bisht 7a674be896 Merged PR 1542122: [Part 1] Improve $lookup and $unwind aggregation stage combination when the lookup options are simple
### 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)
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))
Aggregation performance pipeline optimization for $lookup and $unwind stage combination on same fields.

### Description
1. Optimize $lookup and $unwind stage combination on same field and lookup  options are simple `localField` and `foreignField`
2. Delete dead code for $lookup

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

#### PR Summary
This pull request improves the combination of `$lookup` and `$unwind` aggregation stages by removing redundant and complex code, simplifying the logic, and optimizing performance.
- Removed the `ProcessLookupCore` function and its associated logic from `bson_aggregation_nested_pipeline.c`.
- Removed the `UnwindWalkerContext` struct and related functions for optimizing `$unwind` with `ARRAY_AGG` from `bson_aggregation_nested_pipeline.c`.
2025-01-15 07:48:41 +00:00
Vinod Sridharan 02b0c3af75 Merged PR 1547234: [Infra] Command timeout improvements: Move command timeouts for common commands to the backend
### Does this PR have any customer impact?
Yes

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
Yes

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

### Description
The Gateway does a convoluted processing for maxTimeMS including having a second connection pool and creating transaction wrappers.

Instead, this is simpler if this is moved into the backend and let the backend set custom timeouts directly.
This part just codes up the backend piece and puts it behind a GUC.

The Gateway changes will be made separately.

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

#### PR Summary
This pull request improves command timeout handling by moving common command timeouts to the backend.
- Added new test files `isolation-command_timeout.out` and `isolation-command_timeout.spec` to validate command timeout scenarios.
- Modified `bson_aggregation_pipeline.c` to remove the `TryHandleSimplifyAggregationRequest` function.
- Updated function signatures in `bson_aggregation_pipeline.h` to include `setStatementTimeout` parameter.
- Adjusted `documents_planner.c` to handle the new `setStatementTimeout` parameter in various query generation functions.
2025-01-15 07:48:41 +00:00
Jia Hu 55f6fa3840 Merged PR 1485956: [schema validation] support schema rule included top level operator
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
To enable top level query operators working in schema validation.

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

#### PR Summary
This pull request introduces support for the `$jsonSchema` query operator for schema validation.
- Added handling for `QUERY_OPERATOR_JSONSCHEMA` in `query_operator.c` and `mongo_query_operator.c`.
- Implemented `GetExpressionEvalStateForBsonInput` in `bson_expr_eval.c`.
- Added `BsonJsonSchemaFunctionId` and related OID cache in `metadata_cache.c`.
- Modified `PrepareForSchemaValidation` in `schema_validation.c` to use the new evaluation state function.
2025-01-15 07:48:41 +00:00
Vinod Sridharan 98fa758288 Merged PR 1546349: [Infra] Split up GUC files by intent
### Does this PR have any customer impact?
No

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

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

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

### Description
Split up GUCs by intent:
- Testing GUCs - only for backend or test infra
- System GUCs - configuration of the system as a whole
- Background GUCs - configuration for background jobs
- Feature flag GUCs - GUCs that are transient and we should track enabling and removing them

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

#### PR Summary
This pull request refactors the codebase by splitting up GUC (Grand Unified Configuration) files based on their intent, improving modularity and maintainability.
- Refactored `documentdb_init.c` to delegate GUC initialization to specific functions.
- Added new files `feature_flag_configs.c`, `system_configs.c`, `background_job_configs.c`, and `testing_configs.c` for modular GUC initialization.
- Updated `config_initialization.h` to declare new initialization functions.
- Adjusted related configurations in `documentdb_distributed_init.c` and test files to align with the new structure.
2025-01-15 07:48:41 +00:00
Duan Pei ab6770f92e Merged PR 1537653: [Fix Jstest] fix jstest_server6238
### 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

the PR to fix some cases of jstests/core/server6238.js, ![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1537653/attachments/image.png)

15 line of case cannot be fixed yet, because `$a` is not a operator, in group stage should report `InvalidPipelineOperator`, in project stage, should report error code `31325`  .  so to fix the case, we need to distinguish the group stage and the project stage in ParseAggregationExpressionData Function.

fix some cases of  jstest.
when field is start with "$", ErrorCode should is 16410.
example:
```
db.coll1.aggregate([
    {
        $project: {
            $a: "$a"
        }
    }
]);
```

when field is invalidOperator, ErrorCode should is 40236
```
db.jstest1.aggregate([
    {
        $group: {
            _id: "$_id",
            $a: {
                $sum: 1
            }
        }
    }
]);
```

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

#### PR Summary
This pull request addresses a bug in the jstest_server by adding a new error code and updating related error handling logic.
- `helio_conversion_codes.c`: Added handling for `ERRCODE_HELIO_LOCATION40236`.
- `bson_tree.c` and `bson_io.c`: Updated error codes to use `ERRCODE_HELIO_LOCATION40236`.
- `helio_errors.h`, `helio_codes.txt`, `helioerrors.csv`, `mongoerrors.csv`, and `mongo_codes.csv`: Added definitions and entries for `ERRCODE_HELIO_LOCATION40236`.
2025-01-15 07:48:41 +00:00
Duan Pei 37b4e7e508 Merged PR 1541101: [Fix Jstest] fix corner case in date_from_string_on_error.js
### 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

 the PR to fix js error of date_from_string_on_error.js

fix case, when onError is provided and dateSring is invalid ,need to throw onError.
example:
dateString is 5, should throw onError.
`db.date_from_string_on_error.aggregate([
    {
        $project: {
            date: {
                $dateFromString: {
                    dateString: 5,
                    format:null,
                    onError: ISODate("2017-07-04T11:56:02Z")
                }
            }
        }
    }]);`

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

#### PR Summary
This pull request addresses a corner case in the `date_from_string_on_error.js` test by improving error handling in date parsing functions.
- `src/operators/bson_expression_date_operators.c`: Added checks for `isOnErrorProvided` to handle cases where `onError` is specified, ensuring proper error handling and result setting.
- Modified several functions to include the `isOnErrorProvided` parameter to improve error handling logic.
2025-01-15 07:48:41 +00:00
Vinod Sridharan 02a0c1137b Merged PR 1545989: [Perf] Adhoc Perf Related Changes
### Does this PR have any customer impact?
No

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

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

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

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

### Description
1) Reduce CPU due to GUID generation per request - Assign a unique connectionID and cycle requests through for that connection
2) Reduce Size of the response object - move "ShouldSendResponse" to the request as a computed property
3) Reduce async/await callstacks in the Transport flow
4) Prepare queries on system connection (to avoid random parsers in background requests)
5) Move cursorId and Persisted connection to the beginning of the continuation response (for future perf change)
6) For point read request plan, only allocate lists of the correct size.

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

#### PR Summary
This pull request includes performance-related changes to the BSON aggregation cursor tests.
- Modified `bson_aggregation_cursor_tests.out` to update the structure and content of the test output for aggregation and find queries.
2025-01-15 07:48:41 +00:00
Vinod Sridharan 654b0f00f1 Merged PR 1545804: [OSS] Move source files not pertinent to OSS out of OSS
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Move source files not pertinent to OSS out of OSS

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

#### PR Summary
This pull request moves source files not pertinent to OSS out of the OSS directory and includes some code refactoring.
- Moved `rum_custom_join_scan.c` and `external_configs.c` from `pg_documentdb` to `pg_helio_api`.
- Added `IsValidScanPath` function and refactored path validation in `custom_scan_continuation.c`.
- Introduced `TryOptimizePathForBitmapAnd` function in `api_hooks.c` and updated related hooks.
- Added new external configuration variables in `documentdb_init.c`.
- Removed `RegisterRumJoinScanNodes` from `pg_documentdb` and added it to `pgmongo` and `pg_helio_api`.
2025-01-15 07:48:41 +00:00
Vinod Sridharan 584cc387f0 Merged PR 1545267: [OSS] Support DocumentDB on V0
### Does this PR have any customer impact?
No

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

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

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

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

### Description
Move DocumentDB to schema version 0. To do this version checks now need to handle internal and external versions being different.

Tackle this in version_utils.c

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

#### PR Summary
This pull request adds support for DocumentDB on version 0.
- Modified `cluster_operations.c` to use `DocDB_V0` for version checks.
- Updated `version_utils.h` and `version_utils.c` to define and use `MajorVersion` enum for version handling.
- Adjusted various files in the `aggregation` directory to use `DocDB_V0` for version checks.
- Updated `create_indexes.c` to use `DocDB_V0` for version checks.
2025-01-15 07:48:41 +00:00
Zinan Ren 47ec4231ba Merged PR 1543189: [OSS] Porting type/operator/schema into documentdb - part 1
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Start porting schemas for documentdb api.
Introducing API_SCHEMA_NAME_V2, API_SCHEMA_INTERNAL_NAME_V2, API_CATALOG_SCHEMA_NAME_V2

----
#### AI description  (iteration 1)
#### PR Classification
Porting type/operator/schema into documentdb.

#### PR Summary
This pull request ports various types, operators, and schemas into documentdb as part of an ongoing effort.
- `pg_documentdb/sql/documentdb--0.24-0.sql`: Created multiple schemas and included various SQL files for query functions, operators, and metadata.
- `pg_documentdb/sql/operators/bson_dollar_operators--0.16-0.sql`: Updated operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `pgmongo/sql/operators/bson_dollar_negation_operators--1.15-1.sql` and `pg_documentdb/sql/operators/bson_dollar_negation_operators--0.16-0.sql`: Changed operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `Makefile.cflags`: Added checks for new schema variables `API_SCHEMA_NAME_V2`, `API_SCHEMA_INTERNAL_NAME_V2`, and `API_CATALOG_SCHEMA_NAME_V2`.
- `pg_documentdb/sql/schema/unique_shard_path_operator_class--0.24-0.sql`: Updated operator class definitions to use `__API_SCHEMA_INTERNAL_V2__`.
2025-01-15 07:48:40 +00:00
Jia Hu 7af0d99acf Merged PR 1534319: [DataApi] support authentication with password
### 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 UDF mongo_api_internal.authenticate_with_pwd(p_usename text, p_password text)
output: Boolean

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

#### PR Summary
This pull request introduces support for user authentication using a password in the Data API.
- Added `command_authenticate_with_pwd` function in `src/auth/scram256.c` to handle password-based authentication.
- Created new SQL function `helio_api.authenticate_with_pwd` in `sql/udfs/auth/auth_scram--1.24-0.sql`.
- Updated test cases in `src/test/regress/sql/authentication_scram_sha_256.sql` and `src/test/regress/expected/authentication_scram_sha_256.out` to use the new `authenticate_with_pwd` function.
- Removed the old `test_helio_scram_sha256_dual_api` function from test files.

Related work items: #3316477, #3685426
2025-01-15 07:48:40 +00:00
Zinan Ren d4d61b7278 Merged PR 1543270: [OSS] Move udf files from pg_helio_api -> pg_documentdb
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Move udf files from pg_helio_api -> pg_documentdb

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

#### PR Summary
This pull request moves User Defined Function (UDF) files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated `pgmongo/sql/pgmongo--1.23-0--1.24-0.sql` to include UDFs from `pg_documentdb` instead of `pg_helio_api`.
- Modified `oss/pg_helio_api/sql/pg_helio_api--1.15-0--1.16-0.sql` to reference UDFs from `pg_documentdb`.
- Adjusted `oss/pg_helio_api/sql/pg_helio_api--1.10-0.sql` to include UDFs from `pg_documentdb`.
- Updated `scripts/validate_helio_extension_state.sh` to add validation exceptions for the moved UDF files.
- Changed `pgmongo/sql/pgmongo--1.21-0--1.22-0.sql` to reference UDFs from `pg_documentdb`.
2025-01-15 07:48:40 +00:00
Xiaochun Liang 250d7f98af Merged PR 1535636: Support DBRef in upsert case
### 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 is the PR to fix js error of jstests/core/server1470.js

In upsert case, TraverseQueryDocumentAndProcess skips processing $ref or $id, for example, given sample query:

`db.server1470.update({
    "name": "first",
    "pic": {"$ref": "foo", "$id": ObjectId("4c48d04cd33a5a92628c9af6")}
}, {$set: {x: 1}}, true, true);`

"pic" field is skipped and not inserted in the collection.

Changes includes:
1. Support $ref and $id in upsert case
2. handle error cases

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

#### PR Summary
This pull request adds support for DBRef in upsert operations.
- Modified `bson_query.c` to handle `$ref` and `$id` operators during upsert.
- Updated `query_operator.c` to include error handling for DBRef fields.
- Added new test cases in `commands_update.sql` and `commands_update.out` to validate DBRef upsert functionality.
- Introduced new error codes in `helio_errors.h`, `helio_codes.txt`, and related CSV files for DBRef validation errors.
2025-01-15 07:48:40 +00:00
Shuai Tian 9f4156d9c1 Merged PR 1543042: [OSS] move sql files from pg_helio_distributed into pg_documentdb_distributed - 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

move sql files into pg_documentdb_distributed

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

#### PR Summary
This pull request moves SQL files from `pg_helio_distributed` to `pg_documentdb_distributed` as part of a reorganization effort.
- `documentdb_distributed--0.24-0.sql`: Added schema creation and table setup for `helio_api_distributed`.
- Updated file paths in `pgmongo--1.20-0--1.21-0.sql`, `pg_helio_distributed--1.21-0.sql`, `pg_helio_distributed--1.23-0--1.24-0.sql`, and `pgmongo--1.23-0--1.24-0.sql` to reflect the new location in `pg_documentdb_distributed`.
- `validate_helio_extension_state.sh`: Added exceptions for the newly moved SQL files.
2025-01-15 07:48:40 +00:00
Vinod Sridharan a526ad3bb2 Merged PR 1543038: [Symbols] Fix symbols really
### 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
Symbol upload was still broken. Fix it so that it supports repeatable builds and installs the stripped so file in the target (but doesn't overwrite build output).

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

#### PR Summary
This pull request addresses issues with symbol extraction and handling in the build process.
- `/scripts/makefile.symbols`: Refactored symbol extraction and installation process, added `strip-installed-lib` target.
- `/pgmongo/Makefile`: Fixed symbol file copying process.
- `/.gitignore`: Added `.dbg` files to ignore list.
2025-01-15 07:48:40 +00:00
Zinan Ren 1f110c4fe3 Merged PR 1542804: [OSS] Move type/operator/schema files from pg_helio_api -> pg_documentdb
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Move type/operator/schema files from pg_helio_api -> pg_documentdb
Except udf files

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

#### PR Summary
This pull request moves type, operator, and schema files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated SQL include paths in multiple `pg_helio_api` SQL files to reference `pg_documentdb` directory.
- Modified `pgmongo` SQL files to include paths from `pg_documentdb` instead of `pg_helio_api`.
- Adjusted `validate_helio_extension_state.sh` script to account for new file paths.
- Updated `Makefile` in `pg_helio_api` to include the new directory structure.
- Changed include paths in `pg_documentdb_distributed` and `pg_helio_distributed` C source files to reflect the new directory structure.
2025-01-15 07:48:40 +00:00
Vinod Sridharan ecf2f6c28b Merged PR 1542894: [Symbols] Fix up publishing symbols for docdb
### Does this PR have any customer impact?
No

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

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

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

### Description
Fix up symbols for docdb not getting published

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for publishing symbols in the docdb project.

#### PR Summary
This pull request refactors the Makefile setup to fix issues with publishing symbols for docdb.
- `Makefile` changes in `pg_documentdb_distributed`, `pg_documentdb`, and `pg_documentdb_core` to include a new global Makefile.
- Added a new `Makefile.global` to centralize common Makefile configurations.
- Updated `install_setup_pgmongo.sh` to set `EXTRA_INCLUDE_MAKEFILE` for symbol extraction.
2025-01-15 07:48:40 +00:00
Vinod Sridharan b706079601 Merged PR 1542864: [OSS] Finish up migration of schema from helio_core -> Documentdb_Core
### Does this PR have any customer impact?
No

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
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
Finish up schema migration for documentdb_core

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

#### PR Summary
This pull request finalizes the migration of schema from `helio_core` to `Documentdb_Core`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_io/bson_io--0.11-0.sql` to use `__CORE_SCHEMA__`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_btree/bson_btree--0.19-0.sql` to use `__CORE_SCHEMA__`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bsonsequence_io/bsonsequence_io--0.10-0.sql` to use `__CORE_SCHEMA__`.
- Removed `set search_path` statements from `oss/pg_documentdb_core/sql/documentdb_core--0.24-0.sql`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_hash/bson_hash_functions--0.15-0.sql` to use `__CORE_SCHEMA__`.
2025-01-15 07:48:40 +00:00
Vinod Sridharan f0722edc50 Merged PR 1542411: [OSS] Start porting Schemas into documentdb_core
### Does this PR have any customer impact?
No

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
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
Start porting schemas for SQL in documentdb_core.
Maintain back-compat by introducing CORE_SCHEMA_v2 to handle cases where the existing logic already depends on there being 2 core schemas

----
#### AI description  (iteration 1)
#### PR Classification
Code refactoring to port schemas into `documentdb_core`.

#### PR Summary
This pull request refactors the code to port BSON type definitions and related functions into `documentdb_core`.
- `pg_helio_core/sql/types/bson--1.10-0.sql`: Replaced BSON type definitions with an include directive.
- Added `pg_documentdb_core/sql/types/bson--0.24-0.sql` and `pg_documentdb_core/sql/types/bson_typanalyze--0.24-0.sql` for BSON type and analysis functions.
- `pg_documentdb_core/sql/documentdb_core--0.24-0.sql`: Created `documentdb_core` schema and included BSON type definitions.
- Updated Makefiles (`Makefile.cflags`, `pg_helio_api/Makefile`, `pg_helio_core/Makefile`, `internal/pg_helio_distributed/Makefile`) to include new schema definitions.
- Updated `postgresql.conf` files to preload `pg_documentdb_core`.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 7fdc81c26d Merged PR 1542755: [Perf] Custom Planner bug fixes
### 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
1) In point read wtih `$near`/`$nearSphere` disable the optimization since it creates subqueries
2) Remove projections that are "resJunk" since we're not sorting with the point read.
3) Refactor getting the filters into a separate method.

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

#### PR Summary
This pull request addresses bugs in the custom planner related to point read plans and improves the handling of projections and query qualifications.
- `documents_custom_planner.c`: Added functions `SetPointReadQualsOnIndexScan` and `FormatProjections` to handle point read qualifications and projections more effectively.
- `bson_aggregation_pipeline_tests_point_read.out`: Updated expected output to reflect changes in query plans and error handling.
- `bson_aggregation_pipeline.c`: Added a check to invalidate point read plans when pushing to a subquery.
- `bson_aggregation_pipeline_tests_point_read.sql`: Added new test cases for special operators in filters.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 0cc46eca57 Merged PR 1542496: [Perf] Custom planner for point read
### 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

Improve performance for a point read set up for unsharded collections.
In the scenario where we have a point read in a local unsharded collection with colocation, we can bypass a lot of the planner and go directly to the PK index. Use this to simplify the planner.

With this change, point reads on YCSB are able to hit ~16k on Marlin and ~17.5-18k on flex

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

#### PR Summary
Introduces a custom planner for point read operations to optimize query performance.
- Added `documents_custom_planner.c` to implement the custom point read planner.
- Updated `aggregation_commands.c` to handle the new point read cursor type.
- Modified `planner.c` to integrate the custom point read planner and expand aggregation functions.
2025-01-15 07:48:40 +00:00
Zinan Ren 0ad54c20b8 Merged PR 1540839: [OSS] Remove helio references from sources of documentdb and documentdb_distributed
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Remove helio references from documentdb
Remove helio references from documentdb_distributed

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

#### PR Summary
This pull request removes references to "helio" and replaces them with "documentdb" in the sources of `documentdb` and `documentdb_distributed`.
- `metadata_cache.h` and `metadata_cache.c`: Replaced "Helio" with "DocumentDB" in variable names and function names.
- `pgmongo.c`: Updated include statements and function calls to use "documentdb" instead of "helio".
- `planner.c`: Updated planner function and related calls to use "DocumentDBApiPlanner".
- Moved several header files from `helio_*` to `documentdb_*` naming convention without code changes.
- `commands_common.c` and `create_indexes.c`: Updated function calls and variable names to use "DocumentDB" instead of "Helio".
2025-01-15 07:48:40 +00:00
Vinod Sridharan 7d115344e5 Merged PR 1542502: [OSS] move sql files from helio_core -> documentdb_core for schema files
### 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)
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
move sql files from helio_core -> documentdb_core for schema files

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

#### PR Summary
This pull request moves SQL files from `helio_core` to `documentdb_core` to better organize schema files.
- Updated includes in `oss/pg_helio_core/sql/pg_helio_core--1.10-0.sql` to reference `pg_documentdb_core` paths.
- Modified `pgmongo/sql/pgmongo--1.14-6--1.15-0.sql` to include files from `pg_documentdb_core` instead of `pg_helio_core`.
- Adjusted `scripts/pipeline_check_sql_upgrades.sh` to validate and check SQL files in `pg_documentdb_core`.
- Updated `oss/pg_helio_core/Makefile` to include `OSS_SRC_DIR` for SQL file processing.
- Changed various `pgmongo/sql` files to reference `pg_documentdb_core` paths for BSON-related operations and schema definitions.
2025-01-15 07:48:40 +00:00
Xiaochun Liang 972d08522a Merged PR 1540691: Fix error in case of onNull type is BSON_TYPE_EOD
### 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 `db.date_from_string_on_null.aggregate(
            {$project: {date: {$dateFromString: {dateString: "$missing", onNull: "$missing"}}}})` case,
type of onNull would be BSON_TYPE_EOD, which result in error "unknown BSON type code 0". Add special logic in `HandlePreParsedDollarDateFromString` to handle it.

Unit test was added as well.

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

#### PR Summary
Fixes an error when the `onNull` type is `BSON_TYPE_EOD` in the `$dateFromString` operator.
- `oss/pg_documentdb/src/operators/bson_expression_date_operators.c`: Added a check to return directly if `onNull` type is `BSON_TYPE_EOD`.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_date_operators_tests.out` and `oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_date_operators_tests.sql`: Added test cases to validate the fix.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 491b8cd585 Merged PR 1541964: [OSS] Move all GUCs to a neutral prefix
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?

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

### Description
- Redo GUCs for helio -> documentdb preserving back-compat for the service.
- Move Docdb version to 1.24 -> 0.24

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

#### PR Summary
This pull request updates the prefix for all GUCs (Grand Unified Configuration) to a neutral prefix.
- `documentdb_init.c`: Changed GUCs from "helio_api" to a dynamic prefix using `psprintf`.
- `documentdb_distributed_init.c` and `documentdb_distributed.c`: Updated GUCs to use a dynamic prefix.
- `pg_documentdb.c`, `pg_helio_api.c`, and `pgmongo.c`: Modified initialization functions to pass the new GUC prefix.
- `helio_api_init.h` and `helio_distributed_init.h`: Updated function signatures to include the new GUC prefix parameter.
- Updated control files to reflect the new version `0.24-0`.
2025-01-15 07:48:40 +00:00
Deepak Bisht c136836096 Merged PR 1537692: [Performance] Push Aggregates directly to shard for unsharded tables in single node
### 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 Aggregation queries directly to shard if the collection is unsharded in a single node and pipeline stages refer only 1 collection

### Description
Push Aggregation queries directly to shard if the collection is unsharded in a single node and pipeline stages refer only 1 collection

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

#### PR Summary
This pull request optimizes the aggregation pipeline by pushing aggregates directly to shards for unsharded tables in a single node setup.
- Added tests in `bson_aggregation_pipeline_tests.out` to verify the new optimization for unsharded collections.
- Updated `bson_aggregation_pipeline_tests.out` in both `pg_helio_distributed` and `helio_compat` to include new test cases and EXPLAIN plans demonstrating the performance improvements.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 17c1eda917 Merged PR 1540531: Fix cursor behavior for SRFs in Helio
### 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

Cursors with SRFs caused crashes when not run via citus. Fix this behavior..

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

#### PR Summary
This pull request fixes an issue with cursor handling in the `HoldPortal` function.
- `cursors.c`: Ensures that the cursor options include `CURSOR_OPT_SCROLL` to support backwards scanning.
2025-01-15 07:48:40 +00:00
Lusen Dong ed860f8b6d Merged PR 1525182: [OSS] helio_api.validate different error code with mongo
### 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
Expects MongoDB error code 73 with collection name has invalid type object message. Not MongoDB error code 26 (M0008).

postgres=# SELECT * FROM helio_api.validate('test','{"validate":{}}');
ERROR:  BSON field 'validate' is the wrong type 'object', expected type 'string'
postgres=# \errverbose
ERROR:  M0004: BSON field 'validate' is the wrong type 'object', expected type 'string'
LOCATION:  ThrowTopLevelTypeMismatchError, parse_error.h:24

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

#### PR Summary
This pull request addresses an issue with the `helio_api.validate` function returning an incorrect error code.
- Modified `oss/pg_helio_api/src/commands/validate.c` to check if the `validate` field is of type `BSON_TYPE_DOCUMENT` and return the appropriate error message and code.

Related work items: #3658791
2025-01-15 07:48:40 +00:00
Zinan Ren 8e7bd960bf Merged PR 1540262: [OSS] Remove helio references from sources of documentdb_core
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Remove helio from file name
Remove helio references from source content except schema reference
Start local documentdb server with the documentdb extension
Regression tests using the documentdb  extension

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

#### PR Summary
This pull request removes references to "helio" from the `documentdb_core` source code.
- `scripts/utils.sh`: Renamed variables from `preloadExtensions` to `preloadLibraries`.
- `pg_documentdb_core/include/utils/error_utils.h`: Updated function and macro names to replace "Helio" with "DocumentDB".
- `pg_documentdb_core/include/io/helio_bson_core.h` and `pg_documentdb_core/include/query/helio_bson_compare.h`: Moved to `pg_documentdb_core/include/io/bson_core.h` and `pg_documentdb_core/include/query/bson_compare.h`.
- `pg_documentdb_core/src/collation/collation.c` and `pg_documentdb_core/src/io/pgbson.c`: Replaced error codes and messages to use "DocumentDB" instead of "Helio".
- `scripts/validate_helio_extension_state.sh`: Added exceptions for certain files to skip validation for "helio" references.
2025-01-15 07:48:40 +00:00
Shuai Tian 19f20b4efb Merged PR 1540255: [OSS] remove dependencies on helio 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

[OSS] remove dependencies on helio errors
2025-01-15 07:48:40 +00:00
Shuai Tian 5e6f0ac284 Merged PR 1539317: [OSS] remove mongo_data 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)

### 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] remove mongo_data references

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

#### PR Summary
This pull request removes references to `mongo_data` and replaces them with `documentdb_data` across the codebase.
- `collection.h`: Updated constants and macros to use `DOCUMENTDB` instead of `MONGO`.
- `drop_indexes.c`, `create_indexes.c`, `insert.c`: Replaced `MONGO_DATA` table and index format strings with `DOCUMENTDB_DATA`.
- `planner.c`, `bson_aggregation_output_pipeline.c`, `bson_aggregation_pipeline.c`: Updated attribute number constants and variable names.
- `index.h`: Changed index name format prefixes from `MONGO_DATA` to `DOCUMENTDB_DATA`.
- `shard_colocation.c`: Adjusted table prefix strings and comments to reflect the new naming convention.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 3b609ecd8f Merged PR 1540011: [Add-node] More fixes for add-node scenarios
### 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?

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

### Description

- Cluster Data was not replicated fully on add node (upgrades would fail)
- Checks for index wasn't handled in add-node scenarios. (Create/Drop indexes would fail)
- Get versions on the GW on MX of the added node reutrns NullRef - fix these.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for add-node scenarios.

#### PR Summary
This pull request addresses issues related to ensuring metadata tables are properly replicated during add-node operations.
- `distributed_hooks.c`: Refactored `EnsureMetadataTableReplicatedCore` to return a boolean and added `ExecuteMetadataChecksForReferenceTables`.
- `create_indexes_background.c`: Added checks to ensure metadata tables are replicated before starting index creation.
- `cluster_operations.c`: Ensured `cluster_data` table is replicated on all nodes during cluster setup.
- `api_hooks.c` and `api_hooks.h`: Modified `EnsureMetadataTableReplicated` to return a boolean indicating if replication occurred.
- `ExtensionVersionExtensions.cs`: Added null checks for version strings before writing them.
2025-01-15 07:48:39 +00:00