SlideShare une entreprise Scribd logo
1  sur  48
Presented by :
1.Haithm adam
2.Mostafa hassan
3.Mohamed siddig
4.Mohamed zein elabdeen
5.Omer salih
Outlines:
 importance of transactions.
 Properties of transactions.
 Concurrency Control
 Recovery Control
 Alternative models for long duration transactions.
Transaction:
        Action, or series of actions, carried out by user or
    ` application, which reads or updates contents of database.
     Application program is series of transactions with non-
      database processing in between.
     Transforms database from one consistent state to another,
      although consistency may be violated during transaction.




3
•   have one of two outcomes:
        – Success - transaction commits and database reaches a new
          consistent state.
        – Failure - transaction aborts, and database must be restored
          to consistent state before it started.
        – Such a transaction is rolled back or undone.
    •   Committed transaction cannot be aborted.
    •   Aborted transaction that is rolled back can be
        restarted later.



4
Four basic (ACID) properties of a transaction are:

Atomicity : „All or nothing‟ property.
Consistency: Must transform database from one consistent
state to another.
Isolation :      Partial effects of incomplete transactions should
not be visible to other transactions.
Durability: Effects of a committed transaction are
permanent and must not be lost because of later failure.




5
Concurrency Control

Process of managing simultaneous operations on the
database without having them interfere with one another.
Prevents interference when two or more users are
accessing databases simultaneously and at least one is
updating data
 for Concurrency
Need Concurrency control

Three examples of potential problems caused by
concurrency:

      Lost update problem.
      Uncommitted dependency problem.
      Inconsistent analysis problem.
Lost Update Problem
       Successfully completed update is overridden by another
user
    T1 withdrawing £10 from an account with balx, initially
£100.
T2 depositing £100 into same account.
Serially, final balance would be £190.
Inconsistent Analysis Problem

    Sometimes referred to as dirty read or unrepeatable
Occurs when transaction reads several values but second
transaction updates some of them during execution of first.
read.
T6 is totaling balances of account x (£100), account y (£50),
and account z (£25).
Serial Schedule

Schedule where operations of each transaction are executed
consecutively without any interleaved operations from other
transactions.
Precedence Graph
Create:
    node for each transaction;
    a directed edge Ti  Tj, if Tj reads the value of an item
    written by TI;
    a directed edge Ti  Tj, if Tj writes a value into an item
    after it has been read by Ti.
If precedence graph contains cycle schedule is not conflict
serializable.
Concurrency Control Techniques:
Two basic concurrency control techniques:
        Locking,
        Timestamping.
Both are conservative approaches: delay transactions in
case they conflict with other transactions.
Optimistic methods assume conflict is rare and only check
for conflicts at commit.
   Locking
   Deadlock
   Transaction uses locks to deny access to other
    transactions and so prevent incorrect updates.
   Generally, a transaction must claim a shared (read) or
    exclusive (write) lock on a data item before read or
    write.
   Normal locking guarantees mutual exclusion but does
    not guarantee serializability.
   Transaction follows 2PL protocol if all locking
    operations precede first unlock operation in the
    transaction.
   Two phases for transaction:
    ◦ Growing phase - acquires all locks but cannot release any
      locks.
    ◦ Shrinking phase - releases locks but cannot acquire any new
      locks.
   A situation when two (or more) transactions
    are each waiting for locks held by the other to
    be released.
   Three general techniques for handling
    deadlock:
    ◦ Timeouts.
    ◦ Deadlock prevention.
    ◦ Deadlock detection and recovery
   locking methods generally prevent conflicts by making
    transaction wait , if a transaction need an item that is already
    locked, it may be wait until the item is released .
   With Timestamping the Transactions ordered globally so that
    older transactions, transactions with smaller timestamps, get
    priority in the event of conflict.
   Conflict is resolved by rolling back and restarting
    transaction.
   No locks there no deadlock.
Timestamp:
      A unique identifier created by DBMS that indicates
      relative starting time of a transaction.
   Can be generated by using system clock at time transaction
    started, or by incrementing a logical counter every time a
    new transaction starts.
   Read/write proceeds only if last update on that data item was
    carried out by an older transaction.
   Otherwise, transaction requesting read/write is restarted and
    given a new timestamp.
   Also timestamps for data items:
    ◦ read-timestamp - timestamp of last transaction to read item;
    ◦ write-timestamp - timestamp of last transaction to write
      item.
  Consider a transaction T with timestamp ts(T):
ts(T) < write_timestamp(x)

   ◦ x already updated by younger (later) transaction.
   ◦ Transaction must be aborted and restarted with a new
     timestamp.
ts(T) < read_timestamp(x)

    ◦ x already read by younger transaction.
    ◦ Roll back transaction and restart it using a later timestamp.
ts(T) < write_timestamp(x)

    ◦ x already written by younger transaction.
    ◦ Write can safely be ignored .

   Otherwise, operation is accepted and executed.
   Versioning of data can be used to increase concurrency.
   Basic timestamp ordering protocol assumes only one version
    of data item exists, and so only one transaction can access data
    item at a time.
   Can allow multiple transactions to read and write different
    versions of same data item, and ensure each transaction sees
    consistent set of versions for all data items it accesses.
   Three phases:
    ◦ Read
    ◦ Validation
    ◦ Write
   Transactions should be durable, but we cannot
    prevent all sorts of failures:
    ◦   System crashes
    ◦   Power failures
    ◦   Disk crashes
    ◦   User mistakes
    ◦   Sabotage
    ◦   Natural disasters
   Recovery manager responsible for atomicity
    and durability.
   If failure occurs between commit and
    database buffers being flushed to secondary
    storage then, to ensure durability, recovery
    manager has to redo (rollforward)
    transaction’s updates.
   If transaction had not committed at failure
    time, recovery manager has to undo (rollback)
    any effects of that transaction for atomicity
   Backup mechanism
   Logging
    ◦ Transaction records.
    ◦ Checkpoint records.
   Checkpoint
   Recovery manager
   Three main recovery techniques:
    ◦ Deferred Update
    ◦ Immediate Update
    ◦ Shadow Paging
    It is a protocol that coordinates all the
    processes that participate in a distributed
    transaction on whether to commit or abort
    (roll back) the transaction.
   has two types of nodes:
    ◦   coordinator.
    ◦   subordinate.
Has two phases:
The first phase :
  is a PREPARE phase, where by the
 coordinator of the transaction sends a
 PREPARE message.
The second phase:
  is decision-making phase, where the
 coordinator issues a COMMIT message,
 or an ABORT message .
   carried out with one of the following
    Methods:
    ◦ Centralized .
    ◦ Linear.
    ◦ Distributed.
   communication is done through the
    coordinator’s process only .
   no communication between subordinates.
   The coordinator transmit the PREPARE
    message to the subordinates
   The coordinator receive votes from all
    subordinates.
   the coordinator either abort or COMMIT .
   coordinator issues a PREPARE message to
    all the subordinates
   if a subordinate is willing to COMMIT, sends
    a YES VOTE .
   if that subordinate is not willing to
    COMMIT, sends a NO VOTE.
   If all the subordinate vote to COMMIT, the
    coordinator has to reach a global COMMIT
    decision.
   the NO VOTE acts like a veto , only one NO
    VOTE is needed to abort the transaction .
   After the coordinator reaches a vote, it has
    to relay that vote to the subordinates.
   If the decision is COMMIT , the coordinator
    sends a message to all the subordinates
    informing them of the COMMIT.
   subordinates send an acknowledge (ACK )
    Message to the coordinator.
   When the coordinator receives the ACK
    messages, it ends the transaction .
   If the coordinator reaches an ABORT decision
    , it sends an ABORT message to all the
    subordinates.
   Noneed to send an ABORT message to the
    subordinate(s) that gave a NO VOTE
   subordinates can communicate with each
    other.
   The sites are labeled 1 to N, where the
    coordinator is numbered as site 1 .
   the propagation of the PREPARE message is
    done serially.
    node N is the one that issues the Global
    COMMIT
   The coordinator sends a PREPARE message
    to subordinate 2 .
   If subordinate 2 willing to ABORT,
     then it sends a VOTE ABORT to
    subordinate3 and the transaction is
    aborted at this point.
   in case of COMMIT , subordinate 2 sends
    its vote till node N is reached and issues its
    vote.
   Node N sends either a GLOBAL ABORT or a
    GLOBAL COMMIT to node N-1 .
   until the final vote to commit or abort
    reaches the coordinator node.
   all the nodes communicate with each other.
    each node must have a list of all the
    participating nodes .
   coordinator sends a PREPARE message to all
    the participating nodes.
 When each subordinate gets the PREPARE
  message, it sends its vote to all the other
  subordinates.
 each node maintains a complete list of the
  subordinates in every transaction.
 When a node receives all the votes from all
  the subordinates, it can decide directly
  COMMIT or abort.
   Look at five advanced transaction models:
    ◦   Nested Transaction Model
    ◦   Sagas
    ◦   Multi-level Transaction Model
    ◦   Dynamic Restructuring
    ◦   Workflow Models
   Transaction is viewed as a collection of related subtasks or
    subtransactions each of which may also contain any number
    of subtransactions.
“A sequence of (flat) transactions that can be interleaved with
    other transactions”.
   Saga has only one level of nesting .
  Closed nested transaction :
atomicity enforced at the top-level.
 Open nested transactions :

 allow partial results of subtransactions to be seen outside
   transaction.
   split-transaction - splits transaction into two serializable
    transactions and divides its actions and resources between
    new transactions.
   join-transaction - performs reverse operation, merging
    ongoing work of two or more independent transactions, as
    though they had always been single transaction.
   Workflow is activity involving coordinated execution of
    multiple tasks performed by different processing entities
    (people or software systems).
   Two general problems involved in workflow systems:
    ◦ specification of the workflow.
    ◦ execution of the workflow.
   Database system, thomas connolly
   http://en.wikipedia.org/wiki/Database_transa
    ction

Contenu connexe

Tendances

Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocols
Mayank Jain
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
AbDul ThaYyal
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)
Sri Prasanna
 
4. concurrency control
4. concurrency control4. concurrency control
4. concurrency control
AbDul ThaYyal
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency Control
Damian T. Gordon
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
Anand Grewal
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
kansel85
 

Tendances (20)

Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocols
 
Agreement protocol
Agreement protocolAgreement protocol
Agreement protocol
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 
4. concurrency control
4. concurrency control4. concurrency control
4. concurrency control
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency Control
 
Fault tolerance-omer-rana
Fault tolerance-omer-ranaFault tolerance-omer-rana
Fault tolerance-omer-rana
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
Concurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance TransactionConcurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance Transaction
 
OSCh17
OSCh17OSCh17
OSCh17
 
9 fault-tolerance
9 fault-tolerance9 fault-tolerance
9 fault-tolerance
 
Unit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and ReplicationUnit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and Replication
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
Trafodion Distributed Transaction Management
Trafodion Distributed Transaction ManagementTrafodion Distributed Transaction Management
Trafodion Distributed Transaction Management
 
Concurrent transactions
Concurrent transactionsConcurrent transactions
Concurrent transactions
 

En vedette

Cơ Sở Dữ Liệu Phân Tán
Cơ Sở Dữ Liệu Phân TánCơ Sở Dữ Liệu Phân Tán
Cơ Sở Dữ Liệu Phân Tán
Yến Lê
 
Yetam Powerpoint
Yetam PowerpointYetam Powerpoint
Yetam Powerpoint
SANGONeT
 
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقياالآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
Mohamed Zeinelabdeen Abdelgader Farh jber
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS
koolkampus
 

En vedette (11)

Career ppt
Career pptCareer ppt
Career ppt
 
Cơ Sở Dữ Liệu Phân Tán
Cơ Sở Dữ Liệu Phân TánCơ Sở Dữ Liệu Phân Tán
Cơ Sở Dữ Liệu Phân Tán
 
Yetam Powerpoint
Yetam PowerpointYetam Powerpoint
Yetam Powerpoint
 
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقياالآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
الآثار الأخلاقية المترتبة على الملكية الفكرية في أفريقيا
 
Workflow management
Workflow managementWorkflow management
Workflow management
 
Embedded systems1
Embedded systems1Embedded systems1
Embedded systems1
 
A
AA
A
 
Workflow Management Systems Comparison Study
 Workflow Management Systems Comparison Study Workflow Management Systems Comparison Study
Workflow Management Systems Comparison Study
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS
 
Comparison of the workflow management systems bizagi, process maker, and joget
Comparison of the workflow management systems bizagi, process maker, and jogetComparison of the workflow management systems bizagi, process maker, and joget
Comparison of the workflow management systems bizagi, process maker, and joget
 
Workflow Management Solutions
Workflow Management SolutionsWorkflow Management Solutions
Workflow Management Solutions
 

Similaire à Transaction management transparencies

Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
C.U
 
Databases: Locking Methods
Databases: Locking MethodsDatabases: Locking Methods
Databases: Locking Methods
Damian T. Gordon
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
sumit_study
 
3 phases in transactions 3 units
3 phases in transactions 3 units3 phases in transactions 3 units
3 phases in transactions 3 units
avniS
 

Similaire à Transaction management transparencies (20)

Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
UNIT IV DIS.pptx
UNIT IV DIS.pptxUNIT IV DIS.pptx
UNIT IV DIS.pptx
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed Coordination
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
 
Transaction management
Transaction managementTransaction management
Transaction management
 
dos.ppt.pptx
dos.ppt.pptxdos.ppt.pptx
dos.ppt.pptx
 
Databases: Locking Methods
Databases: Locking MethodsDatabases: Locking Methods
Databases: Locking Methods
 
Transaction
TransactionTransaction
Transaction
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
 
Management of Distributed Transactions
Management of Distributed TransactionsManagement of Distributed Transactions
Management of Distributed Transactions
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
12EASApril-3412
12EASApril-341212EASApril-3412
12EASApril-3412
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
 
3 phases in transactions 3 units
3 phases in transactions 3 units3 phases in transactions 3 units
3 phases in transactions 3 units
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
 
Recovery in Multi database Systems
Recovery in Multi database SystemsRecovery in Multi database Systems
Recovery in Multi database Systems
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPT
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
 

Plus de Mohamed Zeinelabdeen Abdelgader Farh jber

Plus de Mohamed Zeinelabdeen Abdelgader Farh jber (9)

موزع البريد الرقمي
موزع البريد الرقمي موزع البريد الرقمي
موزع البريد الرقمي
 
Comparison of the workflow management systems bizagi, process maker, and joget
Comparison of the workflow management systems bizagi, process maker, and jogetComparison of the workflow management systems bizagi, process maker, and joget
Comparison of the workflow management systems bizagi, process maker, and joget
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Black & White Box testing
 
Transaction management for a main memory database
Transaction management for a main memory databaseTransaction management for a main memory database
Transaction management for a main memory database
 
B trees
B treesB trees
B trees
 
Web servers
Web serversWeb servers
Web servers
 
Requirements engineering
Requirements engineeringRequirements engineering
Requirements engineering
 
Online Msc Application Workflow Management System
Online Msc Application Workflow Management SystemOnline Msc Application Workflow Management System
Online Msc Application Workflow Management System
 
DISTRIBUTED DATABASE
DISTRIBUTED DATABASEDISTRIBUTED DATABASE
DISTRIBUTED DATABASE
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Transaction management transparencies

  • 1. Presented by : 1.Haithm adam 2.Mostafa hassan 3.Mohamed siddig 4.Mohamed zein elabdeen 5.Omer salih
  • 2. Outlines:  importance of transactions.  Properties of transactions.  Concurrency Control  Recovery Control  Alternative models for long duration transactions.
  • 3. Transaction: Action, or series of actions, carried out by user or ` application, which reads or updates contents of database.  Application program is series of transactions with non- database processing in between.  Transforms database from one consistent state to another, although consistency may be violated during transaction. 3
  • 4. have one of two outcomes: – Success - transaction commits and database reaches a new consistent state. – Failure - transaction aborts, and database must be restored to consistent state before it started. – Such a transaction is rolled back or undone. • Committed transaction cannot be aborted. • Aborted transaction that is rolled back can be restarted later. 4
  • 5. Four basic (ACID) properties of a transaction are: Atomicity : „All or nothing‟ property. Consistency: Must transform database from one consistent state to another. Isolation : Partial effects of incomplete transactions should not be visible to other transactions. Durability: Effects of a committed transaction are permanent and must not be lost because of later failure. 5
  • 6. Concurrency Control Process of managing simultaneous operations on the database without having them interfere with one another. Prevents interference when two or more users are accessing databases simultaneously and at least one is updating data for Concurrency Need Concurrency control Three examples of potential problems caused by concurrency: Lost update problem. Uncommitted dependency problem. Inconsistent analysis problem.
  • 7. Lost Update Problem Successfully completed update is overridden by another user T1 withdrawing £10 from an account with balx, initially £100. T2 depositing £100 into same account. Serially, final balance would be £190. Inconsistent Analysis Problem Sometimes referred to as dirty read or unrepeatable Occurs when transaction reads several values but second transaction updates some of them during execution of first. read. T6 is totaling balances of account x (£100), account y (£50), and account z (£25).
  • 8. Serial Schedule Schedule where operations of each transaction are executed consecutively without any interleaved operations from other transactions. Precedence Graph
  • 9. Create: node for each transaction; a directed edge Ti  Tj, if Tj reads the value of an item written by TI; a directed edge Ti  Tj, if Tj writes a value into an item after it has been read by Ti. If precedence graph contains cycle schedule is not conflict serializable.
  • 10. Concurrency Control Techniques: Two basic concurrency control techniques: Locking, Timestamping. Both are conservative approaches: delay transactions in case they conflict with other transactions. Optimistic methods assume conflict is rare and only check for conflicts at commit.
  • 11. Locking  Deadlock
  • 12. Transaction uses locks to deny access to other transactions and so prevent incorrect updates.  Generally, a transaction must claim a shared (read) or exclusive (write) lock on a data item before read or write.  Normal locking guarantees mutual exclusion but does not guarantee serializability.
  • 13. Transaction follows 2PL protocol if all locking operations precede first unlock operation in the transaction.  Two phases for transaction: ◦ Growing phase - acquires all locks but cannot release any locks. ◦ Shrinking phase - releases locks but cannot acquire any new locks.
  • 14. A situation when two (or more) transactions are each waiting for locks held by the other to be released.  Three general techniques for handling deadlock: ◦ Timeouts. ◦ Deadlock prevention. ◦ Deadlock detection and recovery
  • 15. locking methods generally prevent conflicts by making transaction wait , if a transaction need an item that is already locked, it may be wait until the item is released .  With Timestamping the Transactions ordered globally so that older transactions, transactions with smaller timestamps, get priority in the event of conflict.  Conflict is resolved by rolling back and restarting transaction.  No locks there no deadlock.
  • 16. Timestamp: A unique identifier created by DBMS that indicates relative starting time of a transaction.  Can be generated by using system clock at time transaction started, or by incrementing a logical counter every time a new transaction starts.
  • 17. Read/write proceeds only if last update on that data item was carried out by an older transaction.  Otherwise, transaction requesting read/write is restarted and given a new timestamp.  Also timestamps for data items: ◦ read-timestamp - timestamp of last transaction to read item; ◦ write-timestamp - timestamp of last transaction to write item.
  • 18.  Consider a transaction T with timestamp ts(T): ts(T) < write_timestamp(x) ◦ x already updated by younger (later) transaction. ◦ Transaction must be aborted and restarted with a new timestamp. ts(T) < read_timestamp(x) ◦ x already read by younger transaction. ◦ Roll back transaction and restart it using a later timestamp.
  • 19. ts(T) < write_timestamp(x) ◦ x already written by younger transaction. ◦ Write can safely be ignored .  Otherwise, operation is accepted and executed.
  • 20. Versioning of data can be used to increase concurrency.  Basic timestamp ordering protocol assumes only one version of data item exists, and so only one transaction can access data item at a time.  Can allow multiple transactions to read and write different versions of same data item, and ensure each transaction sees consistent set of versions for all data items it accesses.
  • 21. Three phases: ◦ Read ◦ Validation ◦ Write
  • 22. Transactions should be durable, but we cannot prevent all sorts of failures: ◦ System crashes ◦ Power failures ◦ Disk crashes ◦ User mistakes ◦ Sabotage ◦ Natural disasters
  • 23. Recovery manager responsible for atomicity and durability.  If failure occurs between commit and database buffers being flushed to secondary storage then, to ensure durability, recovery manager has to redo (rollforward) transaction’s updates.  If transaction had not committed at failure time, recovery manager has to undo (rollback) any effects of that transaction for atomicity
  • 24.
  • 25. Backup mechanism  Logging ◦ Transaction records. ◦ Checkpoint records.  Checkpoint  Recovery manager
  • 26. Three main recovery techniques: ◦ Deferred Update ◦ Immediate Update ◦ Shadow Paging
  • 27. It is a protocol that coordinates all the processes that participate in a distributed transaction on whether to commit or abort (roll back) the transaction.  has two types of nodes: ◦ coordinator. ◦ subordinate.
  • 28. Has two phases: The first phase : is a PREPARE phase, where by the coordinator of the transaction sends a PREPARE message. The second phase: is decision-making phase, where the coordinator issues a COMMIT message, or an ABORT message .
  • 29. carried out with one of the following Methods: ◦ Centralized . ◦ Linear. ◦ Distributed.
  • 30. communication is done through the coordinator’s process only .  no communication between subordinates.  The coordinator transmit the PREPARE message to the subordinates  The coordinator receive votes from all subordinates.  the coordinator either abort or COMMIT .
  • 31. coordinator issues a PREPARE message to all the subordinates  if a subordinate is willing to COMMIT, sends a YES VOTE .  if that subordinate is not willing to COMMIT, sends a NO VOTE.
  • 32. If all the subordinate vote to COMMIT, the coordinator has to reach a global COMMIT decision.  the NO VOTE acts like a veto , only one NO VOTE is needed to abort the transaction .
  • 33. After the coordinator reaches a vote, it has to relay that vote to the subordinates.  If the decision is COMMIT , the coordinator sends a message to all the subordinates informing them of the COMMIT.  subordinates send an acknowledge (ACK ) Message to the coordinator.  When the coordinator receives the ACK messages, it ends the transaction .
  • 34. If the coordinator reaches an ABORT decision , it sends an ABORT message to all the subordinates.  Noneed to send an ABORT message to the subordinate(s) that gave a NO VOTE
  • 35. subordinates can communicate with each other.  The sites are labeled 1 to N, where the coordinator is numbered as site 1 .  the propagation of the PREPARE message is done serially.  node N is the one that issues the Global COMMIT
  • 36. The coordinator sends a PREPARE message to subordinate 2 .  If subordinate 2 willing to ABORT, then it sends a VOTE ABORT to subordinate3 and the transaction is aborted at this point.  in case of COMMIT , subordinate 2 sends its vote till node N is reached and issues its vote.
  • 37. Node N sends either a GLOBAL ABORT or a GLOBAL COMMIT to node N-1 .  until the final vote to commit or abort reaches the coordinator node.
  • 38.
  • 39. all the nodes communicate with each other.  each node must have a list of all the participating nodes .  coordinator sends a PREPARE message to all the participating nodes.
  • 40.  When each subordinate gets the PREPARE message, it sends its vote to all the other subordinates.  each node maintains a complete list of the subordinates in every transaction.  When a node receives all the votes from all the subordinates, it can decide directly COMMIT or abort.
  • 41.
  • 42. Look at five advanced transaction models: ◦ Nested Transaction Model ◦ Sagas ◦ Multi-level Transaction Model ◦ Dynamic Restructuring ◦ Workflow Models
  • 43. Transaction is viewed as a collection of related subtasks or subtransactions each of which may also contain any number of subtransactions.
  • 44. “A sequence of (flat) transactions that can be interleaved with other transactions”.  Saga has only one level of nesting .
  • 45.  Closed nested transaction : atomicity enforced at the top-level.  Open nested transactions : allow partial results of subtransactions to be seen outside transaction.
  • 46. split-transaction - splits transaction into two serializable transactions and divides its actions and resources between new transactions.  join-transaction - performs reverse operation, merging ongoing work of two or more independent transactions, as though they had always been single transaction.
  • 47. Workflow is activity involving coordinated execution of multiple tasks performed by different processing entities (people or software systems).  Two general problems involved in workflow systems: ◦ specification of the workflow. ◦ execution of the workflow.
  • 48. Database system, thomas connolly  http://en.wikipedia.org/wiki/Database_transa ction