Questions about LeaderLease, delayed propagation across nodes, and replica selection

  1. I wanted to manually change the leader for a range, and I found there is a command called “LeaderLease”. How could I use this?

  2. Can raft leader delay the propagation of the updated value? Sometimes, I want to be able to just write at one instance (leader) to make write operation faster.

  3. Is it possible for me to choose which instances will have replicas?

  4. If I run cockroachdb with only one instance… would raft still be used in order to update a value?

@tobias

  1. LeaderLease is an internal command. It’s not available for external use, though we’re working on a leadership transfer mechanism (https://github.com/cockroachdb/cockroach/pull/6999). We also don’t have plans to expose that directly (but we may instead offer something like a preferred leadership location via zone configs), but please do let us know what you’re trying to do.

  2. No, not currently, but having asynchronous followers is something we may consider at later stages in the development. It’s not terribly difficult to implement in Raft (it amounts to adding non-voting replicas).

  3. Yes, that is handled through zone configs. More precisely, you can specify free-text attributes for each node (such as location, type, …) and then configure the zone configs so that they ask for certain attributes for the replicas of your data. See https://www.cockroachlabs.com/docs/configure-replication-zones.html (I think there’s an open issue for that, so something may not work at the moment - in any case, that’s how it should work).

  4. When you run a single node, Raft will still be used. We could optimize that away for performance, but for now we’ve shied away from making a single-node cluster behave differently from most “real” deployments (which are mostly going to be multi-node).