Unit 6 Databases, Serialisability, Transactions and 2 Phase Locking Flashcards
What is a database?
A database is an organised collection of data, and is said to be a form of persistent storage.
What are the (ACID) desirable properties of a transaction?
Atomicity - either all steps occur, or none at all
Consistency - The system remains in a consistent state
Isolation - the transaction cannot reveal any part of its state til the transaction is committed.
Durability - once committed the result will persist.
What are the methods of UserTransaction?
begin(), commit(), rollback()
What are the states of a Transaction?
ACTIVE - initial state and while it is executing
PARTIALLY COMMITTED - the state after the final operation has been executed. It remains here while the system writes information to disk.
COMMITTED - the state after successful completion.
FAILED - when normal exection cannot proceed
ABORTED - following rollback() ie all effects are undone and the database is restored to its original state.
Compare the concept of a transaction with that of a coarse grained atomic action. What are their differences and similarities?
Both are as series of steps that need to be implemented ‘as one’. They give the appearance of indivisibility.
The difference is that a transaction has FAILURE ATOMICITY (if it fails it is as though it never happened in the first place, if it succeeds it is made persistent).
What are the possible next states following PARTIALLY COMMITTED for a transaction?
It can progress to COMMITTED once the write completes and the data is made persistent.
Or if there is a problem it will enter FAILED and then ABORTED.
What does the TP system do?
The TP (Transaction Processing) system manages the correct and efficient execution of transactions.
Serialisability - What is a schedule?
A schedule is a preserved, chronological order of operations.
Serialisibility - What is a serial schedule?
A serial schedule is one where the transactions are executed in strict serial order.
Give the definition of serialisibility.
Serialisability is a schedule for a group of transactions that behaves as though it were executed in serial order. ie the results are the same
Is it a problem if serial schedules do not give the same final results for the data object involved?
No it is not. The main concern is whether the data objects are in a consistent state.
What are conflicting operations?
Operations conflict if the order in which they are executed affects the result (e.g read/write)
How is the notion of conflicting operations used to determine whether a schedule is serialisable?
We need to determine what the conflicting operations are. Then we need to determine the order they are executed by transactions. If the oPrrder is the same then we know the schedule is equivalent to a serial schedule..
Precedence graphs can be used to show conflicting operations of transactions. What would the presence of a cycle in a precedence graph mean?
It would mean the schedule it represents is not serialisable.
Why is it important to make schedules of multiple concurrent transactions serialisable?
To keep the transaction ISOLATION property intact (ACID).