From 599f63e762f1f2b51b64353a31342be5e6371fc5 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 2 Jul 2020 16:29:59 -0700 Subject: [PATCH] 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/ --- etc/object-server.conf-sample | 10 ++++++++++ etc/proxy-server.conf-sample | 10 ++++++++++ swift/obj/reconstructor.py | 11 +++++++++++ swift/proxy/server.py | 11 +++++++++++ 4 files changed, 42 insertions(+) diff --git a/etc/object-server.conf-sample b/etc/object-server.conf-sample index cbef1be1bf..cbb738c6d1 100644 --- a/etc/object-server.conf-sample +++ b/etc/object-server.conf-sample @@ -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!): diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample index 0387fde203..ea5f5838d7 100644 --- a/etc/proxy-server.conf-sample +++ b/etc/proxy-server.conf-sample @@ -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 diff --git a/swift/obj/reconstructor.py b/swift/obj/reconstructor.py index 135f9d5f9f..1c227a12bc 100644 --- a/swift/obj/reconstructor.py +++ b/swift/obj/reconstructor.py @@ -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 diff --git a/swift/proxy/server.py b/swift/proxy/server.py index c79251c69c..234320d6b7 100644 --- a/swift/proxy/server.py +++ b/swift/proxy/server.py @@ -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.

AltStyle によって変換されたページ (->オリジナル) /