In Chapter 4 of this book 'Elasticsearch: The Definitive Guide",
In part "Partial Updates to a Document", I am confused about the document-basesd replication:
It is said that If Node 3(the primary shard is in Node 3) has managed to update the document successfully, it forwards the new version of the document in parallel to the replica shards on Node 1 and Node 2 to be reindexed.
A case is as followed:
For example, when a document is like this:
current version = 1
{
"a":1,
"b":2
}
"Update request A" is done in primary node and document version in primary shard is 2, then it sends document-basesd replication requests to replica shards:
"Update request A" is like this:
{
"a":1,
"b":22
}
In the meantime, a "Update request B" to the same document happened just between the interval that the primary shard is updated by "Update request A" and the replica shards has not yet been updated by "Update request A".
"Update request B" is like this:
{
"a":11,
"b":33
}
My questions:
- According to this book, it is said that the order of the "Update request A" to replica shards and the "Update request B" to replica shards can't be guaranteed that they will arrive in the same order that they were sent.
If the "Update request A" to replica shards is after the "Update request B" to replica shards, the "Update request B" to replica shards is lost!
I wonder whether it will happen like this?
And if yes, how to overcome the problem?
And if not, how to understand the 'document-basesd replication' correctly?