Open simon-ball opened 2 years ago
I am running into the same issue on my side. .unused()
is empty and > 200,000 objects that are not referenced are not being deleted / cleared.
Using @simon-ball's code above I am getting this:
schema.external["octo_store"].delete(delete_external_files=True)
returns nothing and finishes in <3 seconds.
With help from @ttngu207 I have stitched together this script to get rid of unused files both in S3 and in the external table (entries). https://gist.github.com/horsto/4826a58837ef37a7f8c4da94981973b8
Bug Report
In an established pipeline, the ExternalTables cannot be cleaned up because
.unused()
returns zero rows, even in cases where I know categorically that at least 1 (and in practice, >10 million) rows should be deleted.Description
I have a group of schemas making use of a single S3-type store (object storage on a private Openstack instance).
The store contains approximately 40 million objects (1.5TB), of which a considerable number (my rough estimate is about 10 million) are unused. Some of those objects are still recorded in the ExternalTables for the schemas. I also know that some completely orphaned objects exist, which are not recorded in the ExternalTable of any schema, but they fall outside the scope of this bug.
Datajoint Docs point to the following command to clean up the ExternalTable and the external filestore:
Which based on reading the source code itself makes use of the call:
However, this command always produces exactly zero responses (which is definitely incorrect, as I have spent the past several days deleting a non-trivial amount of data from two of these schemas)
If, instead, I compare the opposite command,
.used()
to the total length of the table, it tells a very different story. Here I would expecttotal
to be equal to the sum ofused
andunused
.diff
expresses how the actual result diverges from the expectation. It should always be zero, but in practice is not.Note that
unused
remains zero, even thoughtotal
is not equal toused
I can't offer any suggestion why - the source code appears superficially correct, i.e.
used
andunused
are include vs exclude the same restriction. It just doesn't work.Reproducibility
This gets tricky. This is perfectly reproduciable against our production database server, across multiple operating systems and multiple versions of Datajoint:
However, I cannot concoct a toy example that shows the same behaviour. The code below works exactly as it should work, with
.unused()
returning the expected number, and.delete()
removing the correct number.So this may be a historical anomaly (although adding in 0.12.4 to the below example hasn't reproduced it), or it may be a scale example (I don't have enough spare storage space to reproduce 1TB of random test data), neither of which may be amenable to being fixed.
Expected Behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Research and Context
Add any additional research or context that was conducted in creating this report.
For example: