From 532265df614b72459fe89150378c2be9dce21dcb Mon Sep 17 00:00:00 2001 From: Jesse Hallett Date: Mon, 29 Apr 2024 11:05:15 -0700 Subject: [PATCH 1/3] upgrade mongodb driver to v2.8.2 --- Cargo.lock | 11 ++++++----- Cargo.toml | 11 +++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f90bf99d..0b3f493d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -319,14 +319,15 @@ dependencies = [ [[package]] name = "bson" -version = "2.8.0" -source = "git+https://github.com/mongodb/bson-rust?branch=main#4af5805248a063285e9add84adc7ff11934b04e5" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d43b38e074cc0de2957f10947e376a1d88b9c4dbab340b590800cc1b2e066b2" dependencies = [ "ahash", "base64 0.13.1", "bitvec", "hex", - "indexmap 1.9.3", + "indexmap 2.2.5", "js-sys", "once_cell", "rand", @@ -1592,8 +1593,8 @@ dependencies = [ [[package]] name = "mongodb" -version = "2.8.0" -source = "git+https://github.com/hasura/mongo-rust-driver.git?branch=time-series-fix#e83610aff2f68f8f7ac3886f06bf3d4930adec41" +version = "2.8.2" +source = "git+https://github.com/hasura/mongo-rust-driver.git?branch=upstream-time-series-fix#5df5e10153b043c3bf93748d53969fa4345b6250" dependencies = [ "async-trait", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e327e5fa..c39c809d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,12 +25,15 @@ ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.2" } itertools = "^0.12.1" -# We have a fork of the mongodb driver with a fix for reading metadata from time -# series collections. -# See the upstream PR: https://github.com/mongodb/mongo-rust-driver/pull/1003 +# Connecting to MongoDB Atlas database with time series collections fails in the +# latest released version of the MongoDB Rust driver. A fix has been merged, but +# it has not been released yet: https://github.com/mongodb/mongo-rust-driver/pull/1077 +# +# We are using a branch of the driver that cherry-picks that fix onto the v2.8.2 +# release. [patch.crates-io.mongodb] git = "https://github.com/hasura/mongo-rust-driver.git" -branch = "time-series-fix" +branch = "upstream-time-series-fix" # Set opt levels according to recommendations in insta documentation [profile.dev.package] From cc559464fbe7013c02f5d6975bb62a3b01584682 Mon Sep 17 00:00:00 2001 From: Jesse Hallett Date: Mon, 29 Apr 2024 12:23:23 -0700 Subject: [PATCH 2/3] enable mongo driver tracing --- Cargo.lock | 2 ++ Cargo.toml | 1 + crates/cli/Cargo.toml | 2 +- crates/configuration/Cargo.toml | 2 +- crates/dc-api-types/Cargo.toml | 2 +- crates/mongodb-agent-common/Cargo.toml | 2 +- crates/mongodb-connector/Cargo.toml | 2 +- crates/mongodb-support/Cargo.toml | 2 +- crates/test-helpers/Cargo.toml | 2 +- 9 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b3f493d..95c13b92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1610,6 +1610,7 @@ dependencies = [ "hex", "hmac", "lazy_static", + "log", "md-5", "pbkdf2", "percent-encoding", @@ -1630,6 +1631,7 @@ dependencies = [ "tokio", "tokio-rustls 0.24.1", "tokio-util", + "tracing", "trust-dns-proto", "trust-dns-resolver", "typed-builder 0.10.0", diff --git a/Cargo.toml b/Cargo.toml index c39c809d..b0c277fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git" } ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.2" } itertools = "^0.12.1" +mongodb = { version = "2.8", features = ["tracing-unstable"] } # Connecting to MongoDB Atlas database with time series collections fails in the # latest released version of the MongoDB Rust driver. A fix has been merged, but diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 80f3268f..bba31456 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -6,7 +6,7 @@ version.workspace = true [dependencies] configuration = { path = "../configuration" } mongodb-agent-common = { path = "../mongodb-agent-common" } -mongodb = "2.8" +mongodb = { workspace = true } mongodb-support = { path = "../mongodb-support" } anyhow = "1.0.80" diff --git a/crates/configuration/Cargo.toml b/crates/configuration/Cargo.toml index a4dcc197..0bb952f2 100644 --- a/crates/configuration/Cargo.toml +++ b/crates/configuration/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" anyhow = "1" futures = "^0.3" itertools = { workspace = true } -mongodb = "2.8" +mongodb = { workspace = true } mongodb-support = { path = "../mongodb-support" } ndc-models = { workspace = true } schemars = "^0.8.12" diff --git a/crates/dc-api-types/Cargo.toml b/crates/dc-api-types/Cargo.toml index 61cfa52f..a2b61b0e 100644 --- a/crates/dc-api-types/Cargo.toml +++ b/crates/dc-api-types/Cargo.toml @@ -16,5 +16,5 @@ serde_with = "3" [dev-dependencies] anyhow = "1" -mongodb = "2" +mongodb = { workspace = true } pretty_assertions = "1" diff --git a/crates/mongodb-agent-common/Cargo.toml b/crates/mongodb-agent-common/Cargo.toml index e6a9ab7e..80871a40 100644 --- a/crates/mongodb-agent-common/Cargo.toml +++ b/crates/mongodb-agent-common/Cargo.toml @@ -21,7 +21,7 @@ http = "^0.2" indexmap = { version = "1", features = ["serde"] } # must match the version that ndc-client uses indent = "^0.1" itertools = { workspace = true } -mongodb = "2.8" +mongodb = { workspace = true } once_cell = "1" regex = "1" schemars = { version = "^0.8.12", features = ["smol_str"] } diff --git a/crates/mongodb-connector/Cargo.toml b/crates/mongodb-connector/Cargo.toml index 1c39372f..a8b8fcf5 100644 --- a/crates/mongodb-connector/Cargo.toml +++ b/crates/mongodb-connector/Cargo.toml @@ -15,7 +15,7 @@ http = "^0.2" indexmap = { version = "2.1.0", features = ["serde"] } itertools = { workspace = true } lazy_static = "^1.4.0" -mongodb = "2.8" +mongodb = { workspace = true } mongodb-agent-common = { path = "../mongodb-agent-common" } mongodb-support = { path = "../mongodb-support" } ndc-sdk = { workspace = true } diff --git a/crates/mongodb-support/Cargo.toml b/crates/mongodb-support/Cargo.toml index aecfc7f8..a9a42a92 100644 --- a/crates/mongodb-support/Cargo.toml +++ b/crates/mongodb-support/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" dc-api-types = { path = "../dc-api-types" } enum-iterator = "^2.0.0" indexmap = { version = "1", features = ["serde"] } # must match the version that ndc-client uses -mongodb = "2.8" +mongodb = { workspace = true } schemars = "^0.8.12" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/crates/test-helpers/Cargo.toml b/crates/test-helpers/Cargo.toml index fc113da3..27c4ad6d 100644 --- a/crates/test-helpers/Cargo.toml +++ b/crates/test-helpers/Cargo.toml @@ -8,6 +8,6 @@ configuration = { path = "../configuration" } mongodb-support = { path = "../mongodb-support" } enum-iterator = "^2.0.0" -mongodb = "2.8" +mongodb = { workspace = true } proptest = "1" From 7c6e038575a3a81b8a2b2026efcce0f4c56e998e Mon Sep 17 00:00:00 2001 From: Jesse Hallett Date: Mon, 29 Apr 2024 13:25:01 -0700 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91db17c7..2449508b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This changelog documents the changes between release versions. ## [Unreleased] +- Enables logging events from the MongoDB driver by setting the `RUST_LOG` variable ([#67](https://github.com/hasura/ndc-mongodb/pull/67)) + - To log all events set `RUST_LOG=mongodb::command=debug,mongodb::connection=debug,mongodb::server_selection=debug,mongodb::topology=debug` ## [0.0.5] - 2024-04-26 - Fix incorrect order of results for query requests with more than 10 variable sets (#37)