Logging Flashcards

1
Q

Logging

A

Writes down important things that happens during transactions, like states etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Logging with system failure

A

Logging should work even if the system fails, but sometimes logging is not enough.
Therefore we rely on undo logging, redo logging and combinations of both.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Operations for Log Manager

A
  • writing x just writes to the buffer
  • output(x) -> copy database item x from buffer to the database itself
  • flush_log -> write log entries that are residing in main memory to the log
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Undo Logging

A

Undo logging logs activities with the goal of restoring a previous database state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Log Records for Undo Loggging

A
  • <START>
    </START>
  • <COMMIT>
    </COMMIT>
  • <ABORT>
    </ABORT>
  • <T, X , v>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

<START>
</START>

A

Transaction t has started.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

<COMMIT>
</COMMIT>

A

Transaction t has committed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

<ABORT>
</ABORT>

A

Transaction t was aborted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

<T, X, v>

A

Transaction t has updated value of database item x, with the old value being v.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Rules for Undo Logging

A
  • If transaction t updates item x and old value was v, then T, X, v must be written to the log on disk before x is written to disk.
  • If transaction t commits, commit t must be written as soon as all database elements changed by t have been written to disk.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

System Failure with no commits

A

If the system fails and we have not committed (and if there is no abort for the specific transaction, which means it would have already been reverted), we have to undo all changes done, with each v replacing x which was recorded on the logs. If it has committed, then no changes are required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Recovery Manager

A

The recovery manager restores the last consistent database state in an error occurs, traversing the undo log backwards.
Once all undone, we write abort t for each uncommitted transaction t that was not previously aborted (when traversing back through the undo log, if we also have an aborted transaction, we do not have to write up that transaction again) and call flush_log.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Redo Logging

A

Logs activities with the goal of restoring committed transactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Log Records for Redo Logging

A

Only one record has changed:

<T, X , v> -> transaction t has updated value of database item x, with the NEW value being v.
Essentially, we intend to get a value which has been committed, not undoing a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Rules for Redo Logging

A

Rules:
- T first writes all log records for all updates
- T writes commit t to the log on disk
- T writes all committed updates to disk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Main Objective of Redo Logging

A

The main point of redo logging is to do the reverse of undo logging.

17
Q

Combining Redo and Undo Logging

A

<T, X, v, w> -> v is the old value, w is the new value.

18
Q

Undo without Redo

A
  • ensures atomicity
  • can ensure durability with Force (forces writing of updates to disk before committing)
19
Q

Redo without Undo

A
  • ensures durability
  • can ensure atomicity using No Steal (uncommitted data may not overwrite committed data on disk)
20
Q

ACID Logging

A

Can ensure durability and atomicity without logs but instead with No Steal and Force, but is overall very expensive.

21
Q

No Steal

A

Don’t allow buffer-pool frames with
uncommitted updates to overwrite committed data on disk.

22
Q

Force

A

Make sure that every update is on disk before committing.