gc: drop jobs tables whose table no longer exists
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 197
- フォーク
- 101
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
datajoint/datajoint-python のほかの issue
-
len() of an expression with an empty primary key generates invalid SQL対応中かも @dimitri-yatsenko が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
datajoint/datajoint-python#1581 ·
メンテナーはふだん 4 日以内に返信
-
dj.Diagram theme: make the font configurable対応中かも @dimitri-yatsenko が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
datajoint/datajoint-python#1539 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
bug
難易度 4/5 1〜2日 初心者へのやさしさ 68/100
datajoint/datajoint-python#1641 ·
メンテナーはふだん 4 日以内に返信
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schema対応中かも @dimitri-yatsenko が 4 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 82/100
datajoint/datajoint-python#1640 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
PostgreSQL: renaming an attribute of a dj.U restriction quotes it with backticks対応中かも @mayuriphad が 4 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
datajoint/datajoint-python#1638 ·
メンテナーはふだん 4 日以内に返信
datajoint/datajoint-python の issue をすべて見る
似ている issue
-
resource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
hesreallyhim/awesome-claude-code#3214 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
doobidoo/mcp-memory-service#1650 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ml-explore/mlx-lm#2002 ·
メンテナーはふだん 2 日以内に返信