From 8cdddd365b4da0e52e5c7881014c85b4f1496827 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 9 Aug 2018 16:32:07 -0400 Subject: [PATCH] Remove the transaction around creating the tag and the tag manifest The tag manifest creation operation is now quite a bit heavier (because it is populating a bunch of new-model tables as well), and it is not necessary for the transaction to include this operation, because tags are valid without manifests currently. --- data/model/tag.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/data/model/tag.py b/data/model/tag.py index cd86e3dc4..b0fcb2205 100644 --- a/data/model/tag.py +++ b/data/model/tag.py @@ -567,17 +567,18 @@ def store_tag_manifest_for_repo(repository_id, tag_name, manifest, leaf_layer_id """ Stores a tag manifest for a specific tag name in the database. Returns the TagManifest object, as well as a boolean indicating whether the TagManifest was created. """ - with db_transaction(): - tag = create_or_update_tag_for_repo(repository_id, tag_name, leaf_layer_id, - reversion=reversion) + # Create the tag for the tag manifest. + tag = create_or_update_tag_for_repo(repository_id, tag_name, leaf_layer_id, + reversion=reversion) - try: - manifest = TagManifest.get(digest=manifest.digest) - manifest.tag = tag - manifest.save() - return manifest, False - except TagManifest.DoesNotExist: - return _create_manifest(tag, manifest, storage_id_map), True + # Add a tag manifest pointing to that tag. + try: + manifest = TagManifest.get(digest=manifest.digest) + manifest.tag = tag + manifest.save() + return manifest, False + except TagManifest.DoesNotExist: + return _create_manifest(tag, manifest, storage_id_map), True def get_active_tag(namespace, repo_name, tag_name):