apple / apple/foundationdb

Provide tooling to recover from a corrupted (non-recoverable) fdb cluster

Open
#2,480 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

There are several ways we can corrupt a cluster without losing a majority of data:

- We could lose enough tlogs so that we can't recover without losing any storages
- We could corrupt the txnStateStore - which will probably result in a bad state that it is hard to recovery from.
- ..

In some of those cases, even fearless might not help (as the corruption might have been replicated). While restoring from a backup (or even better snapshot) would be possible, recovering from a snapshot will almost always result in some amount data loss. It could also be that that cluster didn't have any backups (hopefully all of our users are running backups - but you never know).

Anyways: there might be situations where a recovery with a small amount of data corruption and data loss is preferable. To do that I would like to have a tool that can read all files from a corrupted cluster and recover as much data as possible. The easiest version I can think of is the following:

- Look in a given directory for all KV-files.
- Read these files and scan the whole normal key-space
- Write these kv-pairs to another cluster

After this is done for all storages we would have (a probably corrupted) copy of the cluster that one could work with. Obviously, to make this useable, we would need to make this a bit more clever (as this would write every key up to three times for example - which would make the whole processes very slow).

Contributor guide

Open the contributing guide

Research direction

The issue names KV files, the txnStateStore, the normal key-space, and a destination cluster, but no source files, tests, or entry points. First map how these storage files are read and how recovered key-value pairs can be written to another cluster. Done should mean a tool can recover as much usable data as possible from a corrupted cluster while handling duplicate or corrupted records.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.