DB: roll back failed transactions and lower the diff size cap

Aperta Adatta ai principianti
#14 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
sqlite, typescript
Ambito
backend, databases

Direzione di ricerca

Inizia in src/lib/server/db.ts nei punti deletePostRows, removeFromEditing e recordPublished, oltre che nel punto esistente di ROLLBACK, e verifica come ciascuno racchiude BEGIN e COMMIT. Aggiungi un helper transaction(fn) che esegua il rollback e rilanci l’errore, quindi usalo in quei punti. Separatamente, riduci maxDiffLines in src/lib/segment-diff.ts da 4000 a 1500. Il lavoro è completato quando src/lib/server/db.check.ts mostra che una scrittura fallita a metà transazione non lascia righe modificate e che la scrittura successiva riesce, e src/lib/segment-diff.check.ts mostra che un input troppo grande restituisce null.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

Three functions in src/lib/server/db.ts open a transaction with BEGIN and COMMIT but no rollback when the body throws: deletePostRows, removeFromEditing and recordPublished. An exception leaves the connection inside an open transaction.

Scope

  • One helper transaction(fn) that runs BEGIN, calls fn, then COMMIT, and ROLLBACKs and rethrows on error. Use it in all three places (and the existing ROLLBACK site).
  • Also lower maxDiffLines in src/lib/segment-diff.ts from 4000 to 1500: the LCS table at 4000 lines allocates about 64 MB.

Acceptance criteria

  • A check in src/lib/server/db.check.ts forces an error mid-transaction and asserts that no rows changed and the next write succeeds.
  • A check in src/lib/segment-diff.check.ts asserts the new cap returns null for an oversized input.

Estimate: about 2 hours.

Lingua principale
HTML
Stelle
0
Fork
0
Merge medio
1m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mrgnw/cfcms

Tutte le issue di mrgnw/cfcms

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.