Ayende @ Rahien

It's a girl

Transitive Replication in RavenDB

TLDR;

Replication topologies make my head hurt.

One of our customers had an interesting requirement, several months ago:

image

Basically, he wanted to write a document at node #1, and have it replicate, through node #2, to node #3. That was an easy enough change, and we did that. But then we got another issue from a different customer, who had the following topology:

image

And that client problem is that when making a write to node #1, it would be replicated to nodes 2 – 4, each of which would then try to update the other two with the new replication information (it would skip node #1 because it is the source). That would cause… issues, because they already had that document in place.

In order to resolve that, I added a configuration option, which controls whatever the node that we replicate to should receive only documents that were modified on the current node, or whatever we need to include documents that were replicated to us from other nodes as well.

It is a relatively small change, code wise. Of course, documenting this, and all of the options that follows is going to be a much bigger task, because now you have to make a distinction between replicating nodes, gateway nodes, etc.

Tags:

Posted By: Ayende Rahien

Published at

Originally posted at

Comments

Rafal
12/23/2011 10:50 AM by
Rafal

I wonder if these customers REALLY needed bi-directional replication. This is not a very common setup and chances are they could have designed it in a better way - witho only one direction of replication and without cycles.

Maybe this should be handled like a pub/sub message distribution in message bus - each document type has its master/origin database where it can be inserted and updated and all other databases are only allowed to take read-only replicas of that document from the master. And a 'slave' for one document type can be a master of another type.

PS your captchas are barely readable or I'm just a computer programmed to consider itself a human

Dave
12/23/2011 11:30 AM by
Dave

@Rafal - It's the google one that helps to read old book texts. One of the words is the real captcha the other is a word that you are helping to decode. But you are right they are a pita.

Valeriu Caraulean
12/23/2011 11:48 AM by
Valeriu Caraulean

Not related to topic:

You're publishing to RSS only post titles. Is it intentional?

Ayende Rahien
12/23/2011 11:53 AM by
Ayende Rahien

Valeriu, no, it isn't. I just updated the blog software, and it might be related to that, I'll check it next week.

Ayende Rahien
12/23/2011 11:56 AM by
Ayende Rahien

Valeriu, no, it isn't. I just updated the blog software, and it might be related to that, I'll check it next week.

Rude Spell Checker
12/23/2011 01:59 PM by
Rude Spell Checker

s/whatever/whether/g

where 'g' means in all your other posts, too...

fschwiet
12/23/2011 05:06 PM by
fschwiet

A little additional context, the transitive replication was needed to support blue/green deployment (in my case, at least). While the replication needed to happen across an arbitrary number of servers, only 2 of those servers would ever actually exist at any one point in time.

Michael L Perry
12/24/2011 01:58 AM by
Michael L Perry

I showed you Correspondence while you were in Dallas. The way it solves the problem is simple. Every object is immutable. And any two objects with exactly the same values are considered to be the same object. The object can come from multiple directions and it won't be a duplicate.

El Guapo
12/24/2011 05:25 AM by
El Guapo

I agree... I am very surprised this causes "issues"... The document is identical in every respect... Why does it matter if I receive another copy of an identical document? Hmmmmm....

eek
12/24/2011 08:19 AM by
eek

Wow, really brainfucking!

Comments have been closed on this topic.