Skip to content

Conversation

prestonvasquez
Copy link
Member

GODRIVER-3659

Summary

Add awaitMinPoolSize to the unified test runner.

Background & Motivation

Warming clients should make CSOT tests less flakey.

@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 03:17
@prestonvasquez prestonvasquez requested a review from a team as a code owner September 11, 2025 03:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the awaitMinPoolSize option to the unified test runner's client entity constructor to improve test stability by warming connection pools before tests run.

  • Updates supported schema version from 1.22 to 1.26
  • Adds awaitMinPoolSize field to entityOptions struct with documentation
  • Implements connection pool warming logic that waits for minimum pool size to be reached

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/integration/unified/schema_version.go Updates supported schema version to 1.26
internal/integration/unified/entity.go Adds awaitMinPoolSize boolean field to entityOptions
internal/integration/unified/client_entity.go Implements pool warming functionality and integrates it into client creation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +229 to 235
if entityOptions.AwaitMinPoolSize && clientOpts.MinPoolSize != nil && *clientOpts.MinPoolSize > 0 {
if err := awaitMinimumPoolSize(ctx, entity, *clientOpts.MinPoolSize); err != nil {
return nil, err
}
}

entity.Client = client
Copy link
Preview

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

The awaitMinimumPoolSize function is called with entity before entity.Client is assigned (line 235). This means the entity doesn't have a valid client when the function tries to check connection events, which could cause the function to behave incorrectly.

Suggested change
if entityOptions.AwaitMinPoolSize && clientOpts.MinPoolSize != nil && *clientOpts.MinPoolSize > 0 {
if err := awaitMinimumPoolSize(ctx, entity, *clientOpts.MinPoolSize); err != nil {
return nil, err
}
}
entity.Client = client
entity.Client = client
if entityOptions.AwaitMinPoolSize && clientOpts.MinPoolSize != nil && *clientOpts.MinPoolSize > 0 {
if err := awaitMinimumPoolSize(ctx, entity, *clientOpts.MinPoolSize); err != nil {
return nil, err
}
}

Copilot uses AI. Check for mistakes.

Copy link
Member Author

@prestonvasquez prestonvasquez Sep 11, 2025

Choose a reason for hiding this comment

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

This doesn't matter since the pool event monitor was defined before client construction.

@prestonvasquez
Copy link
Member Author

This branch must await mongodb/specifications#1834 and the subsequent specifications bump before merging.

Copy link
Contributor

mongodb-drivers-pr-bot bot commented Sep 11, 2025

🧪 Performance Results

Commit SHA: be25c6d

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

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkSingleFindOneByID ops_per_second_min -33.1845 844.8222 Avg: 1264.4110
Med: 1251.6945
Stdev: 181.0055
0.7721 -2.3181
BenchmarkMultiInsertSmallDocument total_time_seconds -15.9073 1.0255 Avg: 1.2195
Med: 1.2195
Stdev: 0.0463
0.9156 -4.1895
BenchmarkBSONFlatDocumentDecoding total_mem_allocs 2.4956 9225641.0000 Avg: 9001010.0000
Med: 8979131.0000
Stdev: 39100.2428
0.9323 5.7450
BenchmarkBSONFlatDocumentDecoding total_bytes_allocated 2.4926 362709728.0000 Avg: 353888794.6667
Med: 353028584.0000
Stdev: 1533377.7150
0.9325 5.7526

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

Copy link
Contributor

API Change Report

No changes found!

@prestonvasquez prestonvasquez force-pushed the ci/godriver-3659-await-min-pool-size-in-ust branch from 6358fe0 to f6da88f Compare September 11, 2025 03:42
@prestonvasquez prestonvasquez force-pushed the ci/godriver-3659-await-min-pool-size-in-ust branch from f6da88f to c2611f2 Compare September 11, 2025 03:44
@matthewdale matthewdale added enhancement review-priority-urgent High Priority PR for Review: review immediately! ignore-for-release labels Sep 11, 2025
matthewdale
matthewdale previously approved these changes Sep 12, 2025
Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@matthewdale matthewdale merged commit 9c0cdd5 into mongodb:master Sep 12, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ignore-for-release review-priority-urgent High Priority PR for Review: review immediately!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants