Distributed Transactions Flashcards

1
Q

What is a transaction?

A

Sequence of server operations guarenteed to be completed.

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

How do transactions comply to ACID?

A

Atomicity: Transactions are either completed or aborted.
Consistency: 1 consistent state to another.
Isolation: Transactions happen without interference from other transactions.
Durability: Results of transactions stored in permanent storage.

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

Why must objects be recoverable?

A

If a process crashes during a transactions, a new process can recover the objects from storage and continue the transaction.

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

Why must operations be synchronised?

A

To ensure isolation

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

When can transactions happen concurrently?

A

When concurrent execution has the same effect as serial execution.

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

What is the lost update problem?

A
Transaction T reads the value of x. (suspends)
Transaction U reads the value of x.
Transaction U adds 4 to value of x.
Transaction U commits.
Transaction T adds 5 to old value of x.
Transaction T commits.
Changes made by U are overridden.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the inconsistent retrieval problem?

A
Wrong retrieval of data because a transactipon accesses data before another has finished modifying it.
(T) a.withdraw(100):100
(U) total = a.get(): 100
(U) total += b.get(): 400
(T) b.deposit(100):400
(T) commit
(U) commit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a conflicting operation?

A

A pair of operations that, when executed in different orders, produce different values.
(Read->Write != Write-> Read)

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

What does serial equivalence require?

A

All conflicting operations to be executed in the same order for all processes.

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

What is locking?

A

Using locks to ensure that only one transaction can access data at any one time.

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

What can locking lead to?

A

Deadlock

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

What is optimistic concurrency?

A

Executing both transactions and checking for conflicts before commiting. If conflicts are found, both transactions are aborted.

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

What is timestamp ordering?

A

Using total ordering of transactions based on start.
If object O was last read/written by EARLIER transactions, O can be written to.
If O was last written to by EARLIER transactions, O can be read.

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

How are dirty reads prevented?

A

Delay commit of U until all transactions from which U has observed a value have also committed.

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

How can cascading aborts be prevented?

A

Only allow reads from commited transactions.

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

How are premature writes prevented?

A

Delay writes until other transactions that have affecting values have commited.

17
Q

What is a distributed transaction?

A

Transactions that access objects managed by multiple servers.

18
Q

What is the two-phase commit protocol?

A

Protocol that allows for atomicty of distributed transactions by ensuring all processes have been completed successfully before committing changes.

19
Q

What is phase 1 of the 2PC protocol?

A

Each server votes for the transaction to be commited or aborted.
When a server votes commit, state = PREPARED

20
Q

What is phase 2 of the 2PC protocol?

A

If any server votes to abort, all must abort transaction.

If all servers vote commit, transaction can be committed.

21
Q

What are the timeout situations and solutions for distributed transactions? (3)

A
  1. Server doesn’t receive joint decision: Request decision again (Coordinator may have crashed.)
  2. Server not received abort/commit request: Abort
  3. Coordinator not received votes from all servers: Can decide to abort, inform all servers.