SlideServe
Menu
Préférences
© SlideServe · v2026

Logging

merv avatar
9 diapositives · 365 Views · Sep 06, 2014

slides online at http://web.mit.edu/6.033/www/assignments/lec17.[ppt|pdf]. Logging. 6.033 Spring 2010 Lecture 17 Sam Madden. Key concepts: Logging for all-or-nothing atomicity Write ahead logging Checkpoints. Shadow Copy Commit. //in memory copy of DB, some records dirty commit(DB):

Logging - slide 1
01 / 9Logging
1 / 17

Télécharger la présentation

Logging
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. slides online at http://web.mit.edu/6.033/www/assignments/lec17.[ppt|pdf] Logging 6.033 Spring 2010 Lecture 17 Sam Madden Key concepts: Logging for all-or-nothing atomicity Write ahead logging Checkpoints

  2. Shadow Copy Commit //in memory copy of DB, some records dirty commit(DB): copy(DB, DBnew) for each record r in memory: if r is dirty: write r into DBnew rename(DBnew, DB) //commit point! // rename must be atomic!

  3. Read with just a log // log is array of records with (type,TID,var,before,after) read(var, log): cset = { } for r in log[len-1] ... log[0]: if (r.type == commit): cset = cset U r.TID if (r.type == update): if (r.TID in cset and r.var == var): return r.after

  4. Read & write with cell storage read(var): return read(cell-storage, var) write(TID,var,newval): append(log,TID,var,read(var),newval) write(cell-storage,var,newval)

  5. Recover with cell-storage and log recover(log): doneset = { } for each record r in log[len-1] ... log[0]: //UNDO if r.type == commit or r.type == abort doneset = doneset U r.TID if r.type == update and r.TID not in doneset: write(cell-storage, r.var, r.before)

  6. Read with cache & cell-storage read(var): if var in cache: return cache[var] else: val = read(cell-storage, var) add (var,val) to cache // possibly evict other // cached values return val write(var,val): append(log,TID, var, cell-storage(var), newval) add (var,val) to cache

  7. Recover with cell-storage, log, and cache recover(log): doneset = { } for each record r in log[len-1] ... log[0]: //UNDO if r.type == commit or r.type == abort doneset = doneset U r.TID if r.type == update and r.TID not in doneset: write(cell-storage, r.var, r.before) for each record r in log[0]...log[len-1]: //REDO if r.type == update and r.TID in doneset: write(cell-storage, r.var, r.after)

  8. REDO Optimization for each record r in log[0]...log[len-1]: //REDO if r.type == update and r.TID in doneset: if (cell-storage does not reflect r) write(cell-storage, r.var, r.after) Log Sequence Number (LSN) is a unique increasing identifier for log records Cell Storage Page LSN | TID | Op | Before | After LSN Log Record Data Do write only if Page.LSN < Record.LSN On write, update LSN