1 / 45

Long-duration transactions

Long-duration transactions. Long-duration transactions. Long-duration transactions = Long transactions = Long-lived transactions = Design transactions =. Long-duration transactions. Long-duration transaction ? What is it ?. Long-duration transactions.

sven
Télécharger la présentation

Long-duration transactions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Long-duration transactions

  2. Long-duration transactions Long-duration transactions = Long transactions = Long-lived transactions = Design transactions = ...

  3. Long-duration transactions • Long-duration transaction ? What is it ?

  4. Long-duration transactions • Long-duration transaction ? What is it ? Long duration transaction is a transaction that accesses a large number of data items and whose execution takes minutes or even hours

  5. Long-duration transactions • Properties of LD transactions

  6. Long-duration transactions • Properties of LD transactions • long duration • access to many database objects • direct input from users

  7. Long-duration transactions • Properties of LD transactions • long duration • access to many database objects • direct input from users Examples • schedule generation • processing purchase orders, or insurance claims • printing monthly account statement in a bank • restructuring a complex data structure in CAD

  8. Long-duration transactions • Problems with LD transactions

  9. Long-duration transactions • Problems with LD transactions • performance • locks should be retained for long periods • expensive rollbacks

  10. Long-duration transactions • Solutions

  11. Long-duration transactions • Solutions • Decomposition of LDT into series of shorter transactions

  12. Long-duration transactions • Solutions • Decomposition of LDT into series of shorter transactions • Use of multiversion data

  13. Long-duration transactions • Solutions • Decomposition of LDT into series of shorter transactions • Use of multiversion data • Restriction of transaction access patterns

  14. Long-duration transactions • Solutions • Decomposition of LDT into series of shorter transactions • Use of multiversion data • Restriction of transaction access patterns • Protocols based on constrained shared locks

  15. Long-duration transactions • Solutions • Decomposition of LDT into series of shorter transactions • Use of multiversion data • Restriction of transaction access patterns • Protocols is based on constrained shared locks • Non-locking protocols

  16. Long-duration transactions • Sagas Garcia-Molina H., Salem K. Sagas, SIGMOD Record, vol. 16, no. 3, 1987

  17. Long-duration transactions • Principles • Saga is a LD transaction which is broken into a collection of subtransactions T1, ..., Tn in such a way that each one of subtransactions can be interleaved in any way with any other transactions

  18. Long-duration transactions • Principles • Saga is a LD transaction which is broken into a collection of subtransactions T1, ..., Tn in such a way that each one of subtransactions can be interleaved in any way with any other transactions • Saga is a two-level nested transaction where each subtransaction must preserve a local database consistency, i.e. its concurrent execution must be conflict serializable

  19. Long-duration transactions • Principles • Every saga is either completed or it is compensated

  20. Long-duration transactions • Principles • Every saga is either completed or it is compensated • Instead of rollback and cascading abort the user supplied compensation functions are executed to compensate for each transaction that failed or was aborted

  21. Long-duration transactions • Principles • Every saga is either completed or it is compensated • Instead of rollback and cascading abort the user supplied compensation functions are executed to compensate for each transaction that failed or was aborted • Compensation function reverses the actions performed by a transaction from a semantic point of view, e.g. reservation of a seat may be cancelled by a compensation function

  22. Long-duration transactions • Principles • Subtransactions in a saga are related one to each other and should be executed as non-atomic unit

  23. Long-duration transactions • Principles • Subtransactions in a saga are related one to each other and should be executed as non-atomic unit • Any partial execution of a saga is undesirable

  24. Long-duration transactions • Principles • Subtransactions in a saga are related one to each other and should be executed as non-atomic unit • Any partial execution of a saga is undesirable • Each subtransaction T1, ..., Tn as an associated compensating transaction C1, ..., Cn

  25. Long-duration transactions • Principles • Compensating transaction C is a transaction that semantically undos the effects of transaction T after T has been committed or aborted

  26. Long-duration transactions • Principles • Compensating transaction C is a transaction that semantically undos the effects of transaction T after T has been committed or aborted • To execute a saga, the system must guarantee that either a sequence T1, ..., Tn (success) or a sequence T1, ..., Tk, Ck, ..., C1 will be executed (failure)

  27. Long-duration transactions • Structure of saga

  28. Long-duration transactions • Structure of saga begin saga begin transaction T1 ... end transaction T1 begin transaction T2 ... end transaction T2 ... begin transaction Tn ... end transaction Tn end saga

  29. Long-duration transactions • Elementary operations of sagas

  30. Long-duration transactions • Elementary operations of sagas • begin saga - starts execution of a saga

  31. Long-duration transactions • Elementary operations of sagas • begin saga - starts execution of a saga • begin transaction - starts execution of any subtransaction and provides an address of respective compensating transaction

  32. Long-duration transactions • Elementary operations of sagas • begin saga - starts execution of a saga • begin transaction - starts execution of any subtransaction and provides an address of respective compensating transaction • end transaction - ends execution of any subtransaction

  33. Long-duration transactions • Elementary operations of sagas • begin saga - starts execution of a saga • begin transaction - starts execution of any subtransaction and provides an address of respective compensating transaction • end transaction - ends execution of any subtransaction • end saga - ends execution of a saga

  34. Long-duration transactions • Elementary operations of sagas • abort transaction - aborts current transaction and initiates execution of its compensating transaction

  35. Long-duration transactions • Elementary operations of sagas • abort transaction - aborts current transaction and initiates execution of its compensating transaction • abort saga - aborts current subtransaction, runs a sequence of compensating transactions in reverse order of transaction execution

  36. Long-duration transactions • Elementary operations of sagas • abort transaction - aborts current transaction and initiates execution of its compensating transaction • abort saga - aborts current subtransaction, runs a sequence of compensating transactions in reverse order of transaction execution • save point - forces a system to save the current status of a running saga and returns a save point identifier for future references

  37. Long-duration transactions • Recovery protocols

  38. Long-duration transactions • Recovery protocols • Backward recovery when aborted transaction is compensated to its start point and saga is continued from the aborted transaction

  39. Long-duration transactions • Recovery protocols • Backward recovery when aborted transaction is compensated to its start point and saga is continued from the aborted transaction • Forward recovery when aborted transaction is compensated to a save point different that its start point and saga is continued from the next transaction

  40. Long-duration transactions • Properties

  41. Long-duration transactions • Properties • Sagas relax the property of isolation by allowing its subtransactions to reveal their partial results one to each other

  42. Long-duration transactions • Properties • Sagas relax the property of isolation by allowing its subtransactions to reveal their partial results one to each other • Sagas preserve the properties of atomicity, consistency and durability

  43. Long-duration transactions • Properties • Sagas relax the property of isolation by allowing its subtransactions to reveal their partial results one to each other • Sagas preserve the properties of atomicity, consistency and durability • Sagas solve the problem of LD transactions by allowing its subtransactions to release the partial results before completion of a whole task

  44. Long-duration transactions • Properties • Sagas are useful only when subtransactions are relatively independent, and each transaction may be compensated

  45. Long-duration transactions • Properties • Sagas are useful only when subtransactions are relatively independent, and each transaction may be compensated • Sagas are useless in the environments where LLTs are not compensable, e.g. a transaction that fires a missile or transaction that dispenses cash from ATM are hardly compensable

More Related