Add sorting_method to swift proxy config as needed

When read_affinity is used and sorting_method is not used warnings
are generated in the swift proxy log indicating that the
read_affinity is not being respected. When read_affinity is specified
this change sets the sorting_method to affinity automatically, and
otherwise uses a configured value which defaults to shuffle.

Note that write_affinity does not respect sorting_method and follows
a different code path and does not issue warnings in logs when used
without sorting_method.

Closes-bug: 1480581
Co-Authored-By: Andy McCrae <andy.mccrae@gmail.com>
Change-Id: I3cab89c95f288b4a59f4dd3c7360daca7a4f47bf
This commit is contained in:
Steve Lewis 2015-08-03 22:56:24 -07:00 committed by Jesse Pretorius
parent b2f8a07e72
commit 39b0e5d443
3 changed files with 5 additions and 1 deletions

View File

@ -245,7 +245,8 @@
# E.g. read_affinity: "r1=100" this would prefer region 1 # E.g. read_affinity: "r1=100" this would prefer region 1
# read_affinity: "r1z1=100, r1=200" this would prefer region 1 zone 1 # read_affinity: "r1z1=100, r1=200" this would prefer region 1 zone 1
# if that is unavailable region 1, otherwise any available region/zone. # if that is unavailable region 1, otherwise any available region/zone.
# Lower number is higher priority. # Lower number is higher priority. When this option is specified the
# sorting_method is set to 'affinity' automatically.
# #
# Option: write_affinity (optional, string) # Option: write_affinity (optional, string)
# Specify which region to prefer when object PUT requests are made. # Specify which region to prefer when object PUT requests are made.

View File

@ -93,6 +93,7 @@ swift_allow_versions: True
swift_allow_all_users: False swift_allow_all_users: False
# If you want to regenerate the swift keys, on a run, for rsync purposes set this var to True otherwise keys will be generated on the first run and not regenerated each run. # If you want to regenerate the swift keys, on a run, for rsync purposes set this var to True otherwise keys will be generated on the first run and not regenerated each run.
swift_recreate_keys: False swift_recreate_keys: False
swift_sorting_method: shuffle
## Swift ceilometer variables ## Swift ceilometer variables
swift_reselleradmin_role: ResellerAdmin swift_reselleradmin_role: ResellerAdmin

View File

@ -23,6 +23,7 @@ account_autocreate = true
{% if swift_proxy_vars is defined %} {% if swift_proxy_vars is defined %}
{% if swift_proxy_vars.read_affinity is defined %} {% if swift_proxy_vars.read_affinity is defined %}
read_affinity = {{ swift_proxy_vars.read_affinity }} read_affinity = {{ swift_proxy_vars.read_affinity }}
{% set swift_sorting_method = 'affinity' %}
{% endif %} {% endif %}
{% if swift_proxy_vars.write_affinity is defined %} {% if swift_proxy_vars.write_affinity is defined %}
write_affinity = {{ swift_proxy_vars.write_affinity }} write_affinity = {{ swift_proxy_vars.write_affinity }}
@ -31,6 +32,7 @@ write_affinity_node_count = {{ swift_proxy_vars.write_affinity_node_count }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
sorting_method = {{ swift_sorting_method }}
{% if 'tempauth' in swift_middleware_list %} {% if 'tempauth' in swift_middleware_list %}
[filter:tempauth] [filter:tempauth]