Skip to content

Conversation

@vinayakphegde
Copy link
Contributor

The current approach incorrectly checks whether a full backup is the only valid base for all PITR target points, which is not a valid criterion. A full backup should not be required to support all PITR points to be considered necessary. Instead, each full backup only contributes to a specific PITR time range, depending on when the backup was taken and the availability of continuous backups afterward.

This ticket proposes a more accurate and conservative approach:

  • Determine the PITR range each full backup can support.
  • Identify if another full backup exists that fully covers the same range.
  • If such a backup exists, the original one can be considered safe for deletion.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

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

lgtm, but we need more unit tests to cover the different cases.

Comment on lines 788 to 789
System.out.println("Backup [" + targetBackup.getBackupId()
+ "] covered PITR window for table [" + table + "]: " + coveredPitrWindow);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these stdout prints added to help development for now?
I don't think we should output it to the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was originally added to help during development, and I thought we could keep it.
But you're right — if it were a proper log message, it might have been acceptable, but plain printing isn't appropriate.
I'll remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be helpful as a log message. Maybe just as an INFO message.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to enabled debug logging for these commands?
If yes, emit at debug level instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no logging currently enabled in that class, likely because these are user-facing commands where the intention is to directly output information rather than log it. Given that, I'll go ahead and skip adding a log statement here as well.

Comment on lines 874 to 876
System.out.println("Backup [" + backup.getBackupId() + "] covers the target window ["
+ targetStart + ", " + targetEnd + "] with window [" + covered.getFirst() + ", "
+ covered.getSecond() + "]");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it could be a helpful log message as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I don't mind, you can keep both if you guys believe they gonna be useful.

@kgeisz
Copy link
Contributor

kgeisz commented Apr 26, 2025

The logic looks good to me. Do you think it would make sense to add a unit test for each case you mentioned in your analysis write-up?

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 29s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ HBASE-28957 Compile Tests _
+1 💚 mvninstall 3m 17s HBASE-28957 passed
+1 💚 compile 0m 31s HBASE-28957 passed
+1 💚 checkstyle 0m 11s HBASE-28957 passed
+1 💚 spotbugs 0m 31s HBASE-28957 passed
+1 💚 spotless 0m 46s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 7s the patch passed
+1 💚 compile 0m 30s the patch passed
+1 💚 javac 0m 30s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 0m 9s /results-checkstyle-hbase-backup.txt hbase-backup: The patch generated 3 new + 0 unchanged - 0 fixed = 3 total (was 0)
+1 💚 spotbugs 0m 36s the patch passed
+1 💚 hadoopcheck 12m 2s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 47s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
30m 24s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6922/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6922
JIRA Issue HBASE-29261
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 4620f724d55b 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision HBASE-28957 / 8773f2d
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-backup U: hbase-backup
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6922/2/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 29s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ HBASE-28957 Compile Tests _
+1 💚 mvninstall 3m 38s HBASE-28957 passed
+1 💚 compile 0m 23s HBASE-28957 passed
+1 💚 javadoc 0m 15s HBASE-28957 passed
+1 💚 shadedjars 5m 55s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 5s the patch passed
+1 💚 compile 0m 19s the patch passed
+1 💚 javac 0m 19s the patch passed
+1 💚 javadoc 0m 13s the patch passed
+1 💚 shadedjars 5m 49s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌ unit 24m 28s /patch-unit-hbase-backup.txt hbase-backup in the patch failed.
45m 33s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6922/2/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6922
JIRA Issue HBASE-29261
Optional Tests javac javadoc unit compile shadedjars
uname Linux af767faf1a6e 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision HBASE-28957 / 8773f2d
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6922/2/testReport/
Max. process+thread count 3564 (vs. ulimit of 30000)
modules C: hbase-backup U: hbase-backup
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6922/2/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@anmolnar
Copy link
Contributor

Backup / restore related unit tests failed, do you work on those @vinayakphegde ?

@vinayakphegde
Copy link
Contributor Author

Backup / restore related unit tests failed, do you work on those @vinayakphegde ?

The failures are due to flaky/intermittent tests in incremental backup and are not related to the tests we’ve added. The upstream community and Ankit are already looking into it.

@anmolnar anmolnar merged commit 58463c4 into apache:HBASE-28957 May 20, 2025
1 check failed
anmolnar pushed a commit that referenced this pull request Jul 28, 2025
…ritical backups and propose correct approach (#6922)

* improve the logic of backup deletion validation of PITR-critical backups

* add new tests
vinayakphegde added a commit to vinayakphegde/hbase that referenced this pull request Jul 29, 2025
…ritical backups and propose correct approach (apache#6922)

* improve the logic of backup deletion validation of PITR-critical backups

* add new tests
vinayakphegde added a commit to vinayakphegde/hbase that referenced this pull request Jul 29, 2025
…ritical backups and propose correct approach (apache#6922)

* improve the logic of backup deletion validation of PITR-critical backups

* add new tests
anmolnar pushed a commit that referenced this pull request Sep 11, 2025
…ritical backups and propose correct approach (#6922)

* improve the logic of backup deletion validation of PITR-critical backups

* add new tests
anmolnar pushed a commit that referenced this pull request Nov 6, 2025
…ritical backups and propose correct approach (#6922)

* improve the logic of backup deletion validation of PITR-critical backups

* add new tests
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