Transactions and locking mechanisms in Redis

Transaction and lock mechanism in Redis Redis’s transaction mechanism is a mechanism that packages multiple commands for execution, ensuring that all of these commands either execute successfully or fail without any intermediate status. In Redis, transactions are implemented through four commands: MULTI, EXEC, DISCARD and WATCH. MULTI: This command marks the beginning of a transaction. […]

How to optimize large transactions in the interface?

1Foreword As back-end development programmers, we often have some relatively complex logic. For example, we need to write a calling interface for the front end. This interface needs to perform relatively complex business logic operations, such as query and remote interface. Or some logic such as local interface call, update, insertion, calculation, etc., the final […]

An explanation of transaction isolation and other concurrent transactions in MySQL database

In MySQL, the transaction isolation level defines the situation in which a transaction and other concurrent transactions can see each other’s changed data. The SQL standard specifies four isolation levels, as follows: Serialization (SERIALIZABLE): Transactions are executed serially, that is, each transaction must wait for the end of the previous transaction before starting execution. This […]

Handling simple transactions in Spring Boot

Speaking of transactions, our first impact should be an important concept of database management systems. Transaction is a concept in a database management system (DBMS) that is used to manage a set of operations on the database. These operations are either all executed successfully or all are rolled back (undone). A transaction usually consists of […]

03-Sping transaction implementation: XML-based implementation of declarative transactions

XML implementation of declarative transactions Development steps Step 1: Introduce AOP-related aspectj dependencies <!–aspectj dependency–> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>6.0.0-M2</version> </dependency> Step 2: Write the dao layer interface and its implementation class public interface AccountDao {<!– –> // Check the balance based on the account number Account selectByActno(String actno); //Update account information int update(Account act); } […]

[MySQL Transactions] Multi-version Concurrency Control (MVCC)

Multi-version Concurrency Control (MVCC) Article directory Multi-version Concurrency Control (MVCC) 1 Overview 2. Snapshot reading and current reading 2.1 Snapshot reading 2.2 Current reading 3. MVCC implementation principle of ReadView 3.1 ReadView Overview 3.2 Design ideas 3.3 ReadView rules 3.4 MVCC overall operation process 4. Give examples 4.1 READ COMMITTED isolation level 4.2 REPEATABLE READ […]

01-The implementation of transactions in Spring: programmatic transactions and declarative transactions

Abnormal bank account transfer Requirement: To transfer 10,000 from act-001 account to act-002 account, it is required that one of the balances of the two accounts is successfully reduced and the other is added successfully, that is, the two update statements executed must succeed or fail at the same time Implementation steps Step 1: Introduce […]

Implementing eventually consistent distributed transactions for placing orders and reducing inventory based on RabbitMQ

The National Day holiday really gave me a break, and the update progress was slow. Now that the status has finally been adjusted back, continue to update. Without further ado, let me show you the overall data flow diagram. Text Interpretation Step 1: The user places an order and calls the order service. We directly […]

MySQL–constraints, multi-table queries, transactions, three paradigms

1. Constraints Constraints are rules that act on the fields of a table to limit the data stored in the table. 2. Purpose: Ensure the accuracy, validity and integrity of data in the database 3. Classification Constraints Description Keywords Non-empty constraints Restrictions This field cannot be empty NOT NULL Unique constraint Ensure that the data […]