Skip to content

HBASE-29905 BackupLogCleaner: skip tables no longer in the backup set - #7761

Open
janvanbesien wants to merge 1 commit into
apache:masterfrom
NGDATA:HBASE-29905_backup_cleaner_stale_entries
Open

janvanbesien wants to merge 1 commit into
apache:masterfrom
NGDATA:HBASE-29905_backup_cleaner_stale_entries

Conversation

@janvanbesien

Copy link
Copy Markdown

BackupLogCleaner.serverToPreservationBoundaryTs() computes the WAL deletion boundary by iterating over tableSetTimestampMap from persisted BackupInfo sessions. This map can contain entries for tables that were once part of the backup set but have since had all their backups deleted. Their stale, old timestamps drag the minimum WAL boundary back, preventing old WALs from being cleaned up.

Fix: when computing boundaries, load the incrbackupset per backup root from BackupSystemTable and skip tables not in the active set. The incrbackupset is populated on every full backup and pruned when backups are deleted, so it accurately reflects which tables still need WAL retention.

@janvanbesien
janvanbesien force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 5a9a2ef to 9f69699 Compare February 17, 2026 07:50
@DieterDP-ng

Copy link
Copy Markdown
Contributor

Hi Jan,

2 remarks regarding the format of the PR:

  • HBASE accepts PRs for the master branch. If accepted for master, it's backported to the other branches by the person doing the merge.
  • HBASE asks that the commit header message matches the title of the ticket it solves.

@janvanbesien
janvanbesien force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 9f69699 to 81e9e0d Compare February 17, 2026 13:53
@janvanbesien
janvanbesien changed the base branch from branch-2.6 to master February 17, 2026 13:54
@DieterDP-ng
DieterDP-ng force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 81e9e0d to 1f676bb Compare April 3, 2026 18:09
@DieterDP-ng

Copy link
Copy Markdown
Contributor

I've force-pushed a rebase on the current master.

@DieterDP-ng
DieterDP-ng force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 1f676bb to 5e8a415 Compare April 3, 2026 18:31

@DieterDePaepe DieterDePaepe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor changes to do, looks good overall.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased your changes to the latest master, and there was some refactoring involved. Would appreciate a second pair of eyes to take a look at the new code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed all your remarks. However, when trying to rebase on master, I noticed that the test seems to work now without any code changes. So either the problem has been fixed it in the mean time via another change, or my test is no good.

I pushed it like this (test only) but I should find some more time to deep dive.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did another rebase & update - but the original issue persists. Found no evidence the issue was fixed in your rebased branch. So I'm force pushing both test & code changes again.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two observations that I had while reviewing, but not something that needs fixing in this PR. Mainly thinking out loud, and might log issues for these.

  • If a table is deleted, it will result in WAL files sticking around until all backups containing that deleted table are gone (because that is when the incremental backup set gets updated). If long backup retention times are used, this can still be problematic. There's room for further improvement here.
  • If a table is deleted and recreated with the same name, the backup info will still have the timestamps of the deleted table, and WALs that are included in incremental backups will also contain data of the deleted table. This would lead to a corrupted restore.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the first point as part of the updated PR.

Logged the second point as https://issues.apache.org/jira/browse/HBASE-30542

@DieterDePaepe

Copy link
Copy Markdown

@hgromer Could you also review this PR?

@janvanbesien
janvanbesien force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 5e8a415 to 792959a Compare April 26, 2026 07:57
@DieterDP-ng
DieterDP-ng force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from 792959a to f3a3000 Compare November 13, 2026 16:55
…es in system:backup table

BackupLogCleaner computes the WAL deletion boundary from the
tableSetTimestampMap of the most recent backup per backup root. A backup
fills this map from all trslm: rows of its backup root, so the map also
contains tables that are no longer backed up, such as deleted tables or
tables whose backups were all deleted. Nothing removes these trslm:
rows, so their timestamps stop advancing. Because the boundary per
region server is the minimum timestamp over all tables, a single stale
table prevents the cleanup of all newer WALs on every region server.

When computing the boundary, BackupLogCleaner now only considers tables
that are both in the incremental backup set of the backup root and still
exist:
- The incremental backup set gets every table of a full backup, and
  backup deletion removes tables that no longer have any backup.
- Incremental backups skip tables that no longer exist, so a deleted
  table no longer needs its WALs, even while backups containing it are
  retained.

Co-authored-by: Dieter De Paepe <dieterdp@ngdata.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DieterDP-ng
DieterDP-ng force-pushed the HBASE-29905_backup_cleaner_stale_entries branch from f3a3000 to b80ca6d Compare November 13, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants