Week 9 - Transaction Processing and JDBC Flashcards

1
Q

Conflict

A

Occurs when multiple users try to access/modify entries in the DB at the same time.

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

Ways of addressing conflicts

A

Serialisation
Recovery (rollback)
Locking

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

Transaction

A

An action or series of actions carried out by a single user or application program, which reads/updates the contents of a DB.

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

ACID: Atomicity

A

A transaction should be treated as an indivisible unit. It should happen entirely or not happen at all.

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

ACID: Consistency

A

A transaction must transform the DB from one consistent state to another consistent state - only valid data will be written to the DB.

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

ACID: Isolation

A

Transactions should execute independently of each other.
Ensures the result of concurrent transactions is state equivalent to some serial order of execution.

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

ACID: Durability

A

Effects of a successful transaction must be permanently recorded in the DB

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

Which stages of ACID are managed by what?

A

Atomicity&raquo_space;> Transaction Recovery Subsystem
Consistency&raquo_space;> Programmers / DBMS module
Isolation&raquo_space;> Concurrency Control Subsystem
Durability&raquo_space;> Transaction Recovery Subsystem

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

Concurrency

A

The ability to execute multiple operations or transactions out-of-order or in partial order without affecting the outcome.

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

Out of order execution

A

Operations can be performed in any order as long as the final result is consistent

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

Partial order execution

A

Some operations can be executed in parallel without order, while others may need to follow a specific order.

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

Schedule

A

A list of atomic actions performed by one of a number of transactions.

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

Scheduling errors: Lost Update

A

A completed update by one user can be overridden by another user.

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

Scheduling errors: Uncommitted Dependency

A

Also known as “dirty read” (reading uncommitted data).
Reasons for not committing vary (e.g. connection or system problems).
Failure to commit causes a rollback, but other transactions are unaware of the rollback.

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

Scheduling errors: Inconsistent Analysis Problem

A

When a transaction’s analysis is inconsistent due to reading data that is in the middle of being updated by another transaction.

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

Serial Schedule

A

All operations from each transaction are executed consecutively, without operations from different transactions interleaving.

17
Q

Non-serial Schedule

A

Operations from different transactions are interleaved. Interleaving is what causes the three scheduling errors.

18
Q

Conditions for two operations to conflict

A
  • They belong to different transactions
    AND
  • They access the same item
    AND
  • At least one of the operations is a write()
19
Q

Two schedules are conflict-equivalents if?

A
  • They involve the same transactions
  • They have the same set of conflicting operations (whether that is none, or 1, or more)
20
Q

Precedence graph

A

Good for visualizing conflicts between schedules
- Node for each transaction

21
Q

Desirable property of schedules

A

They can be rolled back in their entirety.

22
Q

When is a schedule recoverable?

A

If every transaction commits only after all transactions whose changes they read, commit.

23
Q

ACA Schedule

A

Avoiding Cascading Aborts (ACA)
- A schedule disallowing dirty reads
- Every ACA schedule is recoverable

24
Q

What is a Lock?

A

A solution to conflicts.

Locks prevent several transactions from accessing/changing items while another transaction accesses/changes it.

25
Q

How are locks represented?

A

A variable describing the status of an item.
Information held in a lock table.

26
Q

Deadlock

A

Each transaction in a set of transactions is waiting for an item locked by another transaction in the same set.

27
Q

Binary Lock

A

Two possible states: locked or unlocked
Two operations: lock(x), unlock(x)

Transaction must lock data item before read/write operations.
Transaction must unlock data item after finishing.
No two transactions can access same data item concurrently.

28
Q

Shared/Exclusive Lock

A

Multiple states
Three operations: read_lock(x), write_lock(x), unlock(x)

If a transaction has a shared lock on an item, it can read the item but not update it.
If a transaction has an exclusive lock on it, it can both read and update it.
Some systems allow upgrades to exclusive, and downgrades to shared.

29
Q

Two Phase Locking (2PL)

A

Guarantees serialisability

Every transaction must lock an item before accessing it.
Once a lock has been released, no new items can be locked.

30
Q

Solutions for deadlock: Timeout

A

Timeouts, Deadlock prevention, deadlock detection and recovery

A transaction waits a specified amount of time for a lock. If it isn’t granted, the transaction is aborted.

31
Q

Solutions for deadlock: Deadlock Prevention

A

All data items have to be locked at the beginning of a transaction (conservative 2PL)

Disadvantages:
- Locks are held longer, time consuming to determine whether all required locks are free, waits for all required locks

32
Q

Why do real DB applications in industry need both SQL and a GPPL (general purpose programming language e.g. java, python)

A

SQL for simplicity and efficiency of data manipulation
GPPL for its support of complex computation, complex structures of large programs, GUI and integration with other apps.

33
Q

Why use ODBC? (Open Database Connectivity/Connector)

A
  • Provides unique interface between variety of GPPLs and a given DBMS
  • Multiple programs written in multiple languages can access DBMS through same interface
  • Program can change over time without changing the code for connecting to / accessing the DBMS
  • GUI and database engine can be separated as two different products
34
Q

What are ODBC and JDBC

A

ODBC and JDBC are essentially APIs for accessing DBMSs (usually called drivers)

35
Q

Missing content? Check slides

A