Skip to content

Commit

Permalink
[tablet_bootstrap] add a comment explaining WAL recovery dirs
Browse files Browse the repository at this point in the history
It may not be straightforward upon a quick pass through the
bootstrapping code why we have a recovery directory for our WALs. I
found myself reading through method comments to remind myself why we
have them. This patch adds a high-level comment explaining why and how
we use them.

Change-Id: I7866c618f346d6e609df435c4adf2ff94108228a
Reviewed-on: http://gerrit.cloudera.org:8080/17810
Tested-by: Andrew Wong <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
  • Loading branch information
andrwng committed Aug 26, 2021
1 parent 1b499eb commit e554db1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/kudu/tablet/tablet_bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,20 @@ class FlushedStoresSnapshot {
// is handled by the 'TabletCopy' classes, which copy blocks and metadata locally
// before invoking this local bootstrap functionality to start the tablet.
//
// TODO Because the table that is being rebuilt is never flushed/compacted, consensus
// is only set on the tablet after bootstrap, when we get to flushes/compactions though
// we need to set it before replay or we won't be able to re-rebuild.
// When rebuilding an existing WAL, we first move the WAL segments into a
// separate "recovery" directory to serve as the original copy. New WAL entries
// with new commit messages are added to a new WAL in the original WAL
// directory. Entire segments may be skipped (e.g. if the mem-stores were
// flushed prior to shutting down), so the resulting WAL may be shorter than
// the original. Once the bootstrap is complete, the recovery directory is
// deleted, leaving only the new WAL. Since recovery directories contain the
// original WALs, following a crash during bootstrapping, subsequent bootstraps
// should attempt to replay segments out of the recovery directory.
//
// TODO(dralves): Because the table that is being rebuilt is never
// flushed/compacted, consensus is only set on the tablet after bootstrap, when
// we get to flushes/compactions though we need to set it before replay or we
// won't be able to re-rebuild.
class TabletBootstrap {
public:
TabletBootstrap(scoped_refptr<TabletMetadata> tablet_meta,
Expand Down

0 comments on commit e554db1

Please sign in to comment.