Garbage collection deletes the objects of custom codecs that store through <hash@>
Les mainteneurs répondent en général sous 6 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 78/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- mysql, postgresql, python
- Domaine
- data-engineering, databases
Piste de recherche
Start with src/datajoint/heading.py and src/datajoint/gc.py, especially the referenced Attribute.is_hash_object and collector scan; read how is_schema_object resolves codec types. Reproduce with the supplied HashChain and BlobChain example, then check that Codec.referenced_paths accounts for all three stored objects. Done means collect(dry_run=False) preserves every row-referenced object and fetching text, obj, and ref still succeeds.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
GarbageCollector.collect(dry_run=False) deletes the stored objects of a custom codec that stores through <hash@>, directly or through <blob@> or <attach@>. Fetching those rows then fails with MissingExternalFile.
Attribute.is_hash_object decides by codec name: hash, or blob/attach with a store (heading.py#L182-L198). A custom codec whose get_dtype returns "<hash>" or "<blob>" doesn't match. The collector never scans its column for references (gc.py#L162-L192), so its objects count as orphans. Codec.referenced_paths would report their paths correctly.
This is the part of #1469 that is still open. The fix for #1469 recognizes schema-addressed custom codecs by type, but hash-addressed ones are still recognized by name. It belongs under #1478.
Repro (master, eefe74b4; MySQL and PostgreSQL; a file store local as the default store)
import numpy as np
import datajoint as dj
from datajoint.gc import GarbageCollector
class HashChain(dj.Codec):
name = "hashchain"
def get_dtype(self, is_store):
return "<hash>"
def encode(self, value, *, key=None, context=None, store_name=None):
return value.encode()
def decode(self, stored, *, key=None, context=None):
return stored.decode()
class BlobChain(dj.Codec):
name = "blobchain"
def get_dtype(self, is_store):
return "<blob>"
def encode(self, value, *, key=None, context=None, store_name=None):
return value
def decode(self, stored, *, key=None, context=None):
return stored
@schema
class Note(dj.Manual):
definition = """
note_id : int32
---
text : <hashchain@>
obj : <blobchain@>
ref : <blob@>
"""
Note.insert1(dict(note_id=1, text="hello", obj=np.arange(7), ref=np.arange(7)))
GarbageCollector(schema, store="local").collect()
is_hash_objectis False fortextandobj, and True forref.- All three objects are under
_hash/<schema>/, but the collector finds 1 referenced path and reports thetextandobjobjects as orphaned. collect(dry_run=False)deletes both.Note.fetch1("text")andNote.fetch1("obj")then raiseMissingExternalFile, whilerefstill reads.
Expected
An object referenced by any row is never collected, whatever codec stored it.
Suggested fix
Classify by the resolved codec chain, as is_schema_object does. Resolve the attribute's type with resolve_dtype and test for a HashCodec anywhere in the chain.
- Langage dominant
- Python
- Étoiles
- 198
- Forks
- 103
- Merge moyen
- 6 j 1 h
- PR mergées (30 j)
- 10
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de datajoint/datajoint-python
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1703 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1702 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1701 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
datajoint/datajoint-python#1691 ·
Les mainteneurs répondent en général sous 6 jours
-
dependencies needs-discussion
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
datajoint/datajoint-python#1687 ·
Les mainteneurs répondent en général sous 6 jours
Toutes les issues de datajoint/datajoint-python
Issues similaires
-
needs-triage
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
gke-labs/kube-agents#6620 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
open-webui/open-webui#34719 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
cognition
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
One non-object JSON record makes the session catalog exitPeut-être pris @he-yufeng l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
[Suggestion]: Geonode MCP ServerOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
collabnix/awesome-mcp-lists#433 ·
Les mainteneurs répondent en général sous 4 jours