[#215] Fix get latest version node #215
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#215
Loading…
Reference in a new issue
No description provided.
Delete branch ":feature/fix_get_latest_version_node"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We have the following problem. For example, if we created an object with the key
a
and an object with the keya/b
(it is important that the name of the "folder" is the same as the name of the object), and then we call theaws rm --recursive
command to the bucket in which they lie, then in the end the object with the keya
it is not deleted.This happens because when requesting a tree service to get a node of the object version, we get a node that is a secondary object
a
. The resulting node does not have an OID attribute, and as a result, further deletion of the object with thea
key does not occur.As a solution, an option is proposed in which we get the entire list of nodes by a certain path (key) and then choose the node of the object version we need ourselves, depending on the presence of the OID attribute and the timestamp value.
Signed-off-by: Roman Loginov r.loginov@yadro.com
9e1b398be1
to9f3119a875
@ -602,0 +608,4 @@
)
for i, node := range nodes {
currentCreationTime := node.GetTimestamp()
if len(node.GetMeta()) != 0 && currentCreationTime > maxCreationTime {
I'm not sure it's enough to check length of
GetMeta
(as I understand intermediate node also contains some meta:FileName
). Probably it's better to check forOID
attribute that must exist in case of object-version node9f3119a875
to2ffb3e792e
Please, fix commit message (now it refers to #1162)
2ffb3e792e
todc8dc42f4f
[#1162] Fix get latest version nodeto [#215] Fix get latest version node@ -602,0 +614,4 @@
}
}
return nodes[targetIndexNode]
What if the
nodes
doesn't contain any node withOID
attribute?Let's write a unit test for
getLatestNode
and check there some corner cases here.Added a check of this case. Now in this case, the error
layer.ErrNodeNotFound
will be returned.Don't forget to open PR in support branch as well after.
dc8dc42f4f
to2cd03d2fdd
@ -598,0 +606,4 @@
var (
maxCreationTime uint64
targetIndexNode int
objectNodeExist bool
If we initialize
targetIndexNode
with-1
then we can dropobjectNodeExist
variable and check forBut it's optional
2cd03d2fdd
to9b8e991e0b