This article analyzes a production deadlock caused by MyBatis‑Plus’s saveOrUpdate method, explains how MySQL gap locks lead to the issue, demonstrates reproducible tests, and offers practical solutions such as disabling gap locks or customizing the saveOrUpdate implementation.
This article walks you through building a minimal Spring Boot demo, setting breakpoints, analyzing call stacks and logs, and tracing the @Transactional rollback logic in the framework source code to understand why certain methods roll back or commit.
The article investigates why an UPDATE statement on a MySQL 5.7 InnoDB table with RR isolation experiences high lock time, demonstrates how missing indexes cause full‑table scans and blocking, and shows how adding an index and using optimizer trace can diagnose and resolve the issue.
This article explains why @Transactional fails in multithreaded Spring Boot scenarios, then demonstrates how to combine @Async, a custom thread‑pool, @MainTransaction and @SonTransaction annotations with AOP logic to achieve reliable multi‑threaded transaction control, complete with code examples and usage guidelines.
This article investigates how the MyBatis‑Plus saveOrUpdate method can trigger gap‑lock deadlocks in MySQL, explains the underlying concepts of deadlocks and gap locks, reproduces the issue with concrete SQL scripts, and proposes both risky and recommended mitigation strategies.
This article reproduces a MySQL 8.0.32 InnoDB scenario where inserting a row that violates a unique index causes a next‑key exclusive lock on the primary‑key supremum record, explains the underlying implicit‑lock mechanism, walks through the relevant source‑code stack, and details the lock‑conversion and rollback steps under REPEATABLE‑READ isolation.
The article explains how MySQL auto‑increment primary keys, InnoDB invisible row_id, transaction Xid and trx_id, and thread identifiers behave when they reach their numeric limits, showing the resulting errors, data overwrites, and potential visibility bugs in long‑running instances.
This article explains how improper use of AOP in Spring can cause object escape leading to concurrency safety problems, discusses issues such as asynchronous thread modifications, caching, and incorrect advice ordering with @Transaction, @Retryable, and dynamic datasource switching, and provides practical guidance to avoid these pitfalls.
This article explains the fundamentals of database transactions, the ACID properties, and how InnoDB uses redo and undo logs together with MVCC to ensure atomicity, consistency, isolation, durability, and reliable crash recovery.
The article explains how to achieve idempotent order creation and update in distributed systems by using database transactions, unique order identifiers, Redis locks, and version columns to prevent duplicate submissions and resolve the ABA anomaly, ensuring data consistency and reliable user experience.
This article explains how to ensure idempotency in order services by using database transactions, unique request identifiers, and version control to prevent duplicate orders and solve the ABA problem, providing practical code examples and best practices for backend developers.
This article details the design principles, architecture, multi‑tenant sharding strategy, state‑machine workflow, distributed transaction handling, and high‑availability measures of Vivo's transaction platform, illustrating how a micro‑service‑based e‑commerce system achieves low cost, extensibility, and robust performance.
This article explores Java multithreading concepts, JVM safety tools, thread creation methods, coordination mechanisms, and practical scenarios such as parallel data aggregation, for‑loop conversion, map‑based processing, and multi‑threaded transaction handling, providing code examples and performance tips for backend developers.
This article explains how to dynamically manage multiple Spring data sources, switch between them at runtime, and implement custom multi‑database transaction handling, covering both configuration‑file and database‑table approaches, with code examples and AOP techniques for seamless integration.
This article explains how to handle large‑scale data inserts with multithreading in Spring Boot using MyBatis, why the @Transactional annotation fails across threads, and how to achieve reliable all‑or‑nothing rollbacks by manually managing transactions with SqlSession and thread pools.
This article compiles a technical interview recap covering MySQL MVCC, atomicity and persistence mechanisms, operating‑system page cache and deadlock concepts, TCP reliability and flow‑control, Redis persistence and clustering, as well as distributed transaction and consensus fundamentals.
The article explains how to process a batch of overdue unpaid orders in a Spring scheduled task by wrapping each order's business logic in a separate REQUIRES_NEW transaction, catching exceptions, and manually rolling back only the failing transaction so that other orders remain unaffected.
This article explains Spring's unified transaction model, the @Transactional annotation, and the various propagation and isolation settings, then details ten typical scenarios—such as missing Spring management, final or private methods, internal calls, wrong propagation, multithreading, and unsupported databases—that cause transactions to fail, providing code examples and solutions to avoid each issue.
This article examines how common business operations using SELECT ... FOR UPDATE and INSERT can cause Next‑Key lock deadlocks in MySQL under repeatable‑read isolation, demonstrates the locking behavior with practical SQL examples, and proposes strategies such as post‑locking and primary‑key updates to prevent such deadlocks.
The article explains why an UPDATE on the same row in MySQL can block in one transaction but not in another, by analyzing the types of row‑level locks (record, next‑key, gap) acquired during SELECT … FOR UPDATE, normal updates, and updates that modify primary‑key values, illustrating the lock behavior with B+‑tree examples.
This article explains why MySQL needs locking, details every InnoDB lock type—including shared, exclusive, intention, record, gap, next‑key, insert‑intention and auto‑increment locks—shows how they interact, and provides practical guidance for avoiding deadlocks and safely updating rows.
This article presents a series of MySQL 5.7.26 experiments that reveal how record locks on non‑indexed columns are applied to the primary (clustered) index under different isolation levels, how full‑table scans affect locking behavior, and why updates and inserts may or may not be blocked.
The article explains why transaction isolation is needed, describes common concurrency problems such as lost updates, dirty reads, non‑repeatable reads and phantom reads, outlines the ACID properties of a transaction, and details MySQL's four isolation levels and their impact on data consistency.
The article explains MySQL InnoDB’s internal storage hierarchy—from tablespaces, segments, and extents to pages and rows—its physical components such as buffer pool, change buffer, adaptive hash index, redo and binary logs, persistence techniques like double‑write buffering and log‑flushing policies, and how two‑phase commit and SQL execution interact, helping developers write correct, high‑performance applications.
This article explores MySQL’s write‑ahead log, two‑phase commit, engine plugins, memory management, lock strategies, and state‑machine design, showing how these internal mechanisms can inspire more reliable, scalable, and maintainable business system architectures.
This article explains how MySQL's InnoDB engine guarantees ACID properties by describing the four components of ACID, the four isolation levels, lock granularity and types, the MVCC mechanism with version chains and read views, and the roles of undo, redo, and bin logs in ensuring atomicity, consistency, isolation, and durability.
The article explains how Paxos can be generalized by defining its round number (rnd) over any partially ordered set, enabling both forced and non‑forced conflict exclusion mechanisms similar to 2PC, and showing how this expands Paxos’s applicability to multi‑dimensional transaction ordering and simplifies distributed database architectures.
The article details a step‑by‑step investigation of an intermittent deadlock occurring during session creation in a video‑conference system, explains how InnoDB lock types caused the conflict between DELETE and INSERT statements on the session and session_endpoint tables, reproduces the issue, debugs MySQL source code, and presents a simple code‑order fix to eliminate the deadlock.
The article examines common microservice transaction consistency techniques—including blocking retries, asynchronous queues, TCC compensation transactions, local message tables, and MQ transactions—explaining their mechanisms, advantages, drawbacks, and practical code examples for ensuring data integrity across distributed services.
The article explains various techniques for ensuring data consistency in distributed microservice architectures, including blocking retries, asynchronous queues, TCC compensation transactions, local message tables, and MQ transactions, while discussing their advantages, drawbacks, and practical implementation details.
This article explains Spring's @Transactional annotation, detailing its propagation options, rollback mechanisms, common pitfalls such as self‑invocation and non‑public methods, and demonstrates how to correctly invoke transactional methods via proxy objects with practical code examples.
This article reveals ten common Spring transaction pitfalls—including private methods, final modifiers, self‑invocation, missing @Service, wrong propagation, non‑transactional databases, swallowed or wrong exceptions, multi‑threaded calls, and nested transaction rollbacks—that can silently disable transaction management in Java backend projects.
This article provides a step‑by‑step guide on designing the database schema and implementing a multi‑level approval workflow for office automation, covering form submission, dynamic approver selection, core audit tables, transaction safety, and the logic for approval and rejection handling.
The article investigates MySQL InnoDB lock‑wait timeouts caused by hanging transactions that lack proper commit or rollback, explains ACID and lock mechanisms, shows how stale ThreadLocal bindings let pooled threads reuse unfinished transactions, and recommends using @Transactional with robust try‑catch handling to prevent such deadlocks.
This article demonstrates how Spring's @Transactional annotation rolls back only for RuntimeException subclasses, explains why checked exceptions like Exception do not trigger rollback by default, and shows how to configure rollbackFor to handle custom exceptions, illustrated with SQL updates and Java code examples.
This article explains the origins and purpose of Spring transactions, demonstrates how to quickly set them up with code examples, explores key features and common pitfalls, and provides an in‑depth comparison of the REQUIRED, REQUIRES_NEW, and NESTED propagation types for robust backend development.
This article demonstrates how Spring's @Transactional rolls back only RuntimeException subclasses, shows the failure to roll back a checked Exception, and explains how to use rollbackFor to ensure proper transaction rollback for all exception types.
Switching from single‑threaded synchronous calls to multithreaded asynchronous execution can boost performance, but it also introduces nine common problems—including missing return values, data loss, ordering issues, thread‑safety bugs, ThreadLocal anomalies, OOM, high CPU usage, transaction failures, and service crashes—that developers must understand and mitigate.
This article introduces the PHP Neo4j library church/neo4j, outlines its PHP ≥ 7.4 environment requirements, shows how to install it via Composer, and provides detailed code examples for initializing the client, building statements, managing transactions, and running unit tests.
The Xianyu transaction chain now employs automated regression testing that records and replays interface traffic, verifies scenarios, and integrates a strong checkpoint in the release pipeline, cutting manual validation from thirty minutes to one minute, enhancing quality assurance, release safety, and paving the way for broader test coverage.
The article explains how to integrate Alibaba's Graph Database (GDB) with TinkerPop, compares it to other graph databases, details challenges such as string‑based script construction and missing transaction APIs, and demonstrates two DAO implementations and explicit transaction handling using GdbClient.
PolarDB‑X evolved from Alibaba’s internal sharding middleware TDDL to the DRDS cloud service and finally to a fully distributed MySQL‑compatible database, introducing a full SQL optimizer, MPP engine, global secondary indexes, strong‑consistent distributed transactions via TSO + 2PC, and full binlog compatibility.
This article provides a detailed survey of database fundamentals, historical evolution from early relational systems to modern distributed and cloud‑native solutions, explains various architectural components and core technologies such as query processing, indexing, transaction management, and discusses business‑driven classifications, distributed designs, SMP versus MPP, and resource‑access models.
This article investigates how many rows should be inserted per batch in MySQL by measuring the impact of packet size limits, buffer pool usage, insert buffers, transaction handling and index structures, and it provides practical recommendations based on tests with millions of rows.
Learn how to identify when a MySQL DDL statement is blocked, use SHOW PROCESSLIST and the sys.schema_table_lock_waits view to pinpoint the blocking session, and apply targeted KILL commands or transaction queries to safely unblock operations in both MySQL 5.7 and 8.0.
This article explains why the @Transactional annotation can roll back data when Sharding-JDBC performs cross‑database inserts, outlines the scenarios it truly supports, and details the internal rollback mechanism that distinguishes local from distributed transactions.
An in‑depth investigation reveals that Spring’s @Transactional rollback can silently fail due to a bug in mysql‑connector‑java 8.0.28 when useLocalSessionState=true, causing auto‑commit to stay enabled; the article explains the root cause, debugging steps, and how upgrading to 8.0.29 resolves the issue.
This article explains in detail what happens inside MySQL when an UPDATE statement is executed, covering the execution flow, the roles of undo log, redo log, and binlog, buffer pool mechanics, two‑phase commit, group commit, and practical optimization tips.
This article explains the fundamentals of database transactions, the ACID properties, Spring's @Transactional support, various propagation behaviors and isolation levels, and provides practical code examples for both declarative and programmatic transaction management in Java backend development.
This article explains the concept of idempotency, outlines common business scenarios such as duplicate orders and payments, describes natural and required idempotent operations, and provides practical techniques—including unique keys, database constraints, and message‑queue handling—to ensure idempotent behavior in backend systems.
This article provides a comprehensive, step‑by‑step explanation of MySQL InnoDB's MVCC mechanism, covering its fundamentals, the role of Undo Log and Read View, and how it enables repeatable‑read and read‑committed isolation levels while preventing dirty reads and other concurrency anomalies.
This comprehensive guide walks through Spring’s fundamentals—including IoC, DI, core modules, common annotations, AOP concepts, transaction management, MVC workflow, and Spring Boot auto‑configuration—while also covering advanced topics such as bean lifecycle, circular dependencies, proxy mechanisms, and an introduction to Spring Cloud.
An in‑depth guide shows how to accelerate updating tens of thousands of MySQL rows in a Spring Boot‑MyBatis project by switching from automatic per‑record commits to manual transactions, applying multithreaded execution with CountDownLatch coordination, and using UNION‑based batch updates when native batch support is unavailable.
This article analyzes MySQL batch insertion by examining field size, max_allowed_packet limits, transaction overhead, buffer pool usage, and empirical tests with varying batch sizes, ultimately recommending a batch size around half of the max_allowed_packet for optimal throughput.
This article demonstrates how to dramatically speed up updating tens of thousands of records in a Spring‑MyBatis application by switching from automatic per‑operation commits to manual transaction control, applying multithreaded processing, tuning the Hikari connection pool, and using SQL UNION‑based batch updates.
This article explains how to prevent message loss in RabbitMQ by using producer transaction mechanisms, confirm mode, message persistence, and database‑backed compensation, and also details consumer‑side manual acknowledgments to achieve reliable end‑to‑end delivery.
The article explains MySQL's metadata lock (MDL) mechanism, shows how to enable its instrumentation, demonstrates various lock scenarios with SELECT, INSERT and ALTER statements, and provides guidance on diagnosing and resolving MDL‑related blocking issues.
This article analyzes a MySQL InnoDB lock wait timeout error, explains how gap locks cause blocked inserts and phantom reads under repeatable‑read isolation, and offers optimization strategies such as primary‑key deletions, while concluding with a recruitment invitation for the Zero technology team.
This article explains the fundamental concepts, design requirements, and modeling approaches for payment account systems in e‑commerce, covering the distinction between payment and login accounts, transaction needs, accounting structures, entity and account models, and the detailed transaction model.
This article explores common e‑commerce backend challenges such as duplicate orders, order snapshots, cart storage, inventory oversell, logistics updates, account balance consistency, read‑write splitting, hot‑cold data separation, and sharding, and provides concrete design patterns and SQL examples to solve them.
This article examines the challenges faced by a transaction middleware platform, introduces a finite‑state‑machine (FSM) solution for order state flows, and compares traditional serial processing with future‑based staged concurrency and event‑driven concurrency models, highlighting their benefits and trade‑offs.
The article details Maoyan’s transaction data center, explaining its background, the need for a unified real‑time order model, the benefits of reduced coupling and improved data accuracy, and describes the system’s architecture, components, data collection, processing, task scheduling, monitoring, and future plans.
This article evaluates several PHP approaches—including plain inserts, unsigned mode, MySQL transactions, file locks, and Redis queues—to prevent product inventory overselling under high concurrency, presenting test setups, results, and a final recommendation favoring Redis for its superior performance.
This article explains the fundamental concepts, design requirements, and modeling techniques for payment accounts and transaction flows in e‑commerce systems, covering distinctions between payment and login accounts, internal vs. external accounts, and detailed entity, account, and transaction models.
This article explains how to handle flash‑sale (seckill) scenarios in PHP by reducing database pressure with caching, preventing stock oversell using row locks, transactions, file locks, and Redis queues, and provides complete code examples for each technique.
This article explores the precise moment a Spring @Transactional transaction is committed relative to a surrounding lock release, revealing that commits occur after the method finishes, and demonstrates how to verify this through source code inspection, debugging techniques, and proper lock‑usage to prevent overselling.
This article provides a comprehensive overview of distributed storage, covering seven core aspects such as replication, storage engines, transaction processing, analytical query execution, multi‑core scalability, computation models, and compilation techniques, while also highlighting practical challenges and design considerations for modern database systems.
This article provides a detailed overview of Redis, covering its core concepts, high‑performance features, common use cases, installation steps, memory‑management policies, supported data structures, persistence mechanisms, transaction model, and best practices for cache consistency and failure handling.
This article analyzes a Spring transaction rollback issue caused by the use of pattern‑based exception matching, explains why certain custom exceptions trigger unexpected rollbacks, traces the problem through source code and GitHub issues, and describes how the Spring team fixed it with type‑safe rollback rules and documentation updates.
This article delves into MySQL’s internal logging mechanisms—redo log, undo log, and binlog—explaining their structures, purposes, and interactions, and then explores transaction concepts such as dirty reads/writes, non‑repeatable reads, phantom reads, isolation levels, and the MVCC implementation that ensures data consistency.
This article presents a comprehensive overview of payment system architecture, detailing the transaction and payment cores, their interactions, service governance, data consistency, asynchronous processing, performance testing, and practical production practices for building robust backend payment platforms.
ByteDance’s EMR team details how they integrated data‑lake engines such as Hudi and Iceberg into SparkSQL, streamlined jar management, built a custom Spark SQL Server with Hive compatibility, multi‑tenant support, engine pre‑warming, and transaction capabilities, dramatically improving performance and resource efficiency for enterprise workloads.
This article compares three Go transaction implementations, explains their trade‑offs, and presents a refined pattern that uses defer tx.Rollback() to guarantee rollback while still allowing successful commits, covering both simple and loop‑based use cases.
This article explains Java exception categories, how Spring's @Transactional decides which exceptions trigger a rollback, and provides practical annotation configurations to control rollback behavior for both checked and unchecked exceptions.
This article explains database isolation levels, including read committed, repeatable read, serializable, and snapshot isolation, discusses dirty reads, phantom reads, and how various systems such as SQL Server, PostgreSQL, MySQL, Oracle, MongoDB, and others implement or differ in these isolation semantics.
Explore a comprehensive list of 18 essential Spring interview questions covering design patterns, core modules, IoC, DI, AOP, proxy types, bean lifecycle, circular dependency resolution, transaction management, and Spring Boot auto‑configuration, complete with concise explanations and illustrative diagrams to help you ace your interview.
An Excel import that partially succeeds reveals a hidden bug where Spring’s @Transactional annotation doesn’t roll back when using Java 8’s parallelStream, and the article explains the underlying thread‑local transaction mechanics, demonstrates the issue with code, and offers practical solutions and best‑practice guidelines.
This article explains how Flink and ClickHouse can be combined to build a real-time data warehouse with end-to-end Exactly-Once guarantees, detailing the underlying write mechanisms, transaction state machine, connector implementation, and performance test results, while also outlining future enhancements for distributed transactions.
This article outlines the objectives, call flow, architectural design, and potential challenges of a payment center system that unifies transaction, payment, and finance services, detailing its four main modules, data handling, and integration with third‑party payment channels.
The article explains how distributed database systems appear as a single logical database but operate over a network of nodes, detailing failures, stale reads, consistency models, architecture anomalies, sharding, replication, and various read/write scenarios that illustrate the complexity of achieving strong consistency.
This article explains the fundamentals of database transactions, the ACID properties, and how Spring provides both declarative and programmatic transaction support through three core interfaces, detailed configuration examples in XML and Java, and a deep dive into transaction attributes such as isolation, propagation, rollback rules, read‑only mode, and timeout.
This article explains the four necessary conditions that cause deadlocks, outlines four major strategies to prevent or resolve them, and provides a step‑by‑step MySQL example with code snippets and diagrams illustrating how deadlocks occur and can be avoided.
This article explains how MySQL's SELECT ... FOR UPDATE statement adds pessimistic locks, detailing when it results in row‑level locks versus table‑level locks based on the presence of indexes or primary keys, and provides verification examples with code and transaction scenarios.
This article explains how Spring’s @Transactional works with locks, why the transaction may commit after the unlock operation, and provides debugging techniques to trace transaction start, commit, and rollback points in high‑concurrency scenarios.
This article explains the fundamentals of ACID, how Redis implements transactions with MULTI, EXEC, DISCARD and WATCH commands, provides code examples, and analyzes whether Redis transactions satisfy atomicity, consistency, isolation, and durability.
This article explains why Spring @Transactional may become ineffective in various situations—such as wrong method visibility, final or static modifiers, internal method calls, missing bean registration, multithreading, unsupported table engines, misconfigured propagation, swallowed exceptions, and improper rollback settings—and provides practical solutions for each case.
This article explains how MySQL handles concurrent transactions using MVCC, lock mechanisms, and various isolation levels, detailing dirty writes, dirty reads, non‑repeatable reads, phantom reads, and the internal structures such as ReadView that enable reliable data consistency.
This article explains why Spring @Transactional may become ineffective or fail to roll back in various situations—such as wrong method visibility, final modifiers, internal calls, missing Spring bean registration, multithreading, unsupported table engines, misconfigured propagation, swallowed exceptions, and improper rollback settings—while also offering practical solutions and best‑practice recommendations.
This article examines MySQL's INSERT locking behavior, explains why phantom reads do not occur under REPEATABLE READ isolation, and walks through compiling the MySQL source, debugging lock acquisition, and the role of insert‑intention and gap locks using detailed code examples and execution traces.
Distributed tracing in Sentry captures interactions across services to provide a unified view of errors and performance, explaining the concepts of traces, transactions, spans, data sampling, consistency handling, and practical examples such as diagnosing slow page loads.
This article explains MySQL's two essential logs—redo log and binlog—by describing the database's layered architecture, the write‑ahead logging mechanism, persistence strategies, crash‑safe guarantees, and how a two‑phase commit ensures consistency between them.
This article explores why Spring transactions may fail, covering seven common pitfalls such as incorrect method visibility, final methods, internal calls, missing Spring management, multithreading, unsupported table engines, and misconfigured propagation, and provides practical solutions to ensure reliable transaction handling.
This guide demonstrates how to integrate RocketMQ 4.8.0 into a Spring Boot 2.3.9 application, covering dependency setup, configuration, sending and receiving plain, ordered, clustered, broadcast, and transactional messages, with complete code examples and execution results.
This article outlines the objectives, detailed call process, architectural modules, and potential challenges of a payment center system that unifies order, payment, and finance services while ensuring security, scalability, and data support for downstream applications.
This article explains MySQL's logging system—including binlog, redo log, and undo log—their purposes, formats, flush timing, usage in replication and recovery, and how they work together to ensure durability and atomicity in InnoDB transactions.
This article explains why message middleware guarantees at‑least‑once delivery, the challenges of duplicate consumption, and presents both transactional and non‑transactional deduplication strategies—including database and Redis‑based solutions—to achieve idempotent processing in RocketMQ.
This article explains the fundamentals of local transactions and ACID properties, introduces CAP and BASE theories, discusses compensation jobs and transaction messages, and reviews distributed transaction models such as two‑phase commit, three‑phase commit, XA, TCC, Saga, and the Seata framework.
This article explains how MySQL's InnoDB engine implements ACID properties by detailing transaction atomicity, consistency, isolation levels, lock granularity, MVCC version chains, undo/redo logs, buffer pool behavior, and the interplay between redo log and binlog to ensure durability and data integrity.