An open Java Transaction book
We live in a world of both commercial and open-source software, each one having strengths and weaknesses. But when it comes to books, there hasn’t been any noticeable revolution towards embracing new...
View ArticleAsciidoctor for collaborative book writing
I’ve been searching for the most suitable tools I’d use for my Transaction book writing process and I’ve settled for Asciidoctor. In the first place, I decided to use a markup text language that’s...
View ArticleA beginner’s guide to ACID and database transactions
Transactions are omnipresent in today’s enterprise systems, providing data integrity even in highly concurrent environments. So let’s get started by first defining the term and the context where you...
View ArticleA beginner’s guide to database locking and the lost update phenomena
Introduction A database is highly concurrent system. There’s always a chance of update conflicts, like when two concurring transactions try to update the same record. If there would be only one...
View ArticleA beginner’s guide to transaction isolation levels in enterprise Java
Introduction A relational database strong consistency model is based on ACID transaction properties. In this post we are going to unravel the reasons behind using different transaction isolation levels...
View ArticleHow to fix optimistic locking race conditions with pessimistic locking
Recap In my previous post, I explained the benefits of using explicit optimistic locking. As we then discovered, there’s a very short time window in which a concurrent transaction can still commit a...
View ArticleHibernate locking patterns – How does OPTIMISTIC_FORCE_INCREMENT Lock Mode work
Introduction In my previous post, I explained how OPTIMISTIC Lock Mode works and how it can help us synchronize external entity state changes. In this post, we are going to unravel the...
View ArticleHibernate locking patterns – How does PESSIMISTIC_FORCE_INCREMENT Lock Mode work
Introduction In my previous post, I introduced the OPTIMISTIC_FORCE_INCREMENT Lock Mode and we applied it for propagating a child entity version change to a locked parent entity. In this post, I am...
View ArticleHibernate Locking Patterns – How do PESSIMISTIC_READ and PESSIMISTIC_WRITE work
Introduction Java Persistence API comes with a thorough concurrency control mechanism, supporting both implicit and explicit locking. The implicit locking mechanism is straightforward and it relies on:...
View ArticleHibernate CascadeType.LOCK gotchas
Introduction Having introduced Hibernate explicit locking support, as well as Cascade Types, it’s time to analyze the CascadeType.LOCK behavior. A Hibernate lock request triggers an internal LockEvent....
View ArticleA beginner’s guide to read and write skew phenomena
Introduction In my article about ACID and database transactions, I introduced the three phenomena described by the SQL standard: dirty read non-repeatable read phantom read While these are good to...
View ArticleMySQL metadata locking and database transaction ending
Introduction As previously explained, every SQL statement must be executed in the context of a database transaction. For modifying statements (e.g. INSERT, UPDATE, DELETE), row-level locks must be...
View ArticleA beginner’s guide to the Phantom Read anomaly, and how it differs between...
Introduction Unlike SQL Server which, by default, relies on the 2PL (Two-Phase Locking) to implement the SQL standard isolation levels, Oracle, PostgreSQL, and MySQL InnoDB engine use MVCC...
View ArticleHow does database pessimistic locking interact with INSERT, UPDATE, and...
Introduction Relational database systems employ various Concurrency Control mechanisms to provide transactions with ACID property guarantees. While isolation levels are one way of choosing a given...
View ArticleHow does a relational database work
Introduction While doing my High-Performance Java Persistence training, I came to realize that it’s worth explaining how a relational database works, as otherwise, it is very difficult to grasp many...
View ArticleA beginner’s guide to Linearizability
Introduction Linearizability is a lesser-known, yet omnipresent property of a data registry in the context of read and write operations that might happen concurrently. This article aims to explain what...
View ArticleA beginner’s guide to Serializability
Introduction In this article, we are going to see what Serializability means and what guarantees does it offer. Relational database systems provide a Serializable isolation level that’s supposed to...
View ArticleThe race condition that led to Flexcoin bankruptcy
Introduction It’s hard to imagine that a race condition bug could lead to the bankruptcy of a given online service, isn’t it? In this article, I’m going to show you how a race condition led to the...
View ArticleSpring Transaction Best Practices
Introduction In this article, I’m going to show you various Spring Transaction Best Practices that can help you achieve the data integrity guarantees required by the underlying business requirements....
View Article