From a5db313bfd7a0315d994f549ef2dfcd31ceb6e99 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Tue, 20 Oct 2026 17:46:06 +0000 Subject: [PATCH] feat(bigtable): raise the UDS channel inbound message cap to 256 MB Change-Id: I6adb2982640fe2d6736ea63ed165c9ffd6feacb7 --- .../bigtable/data/_async/_accelerator_client.py | 14 +++++++++++++- .../data/_sync_autogen/_accelerator_client.py | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/_accelerator_client.py b/packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/_accelerator_client.py index e6c2dd9db41c..8b168c232b53 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/_accelerator_client.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/_accelerator_client.py @@ -46,6 +46,16 @@ _MUTATE_ROW_METHOD = "/google.bigtable.v2.Bigtable/MutateRow" _READ_ROWS_METHOD = "/google.bigtable.v2.Bigtable/ReadRows" +# Inbound message cap on the UDS channel. gRPC defaults this to 4 MiB, a limit +# meant for a channel that crosses a network. This one doesn't leave the +# machine: the daemon has already paid the cost of pulling the response off the +# wire, and all the cap does on this hop is turn an otherwise-fine read into +# RESOURCE_EXHAUSTED. Raise it well past anything the service itself produces so +# the UDS leg is never the narrower of the two. +_MAX_RECEIVE_MESSAGE_LENGTH = 256 * 1024 * 1024 + +_CHANNEL_OPTIONS = (("grpc.max_receive_message_length", _MAX_RECEIVE_MESSAGE_LENGTH),) + @CrossSync.convert_class(sync_name="_AcceleratorClient") class _AsyncAcceleratorClient: @@ -59,7 +69,9 @@ class _AsyncAcceleratorClient: def __init__(self, uds_path: str, auth_secret: str): self._uds_path = uds_path self._metadata = (("x-accelerator-token", auth_secret),) - self._channel = insecure_channel(_uds_target(uds_path)) + self._channel = insecure_channel( + _uds_target(uds_path), options=_CHANNEL_OPTIONS + ) self._mutate_row_stub = self._channel.unary_unary( _MUTATE_ROW_METHOD, request_serializer=MutateRowRequest.serialize, diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_accelerator_client.py b/packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_accelerator_client.py index 452fcc9c7b72..6b61599736fb 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_accelerator_client.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_accelerator_client.py @@ -42,6 +42,8 @@ _MUTATE_ROW_METHOD = "/google.bigtable.v2.Bigtable/MutateRow" _READ_ROWS_METHOD = "/google.bigtable.v2.Bigtable/ReadRows" +_MAX_RECEIVE_MESSAGE_LENGTH = 256 * 1024 * 1024 +_CHANNEL_OPTIONS = (("grpc.max_receive_message_length", _MAX_RECEIVE_MESSAGE_LENGTH),) class _AcceleratorClient: @@ -55,7 +57,9 @@ class _AcceleratorClient: def __init__(self, uds_path: str, auth_secret: str): self._uds_path = uds_path self._metadata = (("x-accelerator-token", auth_secret),) - self._channel = insecure_channel(_uds_target(uds_path)) + self._channel = insecure_channel( + _uds_target(uds_path), options=_CHANNEL_OPTIONS + ) self._mutate_row_stub = self._channel.unary_unary( _MUTATE_ROW_METHOD, request_serializer=MutateRowRequest.serialize,