jepsen.lazyfs

Lazyfs allows the injection of filesystem-level faults: specifically, losing data which was written to disk but not fsynced. This namespace lets you mount a specific directory as a lazyfs filesystem, and offers a DB which mounts/unmounts it, and downloads the lazyfs log file–this can be composed into your own database. You can then call lose-unfsynced-writes! as a part of your database’s db/kill! implementation, likely after killing your DB process itself.

bin

The lazyfs binary

checkpoint!

(checkpoint! db-or-lazyfs-map)

Forces the given lazyfs map or DB to flush writes to disk.

commit

What version should we check out and build?

config

(config {:keys [log-file fifo fifo-completed cache-size]})

The lazyfs config file text. Takes a lazyfs map

db

(db dir-or-lazyfs)

Takes a directory or a lazyfs map and constructs a DB whose setup installs lazyfs and mounts the given lazyfs dir.

dir

Where do we install lazyfs to on the remote node?

fifo!

(fifo! {:keys [user fifo fifo-completed]} cmd)

Sends a string to the fifo channel for the given lazyfs map.

fuse-dev

The path to the fuse device.

install!

(install!)

Installs lazyfs on the currently-bound remote node.

lazyfs

(lazyfs x)

Takes a directory as a string, or a map of options, or a full lazyfs map, which is passed through unaltered. Constructs a lazyfs map of all the files we need to run a lazyfs for a directory. Map options are:

:dir The directory to mount :user Which user should run lazyfs? Default “root”. :chown Who to set as the owner of the directory. Defaults to “:” :cache-size The size of the lazyfs page cache. Should be a string like “0.5GB”

lose-unfsynced-writes!

(lose-unfsynced-writes! db-or-lazyfs-map)

Takes a lazyfs map or a lazyfs DB. Asks the local node to lose any writes to the given lazyfs map which have not been fsynced yet.

mount!

(mount! {:keys [dir data-dir lazyfs-dir chown user config-file log-file], :as lazyfs})

Takes a lazyfs map, creates directories and config files, and starts the lazyfs daemon. You likely want to call this before beginning database setup. Returns the lazyfs map.

nemesis

(nemesis lazyfs)

A nemesis which inject faults into the given lazyfs map by writing to its fifo. Types of faults (:f) supported:

:lose-unfsynced-writes

Forgets any writes which were not fsynced. The
:value should be a list of nodes you'd like to lose un-fsynced writes on.

You don’t necessarily need to use this–I haven’t figured out how to integrate it well into jepsen.nemesis combined. Once we start getting other classes of faults it will probably make sense for this nemesis to get more use and expand.

real-extension

When we mount a lazyfs directory, it’s backed by a real directory on the underlying filesystem: e.g. ‘foo’ is backed by ‘foo.real’. We name this directory using this extension.

repo-url

Where can we clone lazyfs from?

start-daemon!

(start-daemon! opts)

Starts the lazyfs daemon once preparation is complete. We daemonize ourselves so that we can get logs–also it looks like the built-in daemon might not work right now.

umount!

(umount! {:keys [lazyfs-dir dir], :as lazyfs})

Stops the given lazyfs map and destroys the lazyfs directory. You probably want to call this as a part of database teardown.