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:20260328T043000Z
DTEND:20260328T110000Z
DTSTAMP:20260415T000403Z
UID:session/6HKPTdhunqeoqQhr8xLJ1q@hasgeek.com
SEQUENCE:17
CREATED:20260204T071512Z
DESCRIPTION:# 🧱 Workshop: Building a Distributed Transactional Database
 \n\n## 🎯 Target Audience\n\n* Senior engineers with a background in dis
 tributed systems\, transactions\, and concurrency control\n* Enthusiasts w
 ho want to understand how transactions work in distributed databases\n\n--
 -\n\n## 📘 Abstract\n\nThis workshop explores the design space of global
 ly consistent transactional databases by incrementally building a distribu
 ted **Multi-Version Concurrency Control (MVCC)** key-value store using **H
 ybrid Logical Clocks (HLC)**.\n\nParticipants will implement **Snapshot Is
 olation (SI)** and examine how **strongly consistent reads** can be achiev
 ed under bounded clock skew without hardware-assisted time like TrueTime\,
  using uncertainty detection and restart techniques.\n\nThe workshop empha
 sizes:\n\n* Correctness invariants\n* Timestamp ordering\n* Trade-offs bet
 ween commit-wait and retry-based designs\n\nIt provides a unified conceptu
 al framework for understanding systems such as **Google Spanner\, Cockroac
 hDB\, and YugabyteDB**. \n\n---\n\n## ✅ Learning outcomes\n\nBy the end 
 of the workshop\, participants will be able to:\n\n* Reason about time\, o
 rdering\, and causality in distributed databases\n* Implement Hybrid Logic
 al Clocks\n* Build an MVCC storage engine on top of a RocksDB-like store\n
 * Implement Snapshot Isolation\n* Achieve linearizable reads under bounded
  clock skew\n* Understand the limits of clock-based approaches\n\n---\n\n#
 # 📋 Prerequisites\n\n* Java 21+\n* Basic understanding of distributed s
 ystems\n\n---\n\n## 🔗 Resources\n\n* **Repository:** [https://github.co
 m/unmeshjoshi/hybridclocktxn](https://github.com/unmeshjoshi/hybridclocktx
 n)\n* **Framework:** Tickloom – [https://github.com/unmeshjoshi/tickloom
 ](https://github.com/unmeshjoshi/tickloom)\n  *(Used for determinism and s
 imulation testing)*\n\n---\n\n# 🧩 Workshop Modules\n\n---\n\n## Module 
 1: Time and Order in Distributed Systems (60 minutes)\n\n### 🎯 Objectiv
 e\n\nUnderstand why physical clocks fail and implement Hybrid Logical Cloc
 ks.\n\n### 📚 Concepts\n\n* Physical clock drift and NTP limitations\n* 
 Logical clocks (Lamport) and causality\n* Hybrid Logical Clocks (HLC): com
 bining physical time with logical ticks\n\n### 💻 Coding Tasks\n\n#### 1
 . Implement `HybridTimestamp`\n\nValue object holding:\n\n* `wallClockTime
 `\n* `logicalTicks`\n* Comparison logic\n\n#### 2. Implement `HybridClock`
 \n\n* `now()`\n* Handling physical time updates\n* Handling same-milliseco
 nd logical ticks\n* `tick(remoteTime)` (Lamport rule)\n* MAX_OFFSET sanity
  checks\n\n### 📁 Artifacts\n\n* `src/main/java/org/example/txn/HybridTi
 mestamp.java`\n* `src/main/java/org/example/txn/HybridClock.java`\n\n---\n
 \n## Module 2: The Storage Layer with RocksDB (60 minutes)\n\n### 🎯 Obj
 ective\n\nBuild a versioned key-value store using RocksDB.\n\n### 📚 Con
 cepts\n\n* LSM Trees and RocksDB basics\n* MVCC mapping\n* Key design: `Us
 erKey + Timestamp (descending) → Value`\n* Why descending timestamps ena
 ble efficient latest-version seeks\n* Iterators\, scan\, reverseScan\n\n##
 # 💻 Coding Tasks\n\n#### 1. Implement `MVCCStore`\n\n* `put(key\, times
 tamp\, value)`\n  → `rocksDB.put(serialize(key\, timestamp)\, value)`\n\
 n* `get(key\, readTimestamp)`\n  → `rocksDB.seek(serialize(key\, readTim
 estamp))`\n\n**Challenge:** efficient memcomparable key encoding.\n\n#### 
 2. Refactor\n\nReplace `ConcurrentSkipListMap` with `RocksDBManager`.\n\n#
 ## 📁 Artifacts\n\n* `src/main/java/org/example/txn/MVCCStore.java`\n* `
 src/main/java/org/example/txn/RocksDBStorage.java`\n\n---\n\n## Module 3: 
 Transactions and Snapshot Isolation (60 minutes)\n\n### 🎯 Objective\n\n
 Implement transaction lifecycle and Snapshot Isolation.\n\n### 📚 Concep
 ts\n\n* Snapshot reads at `T_start`\n* Write intents and buffering\n* Tran
 saction states: Running\, Committed\, Aborted\n* Atomic commit and visibil
 ity\n\n### 💻 Coding Tasks\n\n#### Read Path\n\n* Read at `T_read`\n* Re
 solve intents:\n\n  * If intent is mine → read\n  * If intent is other:\
 n\n    * Committed < `T_read` → visible\n    * Committed > `T_read` → 
 ignore\n    * Aborted / Pending → ignore\n\n#### Write Path\n\n* Write i
 ntent with TxnId\n* Detect write–write conflicts\n* Check committed vers
 ions newer than `T_start`\n\n#### Commit Path\n\n* `commit(txnId)`\n* Mark
  COMMITTED with `T_commit`\n* Apply intents asynchronously\n\n### 📁 Art
 ifacts\n\n* `TxnClient.java`\n* `TransactionRecord.java`\n\n---\n\n## Modu
 le 4: Distributed Consistency — Clock-Bound Wait (60 minutes)\n\n### 
 🎯 Objective\n\nAchieve external consistency using HLC.\n\n### 📚 Conc
 epts\n\n* Clock skew & uncertainty window\n\n```\nT_now ∈ [T_now - ε\, 
 T_now + ε]\n```\n\n* Why causal transactions may appear in the future\n* 
 Commit-wait vs restart strategies\n\n### 💻 Coding Tasks\n\n1. Simulate 
 uncertainty (`MAX_CLOCK_SKEW`)\n2. Detect commits in uncertainty window\n\
 n```\nT_commit ∈ [T_read - ε\, T_read]\n```\n\n3. Trigger read restart 
 with `T_restart = T_commit + ε`\n4. Client retry logic\n\n### 📁 Artifa
 cts\n\n* `StorageReplica.java` (handleRead updates)\n* `TxnClient.java` (r
 etry logic)\n\n---\n\n## Module 5: Putting It All Together (30 minutes)\n\
 n### 🎯 Objective\n\nRun end-to-end simulations.\n\n### ▶ Tasks\n\n* R
 un `StorageReplicaCommitTest` (Snapshot Isolation)\n* Run `ClockBoundWaitT
 est` (External Consistency)\n\n### About the instructor\n**Unmesh Joshi** 
 is a Distinguished Engineer at Thoughtworks. He is a software architecture
  enthusiast\, who believes that understanding principles of distributed sy
 stems is as essential today as understanding web architecture or object-or
 iented programming was in the last decade. For the last two years he has b
 een publishing patterns of distributed systems on martinfowler.com. \n**In
  2023\, he authored the [book Patterns of Distributed Systems](https://www
 .amazon.com/Patterns-Distributed-Systems-Addison-wesley-Signature/dp/01382
 21987) published by Addison Wesley Professional.** This book is an essenti
 al catalog of patterns aimed at enhancing comprehension\, communication an
 d education on distributed system design\nHe has also conducted various tr
 aining sessions around this topic. Twitter: [@unmeshjoshi](https://x.com/u
 nmeshjoshi)\n\n### How to attend this workshop\nThis workshop is open for 
 participation to [Rootconf annual members](https://hasgeek.com/rootconf#me
 mberships).\nThis workshop is open to 30 participants only. Seats will be 
 available on first-come-first-serve basis. 🎟️\n\n### Contact informat
 ion ☎️\nFor inquiries about the workshop\, contact +91-7676332020 or w
 rite to info@hasgeek.com
LAST-MODIFIED:20260413T053744Z
LOCATION:Pune - https://hasgeek.com/rootconf/building-a-distributed-transa
 ctional-database/
ORGANIZER;CN=Rootconf:MAILTO:no-reply@hasgeek.com
URL:https://hasgeek.com/rootconf/building-a-distributed-transactional-data
 base/
BEGIN:VALARM
ACTION:display
DESCRIPTION:Building a distributed transactional database in 5 minutes
TRIGGER:-PT5M
END:VALARM
END:VEVENT
END:VCALENDAR
