Essay sample library > The Nature of Database Locking

The Nature of Database Locking

2023-06-26 06:37:29

Hello Mortors and classmates, you know who your enemy is, you know what you are, and you can do hundreds of fights without its own disaster. Database locks are what you call change, evolution, complexity, and technical topics. As a tester, we often consider it as a so-called developer and DBA (that is not my problem). For function testers and performance testers, it is the enemies of many other disasters, these disasters are called hosts and can be proved personally.

For each scope requested from the database, an object DBResource class is created. This object contains the scope name, the type of lock stored in this object, and the list of transactions holding the current lock. The DBResource lock can be none, shared, or exclusive. Once created, these objects are stored in the hash table typed by scope name. This table is included in the LockTable class. LockTable controls access to all database resources. Transactions are connected to the LockTable in three ways: getSharedLock, getExclusiveLock, and releaseLocks.

We designed the transaction manager with the following principles: monitor based concurrency control, strict 2 phase locking protocol, database wide locking and deadlock prevention. I chose Java as the programming language because it is very suitable for "hierarchical" programming and has many built-in functions to facilitate thread concurrency and data structure to handle database resource locking It is because it is. Let's start with this article and look at other research in the field of main memory database. Next I will detail the decisions made in the design of this transaction manager. Each chapter explains that the implementation itself provides the results of several performance tests in each chapter. Finally, in Section 7, I will explain what I want to change and what I want to improve.

Locking ensures transaction integrity and database consistency. In SQL Server, locks are implemented automatically and provide optimistic and pessimistic concurrency control. In optimistic concurrency control, it is assumed that resource conflicts are unlikely but not impossible, so that transactions can be executed without locking resources. Pessimistic concurrency control locks resources during the transaction period. SQL Server can lock resources such as RID, key, page, extent, table, and database. Use multiple lock modes such as sharing, updating, exclusion, intention, mode locking. Using shared locks allows simultaneous read operations without changing or updating data, such as SELECT statements. An update lock prevents a common form of deadlock that occurs when multiple sessions are later read, locked, and possibly updated.