jepsen.db

Allows Jepsen to set up and tear down databases.

cycle!

(cycle! test)

Takes a test, and tears down, then sets up, the database on all nodes concurrently.

If any call to setup! or setup-primary! throws :type ::setup-failed, we tear down and retry the whole process up to cycle-tries times.

cycle-tries

How many tries do we get to set up a database?

DB

protocol

members

setup!

(setup! db test node)

Set up the database on this particular node.

teardown!

(teardown! db test node)

Tear down the database on this particular node.

Kill

protocol

This optional protocol supports starting and killing a DB’s processes.

members

kill!

(kill! db test node)

Forcibly kills the process

start!

(start! db test node)

Starts the process

log-files-map

(log-files-map db test node)

Takes a DB, a test, and a node. Returns a map of remote paths to local paths. Checks to make sure there are no duplicate local paths.

log-files used to return a sequence of remote paths, and some people are likely still assuming that form for composition. When they start e.g. concatenating maps into lists of strings, we’re going to get mixed representations. We try to make all this Just Work (TM).

LogFiles

protocol

members

log-files

(log-files db test node)

Returns either a.) a map of fully-qualified remote paths (on this DB node) to short local paths (in store/), or b.) a sequence of fully-qualified remote paths.

map-test

(map-test f db)

Wraps a DB in another DB which rewrites every test argument using (f test). Helpful for when you want to compose two DBs together that need different test parameters, like :version.

noop

Does nothing.

Pause

protocol

This optional protocol supports pausing and resuming a DB’s processes.

members

pause!

(pause! db test node)

Pauses the process

resume!

(resume! db test node)

Resumes the process

Primary

protocol

This optional protocol supports databases which have a notion of one (or more) primary nodes.

members

primaries

(primaries db test)

Returns a collection of nodes which are currently primaries. Best-effort is OK; in practice, this usually devolves to ‘nodes that think they’re currently primaries’.

setup-primary!

(setup-primary! db test node)

Performs one-time setup on a single node.

Process

protocol

tcpdump

(tcpdump opts)

A database which runs a tcpdump capture from setup! to teardown!, and yields a tcpdump logfile. Options:

:clients-only? If true, applies a filter string which yields only traffic from Jepsen clients, rather than capturing inter-DB-node traffic.

:filter A filter string to apply (in addition to ports). e.g. “host 192.168.122.1”, which can be helpful for seeing just client traffic from the control node.

:ports A collection of ports to grab traffic from.