Skip to content

Add opt-in primary Bridge pile preference - #942

Merged
vgvoleg merged 11 commits into
mainfrom
prefer-primary-pile
Nov 24, 2026
Merged

vgvoleg merged 11 commits into
mainfrom
prefer-primary-pile

Conversation

@vgvoleg

@vgvoleg vgvoleg commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Add prefer_primary_pile to DriverConfig for synchronous and asynchronous drivers. When enabled, PRIMARY/PROMOTED endpoints take priority over SYNCHRONIZED fallback, while clusters without Bridge metadata retain their existing balancing behavior.

Discovery refreshes priorities on existing connections when pile roles change. If the cache is full and has no preferred connection, the driver opens a preferred connection before retiring one lower-priority connection. Sessions using the retired connection may be interrupted.

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.02%. Comparing base (cf038a4) to head (79b5ca7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #942      +/-   ##
==========================================
+ Coverage   82.72%   83.02%   +0.30%     
==========================================
  Files          99       99              
  Lines       12965    13033      +68     
  Branches     1266     1286      +20     
==========================================
+ Hits        10725    10821      +96     
+ Misses       1789     1770      -19     
+ Partials      451      442       -9     
Flag Coverage Δ
integration 80.70% <100.00%> (+0.28%) ⬆️
unit 49.14% <9.73%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ydb/aio/pool.py 79.83% <100.00%> (+4.62%) ⬆️
ydb/aio/resolver.py 82.35% <ø> (ø)
ydb/driver.py 71.64% <100.00%> (+0.21%) ⬆️
ydb/pool.py 89.88% <100.00%> (+6.00%) ⬆️
ydb/resolver.py 86.61% <100.00%> (+4.72%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vgvoleg vgvoleg added the SLO label Nov 19, 2026
@github-actions github-actions Bot removed the SLO label Nov 19, 2026
@github-actions

Copy link
Copy Markdown

🌋 SLO Test Results

🟢 5 workload(s) tested — All thresholds passed

Commit: 69d4979 · View run

Workload Thresholds Duration Report
sync-topic 🟢 OK 10m 7s 📄 Report
async-query 🟢 OK 10m 3s 📄 Report
sync-table 🟢 OK 10m 3s 📄 Report
async-topic 🟢 OK 10m 3s 📄 Report
sync-query 🟢 OK 10m 10s 📄 Report

Generated by ydb-slo-action

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

An active moderate issue remains because the verification can accept duplicate recovery markers for one scenario while failing to confirm recovery for all five scenarios.

1 open issue
What changed in this PR

Adds opt-in Bridge pile-aware endpoint selection to synchronous and asynchronous YDB drivers, preferring PRIMARY/PROMOTED endpoints while retaining synchronized fallback, node affinity, and legacy behavior without Bridge metadata.

Changes:

  • Adds prefer_primary_pile configuration and priority-aware discovery and connection caching for sync and async drivers.
  • Adds tests covering pile role changes, fallback behavior, cache admission, endpoint retirement, and affinity.
  • Adds documentation, changelog coverage, and a hosted five-scenario Bridge chaos SLO workflow with verification and artifact collection.
File Description
ydb/​resolver.py Parses Bridge pile metadata and orders discovered endpoints by pile priority.
ydb/​pool.py Applies Bridge priorities to synchronous connection selection, eviction, and cache admission.
ydb/​driver.py Adds the synchronous prefer_primary_pile driver configuration option.
ydb/​aio/​resolver.py Propagates Bridge pile preference through asynchronous endpoint discovery.
ydb/​aio/​pool.py Mirrors priority-aware connection handling and cache behavior for asynchronous drivers.
ydb/​aio/​driver.py Supports prefer_primary_pile through asynchronous driver configuration.
tests/​test_discovery_detect_local_dc.py Tests synchronous Bridge prioritization, fallback, cache behavior, endpoint retirement, and affinity.
tests/​slo/​src/​root_runner.py Uses shared driver configuration construction for SLO workloads.
tests/​slo/​src/​options.py Adds the SLO option and driver configuration helper for Bridge pile preference.
tests/​slo/​requirements.txt Aligns the OpenTelemetry API dependency version with related packages.
tests/​slo/​README.md Documents the hosted Bridge SLO workload and acceptance criteria.
tests/​slo/​bridge/​verify.py Verifies chaos scenario completion, workload progress, container state, and collected artifacts.
tests/​slo/​bridge/​prepare.py Prepares the pinned Bridge deployment for bounded hosted-runner resources.
tests/​slo/​bridge/​.gitignore Ignores generated Python cache files.
tests/​aio/​test_discovery_detect_local_dc.py Tests asynchronous Bridge prioritization, fallback, cache behavior, cancellation, and affinity.
docs/​driver.rst Documents prefer_primary_pile and its Bridge routing semantics.
CHANGELOG.md Records the new opt-in Bridge pile preference feature.
.github/​workflows/​slo-2dc.yml Runs the hosted five-scenario Bridge SLO workload and uploads qualification evidence.

Review effort: Lite

Comment thread tests/slo/bridge/verify.py Outdated
Comment on lines +31 to +32
if log.count("] Recovered: ") != len(SCENARIOS):
errors.append("Expected five completed chaos recoveries")
@vgvoleg
vgvoleg force-pushed the prefer-primary-pile branch from 97f709c to 55cd0da Compare November 24, 2026 09:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

An active moderate issue remains in the async resolver because it fails to propagate the configured use_all_nodes behavior, causing discovery ordering to diverge from the synchronous resolver.

2 open issues

Review effort: Lite

Comment thread ydb/aio/resolver.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The change affects concurrent discovery and request routing while intentionally retiring live connections, so ordering and session-interruption behavior require runtime stress coverage beyond static review.

1 open issue
1 resolved since last review

Review effort: Lite

@vgvoleg
vgvoleg merged commit beeddea into main Nov 24, 2026
35 checks passed
@vgvoleg
vgvoleg deleted the prefer-primary-pile branch November 24, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants