About Wiring Operations Failure in Replica Shards


(WeiqiangYuan) #1

From this book 'Elasticsearch: The Definitive Guide', in updating or creating documents, I have known that if the writing operation will return success only if the primary shard all the replica shards are done successfully.
For example, we have 1 primary and 3 replica shards. If the writing operation in the primary and 2 replica shards succeeds, and fails in the 3rd replica shards.

  1. How to handle this in ES?
  2. Is there any retries in the 3rd replica shards?
  3. If the final writing operation failed, how to roll back the writing operation in primary shard and the 2 replica shards?

(Yannick Welsch) #2
  1. It depends on the type of exception that occurs. In case where the exception indicates that it is impossible to write the data to the 3rd replica, the primary tells the master to fail the 3rd replica shard, waits for acknowledgement from the master, and successfully acknowledges the write to the client.
  2. Retries can happen for example if the mapping is not up-to-date on the replica shard.
  3. We currently don't do rollbacks. Unsuccessful writes can either have happened or not.

(system) #3