Replace misleading max_message_size option name

The max_message_size option name is misleading. The option
determines max size of message post body. Replacing the
option name to max_messages_post_size.

Change-Id: Ie01cee026e7ebf530cdb2709e2c17d030ad95480
Closes-Bug: #1357397
This commit is contained in:
Sphoorti Joglekar 2014-09-20 01:57:39 +05:30
parent 0f75fdc64c
commit 6253626829
12 changed files with 22 additions and 21 deletions

View File

@ -78,7 +78,7 @@ transport/default_claim_ttl transport
transport/default_message_ttl transport transport/default_message_ttl transport
transport/max_claim_grace transport transport/max_claim_grace transport
transport/max_claim_ttl transport transport/max_claim_ttl transport
transport/max_message_size transport transport/max_messages_post_size transport
transport/max_message_ttl transport transport/max_message_ttl transport
transport/max_messages_per_claim_or_pop transport transport/max_messages_per_claim_or_pop transport
transport/max_messages_per_page transport transport/max_messages_per_page transport

View File

@ -38,7 +38,7 @@
<td>(IntOpt) No help text available for this option.</td> <td>(IntOpt) No help text available for this option.</td>
</tr> </tr>
<tr> <tr>
<td>max_message_size = 262144</td> <td>max_messages_post_size = 262144</td>
<td>(IntOpt) No help text available for this option.</td> <td>(IntOpt) No help text available for this option.</td>
</tr> </tr>
<tr> <tr>

View File

@ -491,7 +491,7 @@
# (integer value) # (integer value)
# Deprecated group/name - [limits:transport]/message_size_uplimit # Deprecated group/name - [limits:transport]/message_size_uplimit
#max_message_size=262144 #max_messages_post_size=262144
# (integer value) # (integer value)
# Deprecated group/name - [limits:transport]/message_ttl_max # Deprecated group/name - [limits:transport]/message_ttl_max

View File

@ -51,4 +51,4 @@ port = 8888
# Maximum size in bytes allowed for queue metadata and bulk/single # Maximum size in bytes allowed for queue metadata and bulk/single
# message post bodies (including whitespace and envelope fields). # message post bodies (including whitespace and envelope fields).
;max_queue_metadata = 65536 ;max_queue_metadata = 65536
;max_message_size = 262144 ;max_messages_post_size = 262144

View File

@ -7,4 +7,4 @@ storage = sqlalchemy
metadata_size_uplimit = 64 metadata_size_uplimit = 64
[transport] [transport]
max_message_size = 256 max_messages_post_size = 256

View File

@ -54,7 +54,7 @@ class TestMessages(base.V1FunctionalTestBase):
doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]'
overhead = len(doc.format('', '')) overhead = len(doc.format('', ''))
half_size = (self.limits.max_message_size - overhead) // 2 half_size = (self.limits.max_messages_post_size - overhead) // 2
doc = doc.format(helpers.generate_random_string(half_size), doc = doc.format(helpers.generate_random_string(half_size),
helpers.generate_random_string(half_size + offset)) helpers.generate_random_string(half_size + offset))
@ -276,7 +276,7 @@ class TestMessages(base.V1FunctionalTestBase):
doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]'
overhead = len(doc.format('', '')) overhead = len(doc.format('', ''))
half_size = (self.limits.max_message_size - overhead) // 2 half_size = (self.limits.max_messages_post_size - overhead) // 2
doc = doc.format(helpers.generate_random_string(half_size), doc = doc.format(helpers.generate_random_string(half_size),
helpers.generate_random_string(half_size + 1)) helpers.generate_random_string(half_size + 1))

View File

@ -56,7 +56,7 @@ class TestMessages(base.V1_1FunctionalTestBase):
'{{"body": "{1}", "ttl": 120}}]}}') '{{"body": "{1}", "ttl": 120}}]}}')
overhead = len(doc.format('', '')) overhead = len(doc.format('', ''))
half_size = (self.limits.max_message_size - overhead) // 2 half_size = (self.limits.max_messages_post_size - overhead) // 2
doc = doc.format(helpers.generate_random_string(half_size), doc = doc.format(helpers.generate_random_string(half_size),
helpers.generate_random_string(half_size + offset)) helpers.generate_random_string(half_size + offset))
@ -408,7 +408,7 @@ class TestMessages(base.V1_1FunctionalTestBase):
doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]'
overhead = len(doc.format('', '')) overhead = len(doc.format('', ''))
half_size = (self.limits.max_message_size - overhead) // 2 half_size = (self.limits.max_messages_post_size - overhead) // 2
doc = doc.format(helpers.generate_random_string(half_size), doc = doc.format(helpers.generate_random_string(half_size),
helpers.generate_random_string(half_size + 1)) helpers.generate_random_string(half_size + 1))

View File

@ -39,9 +39,10 @@ _TRANSPORT_LIMITS_OPTIONS = (
cfg.IntOpt('max_queue_metadata', default=64 * 1024, cfg.IntOpt('max_queue_metadata', default=64 * 1024,
deprecated_name='metadata_size_uplimit', deprecated_name='metadata_size_uplimit',
deprecated_group='limits:transport'), deprecated_group='limits:transport'),
cfg.IntOpt('max_message_size', default=256 * 1024, cfg.IntOpt('max_messages_post_size', default=256 * 1024,
deprecated_name='message_size_uplimit', deprecated_name='message_size_uplimit',
deprecated_group='limits:transport'), deprecated_group='limits:transport',
deprecated_opts=[cfg.DeprecatedOpt('max_message_size')]),
cfg.IntOpt('max_message_ttl', default=1209600, cfg.IntOpt('max_message_ttl', default=1209600,
deprecated_name='message_ttl_max', deprecated_name='message_ttl_max',
@ -153,10 +154,10 @@ class Validator(object):
""" """
if content_length is None: if content_length is None:
return return
if content_length > self._limits_conf.max_message_size: if content_length > self._limits_conf.max_messages_post_size:
raise ValidationFailed( raise ValidationFailed(
_(u'Message collection size is too large. Max size {0}'), _(u'Message collection size is too large. Max size {0}'),
self._limits_conf.max_message_size) self._limits_conf.max_messages_post_size)
def message_content(self, message): def message_content(self, message):
"""Restrictions on each message.""" """Restrictions on each message."""

View File

@ -254,7 +254,7 @@ class MessagesBaseTest(base.V1Base):
doc = jsonutils.dumps([{'body': "some body", 'ttl': 100}] * 20, doc = jsonutils.dumps([{'body': "some body", 'ttl': 100}] * 20,
indent=4) indent=4)
max_len = self.transport_cfg.max_message_size max_len = self.transport_cfg.max_messages_post_size
long_doc = doc + (' ' * (max_len - len(doc) + 1)) long_doc = doc + (' ' * (max_len - len(doc) + 1))
self.simulate_post(self.queue_path + '/messages', self.simulate_post(self.queue_path + '/messages',

View File

@ -75,13 +75,13 @@ class TestValidation(base.V1Base):
self.assertEqual(self.srmock.status, falcon.HTTP_201) self.assertEqual(self.srmock.status, falcon.HTTP_201)
# Both messages' size are too long # Both messages' size are too long
max_message_size = 256 max_messages_post_size = 256
obj = {'a': 0, 'b': ''} obj = {'a': 0, 'b': ''}
envelope_length = len(json.dumps(obj, separators=(',', ':'))) envelope_length = len(json.dumps(obj, separators=(',', ':')))
obj['b'] = 'x' * (max_message_size - envelope_length + 1) obj['b'] = 'x' * (max_messages_post_size - envelope_length + 1)
for long_body in ('a' * (max_message_size - 2 + 1), obj): for long_body in ('a' * (max_messages_post_size - 2 + 1), obj):
doc = json.dumps([{'body': long_body, 'ttl': 100}]) doc = json.dumps([{'body': long_body, 'ttl': 100}])
self.simulate_post(self.queue_path + '/messages', self.simulate_post(self.queue_path + '/messages',
self.project_id, self.project_id,

View File

@ -278,7 +278,7 @@ class MessagesBaseTest(base.V1_1Base):
doc = {'messages': [{'body': "some body", 'ttl': 100}] * 20} doc = {'messages': [{'body': "some body", 'ttl': 100}] * 20}
body = jsonutils.dumps(doc, indent=4) body = jsonutils.dumps(doc, indent=4)
max_len = self.transport_cfg.max_message_size max_len = self.transport_cfg.max_messages_post_size
long_body = body + (' ' * (max_len - len(body) + 1)) long_body = body + (' ' * (max_len - len(body) + 1))
self.simulate_post(self.queue_path + '/messages', self.simulate_post(self.queue_path + '/messages',

View File

@ -75,13 +75,13 @@ class TestValidation(base.V1_1Base):
self.assertEqual(self.srmock.status, falcon.HTTP_201) self.assertEqual(self.srmock.status, falcon.HTTP_201)
# Both messages' size are too long # Both messages' size are too long
max_message_size = 256 max_messages_post_size = 256
obj = {'a': 0, 'b': ''} obj = {'a': 0, 'b': ''}
envelope_length = len(json.dumps(obj, separators=(',', ':'))) envelope_length = len(json.dumps(obj, separators=(',', ':')))
obj['b'] = 'x' * (max_message_size - envelope_length + 1) obj['b'] = 'x' * (max_messages_post_size - envelope_length + 1)
for long_body in ('a' * (max_message_size - 2 + 1), obj): for long_body in ('a' * (max_messages_post_size - 2 + 1), obj):
doc = json.dumps([{'body': long_body, 'ttl': 100}]) doc = json.dumps([{'body': long_body, 'ttl': 100}])
self.simulate_post(self.queue_path + '/messages', self.simulate_post(self.queue_path + '/messages',
self.project_id, self.project_id,