Get all versions of segment

Hi,
I was looking at the API in druid (http://druid.io/docs/latest/design/coordinator.html) and I don’t see an API to retrieve all segments in a given interval. I was wondering if there is missing documentation or missing feature or just by design not to expose this.

Thanks!

What are you trying to accomplish with that API?

Hi Fangjin,
I am trying to clear all unused segments in Deep Storage, and since the kill task documents that it will remove ALL segments, it doesn’t seem like the right fit, and was hoping I could implement something that can iterate over the segments in a interval and delete the unnecessary ones. However from testing, it seems that the kill task leaves the most recent segment which is the behavior we want. Can you speak a bit more about that?

Thanks!

Ah, the kill task was designed to remove all UNUSED segments. I can’t recall if it only works on a disabled datasource or not, but a brief look at the code tells me it is just for unused segments, even if the datasource is active. It’s been awhile since I wrote that code :stuck_out_tongue:

You should be able to issue kill tasks to periodically clean up all unused segments. The kill task will remove the metadata storage entry as well as the segment in deep storage.