Track completeness of Elasticsearch JSON dumps #298
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves an issue that can lead to incomplete JSON dumps of the
audit_log
andhookshot-logs
Elasticsearch indices.Take for example Audit Logs, which are stored in an index per month,
During a backup, existing dumps of indexes from previous months are reused by creating a hard-link to them if they exist in the previous snapshot, and not re-transferred. Only the current month is re-transferred on each backup run.
As the dumps for a previous month are likely to have been taken during that month, and not after the month had concluded, these dumps may be incomplete.
This PR updates this logic, so that we will reuse an existing monthly dump only if it was taken after that month has concluded, ensuring it is a complete and final snapshot of the month in question.
The same applies to Hookshot Logs, which are stored in an index per day.
As these dumps are only used when restoring to Cluster, this issue only impacts customers using GitHub Enterprise Cluster at this time. Restores to non-cluster appliances uses a raw Elasticsearch backup which is not impacted by this issue.
cc @github/backup-utils for review.