Skip to content

Spring Boot + MS SQL + Docker Compose and demonstration of DB deadlock

Notifications You must be signed in to change notification settings

lu2/db-deadlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DB deadlock

This Spring Boot project shows how the deadlock in database can occur when data are written into 2 tables simultaneously and how can be prevented by locking the tables. Application doesn't do much - run JUnit tests to observe.

Prerequisites

  • Docker and Docker Compose
  • Java
  • Maven

Compiling and running the project

Run and setup MS SQL DB:

docker-compose up

Compile and run JUnit tests:

mvn clean test

All tests should pass. Check the difference between DbDeadLockingServiceTest.writeBothOppositeOrderAlphaBeta and DbNotDeadLockingServiceTest.writeBothOppositeOrderAlphaBeta - same test but one throws DB deadlock exception, the other one does not.

Cleanup:

docker-compose down

References

About

Spring Boot + MS SQL + Docker Compose and demonstration of DB deadlock

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages