Skip to content

threads: prefetch pipeline and parallel ingest on Windows - #155

Merged
singhpratech merged 1 commit into
mainfrom
feat/windows-threads
Oct 4, 2026
Merged

singhpratech merged 1 commit into
mainfrom
feat/windows-threads

Conversation

@singhpratech

Copy link
Copy Markdown
Owner

Roadmap item: both features were pthreads and compiled out on _WIN32, so Windows reads ran unpipelined and adbc.odbc.ingest_connections was clamped to 1.

Change. src/odbc_threads.h is a small portability header: one mutex, one condition variable and one joinable thread, pthreads on POSIX and SRWLOCK / CONDITION_VARIABLE / _beginthreadex on Windows (a heap cell carries the pthread-shaped entry point across the __stdcall trampoline). odbc_reader.c and odbc_bind.c use it in place of pthreads, the _WIN32 guards around the prefetch pipeline and the parallel ingest pool are gone, and so is the Windows clamp in odbc_driver.c. The options now behave the same on all three platforms; the docs that said otherwise (README, install-windows, prefetch, options, go, rust, python, performance, FAQ, roadmap) are updated. Crate sources synced.

Verified on Linux (behaviour must not change there): C tests 5316 checks, 0 failures; ctest 10/10; tests/test_prefetch.py + tests/test_parallel_ingest.py 45/45 against PostgreSQL 18 through psqlodbc, including the mid-stream error and the abort-while-prefetching cases.

Windows: this PR's CI builds the library on windows-latest x64 and Win32 and runs the C unit tests; the prefetch and parallel-ingest suites only run on Linux in CI, so the Windows run of those two suites is a manual step on the Windows boot before 0.1.4 is tagged.

A small portability header, src/odbc_threads.h, gives odbc_reader.c and
odbc_bind.c one mutex, condition variable and joinable thread on both
platforms: pthreads on POSIX, SRWLOCK, CONDITION_VARIABLE and _beginthreadex
on Windows. The _WIN32 compile-outs around the prefetch pipeline and the
parallel ingest pool go, as does the ingest_connections clamp to 1 on Windows;
adbc.odbc.prefetch and adbc.odbc.ingest_connections now behave the same on
Linux, macOS and Windows. Docs updated to match. Bundled crate sources synced.

Linux: C tests 5316 checks / ctest 10 of 10; prefetch and parallel-ingest
suites 45 of 45 against PostgreSQL 18 through psqlodbc.
@singhpratech
singhpratech merged commit 24d0ba3 into main Oct 4, 2026
6 checks passed
@singhpratech
singhpratech deleted the feat/windows-threads branch October 4, 2026 01:26
@singhpratech singhpratech mentioned this pull request Oct 28, 2026
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