kragniz / python-etcd3

Python client for the etcd API v3
Apache License 2.0
426 stars 178 forks source link

limit is not used in `get_range_request` of 0.12.0 #1716

Open fly-studio opened 2 years ago

fly-studio commented 2 years ago

I want to read the last revision of a key with prefix

response = etcd.get_prefix_response(settings.CONF_PREFIX, sort_order='descend', sort_target='mod', limit=1)
print(response.header.revision)

but report grpc body is greater then 4M when key/value is big in etcd

Received_message larger than max(4194304)  

This problem occurs because limit is not used in the body of _build_get_range_request, but fix in the master branch, When will the next stable release be?

mangox commented 2 years ago

I'm facing this issue too.

mangox commented 2 years ago

I have solved this issue by setting grpc options. etcd3.client(host=host, port=port, grpc_options={'grpc.max_receive_message_length': -1, 'grpc.max_send_message_length': -1})

kimitoboku commented 1 year ago

I have solved as following setting. etcd3.client(host=host, port=port, grpc_options=[('grpc.max_receive_message_length', -1), ('grpc.max_send_message_length', -1)])

grpc_options is parsed as a list of the key-value tuples. https://github.com/grpc/grpc/blob/066a310df1fe9d68a00f346bd36e6c965d62e528/src/python/grpcio/grpc/_channel.py#L1450-L1460

'grpc.max_receive_message_length: https://grpc.github.io/grpc/core/group__grpc__arg__keys.html#ga813f94f9ac3174571dd712c96cdbbdc1