Merge "Warn if read_affinity is configured but not enabled"
This commit is contained in:
commit
7988a5e006
@ -1820,8 +1820,7 @@ def affinity_key_function(affinity_str):
|
|||||||
priority values are what comes after the equals sign.
|
priority values are what comes after the equals sign.
|
||||||
|
|
||||||
If affinity_str is empty or all whitespace, then the resulting function
|
If affinity_str is empty or all whitespace, then the resulting function
|
||||||
will not alter the ordering of the nodes. However, if affinity_str
|
will not alter the ordering of the nodes.
|
||||||
contains an invalid value, then None is returned.
|
|
||||||
|
|
||||||
:param affinity_str: affinity config value, e.g. "r1z2=3"
|
:param affinity_str: affinity config value, e.g. "r1z2=3"
|
||||||
or "r1=1, r2z1=2, r2z2=2"
|
or "r1=1, r2z1=2, r2z2=2"
|
||||||
|
@ -148,7 +148,7 @@ class Application(object):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Invalid request_node_count value: %r' % ''.join(value))
|
'Invalid request_node_count value: %r' % ''.join(value))
|
||||||
try:
|
try:
|
||||||
read_affinity = conf.get('read_affinity', '')
|
self._read_affinity = read_affinity = conf.get('read_affinity', '')
|
||||||
self.read_affinity_sort_key = affinity_key_function(read_affinity)
|
self.read_affinity_sort_key = affinity_key_function(read_affinity)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
# make the message a little more useful
|
# make the message a little more useful
|
||||||
@ -210,6 +210,15 @@ class Application(object):
|
|||||||
max_container_name_length=constraints.MAX_CONTAINER_NAME_LENGTH,
|
max_container_name_length=constraints.MAX_CONTAINER_NAME_LENGTH,
|
||||||
max_object_name_length=constraints.MAX_OBJECT_NAME_LENGTH)
|
max_object_name_length=constraints.MAX_OBJECT_NAME_LENGTH)
|
||||||
|
|
||||||
|
def check_config(self):
|
||||||
|
"""
|
||||||
|
Check the configuration for possible errors
|
||||||
|
"""
|
||||||
|
if self._read_affinity and self.sorting_method != 'affinity':
|
||||||
|
self.logger.warn("sorting_method is set to '%s', not 'affinity'; "
|
||||||
|
"read_affinity setting will have no effect." %
|
||||||
|
self.sorting_method)
|
||||||
|
|
||||||
def get_controller(self, path):
|
def get_controller(self, path):
|
||||||
"""
|
"""
|
||||||
Get the controller to handle a request.
|
Get the controller to handle a request.
|
||||||
@ -543,4 +552,6 @@ def app_factory(global_conf, **local_conf):
|
|||||||
"""paste.deploy app factory for creating WSGI proxy apps."""
|
"""paste.deploy app factory for creating WSGI proxy apps."""
|
||||||
conf = global_conf.copy()
|
conf = global_conf.copy()
|
||||||
conf.update(local_conf)
|
conf.update(local_conf)
|
||||||
return Application(conf)
|
app = Application(conf)
|
||||||
|
app.check_config()
|
||||||
|
return app
|
||||||
|
Loading…
Reference in New Issue
Block a user