{"repo":"Adarsh-Kmt/DragonDB","free":true,"listed":false,"github":"https://github.com/Adarsh-Kmt/DragonDB","clone":"git clone https://github.com/Adarsh-Kmt/DragonDB.git","description":"A B+ Tree based database storage engine, written in Go.","language":"Go","stars":12,"topics":["database","golang","buffer-pool-manager","slotted-page","b-plus-tree","write-ahead-log"],"license":null,"category":"databases-storage","readme_excerpt":"DragonDB A B+ Tree based database storage engine, written in Go. Check out my substack, where I'll be explaining how I built it, layer by layer. Features - Create multiple B+ trees. - Allows multiple concurrent readers or single exclusive writer per B+ tree. - Uses a slotted page format to represent B+ Tree nodes with support for variable-size records and compaction. - Uses a buffer pool manager with an LRU eviction policy to cache database pages in memory. - Direct I/O is used to bypass the kernel page cache and read/write data directly to disk, improving memory efficiency and giving the database full control over caching. - Integrated a Write Ahead Log. Page level modifications are logged before persistence and replayed during crash recovery. Architecture Checkout architecture.md for an overview. Installation and Setup Prerequisites - Go 1.19 or higher - POSIX-compliant operating system (Linux, macOS) Clone and Build Technical Challenges Solved 1. Duplicate Page Fetching Problem : When multiple threads simultaneously try to read the same page from disk, duplicate copies of the page are created in memory. Solution : Use a double-checked locking pattern: - Acquire read lock and check if page exists in memory. - If not, release read lock and acquire write lock. - Re-check condition under write lock to make sure another thread didn't make a copy of the page before write lock could be acquired. - Only one copy of the page exists in memory. 2. Resource Leaks in Error Paths Proble","default_branch":null,"files":null,"tree":[],"storefront":"/r/Adarsh-Kmt","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Adarsh-Kmt/DragonDB/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}