Idempotence is the ability to apply multiple times an operation without changing the result beyond the initial application.
Given the same input, re-executing a task will always produce the same result and will not change other state.
Running an idempotent code (application, function,..) multiple times in a sequence should have the same effect as running it just once.
One way to achieve idempotency is to have a check whether the desired final state has already been achieved, and if that's the case, to exit without performing any actions.
The individual tasks in a Map Reduce job:
- are idempotent.
- and have no side effects.
They can be restarted without changing the final result.
These two properties mean that given the same input, re-executing a task will always produce the same result and will not change other state. So, the results and end condition of the system are the same, whether a task is executed once or a thousand times.
Database Migration Script
A migration script will not try to add a column if it’s already there. Therefore, a specific script order isn't necessary needed in the database migration script.