Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions src/main/asciidoc/_chapters/backup_restore.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -578,33 +578,60 @@ $ hbase backup describe backupId_1467823988425
// hbase backup delete

[[br.delete.backup]]
=== Deleting a Backup Image
=== Deleting Backup Images

This command can be used to delete a backup image which is no longer needed.
The `hbase backup delete` command deletes backup images that are no longer needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Two thing that surprised me when experimenting with backup-restore, and would in my opinion be useful to add, are the following:

  1. Deleting a backup will affect all following incremental backups (in the same backup root) up to the next full backup. This might lead to unexpected data loss.

An example: assume you do a full backup every 2 weeks, and a daily incremental backup. If you do hbase backup delete -k 7 and the full backup is older than 7 days, you'll have effectively cleared all incremental backups as well. (The backup will still be listed, but the backup data inside it will be gone.)

  1. If the most recent backup is an incremental backup, and you delete it, you should do a full backup next. If you do an incremental backup instead, the backup image may miss data that is present in HBase. (Logged as HBASE-28084)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out @DieterDP-ng I have updated the doc, please review it.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM


[[br.delete.backup.syntax]]
==== Syntax

[source]
----
$ hbase backup delete <backup_id>
$ hbase backup delete -l <backup_id1,backup_id2,...>
Copy link
Contributor

Choose a reason for hiding this comment

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

hbase backup delete <backup_id> does not work anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it does not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

cool thanks for confirming. we are good to merge this and #7199?

Copy link
Contributor

Choose a reason for hiding this comment

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

also please analyse that this is not a backward incompat change. i am not sure in which version the delete command was added, but if it worked before in say hbase 2, it should still work unless we had a deprecation cycle. this may break user scripts with upgrade otherwise.

Copy link
Contributor Author

@vinayakphegde vinayakphegde Aug 13, 2025

Choose a reason for hiding this comment

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

we are good to merge this

can we wait for one more review, just to be on the safer side. :)

also please analyse that this is not a backward incompatible change.

this is just a documentation update, right? But I will still check that. maybe mention a note regarding that?

Copy link
Contributor

Choose a reason for hiding this comment

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

also please analyse that this is not a backward incompatible change.

this is just a documentation update, right? But I will still check that. maybe mention a note regarding that?

Not as part of this ticket, please create a new JIRA for this.

$ hbase backup delete -k <days>
----

[[br.delete.backup.positional.cli.arguments]]
==== Positional Command-Line Arguments

_backup_id_::
The ID to the backup image which should be deleted.

[[br.delete.backup.named.cli.arguments]]
==== Named Command-Line Arguments

None.
_-l <backup_id1,backup_id2,...>_::
Comma-separated list of backup IDs to delete.

_-k <days>_::
Deletes all backup images completed more than the specified number of days ago.

NOTE: These options are **mutually exclusive**. Only one of `-l` or `-k` may be used at a time.

[[br.delete.backup.example]]
==== Example usage
==== Example Usage

Delete specific backup images by ID:

[source]
----
$ hbase backup delete backupId_1467823988425
$ hbase backup delete -l backupId_1467823988425,backupId_1467824989999
----

Delete all backup images older than 30 days:

[source]
----
$ hbase backup delete -k 30
----

[CAUTION]
====
* Deleting a backup may affect all following incremental backups (in the same backup root) up to
the next full backup. For example, if you take a full backup every 2 weeks and
daily incremental backups, running `hbase backup delete -k 7` when the full backup is older than
7 days will effectively remove the data for all subsequent incremental backups.
The backup IDs may still be listed, but their data will be gone.

* If the most recent backup is an incremental backup and you delete it,
you should run a **full backup** next.
Running another incremental backup immediately after may result in missing data in the
backup image. (See link:https://issues.apache.org/jira/browse/HBASE-28084[HBASE-28084])
====

// hbase backup repair

Expand Down