Repository navigation
feat(bigtable): support the accelerator on Windows x86_64 and x86 - #18778
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces Windows support for the Bigtable accelerator daemon. It handles Windows-specific binary naming, adjusts socket liveness checks and stale directory sweeping to accommodate Windows filesystem and socket behaviors, and updates the gRPC socket target format to support drive-lettered paths. The review feedback points out a critical issue where checking hasattr(socket, 'AF_UNIX') is insufficient on Python 3.9+ because CPython exposes AF_UNIX on Windows, which would bypass the intended Windows fallback logic. It is recommended to use the _IS_WINDOWS constant directly instead.
d933d13 to
bdfb6c8
Compare
| # console control event to TerminateProcess, so that same call would | ||
| # *kill* the spawning Python process it is supposed to be asking | ||
| # about — someone else's live application. Porting it needs an | ||
| # OpenProcess/WaitForSingleObject check instead, which is left for a |
There was a problem hiding this comment.
The sweep is correctly disabled on Windows, but as noted the trade is that leftover tempdirs accumulate in %TEMP% across daemon restarts/crashes. Worth filing a tracked follow-up to port the liveness check to OpenProcess + GetExitCodeProcess (or WaitForSingleObject with timeout 0) so this doesn't quietly turn into a %TEMP% pollution bug report in six months.
| # tempfile.mkdtemp(prefix="bt-accel-") placement keeps the socket path well | ||
| # under the limit on every platform. | ||
| @pytest.fixture | ||
| def tmp_path(): |
There was a problem hiding this comment.
Module-scoped tmp_path override silently shadows pytest's built-in for every test in the file. Rationale (sockaddr_un.sun_path limit) is correct and well-commented, but a future contributor who adds a test here and expects pytest's standard tmp_path layout (e.g., for a fixture that assumes the pytest-of-user tree) will be confused. Suggest renaming to short_tmp_path or similar so tests opt in explicitly to the shortened path.
| monkeypatch.setattr(_daemon.os.path, "exists", lambda p: False) | ||
| # Nothing ever binds the socket, so the readiness channel stays in | ||
| # TRANSIENT_FAILURE and the deadline is what ends the wait. | ||
| monkeypatch.setenv(_STARTUP_TIMEOUT_ENV_VAR, "0.05") |
There was a problem hiding this comment.
This test used to monkeypatch os.path.exists to always return False so the UDS "could never appear"; after the readiness-probe switch it now relies on the gRPC channel staying in TRANSIENT_FAILURE for the 50 ms timeout. Fine today, but if the OS ever puts something at the real uds_path (unlikely with tempfile.mkdtemp's 0700 mode, but not impossible in odd CI setups), this test could spuriously pass the readiness probe and then fail an unrelated assertion. Consider re-adding an explicit "nothing is listening on this socket" guard — e.g., assert grpc.channel_ready_future(...).result(0.1) raises on a bare mkdtemp() path first, so the test anchors the failure mode.
sushanb
left a comment
There was a problem hiding this comment.
LGTM. Approach is sound — AF_UNIX end-to-end via gRPC C-core, channel_ready_future probe (a nice improvement on POSIX too, since bare connect() succeeded on the listen backlog before gRPC was accepting), and the pid-liveness sweep gated off until Windows gets an OpenProcess port. Three low-severity follow-ups above (Windows sweep tracking issue, tmp_path fixture naming, test_uds_never_appears guard). None are blockers.
Change-Id: I7a17dd9919dff6e9d38b0cdfb3c600ffc363900c
…_uds_target Change-Id: I4ee8c69a938ff86ab6967642809a70f5330af25b
… a raw socket connect Change-Id: I1f9899ed28dc504fbdbfdb2a93d34a404e187301
The Go daemon gained Windows UDS support in googleapis/google-cloud-go#20455, so this lifts the
sys.platform == "win32"block and fixes the POSIX assumptions behind it.