Preventing Safety Risks in Leases

Explore how fencing prevents issues with distributed leases.

We'll cover the following

Fencing

Fencing is a simple technique used to prevent safety risks in leases.

Purpose

The main idea of fencing is to allow the system to block some nodes from performing some operations when these nodes are malfunctioning.

Note: In our previous example, nodes are malfunctioning in the sense that they think they hold a lease, while they don’t.

How it works

The locking subsystem can associate every lease with a monotonically increasing number. All the other systems can then use this number to keep track of the node that has performed an operation with the most recent lease. If a node with an older lease attempts to perform an operation, the system can detect that and reject it while also notifying the node that it’s not the lease owner anymore. The following illustration shows how fencing would work in practice:

Get hands-on with 1400+ tech skills courses.