From b084744d02ecc154c8e744a0138c90ffdd7482f4 Mon Sep 17 00:00:00 2001 From: Chinemerem Date: Tue, 15 Oct 2024 16:15:51 -0700 Subject: [PATCH] Rename obj to path In our updater we define `obj = '/%s/%s/%s' % (acct, cont, update['obj'])` which is a path, not an object. This commit renames the variable appropriately Change-Id: I218fa6759df9af84002420a66a721740c0039003 --- swift/obj/updater.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/swift/obj/updater.py b/swift/obj/updater.py index 00db49c2d7..63e03ecdda 100644 --- a/swift/obj/updater.py +++ b/swift/obj/updater.py @@ -625,9 +625,9 @@ class ObjectUpdater(Daemon): headers_out.setdefault('X-Backend-Accept-Quoted-Location', 'true') acct, cont = split_update_path(update) part, nodes = self.get_container_ring().get_nodes(acct, cont) - obj = '/%s/%s/%s' % (acct, cont, update['obj']) + path = '/%s/%s/%s' % (acct, cont, update['obj']) events = [spawn(self.object_update, - node, part, update['op'], obj, headers_out) + node, part, update['op'], path, headers_out) for node in nodes if node['id'] not in successes] success = True new_successes = rewrite_pickle = False @@ -646,8 +646,8 @@ class ObjectUpdater(Daemon): if success: self.stats.successes += 1 self.logger.increment('successes') - self.logger.debug('Update sent for %(obj)s %(path)s', - {'obj': obj, 'path': update_path}) + self.logger.debug('Update sent for %(path)s %(update_path)s', + {'path': path, 'update_path': update_path}) self.stats.unlinks += 1 self.logger.increment('unlinks') os.unlink(update_path) @@ -673,15 +673,16 @@ class ObjectUpdater(Daemon): self.stats.redirects += 1 self.logger.increment("redirects") self.logger.debug( - 'Update redirected for %(obj)s %(path)s to %(shard)s', - {'obj': obj, 'path': update_path, + 'Update redirected for %(path)s %(update_path)s to ' + '%(shard)s', + {'path': path, 'update_path': update_path, 'shard': update['container_path']}) rewrite_pickle = True else: self.stats.failures += 1 self.logger.increment('failures') - self.logger.debug('Update failed for %(obj)s %(path)s', - {'obj': obj, 'path': update_path}) + self.logger.debug('Update failed for %(path)s %(update_path)s', + {'path': path, 'update_path': update_path}) if new_successes: update['successes'] = successes rewrite_pickle = True @@ -696,14 +697,14 @@ class ObjectUpdater(Daemon): write_pickle(update, update_path, os.path.join( device, get_tmp_dir(policy))) - def object_update(self, node, part, op, obj, headers_out): + def object_update(self, node, part, op, path, headers_out): """ Perform the object update to the container :param node: node dictionary from the container ring :param part: partition that holds the container :param op: operation performed (ex: 'PUT' or 'DELETE') - :param obj: object name being updated + :param path: /// path being updated :param headers_out: headers to send with the update :return: a tuple of (``success``, ``node_id``, ``redirect``) where ``success`` is True if the update succeeded, ``node_id`` is @@ -718,7 +719,7 @@ class ObjectUpdater(Daemon): with ConnectionTimeout(self.conn_timeout): conn = http_connect( node['replication_ip'], node['replication_port'], - node['device'], part, op, obj, headers_out) + node['device'], part, op, path, headers_out) with Timeout(self.node_timeout): resp = conn.getresponse() resp.read() @@ -730,7 +731,7 @@ class ObjectUpdater(Daemon): except ValueError as err: self.logger.error( 'Container update failed for %r; problem with ' - 'redirect location: %s' % (obj, err)) + 'redirect location: %s' % (path, err)) success = is_success(status) if not success: