ec: Add an option to write fragments with legacy crc

When upgrading from liberasurecode<=1.5.0, you may want to continue
writing legacy CRCs until all nodes are upgraded and capabale of reading
fragments with zlib CRCs.

Starting in liberasurecode>=1.6.2, we can use the environment variable
LIBERASURECODE_WRITE_LEGACY_CRC to control whether we write zlib or
legacy CRCs, but for many operators it's easier to manage swift configs
than environment variables. Add a new option, write_legacy_ec_crc, to the
proxy-server app and object-reconstructor; if set to true, ensure legacy
frags are written.

Note that more daemons instantiate proxy-server apps than just the
proxy-server. The complete set of impacted daemons should be:

  * proxy-server
  * object-reconstructor
  * container-reconciler
  * any users of internal-client.conf

UpgradeImpact
=============
To ensure a smooth liberasurecode upgrade:

 1. Determine whether your cluster writes legacy or zlib CRCs. Depending
    on the order in which shared libraries are loaded, your servers may
    already be reading and writing zlib CRCs, even with old
    liberasurecode. In that case, no special action is required and
    WRITING LEGACY CRCS DURING THE UPGRADE WILL CAUSE AN OUTAGE.
    Just upgrade liberasurecode normally. See the closed bug for more
    information and a script to determine which CRC is used.
 2. On all nodes, ensure Swift is upgraded to a version that includes
    write_legacy_ec_crc support and write_legacy_ec_crc is enabled on
    all daemons.
 3. On each node, upgrade liberasurecode and restart Swift services.
    Because of (2), they will continue writing legacy CRCs which will
    still be readable by nodes that have not yet upgraded.
 4. Once all nodes are upgraded, remove the write_legacy_ec_crc option
    from all configs across all nodes. After restarting daemons, they
    will write zlib CRCs which will also be readable by all nodes.

Change-Id: Iff71069f808623453c0ff36b798559015e604c7d
Related-Bug: #1666320
Closes-Bug: #1886088
Depends-On: https://review.opendev.org/#/c/738959/
This commit is contained in:
Tim Burke 2020-07-02 16:29:59 -07:00
parent 5c087ad7b9
commit 599f63e762
4 changed files with 42 additions and 0 deletions

View File

@ -380,6 +380,16 @@ use = egg:swift#recon
# Work only with ionice_class.
# ionice_class =
# ionice_priority =
#
# When upgrading from liberasurecode<=1.5.0, you may want to continue writing
# legacy CRCs until all nodes are upgraded and capabale of reading fragments
# with zlib CRCs. liberasurecode>=1.6.2 checks for the environment variable
# LIBERASURECODE_WRITE_LEGACY_CRC; if set (value doesn't matter), it will use
# its legacy CRC. Set this option to true or false to ensure the environment
# variable is or is not set. Leave the option blank or absent to not touch
# the environment (default). For more information, see
# https://bugs.launchpad.net/liberasurecode/+bug/1886088
# write_legacy_ec_crc =
[object-updater]
# You can override the default log routing for this app here (don't use set!):

View File

@ -285,6 +285,16 @@ use = egg:swift#proxy
# Work only with ionice_class.
# ionice_class =
# ionice_priority =
#
# When upgrading from liberasurecode<=1.5.0, you may want to continue writing
# legacy CRCs until all nodes are upgraded and capabale of reading fragments
# with zlib CRCs. liberasurecode>=1.6.2 checks for the environment variable
# LIBERASURECODE_WRITE_LEGACY_CRC; if set (value doesn't matter), it will use
# its legacy CRC. Set this option to true or false to ensure the environment
# variable is or is not set. Leave the option blank or absent to not touch
# the environment (default). For more information, see
# https://bugs.launchpad.net/liberasurecode/+bug/1886088
# write_legacy_ec_crc =
# Some proxy-server configuration options may be overridden on a per-policy
# basis by including per-policy config section(s). The value of any option

View File

@ -208,6 +208,17 @@ class ObjectReconstructor(Daemon):
'of handoffs_only.')
self.rebuild_handoff_node_count = int(conf.get(
'rebuild_handoff_node_count', 2))
# When upgrading from liberasurecode<=1.5.0, you may want to continue
# writing legacy CRCs until all nodes are upgraded and capabale of
# reading fragments with zlib CRCs.
# See https://bugs.launchpad.net/liberasurecode/+bug/1886088 for more
# information.
if 'write_legacy_ec_crc' in conf:
os.environ['LIBERASURECODE_WRITE_LEGACY_CRC'] = \
'1' if config_true_value(conf['write_legacy_ec_crc']) else '0'
# else, assume operators know what they're doing and leave env alone
self._df_router = DiskFileRouter(conf, self.logger)
self.all_local_devices = self.get_local_devices()
self.rings_mtime = None

View File

@ -287,6 +287,17 @@ class Application(object):
self.swift_owner_headers = [
name.strip().title()
for name in swift_owner_headers.split(',') if name.strip()]
# When upgrading from liberasurecode<=1.5.0, you may want to continue
# writing legacy CRCs until all nodes are upgraded and capabale of
# reading fragments with zlib CRCs.
# See https://bugs.launchpad.net/liberasurecode/+bug/1886088 for more
# information.
if 'write_legacy_ec_crc' in conf:
os.environ['LIBERASURECODE_WRITE_LEGACY_CRC'] = \
'1' if config_true_value(conf['write_legacy_ec_crc']) else '0'
# else, assume operators know what they're doing and leave env alone
# Initialization was successful, so now apply the client chunk size
# parameter as the default read / write buffer size for the network
# sockets.