Create and discard an archive database file
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 15
- Forks
- 27
- Merge medio
- 6 d 44 min
- PR fusionados (30 d)
- 13
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de learningequality/morango
-
Document disk export and deprecations in the changelogQuizá libre de nuevo @ArpitaSamanta10 la tomó hace 14 días y no hay ningún pull request abierto. AbiertoDEV: dev-ops DEV: distributions DOCS: developer
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
learningequality/morango#387 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
DEV: backend DEV: dev-ops TAG: unit tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
learningequality/morango#385 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 54/100
learningequality/morango#425 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 1/100
learningequality/morango#424 ·
Los mantenedores suelen responder en 1 día
-
DEV: backend P2 - normal
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
learningequality/morango#416 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de learningequality/morango
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
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"Posiblemente ocupada @cestercian la tomó hoy. Abiertocomp/cli P2 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NousResearch/hermes-agent#162259 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[request] gRpc/1.86.0Abiertoupstream update
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
conan-io/conan-center-index#31597 ·
Los mantenedores suelen responder en 1 día
-
bug enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
AOSSIE-Org/PictoPy#1802 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
community-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NVIDIA-NeMo/Run#727 ·
Los mantenedores suelen responder en 1 día