swift/etc
Tim Burke eef87ee212 py3: Work with proper native string paths in crypto meta
Previously, we would work with these paths as WSGI strings -- this would
work fine when all data were read and written on the same major version
of Python, but fail pretty badly during and after upgrading Python.

In particular, if a py3 proxy-server tried to read existing data that
was written down by a py2 proxy-server, it would hit an error and
respond 500. Worse, if an un-upgraded py2 proxy tried to read data that
was freshly-written by a py3 proxy, it would serve corrupt data back to
the client (including a corrupt/invalid ETag and Content-Type).

Now, ensure that both py2 and py3 write down paths as native strings.
Make an effort to still work with WSGI-string metadata, though it can be
ambiguous as to whether a string is a WSGI string or not. The heuristic
used is if

 * the path from metadata does not match the (native-string) request
   path and
 * the path from metadata (when interpreted as a WSGI string) can be
   "un-wsgi-fied" without any encode/decode errors and
 * the native-string path from metadata *does* match the native-string
   request path

then trust the path from the request. By contrast, we usually prefer the
path from metadata in case there was a pipeline misconfiguration (see
related bug).

Add the ability to read and write a new, unambiguous version of metadata
that always has the path as a native string. To support rolling
upgrades, a new config option is added: meta_version_to_write. This
defaults to 2 to support rolling upgrades without configuration changes,
but the default may change to 3 in a future release.

UpgradeImpact
=============
When upgrading from Swift 2.20.0 or Swift 2.19.1 or earlier, set

    meta_version_to_write = 1

in your keymaster's configuration. Regardless of prior Swift version, set

    meta_version_to_write = 3

after upgrading all proxy servers.

When switching from Python 2 to Python 3, first upgrade Swift while on
Python 2, then upgrade to Python 3.

Change-Id: I00c6693c42c1a0220b64d8016d380d5985339658
Closes-Bug: #1888037
Related-Bug: #1813725
(cherry picked from commit 7d429318dd)
2020-08-30 17:25:45 +00:00
..
account-server.conf-sample Make log format for requests configurable 2019-05-02 17:43:25 -06:00
container-reconciler.conf-sample Change schedule priority of daemon/server in config 2016-08-10 23:56:15 +02:00
container-server.conf-sample Make log format for requests configurable 2019-05-02 17:43:25 -06:00
container-sync-realms.conf-sample Removing some redundant words 2016-03-25 17:20:24 +07:00
dispersion.conf-sample Fix swift-dispersion in multi-region setups 2016-06-01 15:35:47 +02:00
drive-audit.conf-sample py3: Fix swift-drive-audit 2019-10-15 17:45:23 +00:00
internal-client.conf-sample add symlink to container sync default and sample config 2017-12-14 12:13:20 -08:00
keymaster.conf-sample py3: Work with proper native string paths in crypto meta 2020-08-30 17:25:45 +00:00
memcache.conf-sample fixups for ipv6 memcache_servers docs 2016-01-12 21:08:58 -08:00
mime.types-sample PEP 8 compliance and small modification to mime.types file 2010-11-23 19:26:02 -06:00
object-expirer.conf-sample Add request_tries option to object-expirer.conf-sample 2018-01-15 15:29:11 +00:00
object-server.conf-sample py3: add swift-dsvm-functional-py3 job 2019-06-21 22:31:18 -07:00
proxy-server.conf-sample py3: Work with proper native string paths in crypto meta 2020-08-30 17:25:45 +00:00
rsyncd.conf-sample Remove deprecated vm_test_mode option 2017-05-25 13:02:42 -07:00
swift-rsyslog.conf-sample Add sample rsyslog.conf. 2013-06-25 10:24:26 +08:00
swift.conf-sample Configure diskfile per storage policy 2018-08-24 02:29:13 +00:00