Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure: Java FileSystem Primitives for Implementing Database Persistence

Tags:

java

clojure

Context

This is purely for education purposes. I want to write a primitive database. Focus is NOT on performance; but just the principles behind databases. I have material already on locking / mutexes / transactions. What I know nothing about is writing to disk / guaranteeing persistence in unexpected hardware (say power) failures.

In order to have proper recovery / persistence, I need certain guarantees when writing files to disk.

Question:

For the above purposes, what types of file primitives (guarantees that file is written to disk? leaving a file open and appending to the log?) do I need? What does the JVM offer?

Thanks!


1 Answers

It's a huge area to talk about because of the many layers of abstraction surrounding discs these days, though from the JVM's perspective you pretty much depend on fsync to actually write your bits to disc once you call fsync you depend on these bits being on the disc. the rest is built on this.

like image 175
Arthur Ulfeldt Avatar answered Mar 28 '26 16:03

Arthur Ulfeldt