Title
#lakefs-for-beginners
t

Tamir Zheleznyak

11/17/2022, 1:44 PM
Hey, Questions regarding deletion with: POST/repositories​/{repository}​/branches​/{branch}​/objects​/delete • There is maximum to files I can give ? • If i give wrong pass why there are no errors and I get 200 ok? • Can I give directory to recursively delete all files under it? • Why it is post request and not delete request?
Itai Admi

Itai Admi

11/17/2022, 1:55 PM
Hey Tamir1. There is a maximum of 1000 objects to be passed. 2. By wrong, do you mean
NotFound
? We return per-object errors in the body of the response. Trying to delete an object which is already deleted (or simply never existed) is not consider a failure. What would you expect to see? 3. Recursive deletion is not possible. The
deleteObjects
operation was inspired by S3 batch delete objects. The limit is similar and so is the error handling and the verb.
t

Tamir Zheleznyak

11/17/2022, 1:57 PM
1. Thanks 🙂 2. I tried to pass wrong passes and got 200 ok with empty errors list 3. So what is the advised approach if we want to remove a directory ?
Itai Admi

Itai Admi

11/17/2022, 2:01 PM
Deletion of a missing object is not considered an error. Every other error (no permissions, internal error, etc.) will be logged in the response. For recursive deletion I think the best approach is to list it from the client, batch and delete every 1000 objects until completion.
t

Tamir Zheleznyak

11/17/2022, 2:37 PM
Maybe adding a route for this/ or adding this capability to one of the deletion routes can be helpful because It sounds like a common usecase .So there be ability to remove folder completely without removal of repository. The list of files is recursive ?
Itai Admi

Itai Admi

11/17/2022, 2:42 PM
Listing files can be recursive. It's tricky to add unbounded operations to the API, like delete recursive. A prefix may have billions of objects and the server side operation may not complete in a reasonable time.
t

Tamir Zheleznyak

11/17/2022, 2:52 PM
So if I created a folder It will stay forever and what can I do is to just empty it ?
Itai Admi

Itai Admi

11/17/2022, 3:02 PM
In lakeFS, like other object stores, there isn't a folder object. For example, creating the object
<lakefs://repo1/main/foo/goo/bar|lakefs://repo1/main/foo/goo/bar>
. When listing objects under the prefix
foo/goo/
, it will return
bar
. If you'll delete that object, there aren't any empty folders to clean up.
3:03 PM
Try it for yourself 😀
t

Tamir Zheleznyak

11/17/2022, 3:03 PM
Cool thank you for the answer