Jepsen 0.3.7
Released under the Eclipse Public License
Distributed systems testing framework.
Installation
To install, add the following dependency to your project or build file:
[jepsen "0.3.7"]
Namespaces
jepsen.checker
Validates that a history is correct with respect to some model.
Public variables and functions:
- check-safe
- Checker
- clock-plot
- compose
- concurrency-limit
- counter
- expand-queue-drain-ops
- frequency-distribution
- latency-graph
- linearizable
- log-file-pattern
- merge-valid
- noop
- perf
- queue
- rate-graph
- set
- set-full
- set-full-add
- set-full-element
- set-full-element-results
- set-full-read-absent
- set-full-read-present
- set-full-results
- stats
- stats-fold
- total-queue
- unbridled-optimism
- unhandled-exceptions
- unique-ids
- valid-priorities
jepsen.checker.perf
Supporting functions for performance analysis.
Public variables and functions:
- broaden-range
- bucket-points
- bucket-scale
- bucket-time
- buckets
- completions-by-f-type
- default-nemesis-color
- first-time
- fs->points
- has-data?
- interval->times
- invokes-by-f
- invokes-by-f-type
- invokes-by-type
- latencies->quantiles
- latency-point
- latency-preamble
- legend-part
- nemesis-activity
- nemesis-alpha
- nemesis-lines
- nemesis-ops
- nemesis-regions
- nemesis-series
- plot!
- point-graph!
- preamble
- qs->colors
- quantiles
- quantiles-graph!
- rate
- rate-graph!
- rate-preamble
- type->color
- types
- with-nemeses
- with-range
- without-empty-series
jepsen.checker.timeline
Renders an HTML timeline of a history.
jepsen.cli
Command line interface. Provides a default main method for common Jepsen functions (like the web interface), and utility functions for Jepsen tests to create their own test runners.
Public variables and functions:
- -main
- default-nodes
- help-opt
- merge-opt-specs
- one-of
- package-opt
- parse-concurrency
- parse-nodes
- rename-keys
- rename-options
- rename-ssh-options
- repeated-opt
- run!
- serve-cmd
- single-test-cmd
- tarball-opt
- test-all-cmd
- test-all-exit!
- test-all-print-summary!
- test-all-run-tests!
- test-opt-fn
- test-opt-spec
- test-usage
- validate-tarball
jepsen.codec
Serializes and deserializes objects to/from bytes.
jepsen.control
Provides control over a remote node. There’s a lot of dynamically bound state in this namespace because we want to make it as simple as possible for scripts to open connections to various nodes.
Public variables and functions:
- &&
- *dir*
- *dummy*
- *host*
- *password*
- *port*
- *private-key-path*
- *remote*
- *retries*
- *session*
- *strict-host-key-checking*
- *sudo*
- *sudo-password*
- *trace*
- *username*
- cd
- clj-ssh
- cmd-context
- conn-spec
- debug-data
- disconnect
- download
- env
- escape
- exec
- exec*
- expand-path
- file->path
- just-stdout
- lit
- on
- on-many
- on-nodes
- session
- ssh
- ssh*
- su
- sudo
- throw-on-nonzero-exit
- trace
- upload
- upload-resource!
- with-remote
- with-session
- with-ssh
- with-test-nodes
- wrap-cd
- wrap-sudo
- wrap-trace
- |
jepsen.control.clj-ssh
A CLJ-SSH powered implementation of the Remote protocol.
Public variables and functions:
jepsen.control.core
Provides the base protocol for running commands on remote nodes, as well as common functions for constructing and evaluating shell commands.
jepsen.control.docker
The recommended way is to use SSH to setup and teardown databases. It’s however sometimes conveniet to be able to setup and teardown the databases using docker exec
and docker cp
instead, which is what this namespace helps you do.
Public variables and functions:
jepsen.control.k8s
The recommended way is to use SSH to setup and teardown databases. It’s however sometimes conveniet to be able to setup and teardown the databases using kubectl
instead, which is what this namespace helps you do. Use at your own risk, this is an unsupported way of running Jepsen.
jepsen.control.retry
SSH client libraries appear to be near universally-flaky. Maybe race conditions, maybe underlying network instability, maybe we’re just doing it wrong. For whatever reason, they tend to throw errors constantly. The good news is we can almost always retry their commands safely! This namespace provides a Remote which wraps an underlying Remote in a jepsen.reconnect wrapper, catching certain exception classes and ensuring they’re automatically retried.
Public variables and functions:
jepsen.control.scp
Built-in JDK SSH libraries can be orders of magnitude slower than plain old SCP for copying even medium-sized files of a few GB. This provides a faster implementation of a Remote which shells out to SCP.
Public variables and functions:
jepsen.control.sshj
An sshj-backed control Remote. Experimental; I’m considering replacing jepsen.control’s use of clj-ssh with this instead.
Public variables and functions:
jepsen.control.util
Utility functions for scripting installations.
jepsen.core
Entry point for all Jepsen tests. Coordinates the setup of servers, running tests, creating and resolving failures, and interpreting results.
jepsen.db
Allows Jepsen to set up and tear down databases.
jepsen.faketime
Libfaketime is useful for making clocks run at differing rates! This namespace provides utilities for stubbing out programs with faketime.
Public variables and functions:
jepsen.fs-cache
Some systems Jepsen tests are expensive or time-consuming to set up. They might involve lengthy compilation processes, large packages which take a long time to download, or allocate large files on initial startup.
Public variables and functions:
jepsen.generator
Public variables and functions:
- all-processes
- all-threads
- any
- clients
- concat
- context
- cycle
- cycle-times
- delay
- dissoc-vec
- each-process
- each-thread
- each-thread-ensure-context-filters!
- extend-protocol-runtime
- f-map
- fill-in-op
- filter
- flip-flop
- fn-wrapper
- free-processes
- free-threads
- friendly-exceptions
- Generator
- init!
- initialized?
- limit
- log
- map
- mix
- nemesis
- on
- on-threads
- on-threads-context
- on-update
- once
- phases
- process->thread
- process-limit
- rand-int-seq
- rand-seq
- repeat
- reserve
- sleep
- some-free-process
- soonest-op-map
- stagger
- synchronize
- then
- thread->process
- time-limit
- trace
- tracking-get!
- until-ok
- validate
jepsen.generator.context
Generators work with an immutable context that tells them what time it is, what processes are available, what process is executing which thread and vice versa, and so on. We need an efficient, high-performance data structure to track this information. This namespace provides that data structure, and functions to alter it.
jepsen.generator.interpreter
This namespace interprets operations from a pure generator, handling worker threads, spawning processes for interacting with clients and nemeses, and recording a history.
Public variables and functions:
jepsen.generator.test
This namespace contains functions for testing generators. See the jepsen.generator-test
namespace in the test/
directory for a concrete example of how these functions can be used.
Public variables and functions:
jepsen.generator.translation-table
We burn a lot of time in hashcode and map manipulation for thread names, which are mostly integers 0…n, but sometimes non-integer names like :nemesis. It’s nice to be able to represent thread state internally as purely integers. To do this, we compute a one-time translation table which lets us map those names to integers and vice-versa.
Public variables and functions:
jepsen.independent
Some tests are expensive to check–for instance, linearizability–which requires we verify only short histories. But if histories are short, we may not be able to sample often or long enough to reveal concurrency errors. This namespace supports splitting a test into independent components–for example taking a test of a single register and lifting it to a map of keys to registers.
Public variables and functions:
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.
Public variables and functions:
jepsen.nemesis
Public variables and functions:
- bisect
- bitflip
- bitflip-dir
- bridge
- clock-scrambler
- complete-grudge
- compose
- f-map
- hammer-time
- invert-grudge
- majorities-ring
- majorities-ring-perfect
- majorities-ring-stochastic
- Nemesis
- node-start-stopper
- noop
- partition-halves
- partition-majorities-ring
- partition-random-halves
- partition-random-node
- partitioner
- Reflection
- set-time!
- split-one
- timeout
- truncate-file
- validate
jepsen.nemesis.combined
A nemesis which combines common operations on nodes and processes: clock skew, crashes, pauses, and partitions. So far, writing these sorts of nemeses has involved lots of special cases. I expect that the API for specifying these nemeses is going to fluctuate as we figure out how to integrate those special cases appropriately. Consider this API unstable.
Public variables and functions:
jepsen.nemesis.membership
EXPERIMENTAL: provides standardized support for nemeses which add and remove nodes from a cluster.
Public variables and functions:
jepsen.nemesis.membership.state
This namespace defines the protocol for nemesis membership state machines—how to find the current view from a node, how to merge node views together, how to generate, apply, and complete operations, etc.
Public variables and functions:
jepsen.nemesis.time
Functions for messing with time and clocks.
jepsen.net
Controls network manipulation.
jepsen.net.proto
Protocols for network manipulation. High-level functions live in jepsen.net.
Public variables and functions:
jepsen.os.ubuntu
Common tasks for Ubuntu boxes. Tested against Ubuntu 18.04.
Public variables and functions:
jepsen.reconnect
Stateful wrappers for automatically reconnecting network clients.
Public variables and functions:
jepsen.role
Supports tests where each node has a single, distinct role. For instance, one node might run ZooKeeper, and the remaining nodes might run Kafka.
Public variables and functions:
jepsen.store
Persistent storage for test runs and later analysis.
Public variables and functions:
- all-tests
- base-dir
- class-name->ns-str
- close!
- console-appender
- default-edn-reader
- default-logging-overrides
- default-nonserializable-keys
- delete!
- delete-file-recursively!
- dir?
- edn-tag->constructor
- file-name
- fressian-file
- fressian-file!
- jepsen-file
- jepsen-file!
- latest
- load
- load-fressian-file
- load-jepsen-file
- load-results
- load-results-edn
- memoized-edn-tag->constructor
- memoized-load-results
- migrate-to-jepsen-format!
- nonserializable-keys
- path
- path!
- read-handlers
- save-0!
- save-1!
- save-2!
- serializable-test
- start-logging!
- stop-logging!
- symlink?
- test
- test-names
- tests
- update-current-symlink!
- update-symlink!
- update-symlinks!
- virtual-dir?
- with-handle
- with-out-file
- write-fressian!
- write-fressian-file!
- write-handlers
- write-history!
- write-jepsen!
- write-results!
jepsen.store.format
Jepsen tests are logically a map. To save this map to disk, we originally wrote it as a single Fressian file. This approach works reasonably well, but has a few problems:
Public variables and functions:
- append-to-big-vector-block!
- append-to-fressian-stream-block!
- assoc-block!
- big-vector-block-writer!
- big-vector-block-writer-worker!
- big-vector-chunk-size
- big-vector-count-size
- big-vector-index-size
- block-checksum
- block-checksum-given-data-checksum
- block-checksum-offset
- block-checksum-size
- block-header
- block-header-checksum
- block-header-for-data
- block-header-for-length-and-checksum!
- block-header-length
- block-header-size
- block-header-type
- block-id-size
- block-index-data-size
- block-index-offset-offset
- block-len-offset
- block-len-size
- block-offset-size
- block-ref
- block-references
- block-type->short
- block-type-offset
- block-type-size
- check-block-checksum
- check-magic
- check-version!
- close!
- copy!
- current-version
- find-references
- first-block-offset
- flush!
- fressian-buffer-size
- fressian-read-handlers
- fressian-stream-block-writer!
- fressian-write-handlers
- gc!
- IPartialMap
- large-region-size
- load-block-index!
- magic
- magic-offset
- magic-size
- new-block-id!
- next-block-offset
- open
- prep-read!
- prep-write!
- read-big-vector-block
- read-block-by-id
- read-block-by-offset
- read-block-by-offset*
- read-block-data
- read-block-header
- read-block-index-block
- read-block-index-offset
- read-file
- read-fressian-block
- read-fressian-stream-block
- read-partial-map-block
- read-root
- read-test
- set-block-header-checksum!
- set-block-header-length!
- set-block-header-type!
- set-root!
- short->block-type
- test-history-writer!
- version
- version-offset
- version-size
- write-big-vector-block!
- write-block!
- write-block-data!
- write-block-header!
- write-block-index!
- write-block-index-offset!
- write-file!
- write-fressian-block!
- write-fressian-block!*
- write-fressian-to-file!
- write-header!
- write-initial-test!
- write-partial-map-block!
- write-partial-map-block!*
- write-test!
- write-test-with-history!
- write-test-with-results!
jepsen.store.fressian
Supports serialization of various Jepsen datatypes via Fressian.
Public variables and functions:
jepsen.tests.adya
Generators and checkers for tests of Adya’s proscribed behaviors for weakly-consistent systems. See http://pmg.csail.mit.edu/papers/adya-phd.pdf
Public variables and functions:
jepsen.tests.bank
Helper functions for doing bank tests, where you simulate transfers between accounts, and verify that reads always show the same balance. The test map should have these additional options:
jepsen.tests.causal-reverse
Checks for a strict serializability anomaly in which T1 < T2, but T2 is visible without T1.
jepsen.tests.cycle
Tests based on transactional cycle detection via Elle. If you’re looking for code that used to be here, see elle.core.
Public variables and functions:
jepsen.tests.cycle.append
Detects cycles in histories where operations are transactions over named lists lists, and operations are either appends or reads. See elle.list-append for docs.
jepsen.tests.cycle.wr
A test which looks for cycles in write/read transactions. Writes are assumed to be unique, but this is the only constraint. See elle.rw-register for docs.
jepsen.tests.kafka
This workload is intended for systems which behave like the popular Kafka queue. This includes Kafka itself, as well as compatible systems like Redpanda.
Public variables and functions:
- allowed-error-types
- analysis
- around-key-offset
- around-key-value
- around-some
- assocv
- checker
- condense-error
- consume-counts
- crash-client-gen
- cycles!
- datafy-version-order-log
- downsample-plot
- duplicate-cases
- final-polls
- firstv
- g1a-cases
- graph
- index-seq
- int-poll-skip+nonmonotonic-cases
- int-poll-skip+nonmonotonic-cases-per-key
- int-send-skip+nonmonotonic-cases
- interleave-subscribes
- key-order-viz
- log->last-index->values
- log->value->first-index
- lost-write-cases
- mop-index
- must-have-committed?
- nonmonotonic-send-cases
- nth+
- op->max-offsets
- op->max-poll-offsets
- op->max-send-offsets
- op->thread
- op-around-key-offset
- op-around-key-value
- op-pairs
- op-read-offsets
- op-read-pairs
- op-reads
- op-reads-helper
- op-reads-index
- op-write-offsets
- op-write-pairs
- op-writes
- op-writes-helper
- plot-bounds
- plot-realtime-lag!
- plot-realtime-lags!
- plot-unseen!
- poll-skip+nonmonotonic-cases
- poll-skip+nonmonotonic-cases-per-process
- poll-unseen
- precommitted-read-cases
- previous-value
- readers-of
- reads-by-type
- reads-of-key
- reads-of-key-offset
- reads-of-key-value
- realtime-lag
- render-order-viz!
- secondv
- stats-checker
- strip-types
- tag-rw
- track-key-offsets
- txn-generator
- unseen
- version-orders
- version-orders-reduce-mop
- version-orders-update-log
- workload
- worst-realtime-lag
- wr-graph
- writer-of
- writes-by-type
- writes-of-key
- writes-of-key-offset
- writes-of-key-value
- ww-graph
jepsen.tests.linearizable-register
Common generators and checkers for linearizability over a set of independent registers. Clients should understand three functions, for writing a value, reading a value, and compare-and-setting a value from v to v’. Reads receive nil
, and replace it with the value actually read.
jepsen.tests.long-fork
Tests for an anomaly in parallel snapshot isolation (but which is prohibited in normal snapshot isolation). In long-fork, concurrent write transactions are observed in conflicting order. For example:
jepsen.util
Kitchen sink
Public variables and functions:
- *relative-time-origin*
- all-jdk-loggers
- arities
- await-fn
- buf-size
- chunk-vec
- coll
- compare<
- concat-files!
- contains-many?
- deepfind
- default
- drop-common-proper-prefix
- ex-root-cause
- exception?
- extreme-by*
- fast-last
- fcatch
- fixed-point
- forget!
- forgettable
- fraction
- get-named-lock!
- history->latencies
- inc*
- integer-interval-set-str
- lazy-atom
- letr
- letr-let-if
- letr-partition-bindings
- letr-rewrite-return
- linear-time-nanos
- local-time
- log
- log-op
- log-print
- logger
- longest-common-prefix
- majority
- map-keys
- map-kv
- map-vals
- max-by
- maybe-number
- meh
- min-by
- minority-third
- ms->nanos
- mute
- mute-jdk
- name+
- named-locks
- nanos->ms
- nanos->secs
- nemesis-intervals
- nil-if-empty
- op->str
- parse-long
- partition-by-vec
- poly-compare
- polysort
- pprint-str
- print-history
- prn-op
- processors
- pwrite-history!
- rand-distribution
- rand-exp
- rand-nth-empty
- random-nonempty-subset
- real-pmap
- relative-time-nanos
- retry
- secs->nanos
- sequential
- sh
- sleep
- spy
- test->str
- time-
- timeout
- uninteresting-exceptions
- with-named-lock
- with-relative-time
- with-retry
- with-thread-name
- write-history!
jepsen.web
Web server frontend for browsing test results.
Public variables and functions:
- app
- assert-file-in-scope!
- basic-date-time
- clj-escape
- colors
- content-type
- dir
- dir-cell
- dir-sort
- e404
- fast-tests
- file-cell
- file-url
- files
- home
- js-escape
- page-limit
- params
- parse-time
- relative-path
- serve!
- test-cache
- test-cache-key
- test-cache-mutable-window
- test-header
- test-row
- url
- url-encode-path-components
- valid-color
- zip
- zip-path!