Oracle Berkeley DB Getting Started with Transaction Processing for C

Oracle Berkeley DB Getting Started with Transaction Processing for C

Oracle Berkeley DB Getting Started with Transaction Processing for C 12c Release 1 Library Version 12.1.6.2 Legal Notice This documentation is distributed under an open source license. You may review the terms of this license at: http:// www.oracle.com/technetwork/database/berkeleydb/downloads/oslicense-093458.html Oracle, Berkeley DB, and Sleepycat are trademarks or registered trademarks of Oracle. All rights to these marks are reserved. No third-party use is permitted without the express prior written consent of Oracle. Other names may be trademarks of their respective owners. To obtain a copy of this document's original source code, please submit a request to the Oracle Technology Network forum at: https://forums.oracle.com/forums/forum.jspa?forumID=271 Published 4/13/2017 Table of Contents Preface ....................................................................................................... v Conventions Used in this Book .................................................................... v For More Information ............................................................................... vi Contact Us ..................................................................................... vi 1. Introduction .............................................................................................. 1 Transaction Benefits ................................................................................. 1 A Note on System Failure .......................................................................... 2 Application Requirements .......................................................................... 2 Multi-threaded and Multi-process Applications ................................................. 4 Recoverability ........................................................................................ 4 Performance Tuning ................................................................................. 5 2. Enabling Transactions .................................................................................. 6 Environments ......................................................................................... 6 File Naming .................................................................................... 7 Specifying the Environment Home Directory ....................................... 7 Specifying File Locations .............................................................. 7 Identifying Specific File Locations ................................................... 8 Error Support ................................................................................. 10 Shared Memory Regions ..................................................................... 10 Regions Backed by Files .............................................................. 11 Regions Backed by Heap Memory ................................................... 11 Regions Backed by System Memory ................................................ 11 Security Considerations ..................................................................... 12 Opening a Transactional Environment and Database ........................................ 13 3. Transaction Basics ..................................................................................... 17 Committing a Transaction ......................................................................... 20 Non-Durable Transactions ......................................................................... 21 Aborting a Transaction ............................................................................ 22 Auto Commit ........................................................................................ 22 Nested Transactions ................................................................................ 25 Transactional Cursors .............................................................................. 26 Secondary Indices with Transaction Applications ............................................. 28 Configuring the Transaction Subsystem ......................................................... 29 4. Concurrency ............................................................................................ 32 Which DB Handles are Free-Threaded .......................................................... 33 Locks, Blocks, and Deadlocks .................................................................... 33 Locks ........................................................................................... 33 Lock Resources ........................................................................ 34 Types of Locks ......................................................................... 34 Lock Lifetime .......................................................................... 35 Blocks .......................................................................................... 35 Blocking and Application Performance ............................................ 36 Avoiding Blocks ........................................................................ 37 Deadlocks ..................................................................................... 38 Deadlock Avoidance ................................................................... 39 The Locking Subsystem ............................................................................ 39 4/13/2017 Using Transactions with DB Page iii Configuring the Locking Subsystem ....................................................... 40 Configuring Deadlock Detection ........................................................... 42 Resolving Deadlocks ......................................................................... 44 Setting Transaction Priorities .............................................................. 46 Isolation .............................................................................................. 47 Supported Degrees of Isolation ............................................................ 48 Reading Uncommitted Data ................................................................ 49 Committed Reads ............................................................................ 51 Using Snapshot Isolation .................................................................... 54 Snapshot Isolation Cost ............................................................... 54 Snapshot Isolation Transactional Requirements .................................. 54 When to Use Snapshot Isolation .................................................... 54 How to use Snapshot Isolation ...................................................... 55 Transactional Cursors and Concurrent Applications ........................................... 57 Using Cursors with Uncommitted Data ................................................... 57 Exclusive Database Handles ...................................................................... 59 Read/Modify/Write ................................................................................. 60 No Wait on Blocks .................................................................................. 61 Reverse BTree Splits ............................................................................... 61 5. Managing DB Files ..................................................................................... 64 Checkpoints ......................................................................................... 64 Backup Procedures ................................................................................. 67 About Unix Copy Utilities .................................................................. 67 Offline Backups .............................................................................. 68 Hot Backup ................................................................................... 68 Incremental Backups ........................................................................ 69 Recovery Procedures ............................................................................... 70 Normal Recovery ............................................................................. 70 Catastrophic Recovery ...................................................................... 72 Designing Your Application for Recovery ....................................................... 73 Recovery for Multi-Threaded Applications ............................................... 73 Recovery in Multi-Process Applications ................................................... 74 Effects of Multi-Process Recovery .................................................. 75 Process Registration ................................................................... 75 Failure Checking ....................................................................... 76 Using Hot Failovers ................................................................................ 77 Removing Log Files ................................................................................. 79 Configuring the Logging Subsystem ............................................................. 80 Setting the Log File Size ................................................................... 80 Configuring the Logging Region Size ...................................................... 81 Configuring In-Memory Logging ............................................................ 81 Setting the In-Memory Log Buffer Size ................................................... 84 6. Summary and Examples .............................................................................. 85 Anatomy of a Transactional Application

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    114 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us