Sie sind auf Seite 1von 3

Transaction Management Properties of Transaction (ACID): Phantom read: Additional tuples inserted by

another transaction when transaction


Concurrency Control Protocol: Control 1. Atomicity: ‘all or nothing’ Transaction is execute query in other time.
Data Base Access from interfering with one invisible unit. Either perform entirely or not
another. perform. Responsible of recovery subsystem *Schedule: A sequence of operation by a set
of the DBMS to ensure atomicity. of concurrency transaction that preserves the
Database Recovery: Restoring Database order of the operations in each individual
consistent state for back up. DBMS must be 2. Consistency: Transaction must transform transaction.
able to recover from the failure. the Database from one consistent state to
another consistency state. DBMS and * Serial Schedule: A schedule where the
Transaction: Action that reads or upgrades application developer to make sure operations of each transaction are executed
the content of the database. consistency. consecutively without any interleaved
operation from other transaction.
Logical Unit of Work: Transaction is logical 3. Isolation: Transaction execute
units of work on the database. independently of one another. (Incomplete *Non serial schedule: A schedule where the
transaction should not be visible to other operation from a set of concurrent
Database Operation : Ex transaction) transactions are interleaved.
read (SNo=X, sal)
Write(SNo=x,new_sal) 4. Durability: Effects of the successfully Serializability: find non serial schedule.
Delete(SNo=x) completed transaction are permanently
recorded in the database and must not be Serializable: non serial schedule might
Non Database Operation: Ex: Sal=sal*1.1 lost because of the subsequent failure. correct if it produce same result as serial
execution.
Inconsistent State: A property will be Transaction manager: Coordinates
managed by a member of attribute who no transactions on behalf of application *Serializability read write operation:
longer exists in the database. programs and communicate with scheduler. 1. If the 2 transaction only read a date items,
they do not conflict order is not important.
NewStaffNo: End of the transaction, all Scheduler: module that responsible for 2.if 2 transaction reads or write complete
necessary tuples should have new value. implementing a particular strategy for separate data items they do not conflict order
concurrency control. is not important.
*Committed: Transaction outcome if the 3.if one transaction writes a date items and
transaction completed successfully. Lock manager: Lock manager is scheduler other reads or write the same data items
Database reaches new consistent state. if the concurrency control protocol is locking order of execution is not important.
base. Conflict serializability: If the a transaction is a
Aborted: Transaction outcome that if the serial schedule since other two transaction
transaction does not execute successfully.. Recovery Manager: Responsible for storing equal to the first one
Database before the transaction.
* Roll back or undone: If the transaction Constrained written rule: Transaction
unsuccessful Database must be stored to the Buffer Manager: Responsible of transferring update a data items base on its old value.
consistent state. Before the unsuccessful Data between disk storage and main Which is first read
transaction. memory.
Precedence (serialization) graph: Test the
Compensating Transaction: If the *Concurrency Control: Process of conflict serializability
committed transaction was a mistake we managing simultaneous operation on the
must perform Compensation Transaction to Database without having them to interfere *Blind writes: view serializable schedule
reverse its effects. with one another. that is not conflict serializable.

Interleaved: Operation of two transaction are *Recoverable schedule: Schedule where


Begin Transaction
interleaved to achieve concurrent execution each pair of transaction A and B if B reads a
data items previously written by A, then the
Active Throughput: Amount of work that is commit operation of A before the commit
accomplish in a given time. operation of B.

Potential problems cause by Concurrency Control Technique:


concurrency: 1. Locking
Partly FAILED 1.Lost update problem 2. Timestamp
Committed
2.Uncommitted dependency problem
3.inconsistent analysis problem Conservative approach: they cause
Commit transaction to be delay in case they conflict
*1.The Lost Update Problem: Completed with other transaction at the same time in the
Aborted update operation by one user can be future.
Committed
overridden by another user.
*2. The Uncommitted Dependency (or Optimistic Methods: Conflict between
dirty read) Problem: one transaction wants transactions is rare, so they allow transaction
Keyword of Transaction to see intermediate results of another to precede unsynchronized and only check
• Beginning transaction(ACTIVE) transaction before it committed. for conflicts at the ends, when the transaction
• Commit: Prog. Terminate correctly. commits.
• Rollback: Prog. Terminate wrong. * 3. The Inconsistent Analysis Problem:
• Partially Committed: Transaction Occurs when transaction reads values from * Locking: A procedure used to control same
has violated. Abort transaction database BUT second transaction updates time access to data One transaction
some of them during the execution of the list. accessing the database, lock deny access to
• Failed: In the beginning transaction
Nonreadeble (fuzzy) read: Two different other transaction to prevent incorrect result.
failed.
values for the same data items.
**Rigorous 2PL: Released all the lock until **Timestamp: indicates the relative starting
Share=read the end of the transaction. time of the transaction.
exclusive=write. **Timestamping: Order transaction in such
**Strict 2PL: Only holds exclusive lock until a way that older transaction, transaction with
* In locking methods, transaction must the end of the transaction. smaller timestamp get priority in the event of
claim share(read) or exclusive (write) lock on the conflict.
data items before the corresponding Livelock: Transaction can not process any ***Basic Timestamp ordering: Transaction
database reads or write operation new lock even though DBMS is not in executed chorological order of timestamp
deadlock. ** Optimistic Techniques: Allow
* Lock prevents another transaction from transaction to proceed without imposing
modifying the items or read items. **Tree-base index observation(Locking delay to make sure serializability.
Strategy:): **Three Phase for Optimistic Concurrency
** Shared Lock: Transaction can read the 1.The search path stars from the root and Protocol:
data item but not updated. moves down to the leaf but search never 1. Read Phase: transaction reads the
moves back up the tree. Once, lover-level values of all data items it needs from the
** Exclusive Lock: Transaction can read node has been accessed, the higher level database and store them in logical
and update the data item. nodes in that path will not be used again. variable.
2. When a new index value is inserted into a
**Locks are used following way leaf node, than if the nodes is not full, 2. Validation phase: Make sure that
1. Any transaction that needs to access a insertion will not cause change to the higher transaction updates are applied to the
data items must first lock the item, requesting level nodes. database.
a shared lock for read only access or 3. Write Phase: update transaction.
exclusive lock for read and write access. *Lashes: Type of lock shorter than normal. **Granularity: (SIZE) The size of the data
2. If the item is not lock by other transaction, items chosen as the unit of protection by a
the lock will be granted. ***Deadlock: Two or more transaction concurrency control protocol.
3. If the item is currently lock; the DBMS waiting for locks to be released that are held **Granularity refers to large item size:
determines whether the request is by other (Abort one or more transaction to 1. Entire database, 2. A file 3. A page 4. A
compatible with the existing lock. If a shared break deadlock). record 5. A file value or record.
lock is requested on an item that already has **Multi-granularity locking: Reduce
shared lock on it, request will be granted. Techniques for handling DEADLOCK: searching involved in location locks on
Other wise transaction must wait until the 1. Timeout: Transaction requested a descendants, the DBMS use
existing lock is released. lock waits for at most specified period of **Intention lock: New type of lock. When
4. Transaction continues to hold a lock until it time. any node is locked an intention lock is placed
explicitly released it either during execution on all the ancestors of the node.
or when it terminates (aborts or commit). It is 2. ***Dead lock prevention: DBMS looks ***Database Recovery: Restoring to
only when the exclusive lock has been a head to determine if the transaction database to a correct state in the event of a
released that the effects of the write would cause a deadlock and never allow failure.
operation will be made visible to another dead lock to occur. Storage of Data Includes:
transaction. 1. Main Memory 2. Magnetic Disk
***Wait-Die: Allows only older transaction to 3. Magnetic tape 4. optical disk
Upgrade: shared lock  exclusive lock wait for younger one, other wise the ***System Failure:
transaction is aborted (dies). 1. System crashes
Downgrade: exclusive lock  shared lock
2. media failures
**Would-Wait: Only younger transaction can 3. application software error
*2PL(Two Phase Locking): A transaction
wait for an older one. If an older transaction 4. natural physical disaster
follows the two-phase locking protocol if all
request a lock held by a younger one, 5. unintentional distraction
locking operations comes the first unlock
younger one is aborted (wounded). 6. sabotage
operation in the transaction.
**Read operation’s steps:
***Growing Phase: All lock s needed but 3. Deadlock detection & recovery: • Find address of the disk contain record
cannot release any locks. DBMS allows dead lock to occur but with primary key value X
recognize occurrence of dead lock and • Transfer disk block into database buffer
***Shrinking Phase: Released its locks but breaks them. in a main memory.
cannot process any new lock. Wait-for graph: transaction dependency. • Copy salary data from the database
buffer into variable salary.
***2PL Rules are: Important issues when abort transaction from Write Operation’s steps:
1 Transaction must process a lock on an database:
item before operating on the item, The lock ***1. Choice of deadlock victim: abort the • Write the database buffer back to disk.
transactions that incur the minimal cost. Partial Undo: One transaction has undone.
maybe read or write; depend on the type of
• Abort transaction that has just Global undo: All active transaction undone.
access needed.
started. Rather than old one. ***Pinned: If the requested page is pinned in
2. Once the transaction released a lock, it
the database buffer and cannot be written
can never process any new lock. • Abort the transaction that has made
back to the disk. Replacement strategy
little change to the database Rather
cannot choose a buffer that has been pinned
**Upgrading can take place only during the than more change.
***Checkpoint: Point of synchronization
growing phase and may require that • Abort transaction that has many between the database and the transaction
transaction wait until another transaction changes still to make database log file. All buffers are force-written to
released a shared lock on the item. rather than few changes to make. secondary storage.
**Downgrading can take only during *2. How far to roll a transaction back: ***Check points involve the following
shrinking phase. Rolling back only one part of the transaction. operation
1. Write all log records in main memory to
Wait: transaction waits to access data until *3.Avoiding starvation: Same transaction secondary storage.
other transaction released the lock always chosen as the victim. Transaction 2. Writing the modified blocks in the
never complete. database buffer to secondary storage.
Cascading Rollback: Single transaction
leads series of rollback. 3. Writing all check point. To log file. (identi

Das könnte Ihnen auch gefallen