Sdaas / SnapshotIsolationDemo

Demonstration of Snapshot Isolation using MVCC (Multi-Version Concurrency Control)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

This application shows a simple implementation of Snapshot Isolation.

From wikipedia - "snapshot isolation is a guarantee that all reads made in a transaction will see a consistent snapshot of the database (in practice it reads the last committed values that existed at the time it started), and the transaction itself will successfully commit only if no updates it has made conflict with any concurrent updates made since that snapshot."

Important Files

  • Transaction : Keep track of maximum committed transaction and all transactions that were in flight when this was created.
  • TransactionManager : generates new transactions, and keeps track of transactions in flight.
  • Account : A record in the data store. Keeps a versioned history of its balances.
  • AccountEntry : A single entry in an Account's history.
  • Bank : Contains a collection of accounts and provides methods to transfer money.
  • BankDemo : Illustrates the effect of snapshot isolation.

Instructions

  • mvn clean
  • mvn install
  • export CLASSPATH="target/SnapshotIsolationDemo-1.0-SNAPSHOT.jar"
  • java com.daasworld.BankDemo

References

About

Demonstration of Snapshot Isolation using MVCC (Multi-Version Concurrency Control)


Languages

Language:Java 100.0%