Skip to content

GODRIVER-3900 Move Hello into internal/handshake/operation. - #2513

Open
qingyang-hu wants to merge 1 commit into
mongodb:masterfrom
qingyang-hu:godriver3900
Open

GODRIVER-3900 Move Hello into internal/handshake/operation.#2513
qingyang-hu wants to merge 1 commit into
mongodb:masterfrom
qingyang-hu:godriver3900

Conversation

@qingyang-hu

Copy link
Copy Markdown
Contributor

GODRIVER-3900

Summary

This PR relocates Hello from x/mongo/driver/operation package into a new internal package internal/handshake/operation.

8 callers are updated with an import path swap only.

Background & Motivation

Moving Hello to internal/ makes it unimportable by external code.

It is impossible to move Hello into the mongo package because it would force topology/auth to import mongo, which cycles.

@mongodb-drivers-pr-bot

Copy link
Copy Markdown
Contributor

API Change Report

./v2/x/mongo/driver/operation

incompatible changes

Hello: removed
NewHello: removed

@mongodb-drivers-pr-bot

mongodb-drivers-pr-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🧪 Performance Results

Commit SHA: 2920d85

The following benchmark tests for version 6a67dbdf04b2330007be4e55 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkBSONDeepDocumentEncoding ops_per_second_max 8.1354 81900.0819 Avg: 75738.4639
Med: 75187.9699
Stdev: 2551.0262
0.7659 2.4153
BenchmarkBSONDeepDocumentEncoding ops_per_second_med 7.7317 77936.2481 Avg: 72342.8796
Med: 71844.2417
Stdev: 2681.8388
0.7315 2.0856
BenchmarkBSONDeepDocumentEncoding total_mem_allocs 7.1493 259291.0000 Avg: 241990.4460
Med: 240459.0000
Stdev: 8479.6634
0.7243 2.0402
BenchmarkBSONDeepDocumentEncoding total_bytes_allocated 7.0225 184482272.0000 Avg: 172377108.2441
Med: 171314432.0000
Stdev: 5931132.1791
0.7244 2.0410
BenchmarkBSONDeepDocumentDecoding ops_per_second_med 6.4896 17807.2190 Avg: 16722.0253
Med: 16678.7589
Stdev: 278.5824
0.8583 3.8954
BenchmarkBSONDeepDocumentDecoding ops_per_second_max 6.1923 18492.8340 Avg: 17414.4711
Med: 17333.4258
Stdev: 270.6062
0.8672 3.9850
BenchmarkBSONDeepDocumentDecoding total_bytes_allocated 5.9008 303217504.0000 Avg: 286322157.6075
Med: 286104824.0000
Stdev: 4920452.6550
0.8395 3.4337
BenchmarkBSONDeepDocumentDecoding ns_per_op -5.2363 59913.0000 Avg: 63223.5514
Med: 63311.0000
Stdev: 1111.4101
0.8147 -2.9787
BenchmarkBSONFullDocumentEncoding ops_per_second_max 4.2206 49258.6572 Avg: 47263.8282
Med: 47270.1489
Stdev: 540.0419
0.8554 3.6938
BenchmarkMultiFindMany ops_per_second_max 3.6516 4385964.9123 Avg: 4231448.8582
Med: 4237288.1356
Stdev: 51216.4571
0.8258 3.0169
BenchmarkBSONFlatDocumentEncoding ops_per_second_max 3.6429 87298.1231 Avg: 84229.6873
Med: 84160.9157
Stdev: 1199.2630
0.7804 2.5586
BenchmarkBSONFullDocumentEncoding ops_per_second_med 3.6392 47664.4423 Avg: 45990.7659
Med: 45990.7600
Stdev: 682.0835
0.7806 2.4538
BenchmarkBSONFullDocumentDecoding ops_per_second_max 2.8410 15606.4673 Avg: 15175.3328
Med: 15166.6819
Stdev: 188.8977
0.7816 2.2824
BenchmarkBSONDeepDocumentEncoding allocated_bytes_per_op -0.1585 2140.0000 Avg: 2143.3981
Med: 2144.0000
Stdev: 1.5284
0.7484 -2.2233
BenchmarkBSONDeepDocumentDecoding allocated_bytes_per_op -0.0145 15097.0000 Avg: 15099.1916
Med: 15099.0000
Stdev: 0.7288
0.8296 -3.0070

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

@qingyang-hu
qingyang-hu marked this pull request as ready for review July 28, 2026 13:14
@qingyang-hu
qingyang-hu requested a review from a team as a code owner July 28, 2026 13:14
@qingyang-hu
qingyang-hu requested review from Copilot, matthewdale and prestonvasquez and removed request for prestonvasquez July 28, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Relocates the Hello handshake operation from the importable x/mongo/driver/operation package into a new internal/handshake/operation package to prevent external consumption, while updating existing internal callers to use the new import path.

Changes:

  • Added internal/handshake/operation/hello.go containing the Hello handshaker implementation.
  • Added internal/handshake/operation/hello_test.go with unit tests/benchmarks/fuzzing for client metadata encoding helpers.
  • Updated 8 internal callers to swap imports from go.mongodb.org/mongo-driver/v2/x/mongo/driver/operation to go.mongodb.org/mongo-driver/v2/internal/handshake/operation.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
x/mongo/driver/topology/topology_options.go Swaps operation import to the new internal handshake package.
x/mongo/driver/topology/server.go Swaps operation import to the new internal handshake package.
x/mongo/driver/topology/rtt_monitor.go Swaps operation import to the new internal handshake package.
x/mongo/driver/topology/rtt_monitor_test.go Swaps operation import to the new internal handshake package for tests.
x/mongo/driver/topology/pool_test.go Swaps operation import to the new internal handshake package for tests.
x/mongo/driver/topology/CMAP_spec_test.go Swaps operation import to the new internal handshake package for spec tests.
x/mongo/driver/topology/cmap_prose_test.go Swaps operation import to the new internal handshake package for prose tests.
x/mongo/driver/auth/auth.go Swaps operation import to the new internal handshake package.
internal/handshake/operation/hello.go Introduces the internalized Hello operation implementation.
internal/handshake/operation/hello_test.go Adds unit tests/benchmarks/fuzzing for the moved code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants