Skip to content

HBASE-28810 Improve BackupLogCleaner naming, debug logging - #6195

Merged
ndimiduk merged 3 commits into
apache:masterfrom
HubSpot:HBASE-28810
Sep 9, 2024
Merged

HBASE-28810 Improve BackupLogCleaner naming, debug logging#6195
ndimiduk merged 3 commits into
apache:masterfrom
HubSpot:HBASE-28810

Conversation

@rmdmattingly

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/HBASE-28810

While implementing HBase's incremental backups across a few hundred clusters, we continue to step on some rakes. Now and again, we find old WALs piling up due to a poorly cleaned up BackupInfo, or a bug in the BackupLogCleaner, etc.

The BackupLogCleaner is difficult to debug for a couple of reasons:

This small refactor improves the logging and naming

cc @ndimiduk

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.


private Map<Address, Long> getServersToOldestBackupMapping(List<BackupInfo> backups)
throws IOException {
private Map<Address, Long> getServerToLastBackupTs(List<BackupInfo> backups) throws IOException {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

imho this method name is still confusing. What's the relationship between "last" and "oldest"? Can backups not be chronologically ordered? How about getServerToOldestBackupTS, and the log message can talk about cleaning WALs that are older than the oldest backups.

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.

"Last" could indeed be interpreted as "most recent". I also prefer "Oldest" (or "Earliest")

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good suggestions, ty both

@rmdmattinglyrmdmattinglySep 5, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Oh, to clarify, we don't want to clean WALs that are older than the oldest backup. We want to clean WALs that are older than the newest backup. It's confusing because this was literally called the opposite, getServersToOldestBackupMapping, but I believe newest backup makes sense and the implementation clearly fetches the newest, despite what the name suggests: https://github.com/apache/hbase/blob/master/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java#L83-L102

privateMap<Address, Long> getServersToOldestBackupMapping(List<BackupInfo> backups)
throwsIOException {
Map<Address, Long> serverAddressToLastBackupMap = newHashMap<>();
Map<TableName, Long> tableNameBackupInfoMap = newHashMap<>();
for (BackupInfobackupInfo : backups) {
for (TableNametable : backupInfo.getTables()) {
tableNameBackupInfoMap.putIfAbsent(table, backupInfo.getStartTs());
if (tableNameBackupInfoMap.get(table) <= backupInfo.getStartTs()) {
// ie, if backup is *newer* than what we've already mapped, then overwritetableNameBackupInfoMap.put(table, backupInfo.getStartTs());
for (Map.Entry<String, Long> entry : backupInfo.getTableSetTimestampMap().get(table)
.entrySet()) {
serverAddressToLastBackupMap.put(Address.fromString(entry.getKey()), entry.getValue());
}
}
}
}
returnserverAddressToLastBackupMap;
}

So, by last, I meant most recent. And it was still confusing! I'm going to refactor to newest?

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'm pro naming this newest.

Realizing now that this tracks the newest backup, it means this logic also contains a bug: it does not keep track of multi-root backups. I.e. if there are 2 backups roots R1 and R2, where R1 was backed up 1 week ago, and R2 today, the WALS needed for R1 could be deleted (= data loss).
Perhaps log that as a separate issue?

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.

It's also a good idea to use "newest" or "most recent" in the logs produced in this class, rather than "latest" or "last".

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Realizing now that this tracks the newest backup, it means this logic also contains a bug: it does not keep track of multi-root backups. I.e. if there are 2 backups roots R1 and R2, where R1 was backed up 1 week ago, and R2 today, the WALS needed for R1 could be deleted (= data loss).
Perhaps log that as a separate issue?

Agreed this sounds like a separate, but very real, issue. This multi-root case seems to be a gift that keeps giving...

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.

Hadn't seen an issue for this passing by yet, so logged it as https://issues.apache.org/jira/browse/HBASE-28833

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 28sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall3m 14smaster passed
+1 💚compile0m 29smaster passed
+1 💚checkstyle0m 9smaster passed
+1 💚spotbugs0m 28smaster passed
+1 💚spotless0m 45sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall3m 2sthe patch passed
+1 💚compile0m 28sthe patch passed
+1 💚javac0m 28sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 9sthe patch passed
+1 💚spotbugs0m 34sthe patch passed
+1 💚hadoopcheck11m 33sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 44spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 9sThe patch does not generate ASF License warnings.
29m 22s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6195/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6195
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 2e1f2f593781 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / a756f53
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-backup U: hbase-backup
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6195/3/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 42sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 40smaster passed
+1 💚compile0m 24smaster passed
+1 💚javadoc0m 17smaster passed
+1 💚shadedjars5m 45sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall3m 2sthe patch passed
+1 💚compile0m 20sthe patch passed
+1 💚javac0m 20sthe patch passed
+1 💚javadoc0m 14sthe patch passed
+1 💚shadedjars5m 28spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit11m 1shbase-backup in the patch passed.
32m 0s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6195/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6195
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 7554148176b5 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / a756f53
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6195/3/testReport/
Max. process+thread count3438 (vs. ulimit of 30000)
modulesC: hbase-backup U: hbase-backup
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6195/3/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@ndimidukndimiduk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I love it.

@rmdmattingly friendly reminder to be consistent with Jira issue titles and git commit summaries. These need to match, as per the comment in https://hbase.apache.org/book.html#committing.patches

@ndimiduk
ndimiduk merged commit 53ca883 into apache:masterSep 9, 2024
@ndimiduk
ndimiduk deleted the HBASE-28810 branch September 9, 2024 09:51
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit that referenced this pull request Sep 9, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
rmdmattingly added a commit to HubSpot/hbase that referenced this pull request Sep 17, 2024
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
rmdmattingly added a commit to HubSpot/hbase that referenced this pull request Oct 8, 2024
…) (#113)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Sign up for freeto 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.

5 participants

@rmdmattingly@Apache-HBase@ndimiduk@NihalJain@DieterDP-ng