gc: drop jobs tables whose table no longer exists
Maintainer antworten meist innerhalb von 4 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Start by reading dj.gc and the existing GarbageCollector.collect() implementation to understand how reports and errors are represented. Trace how schema tables identify Computed and Imported tables and how their tier prefixes map to ~~ jobs tables; the issue names no files or tests, so locate the relevant tests before implementation. Done means dry-run reports all orphaned jobs tables without changes, execution drops only those tables, and the acceptance cases pass on MySQL and PostgreSQL.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
A jobs table, ~~<name>, can outlive the auto-populated table it belongs to: #1601 shows it for drop(), and its comments show it for a cascading drop and for a drop through a virtual module. It also happens with tables dropped by an earlier release, by another process, or by hand. A jobs table left behind keeps its records and its primary key, and a table declared later under the same name inherits them (#1601).
Fixing drop() stops new leftovers, but not the ones already in existing schemas. A garbage-collection step would remove those too, whatever path left them, the same way dj.gc already handles orphaned objects in storage.
Proposal
A function in dj.gc, separate from GarbageCollector because jobs tables live in the database and not in a store:
dj.gc.collect_jobs_tables(schema) # report only (dry_run=True by default)
dj.gc.collect_jobs_tables(schema, dry_run=False) # drop the orphans
- For each schema, list the
~~%tables and the Computed and Imported tables. A jobs table is orphaned when no Computed or Imported table has its name, after the tier prefix is stripped (__nameor_namefor~~name). dry_run=Trueis a read-only report;dry_run=Falsedrops the orphaned jobs tables, and nothing else.- Return a report in the style of
GarbageCollector.collect(): the number of jobs tables found, the orphaned ones by full name, the number dropped, and errors.
Out of scope
A jobs table whose table exists but whose primary key no longer matches it, after a table is re-declared under the same name. That is the check in AutoPopulate.jobs that #1601 proposes; a GC step cannot tell a stale jobs table from a current one by name alone.
Acceptance
- With
dry_run=Truenothing changes; the report lists every orphaned jobs table. - With
dry_run=Falseexactly those are dropped. Jobs tables of existing Computed and Imported tables are kept, along with their records. - After
Stage1.drop()cascades toStage2(the reproduction in #1601's comments), both~~stage1and~~stage2are reported and dropped. - Works on MySQL and on PostgreSQL.
- Vorherrschende Sprache
- Python
- Sterne
- 197
- Forks
- 101
- Ø Merge
- 3 T. 8 Std.
- Gemergte PRs (30 T.)
- 28
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus datajoint/datajoint-python
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
datajoint/datajoint-python#1646 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
len() of an expression with an empty primary key generates invalid SQLEvtl. vergeben @dimitri-yatsenko hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
datajoint/datajoint-python#1581 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
dj.Diagram theme: make the font configurableEvtl. vergeben @dimitri-yatsenko hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
datajoint/datajoint-python#1539 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 4 Tagen
-
bug
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 68/100
datajoint/datajoint-python#1641 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaEvtl. vergeben @dimitri-yatsenko hat das vor 8 Tagen übernommen. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 82/100
datajoint/datajoint-python#1640 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 4 Tagen
Alle Issues in datajoint/datajoint-python
Ähnliche Issues
-
link-rot
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 67/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
developmentseed/titiler-cmr#265 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Insecure Brotli version <1.2.1Evtl. vergeben @jamescw19 hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
stac-utils/stac-fastapi-pgstac#438 · 1 Reaktion ·
-
bug triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag