Skip to content

Add sync-first runtime bridge - #305

Draft
Saurabh Singh (saurabh500) wants to merge 1 commit into
dev/saurabh500/tds-cursor-hot-pathfrom
dev/saurabh500/tds-sync-first-bridge
Draft

Add sync-first runtime bridge#305
Saurabh Singh (saurabh500) wants to merge 1 commit into
dev/saurabh500/tds-cursor-hot-pathfrom
dev/saurabh500/tds-sync-first-bridge

Conversation

@saurabh500

Copy link
Copy Markdown
Contributor

Description

Adds a supported mssql_tds::runtime::block_on_sync_first bridge for synchronous consumers of native TDS futures.

The bridge pins exactly one future, polls it once under the supplied Tokio runtime with the standard no-op waker, returns directly when buffered work is ready, and otherwise resumes that same pinned future through Runtime::block_on. Entered Tokio contexts are rejected before polling so a stateful protocol future cannot be partially advanced under an invalid fallback policy.

This preserves strict row-at-a-time and column-at-a-time streaming. It does not batch, prefetch, or materialize whole rows.

Correctness coverage

  • Ready fast path without I/O/time drivers
  • Pending-to-ready handoff on the identical pinned future
  • Runtime waker replacement after the temporary no-op waker
  • Multi-thread and current-thread runtimes
  • Cancellation and exhausted zero-timeout behavior
  • Rejection before polling in async and blocking-pool runtime contexts
  • Real TdsClient cursor decode with one INT split across two gated TDS packets

Performance context

The proof-of-concept ODBC integration improved the four-column streaming workload from approximately 265K to 435K rows/sec before the lower-layer cursor cleanup in #304. The ODBC adoption is intentionally deferred to the next stack layer.

Stack

Related Issues

Experimental follow-up to #303 and #304. Source performance context: #291 and #299.

Validation

  • cargo fmt --all -- --check
  • Focused sync-first and forced packet-boundary tests: 8 passed
  • cargo clippy -p mssql-tds --frozen --all-features --all-targets -- -D warnings
  • Full mssql-tds library suite: 1,676 passed; 4 existing certificate-fixture failures (valid_cert.pem / valid_cert.der absent)

Checklist

  • Formatting passes
  • Clippy passes with warnings denied
  • New behavior has focused tests
  • Public API is documented
  • No batching, row prefetch, or whole-row materialization

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@saurabh500
Saurabh Singh (saurabh500) changed the base branch from main to dev/saurabh500/tds-cursor-hot-path August 15, 2026 18:23
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.

1 participant