Add Windows build support: shared memory wiring, PGDLLEXPORT, subscriber tool fixes - #528
Open
semihkiroglu wants to merge 1 commit into
Open
Conversation
Make pglogical 2.4.8 build and run on Windows, based on the work tracked in upstream issue 2ndQuadrant#442: - PG15+ shared-memory startup-hook wiring (re-register in the supervisor worker; guard against double registration and hook recursion) - PGDLLEXPORT declarations for _PG_init, _PG_output_plugin_init, PGLogicalCtx and the shmem startup hook - Subscriber tool fixes: exclude sys/stat.h on Windows, rand() instead of random(), empty shared_preload_libraries= for the catchup start (cmd.exe keeps '' literal), DWORD exit code, QuoteWindowsArgv linkage + cast Windows-only behavior is wrapped in #ifdef WIN32 so non-Windows builds are behavior-identical to upstream. Fixes 2ndQuadrant#442.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Windows build and runtime support for pglogical 2.4.8. It builds on the work contributed by @MickeyYadav and @ljackwilson in #442 and makes the extension compile, install and run (including the background worker startup) on Windows.
Provenance
random()→rand()for MSVC compatibilitysys/stat.hexcluded on Windows (#ifndef WIN32)QuoteWindowsArgvcast fixpostmasteron Windows)PGDLLEXPORTdeclarations required for Windows DLL buildsDWORDexit code for worker threadsQuoteWindowsArgvstatic → non-static linkage fixshared_preload_librarieschange so the subscriber catchup start path worksAll Windows-only behavior is wrapped in
#ifdef WIN32, so non-Windows builds are behavior-identical to upstream. Debug logging from the original patch is removed.Note: the Makefile /
.gitignorechanges from the 2.4.5-era patch are intentionally not included — they were not validated against 2.4.8 and the build is driven by CMake on Windows.Testing
CREATE EXTENSION,create_node, and both background workers (pglogical supervisor,pglogical manager) start via the shared-memory hook.#ifdef WIN32balance and syntax verified across PG14–PG18 with mingw.I verify the Windows build (CMake/MSVC, PostgreSQL 14–18) in the CI of semihkiroglu/pglogical-windows, where I also package these fixes as per-major Windows releases (zip + checksums).
Fixes #442