BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//HasGeek//NONSGML Funnel//EN
DESCRIPTION:Design MVCC databases with real-world consistency guarantees
X-WR-CALDESC:Design MVCC databases with real-world consistency guarantees
NAME:Building a distributed transactional database
X-WR-CALNAME:Building a distributed transactional database
REFRESH-INTERVAL;VALUE=DURATION:PT12H
SUMMARY:Building a distributed transactional database
TIMEZONE-ID:Asia/Kolkata
X-PUBLISHED-TTL:PT12H
X-WR-TIMEZONE:Asia/Kolkata
BEGIN:VEVENT
SUMMARY:Building a distributed transactional database
DTSTART:20260509T041500Z
DTEND:20260509T120000Z
DTSTAMP:20260419T102455Z
UID:session/D51MxpodyjpEC7e5KXqVvq@hasgeek.com
SEQUENCE:5
CREATED:20260413T053739Z
DESCRIPTION:# 🧱 Workshop: Building a Distributed Transactional Database
 \n\n## 🎯 Target Audience\n* Senior engineers with a background in distr
 ibuted systems\, transactions\, and concurrency control\n* Enthusiasts who
  want to understand how transactions work in distributed databases\n\n---\
 n\n## 📘 Workshop overview\nThis workshop explores the design space of g
 lobally consistent transactional databases by incrementally building a dis
 tributed **Multi-Version Concurrency Control (MVCC)** key-value store usin
 g **Hybrid Logical Clocks (HLC)**.\n\nParticipants will implement **Snapsh
 ot Isolation (SI)** and examine how **strongly consistent reads** can be a
 chieved under bounded clock skew without hardware-assisted time like TrueT
 ime\, using uncertainty detection and restart techniques.\n\nThe workshop 
 emphasizes:\n* Correctness invariants\n* Timestamp ordering\n* Trade-offs 
 between commit-wait and retry-based designs\n\nIt provides a unified conce
 ptual framework for understanding systems such as **Google Spanner\, Cockr
 oachDB\, and YugabyteDB**. \n\n---\n\n## ✅ Learning outcomes\nBy the end
  of the workshop\, participants will be able to:\n\n* Reason about time\, 
 ordering\, and causality in distributed databases\n* Implement Hybrid Logi
 cal Clocks\n* Build an MVCC storage engine on top of a RocksDB-like store\
 n* Implement Snapshot Isolation\n* Achieve linearizable reads under bounde
 d clock skew\n* Understand the limits of clock-based approaches\n\n---\n\n
 ## 📋 Prerequisites\n* Java 21+\n* Basic understanding of distributed sy
 stems\n\n---\n\n## 🔗 Resources\n* **Repository:** [https://github.com/u
 nmeshjoshi/hybridclocktxn](https://github.com/unmeshjoshi/hybridclocktxn)\
 n* **Framework:** Tickloom – [https://github.com/unmeshjoshi/tickloom](h
 ttps://github.com/unmeshjoshi/tickloom)\n  *(Used for determinism and simu
 lation testing)*\n\n---\n\n# 🧩 Workshop Modules\n## Module 1: Time and 
 Order in Distributed Systems (60 minutes)\n\n### 🎯 Objective\nUnderstan
 d why physical clocks fail and implement Hybrid Logical Clocks.\n\n### 
 📚 Concepts\n* Physical clock drift and NTP limitations\n* Logical clock
 s (Lamport) and causality\n* Hybrid Logical Clocks (HLC): combining physic
 al time with logical ticks\n\n### 💻 Coding Tasks\n\n#### 1. Implement `
 HybridTimestamp`\nValue object holding:\n* `wallClockTime`\n* `logicalTick
 s`\n* Comparison logic\n\n#### 2. Implement `HybridClock`\n* `now()`\n* Ha
 ndling physical time updates\n* Handling same-millisecond logical ticks\n*
  `tick(remoteTime)` (Lamport rule)\n* MAX_OFFSET sanity checks\n\n### 📁
  Artifacts\n* `src/main/java/org/example/txn/HybridTimestamp.java`\n* `src
 /main/java/org/example/txn/HybridClock.java`\n\n---\n\n## Module 2: The St
 orage Layer with RocksDB (60 minutes)\n### 🎯 Objective\nBuild a version
 ed key-value store using RocksDB.\n\n### 📚 Concepts\n* LSM Trees and Ro
 cksDB basics\n* MVCC mapping\n* Key design: `UserKey + Timestamp (descendi
 ng) → Value`\n* Why descending timestamps enable efficient latest-versio
 n seeks\n* Iterators\, scan\, reverseScan\n\n### 💻 Coding Tasks\n\n####
  1. Implement `MVCCStore`\n* `put(key\, timestamp\, value)`\n  → `rocksD
 B.put(serialize(key\, timestamp)\, value)`\n\n* `get(key\, readTimestamp)`
 \n  → `rocksDB.seek(serialize(key\, readTimestamp))`\n\n**Challenge:** e
 fficient memcomparable key encoding.\n\n#### 2. Refactor\nReplace `Concurr
 entSkipListMap` with `RocksDBManager`.\n\n### 📁 Artifacts\n* `src/main/
 java/org/example/txn/MVCCStore.java`\n* `src/main/java/org/example/txn/Roc
 ksDBStorage.java`\n\n---\n\n## Module 3: Transactions and Snapshot Isolati
 on (60 minutes)\n### 🎯 Objective\nImplement transaction lifecycle and S
 napshot Isolation.\n\n### 📚 Concepts\n* Snapshot reads at `T_start`\n* 
 Write intents and buffering\n* Transaction states: Running\, Committed\, A
 borted\n* Atomic commit and visibility\n\n### 💻 Coding Tasks\n\n#### Re
 ad Path\n* Read at `T_read`\n* Resolve intents:\n\n  * If intent is mine 
 → read\n  * If intent is other:\n    * Committed < `T_read` → visible\
 n    * Committed > `T_read` → ignore\n    * Aborted / Pending → ignore
 \n\n#### Write Path\n* Write intent with TxnId\n* Detect write–write con
 flicts\n* Check committed versions newer than `T_start`\n\n#### Commit Pat
 h\n* `commit(txnId)`\n* Mark COMMITTED with `T_commit`\n* Apply intents as
 ynchronously\n\n### 📁 Artifacts\n* `TxnClient.java`\n* `TransactionReco
 rd.java`\n\n---\n\n## Module 4: Distributed Consistency — Clock-Bound Wa
 it (60 minutes)\n\n### 🎯 Objective\nAchieve external consistency using 
 HLC.\n\n### 📚 Concepts\n* Clock skew & uncertainty window\n\n```\nT_now
  ∈ [T_now - ε\, T_now + ε]\n```\n\n* Why causal transactions may appea
 r in the future\n* Commit-wait vs restart strategies\n\n### 💻 Coding Ta
 sks\n1. Simulate uncertainty (`MAX_CLOCK_SKEW`)\n2. Detect commits in unce
 rtainty window\n\n```\nT_commit ∈ [T_read - ε\, T_read]\n```\n\n3. Trig
 ger read restart with `T_restart = T_commit + ε`\n4. Client retry logic\n
 \n### 📁 Artifacts\n* `StorageReplica.java` (handleRead updates)\n* `Txn
 Client.java` (retry logic)\n\n---\n\n## Module 5: Putting It All Together 
 (30 minutes)\n\n### 🎯 Objective\nRun end-to-end simulations.\n\n### ▶
  Tasks\n* Run `StorageReplicaCommitTest` (Snapshot Isolation)\n* Run `Cloc
 kBoundWaitTest` (External Consistency)\n\n### About the instructor - Unmes
 h Joshi\n**Unmesh Joshi** is a Distinguished Engineer at Thoughtworks. He 
 is a software architecture enthusiast\, who believes that understanding pr
 inciples of distributed systems is as essential today as understanding web
  architecture or object-oriented programming was in the last decade. For t
 he last two years he has been publishing patterns of distributed systems o
 n martinfowler.com. \n**In 2023\, he authored the [book Patterns of Distri
 buted Systems](https://www.amazon.com/Patterns-Distributed-Systems-Addison
 -wesley-Signature/dp/0138221987) published by Addison Wesley Professional.
 ** This book is an essential catalog of patterns aimed at enhancing compre
 hension\, communication and education on distributed system design\nHe has
  also conducted various training sessions around this topic. Twitter: [@un
 meshjoshi](https://x.com/unmeshjoshi)\n\n### How to attend this workshop\n
 This workshop will be held online (_via Zoom_)\, and is open for [Rootconf
  annual members](https://hasgeek.com/rootconf#memberships).\nThis workshop
  is open to 30 participants only. Seats will be available on first-come-fi
 rst-serve basis. 🎟️\n\n### Contact information ☎️\nFor inquiries 
 about the workshop\, contact +91-7676332020 or write to info@hasgeek.com
LAST-MODIFIED:20260413T054208Z
LOCATION:Online - https://hasgeek.com/rootconf/building-distributed-transa
 ctional-database-online/
ORGANIZER;CN=Rootconf:MAILTO:no-reply@hasgeek.com
URL:https://hasgeek.com/rootconf/building-distributed-transactional-databa
 se-online/
BEGIN:VALARM
ACTION:display
DESCRIPTION:Building a distributed transactional database in 5 minutes
TRIGGER:-PT5M
END:VALARM
END:VEVENT
END:VCALENDAR
