Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » Getting Started » Locking and Concurrency |
Locking Protocol | Description |
Pessimistic | The pessimistic row locking protocol specifies that a row should be locked when the row is retrieved for updating. |
Optimistic | The optimistic locking protocol specifies that a row should be locked when any row modifications are posted back to the table. Using the optimistic row locking protocol for remote sessions removes the possibility that dangling row locks will be left on the ElevateDB Server if the application is terminated unexpectedly. However, even with the pessimistic row locking protocol, an ElevateDB server can clean up dead sessions and remove any row locks that they may be holding. |
Action | Description |
Inserting | When inserting a row, no row locks are acquired until the row is actually inserted. During the insertion of a new row, a row lock is only implicity acquired by ElevateDB on the new row if the insertion is taking place inside of a transaction. |
Updating | When updating a row, a row lock is implicity acquired by ElevateDB. This row lock will fail if the row is already locked by the same session or a different session. If the row lock fails, then an exception will be raised. The error code that is raised when a row lock fails is 1005 (EDB_ERROR_LOCKROW). If the row locking protocol for the session is set to optimistic then ElevateDB will not attempt to implicitly acquire a row lock when the row is retrieved, but will instead wait until the row is actually updated to implicitly acquire the row lock. This means that another session is capable of updating or deleting the row before the current session actually completes the update. If either of these actions occur, an exception will be raised. The error code that is raised when an update fails because the row has been altered is 1008 (EDB_ERROR_ROWMODIFIED). The error code that is raised when an update fails because the row has been deleted is 1007 (EDB_ERROR_ROWDELETED). |
Deleting | When deleting a row, a row lock is implicity acquired by ElevateDB. This row lock will fail if the row is already locked by the same session or a different session. If the row lock fails, then an exception will be raised. The error code that is raised when a row lock fails is 1005 (EDB_ERROR_LOCKROW). |
Type | Description |
Table Read Locks | Table read locks allow ElevateDB to accurately treat reads on internal table structures, such as the indexes or BLOB columns, as atomic, or a single unit of work. Table read locks ensure that no other session writes to the table by blocking any table write locks. Table read locks are the most widely-used locks in ElevateDB and are the cornerstone of correct multi-user operation. They especially play a large role in change detection. Please see the Change Detection topic for more information. Table read locks are also acquired during table scans for un-optimized query conditions. Please see the Optimizer topic for more information on optimizing query conditions. |
Table Write Locks | Table write locks allow ElevateDB to accurately treat writes on internal table structures, such as the indexes or BLOB columns, as atomic, or a single unit of work. Table write locks ensure that no other session reads from or writes to the table by blocking any table read lock or write locks. |
Table Transaction Locks | Table transaction locks allow ElevateDB to treat single or multi-table updates within a transaction as atomic, or a single unit of work. Table transaction locks ensure that no other session begins a transaction on the table by blocking any other table transaction locks. Table read locks are allowed, however, and other sessions can read the rows from tables and acquire row locks. When a transaction is ready to be committed to disk, additional table write locks are acquired in order to block other table reads or writes while the data is being committed. |
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |