Create and discard an archive database file
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start with morango/sync/archive.py and morango/errors.py, then read the SyncDatabase pattern from #365 and the alias and migration notes in #362. Use the acceptance criteria and router override requirement to guide tests for creation, migration failure cleanup, and discard; done means the full test suite passes and all listed archive behaviors hold.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
Morango can create a new SQLite archive file with only the morango tables, and it can discard that file cleanly. This work is part of milestone M5.
Background & Motivation
The archive is a second Django database. Morango must open it at run time, add the morango tables with the normal migrations, and remove every trace of it after a failure. The work happens in a partial file, and only a completed export gets the final name.
Design: spec. Plan: implementation plan, Task 17.
Description & Expected Outcomes
Archive.create(path) refuses a path that exists. It writes to <path>.partial and replaces a stale partial file. It registers an archive alias with the prefix morango_archive_, and it turns on incremental auto-vacuum before the tables exist. Then it runs the morango migrations on the archive alias and makes sure that every morango table exists.
If a table is missing, a host router blocked the migration. In that case, create raises MorangoArchiveError with a message about the router requirement. Archive.discard() closes the connection, removes the archive alias, and deletes the partial file.
An ArchiveDatabase handle gives the archive alias to other code. Every query through this handle goes to the archive.
Deliverables & Contracts
The change delivers these capabilities:
ARCHIVE_ALIAS_PREFIX, with the value"morango_archive_".ArchiveDatabase, a subclass ofSyncDatabasewith a fixed alias.Archive.create(path)andArchive.discard().- The errors
MorangoArchiveErrorandMorangoArchiveExists.
Acceptance Criteria
-
createon a new path makes<path>.partialwith a table for every morango model. -
PRAGMA auto_vacuumon the new file returns 2 (incremental). -
createon an existing path raisesMorangoArchiveExists. -
createreplaces a stale<path>.partial. - If a router denies morango migrations on the prefix,
createraisesMorangoArchiveError, and no archive alias and no partial file remain. -
discardremoves the partial file and the archive alias, and a seconddiscarddoes nothing. - The full test suite passes.
Technical Pointers & Architecture
- Target Components / Context:
morango/sync/archive.py,morango/errors.py. - Related Patterns:
SyncDatabasefrom #365. The spike in #362 records how alias registration and migrations work on Django 3.2. - Data Model & Schema Considerations: The archive uses the normal morango migrations, so its
django_migrationstable records its schema version. - Resilience & Failure Modes: Every failure after the alias registration must remove the archive alias and the partial file. Errors must propagate. A router that denies migration makes Django skip every table, record the migrations as applied, and raise no error (#362). The table check is what detects it. Django connections are thread-local, so register, use and remove the alias on one thread.
Notes & Tradeoffs
- Dependencies: Blocked by: #362 (spike), #365 (
SyncDatabase), #377 (ArchiveManifest). Blocks: #379, #380, #381, #382. - Testing Requirements: Use
override_settings(DATABASE_ROUTERS=[...])for the router case. - Tradeoffs & Alternatives Considered: The
migratecommand sendspost_migrateto all apps, and the contenttypes app then needs its table in the archive. A direct call to the migration executor prevents this. - Compatibility & Migrations: Kolibri routers must allow morango migrations on aliases with the prefix.
Metadata
- Complexity: Medium
- Target Branch: release-v0.9.x
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.
- Ngôn ngữ chính
- Python
- Star
- 15
- Fork
- 27
- Merge trung bình
- 6 ngày 44 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của learningequality/morango
-
Document disk export and deprecations in the changelogCó thể làm lại được @ArpitaSamanta10 đã nhận 14 ngày trước và không có pull request nào đang mở. Đang mởDEV: dev-ops DEV: distributions DOCS: developer
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/morango#387 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend DEV: dev-ops TAG: unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
learningequality/morango#385 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 54/100
learningequality/morango#425 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 1/100
learningequality/morango#424 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend P2 - normal
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
learningequality/morango#416 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của learningequality/morango
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Có thể đã có người làm @cestercian đã nhận hôm nay. Đang mởcomp/cli P2 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
NousResearch/hermes-agent#162259 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[request] gRpc/1.86.0Đang mởupstream update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
conan-io/conan-center-index#31597 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AOSSIE-Org/PictoPy#1802 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
community-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA-NeMo/Run#727 ·
Maintainer thường phản hồi trong vòng 1 ngày