Clean up already removed object from tree #97

Merged
alexvanin merged 1 commit from ironbee/frostfs-s3-gw:cleanup-tree-when-object-deleted-via-grpc into master 2023-05-24 15:06:36 +00:00
Contributor

Signed-off-by: Artem Tataurov a.tataurov@yadro.com

Closes: #78

Signed-off-by: Artem Tataurov <a.tataurov@yadro.com> Closes: #78
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from 5d12d7a0d9 to 5d063ddaec 2023-04-24 17:44:17 +00:00 Compare
ironbee requested review from dkirillov 2023-04-24 23:51:11 +00:00
ironbee changed title from WIP: Clean up already removed object from tree to Clean up already removed object from tree 2023-04-27 18:39:13 +00:00
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from 5d063ddaec to e28d5eff73 2023-04-27 18:41:01 +00:00 Compare
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from e28d5eff73 to f99f1f73b9 2023-04-27 18:45:55 +00:00 Compare
dkirillov requested review from storage-services-developers 2023-04-28 06:22:08 +00:00
dkirillov requested review from storage-services-committers 2023-04-28 06:22:08 +00:00
dkirillov reviewed 2023-04-28 06:22:32 +00:00
@ -5,6 +5,7 @@ import (
"crypto/ecdsa"
"crypto/rand"
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/cache"
Member

Please group imports

Please group imports
dkirillov marked this conversation as resolved
dkirillov reviewed 2023-04-28 06:38:36 +00:00
@ -633,2 +635,4 @@
}
func (n *layer) handleObjectAlreadyRemovedError(ctx context.Context, bkt *data.BucketInfo, obj *VersionedObject, nodeID uint64) *VersionedObject {
if !client.IsErrObjectAlreadyRemoved(obj.Error) {
Member

It seems we also should handle not found error and put empty list into cache only in such case

It seems we also should handle `not found` error and put empty list into cache only in such case
dkirillov marked this conversation as resolved
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from f99f1f73b9 to f75cdf4fcb 2023-04-28 17:36:51 +00:00 Compare
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from f75cdf4fcb to 3b5dda3725 2023-04-28 17:38:28 +00:00 Compare
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from 3b5dda3725 to c4000c48c6 2023-05-23 13:53:35 +00:00 Compare
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from c4000c48c6 to 6d67ac9b30 2023-05-23 14:08:07 +00:00 Compare
dkirillov reviewed 2023-05-23 14:39:01 +00:00
@ -635,0 +647,4 @@
owner := n.Owner(ctx)
cacheKey := cache.CreateObjectsListCacheKey(bkt.CID, "", false)
n.cache.DeleteObjectName(bkt.CID, bkt.Name, obj.Name)
n.cache.PutList(owner, cacheKey, []*data.NodeVersion{})
Member

We should omit this.
Let's write:

		n.cache.DeleteObjectName(bkt.CID, bkt.Name, obj.Name)
	}

	return obj

instead of

		owner := n.Owner(ctx)
		cacheKey := cache.CreateObjectsListCacheKey(bkt.CID, "", false)
		n.cache.DeleteObjectName(bkt.CID, bkt.Name, obj.Name)
		n.cache.PutList(owner, cacheKey, []*data.NodeVersion{})

		return obj
	}

	return obj
We should omit this. Let's write: ``` n.cache.DeleteObjectName(bkt.CID, bkt.Name, obj.Name) } return obj ``` instead of ``` owner := n.Owner(ctx) cacheKey := cache.CreateObjectsListCacheKey(bkt.CID, "", false) n.cache.DeleteObjectName(bkt.CID, bkt.Name, obj.Name) n.cache.PutList(owner, cacheKey, []*data.NodeVersion{}) return obj } return obj ```
dkirillov marked this conversation as resolved
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from 6d67ac9b30 to 8b93f2d515 2023-05-24 10:03:53 +00:00 Compare
alexvanin approved these changes 2023-05-24 12:43:05 +00:00
alexvanin left a comment
Owner

LGTM

LGTM
dkirillov approved these changes 2023-05-24 12:53:37 +00:00
ironbee force-pushed cleanup-tree-when-object-deleted-via-grpc from 8b93f2d515 to a0f0d792b8 2023-05-24 14:42:54 +00:00 Compare
dkirillov approved these changes 2023-05-24 14:45:15 +00:00
alexvanin merged commit a0f0d792b8 into master 2023-05-24 15:06:36 +00:00
alexvanin deleted branch cleanup-tree-when-object-deleted-via-grpc 2023-05-24 15:06:37 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#97
No description provided.