Skip to content

Instantly share code, notes, and snippets.

View haikuginger's full-sized avatar

Jess Shapiro haikuginger

View GitHub Profile
@quinthar
quinthar / gist:31d8e58aac8432426cadd2f71496d984
Last active December 14, 2020 19:09
Explanation of how a cluster might do multi-leader replicated transactions using vector clocks

Explanation of how a cluster might do multi-leader replicated transactions using vector clocks

BedrockDB is a highly distributed, WAN-replicated, fault-tolerant database: read BedrockDB.com for more. Of particular relevance to this Gist, the design is such that the client (eg, webserver) sends every "command" (ie, to trigger a stored procedure written in C++ on the Bedrock node) to any node in the cluster -- the client needn't treat any node special. However, in practice one of the nodes is very special: it is the "leader", which coordinates distributed two-phase commit transactions.

Problem:

In practice the extra burden upon the leader isn't normally material: most commands that generate write activity generate roughtly the same number of "extra" queries on the leader and follower -- after all, anything that changes the database needs to be replicated out to followers using the same queries. However, there are some write commands that do a tremendous amount of "extra