Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add max_message_length for larger rows. #2907

Merged

Conversation

daspecster
Copy link
Contributor

@daspecster daspecster added api: bigtable Issues related to the Bigtable API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 29, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 29, 2016
self.assertEqual(partial_row_data.row_key, ROW_KEY)
cell = partial_row_data.cells[COLUMN_FAMILY_ID1]
column = cell[COL_NAME1]
self.assertIsNotNone(column[0].value)

This comment was marked as spam.

This comment was marked as spam.

@@ -76,8 +76,15 @@ def _make_data_stub(client):
:returns: A gRPC stub object.
"""
if client.emulator_host is None:
one_hundred_mb = 100 * 1024 * 1024

This comment was marked as spam.

@@ -480,22 +480,29 @@ def make_secure_channel(credentials, user_agent, host):
:type host: str
:param host: The host for the service.

:type extra_options: tuple
:param extra_options: Extra gRPC options used when creating the channel.

This comment was marked as spam.

self.assertEqual(partial_row_data.row_key, ROW_KEY)
cell = partial_row_data.cells[COLUMN_FAMILY_ID1]
column = cell[COL_NAME1]
self.assertIsNotNone(column[0].value)

This comment was marked as spam.

row = self._table.row(ROW_KEY)
self.rows_to_delete.append(row)

data = '1' * 10 * 1024 * 1024 # 10MB of 1's.

This comment was marked as spam.

@@ -356,6 +356,21 @@ def _write_to_row(self, row1=None, row2=None, row3=None, row4=None):
cell4 = Cell(CELL_VAL4, timestamp4)
return cell1, cell2, cell3, cell4

def test_read_large_row(self):

This comment was marked as spam.

@daspecster daspecster changed the title Add max_receive_message_length for larger rows. Add max_message_length for larger rows. Dec 29, 2016
# NOTE: 'grpc.max_message_length' will be deprecated in the 1.1 release
# of grpcio in favor of 'grpc.max_receive_message_length' and
# 'grpc.max_send_message_length'.
max_msg_length = (('grpc.max_message_length', one_hundred_mb),

This comment was marked as spam.

This comment was marked as spam.

@@ -76,8 +76,15 @@ def _make_data_stub(client):
:returns: A gRPC stub object.
"""
if client.emulator_host is None:
one_hundred_mb = 100 * 1024 * 1024
# NOTE: 'grpc.max_message_length' will be deprecated in the 1.1 release

This comment was marked as spam.

@daspecster
Copy link
Contributor Author

Added Nathaniel's feedback and updated the constant.

# grpcio 1.1 and later.
max_msg_length = (('grpc.max_message_length', _MAX_MSG_LENGTH_100MB),
('grpc.max_receive_message_length',
_MAX_MSG_LENGTH_100MB))

This comment was marked as spam.

This comment was marked as spam.

@daspecster daspecster force-pushed the increase-bigtable-receive-length branch from 78aa62a to 878fb58 Compare December 29, 2016 21:13
@daspecster
Copy link
Contributor Author

Reformatted and squashed.

Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: Are you planning to add a system test where two cells combined exceed 10MB but neither does individually?

@@ -65,6 +65,13 @@
READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/bigtable.data.readonly'
"""Scope for reading table data."""

# NOTE: 'grpc.max_message_length' will no longer be recognized in
# grpcio 1.1 and later.

This comment was marked as spam.

This comment was marked as spam.


with self.assertRaises(Exception):
partial_row_data = self._table.read_row(ROW_KEY)

This comment was marked as spam.

row = self._table.row(ROW_KEY)
self.rows_to_delete.append(row)

data = '1' * 101 * 1024 * 1024 # 11MB of 1's.

This comment was marked as spam.


data = '1' * 101 * 1024 * 1024 # 11MB of 1's.
row.set_cell(COLUMN_FAMILY_ID1, COL_NAME1, data)
with self.assertRaises(Exception):

This comment was marked as spam.

This comment was marked as spam.

self.rows_to_delete.append(row)

number_of_bytes = 10 * 1024 * 1024
data = '1' * number_of_bytes # 10MB of 1's.

This comment was marked as spam.

@daspecster daspecster force-pushed the increase-bigtable-receive-length branch from dc49e57 to 11d33bb Compare December 29, 2016 21:39
@daspecster
Copy link
Contributor Author

daspecster commented Dec 30, 2016

@dhermes and @nathanielmanistaatgoogle
I added the test for multiple cells.

If this looks good, I'll squash and merge.

@daspecster daspecster force-pushed the increase-bigtable-receive-length branch from 38e46d5 to 8e950a8 Compare January 3, 2017 17:14
@daspecster
Copy link
Contributor Author

Squashed.

_MAX_MSG_LENGTH_100MB = 100 * 1024 * 1024
_GRPC_MAX_LENGTH_OPTIONS = (
('grpc.max_message_length', _MAX_MSG_LENGTH_100MB),
('grpc.max_receive_message_length', _MAX_MSG_LENGTH_100MB)

This comment was marked as spam.

@@ -30,6 +30,7 @@
from google.cloud.bigtable.row_data import Cell
from google.cloud.bigtable.row_data import PartialRowData
from google.cloud.environment_vars import BIGTABLE_EMULATOR
from grpc._channel import _Rendezvous

This comment was marked as spam.

cell = partial_row_data.cells[COLUMN_FAMILY_ID1]
column = cell[COL_NAME1]
value = column[0].value
self.assertIsNotNone(value)

This comment was marked as spam.

row.set_cell(COLUMN_FAMILY_ID1, COL_NAME1, data)
row.commit()
row.set_cell(COLUMN_FAMILY_ID1, COL_NAME1, data)
row.commit()

This comment was marked as spam.

This comment was marked as spam.

row.commit()

with self.assertRaises(_Rendezvous):
self._table.read_row(ROW_KEY)

This comment was marked as spam.

This comment was marked as spam.

@@ -356,6 +357,46 @@ def _write_to_row(self, row1=None, row2=None, row3=None, row4=None):
cell4 = Cell(CELL_VAL4, timestamp4)
return cell1, cell2, cell3, cell4

def test_read_large_cell_limit(self):

This comment was marked as spam.

This comment was marked as spam.

with self.assertRaises(_Rendezvous):
row.commit()
self.assertEqual(len(column), 1)
self.assertEqual(len(column[0].value), number_of_bytes)

This comment was marked as spam.

This comment was marked as spam.

@daspecster daspecster force-pushed the increase-bigtable-receive-length branch from c5990c1 to 85c6bf3 Compare January 4, 2017 02:33
@daspecster
Copy link
Contributor Author

Squashed.

@daspecster daspecster merged commit 60f1ada into googleapis:master Jan 4, 2017
@daspecster daspecster deleted the increase-bigtable-receive-length branch January 4, 2017 03:06
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…receive-length

Add max_message_length for larger rows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API. cla: yes This human has signed the Contributor License Agreement. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants