For instance, it could reattempt the update, using the fresh data, or it could report the situation to the user.
You installed the secure agent before you created this task.
Repositoryexception while updating documents in master repository
Used by Elasticsearch, this approach assumes that conflicts are unlikely to happen and doesn’t block operations from being attempted.
However, if the underlying data has been modified between reading and writing, the update will fail.
It is then up to the application to decide how it should resolve the conflict.
Every time that we sell a widget, we decrement the stock count in Elasticsearch. Suddenly, we are selling several widgets every second.
Imagine two web processes, running in parallel, both processing the sale of one widget each, as shown in Figure 7, “Consequence of no concurrency control”. The result is that we think we have more widgets than we actually do, and we’re going to disappoint customers by selling them stock that doesn’t exist.
The more frequently that changes are made, or the longer the gap between reading data and updating it, the more likely it is that we will lose changes.
In the database world, two approaches are commonly used to ensure that changes are not lost when making concurrent updates: Widely used by relational databases, this approach assumes that conflicting changes are likely to happen and so blocks access to a resource in order to prevent conflicts.
The most recent indexing request wins: whichever document was indexed last is the one stored in Elasticsearch.
If somebody else had changed the document in the meantime, their changes would be lost. Perhaps our main data store is a relational database, and we just copy the data into Elasticsearch to make it searchable.
Perhaps there is little chance of two people changing the same document at the same time.
Or perhaps it doesn’t really matter to our business if we lose changes occasionally. Imagine that we’re using Elasticsearch to store the number of widgets that we have in stock in our online store.