Create and discard an archive database file
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 15
- Forks
- 27
- Ø Merge
- 6 T. 44 Min.
- Gemergte PRs (30 T.)
- 13
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine 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 learningequality/morango
-
Document disk export and deprecations in the changelogEvtl. wieder frei @ArpitaSamanta10 hat das vor 14 Tagen übernommen, und es ist kein Pull Request offen. OffenDEV: dev-ops DEV: distributions DOCS: developer
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/morango#387 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend DEV: dev-ops TAG: unit tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
learningequality/morango#385 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 54/100
learningequality/morango#425 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 1/100
learningequality/morango#424 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend P2 - normal
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
learningequality/morango#416 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in learningequality/morango
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
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"Evtl. vergeben @cestercian hat das heute übernommen. Offencomp/cli P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
NousResearch/hermes-agent#162259 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[request] gRpc/1.86.0Offenupstream update
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
conan-io/conan-center-index#31597 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
AOSSIE-Org/PictoPy#1802 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
community-request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NVIDIA-NeMo/Run#727 ·
Maintainer antworten meist innerhalb von 1 Tag