Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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),)


def _uds_target(uds_path: str) -> str:
"""Build the gRPC target for the daemon's socket at ``uds_path``.
Expand All @@ -70,7 +80,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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),)


def _uds_target(uds_path: str) -> str:
Expand All @@ -65,7 +67,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,
Expand Down
Loading