2020-04-08

Apr 8 In-Class Exercise Thread .

Post your solutions to the Apr 8 In-Class Exercise to this thread.

Best,

Chris

Post your solutions to the Apr 8 In-Class Exercise to this thread. Best, Chris

-- Apr 8 In-Class Exercise Thread

not done yet <T1, X , 6, 8>

  • X not in disk

<C0MMIT T1> <FLUSH LOG> <START DUMP> <START CKPT (T2)> <T2, Y, 10, 5 > <END CKPT> -X->archive -Y->archive <END DUMP>

(Edited: 2020-04-08)
not done yet <T1, X , 6, 8> - X not in disk <C0MMIT T1> <FLUSH LOG> <START DUMP> <START CKPT (T2)> <T2, Y, 10, 5 > <END CKPT> -X->archive -Y->archive <END DUMP>

-- Apr 8 In-Class Exercise Thread

maybe this?

&lt;T1, X, 6, 8&gt; &lt;COMMIT (T1)&gt; &lt;FLUSH LOG&gt; &lt;START DUMP&gt; &lt;START CHECKPOINT (T2)&gt; &lt;T2, Y, 10, 5&gt; &lt;COMMIT (T2)&gt; &lt;FLUSH LOG&gt;

  • db copies X=8 to disk
  • db copies Y=5 to disk

&lt;END CHECKPOINT&gt;

  • X=8 is copied to archive
  • Y=5 is copied to archive

&lt;END DUMP&gt;

  • copy over log records from the &lt;START DUMP&gt; to the &lt;END DUMP&gt; to the archive
  • old logs in archive before the &lt;START CHECKPOINT&gt; are thrown away
(Edited: 2020-04-08)
maybe this? <T1, X, 6, 8> <COMMIT (T1)> <FLUSH LOG> <START DUMP> <START CHECKPOINT (T2)> <T2, Y, 10, 5> <COMMIT (T2)> <FLUSH LOG> - db copies X=8 to disk - db copies Y=5 to disk <END CHECKPOINT> - X=8 is copied to archive - Y=5 is copied to archive <END DUMP> - copy over log records from the <START DUMP> to the <END DUMP> to the archive - old logs in archive before the <START CHECKPOINT> are thrown away

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt; &lt;T1, Commit&gt; &lt;T2, Y, 10, 5&gt; On disk: X = 6, Y = 10 &lt;Start Dump&gt; &lt;Start Checkpoint (T2)&gt; Dirty buffers written to disk On disk: X = 8, Y = 5 &lt;End Checkpoint (T2)&gt; database copies X as 8 database copies Y as 5 &lt;End Dump&gt;

in archive X = 8, Y = 5 log file before &lt;Start T2&gt; thrown out

(Edited: 2020-04-08)
<T1, X, 6, 8> <T1, Commit> <T2, Y, 10, 5> *On disk: X = 6, Y = 10* <Start Dump> <Start Checkpoint (T2)> *Dirty buffers written to disk* *On disk: X = 8, Y = 5* <End Checkpoint (T2)> *database copies X as 8* *database copies Y as 5* <End Dump> *in archive X = 8, Y = 5* *log file before <Start T2> thrown out*

-- Apr 8 In-Class Exercise Thread

&lt;T1, X,6,8&gt; &lt;Commit T1&gt; Memory X=8, Y=10 &lt;T2, Y, 10, 5&gt; &lt;START DUMP&gt; &lt;START CKPT&gt; write to disk, disk x = 6, disk y = 10 Memory Y = 5, X = 8 Disk x = 6, y = 10 &lt;END CKPT&gt; Archive Memory X = 8, Y= 10

&lt;FLUSH LOG&gt; &lt;END DUMP&gt;

(Edited: 2020-04-08)
<T1, X,6,8> <Commit T1> Memory X=8, Y=10 <T2, Y, 10, 5> <START DUMP> <START CKPT> write to disk, disk x = 6, disk y = 10 Memory Y = 5, X = 8 Disk x = 6, y = 10 <END CKPT> Archive Memory X = 8, Y= 10 <FLUSH LOG> <END DUMP>

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt;

&lt;COMMIT T1&gt;

The new value of X is not on disk

X=8 is in memory

&lt;T2, Y, 10, 5&gt;

&lt;START DUMP&gt;

&lt;START CHECKPOINT T2&gt;

T2 is not on disk or memory

&lt;FLUSH LOG&gt;

T1 is stored on disk as X=8

T2 could be in a dirty block so it might be in disk

&lt;END CHECKPOINT T2&gt;

X=8 &amp; Y=5 are moved to the archive

&lt;END DUMP&gt;

Logs from start checkpoint until end dump are preserved in the archive

(Edited: 2020-04-08)
<T1, X, 6, 8> <COMMIT T1> The new value of X is not on disk X=8 is in memory <T2, Y, 10, 5> <START DUMP> <START CHECKPOINT T2> T2 is not on disk or memory <FLUSH LOG> T1 is stored on disk as X=8 T2 could be in a dirty block so it might be in disk <END CHECKPOINT T2> X=8 & Y=5 are moved to the archive <END DUMP> Logs from start checkpoint until end dump are preserved in the archive

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt;

&lt;COMMIT T1&gt;

X = 8 in memory, X = 6 on disk still

&lt;FLUSH LOGS&gt;

&lt;START DUMP&gt;

&lt;START CKPT T2&gt;

&lt;T2, Y, 10, 5&gt;

&lt;FLUSH LOGS&gt;

&lt;END CKPT T2&gt;

&lt;END DUMP&gt;

T2 not committed so we lost it

(Edited: 2020-04-08)
<T1, X, 6, 8> <COMMIT T1> X = 8 in memory, X = 6 on disk still <FLUSH LOGS> <START DUMP> <START CKPT T2> <T2, Y, 10, 5> <FLUSH LOGS> <END CKPT T2> <END DUMP> T2 not committed so we lost it

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt;

&lt;COMMIT T1&gt;

&lt;START DUMP&gt;

&lt;T2, Y, 10, 5&gt;

&lt;FLUSH LOG&gt;

&lt;START CKPT (T2)&gt;

&lt;COMMIT T2&gt;

&lt;FLUSH LOG&gt;

&lt;END CKPT&gt;

  • X=8 is in memory and never on disk
  • Y=5 is in memory and never on disk
  • Archive &lt;T1, X, 6, 8&gt;
  • Archive &lt;T2, Y, 10, 5&gt;

&lt;END DUMP&gt;

<T1, X, 6, 8> <COMMIT T1> <START DUMP> <T2, Y, 10, 5> <FLUSH LOG> <START CKPT (T2)> <COMMIT T2> <FLUSH LOG> <END CKPT> - X=8 is in memory and never on disk - Y=5 is in memory and never on disk - Archive <T1, X, 6, 8> - Archive <T2, Y, 10, 5> <END DUMP>

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt; &lt;COMMIT (T1)&gt; -X=8 in memory, X=6 on disk &lt;FLUSH LOG&gt; &lt;T2, Y, 10, 5&gt; &lt;START DUMP&gt; &lt;START CHECKPOINT(T2)&gt; &lt;COMMIT (T2)&gt; &lt;FLUSH LOG&gt; &lt;END CHECKPOINT&gt; -X=8 and Y=5 copied to archive &lt;END DUMP&gt; -old log records are dumped but logs between start checkpoint and end dump are preserved in the archive

<T1, X, 6, 8> <COMMIT (T1)> -X=8 in memory, X=6 on disk <FLUSH LOG> <T2, Y, 10, 5> <START DUMP> <START CHECKPOINT(T2)> <COMMIT (T2)> <FLUSH LOG> <END CHECKPOINT> -X=8 and Y=5 copied to archive <END DUMP> -old log records are dumped but logs between start checkpoint and end dump are preserved in the archive

-- Apr 8 In-Class Exercise Thread

&lt;T1, X, 6, 8&gt; &lt;COMMIT T1&gt; new value of X is not on disk X=8 is in memory &lt;FLUSH LOG&gt; &lt;START DUMP&gt; &lt;START CHECKPOINT T2&gt; &lt;T2, Y, 10, 5&gt; &lt;COMMIT (T2)&gt; &lt;FLUSH LOG&gt; copy value of X, Y to the archive &lt;END CHECKPOINT T2&gt; &lt;END DUMP&gt;

<T1, X, 6, 8> <COMMIT T1> new value of X is not on disk X=8 is in memory <FLUSH LOG> <START DUMP> <START CHECKPOINT T2> <T2, Y, 10, 5> <COMMIT (T2)> <FLUSH LOG> copy value of X, Y to the archive <END CHECKPOINT T2> <END DUMP>
[ Next ]
X