-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29449 Update backup describe command for continuous backup #7045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I see a few issues around resource/connection cleanup/reset etc. in the new test, lets see if copilot catches them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the hbase backup describe command to include a flag indicating whether continuous backup was enabled for a given backup run.
- Added a new
continuousBackupEnabledfield to the BackupInfo protobuf definition. - Extended
BackupInfoJava class to set/read the new field and include it in the short description. - Added a new unit test exercising the describe command for a continuous backup scenario.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| hbase-protocol-shaded/src/main/protobuf/Backup.proto | Added optional bool continuousBackupEnabled = 14. |
| hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/BackupInfo.java | Populated protobuf builder, parser, and short description with the new flag. |
| hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java | Added testBackupDescribeCommandForContinuousBackup to verify the CLI output. |
Comments suppressed due to low confidence (1)
hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java:116
- [nitpick] Consider adding a complementary test for the non-continuous case (e.g., without
-enableContinuousBackup) to verify that the describe output showsIsContinuous=false.
@Test
public void testBackupDescribeCommandForContinuousBackup() throws Exception {
| System.setOut(new PrintStream(baos)); | ||
|
|
||
| String[] args = new String[] { "describe", backupId }; | ||
| // Run backup | ||
| ret = ToolRunner.run(conf1, new BackupDriver(), args); | ||
| assertTrue(ret == 0); | ||
| String response = baos.toString(); | ||
| assertTrue(response.indexOf(backupId) > 0); | ||
| assertTrue(response.indexOf("COMPLETE") > 0); | ||
| assertTrue(response.indexOf("IsContinuous=true") > 0); | ||
|
|
||
| BackupInfo status = table.readBackupInfo(backupId); | ||
| String desc = status.getShortDescription(); | ||
| table.close(); | ||
| assertTrue(response.indexOf(desc) >= 0); | ||
|
|
Copilot
AI
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capture the original System.out (e.g., PrintStream original = System.out) and restore it in a finally block or @after method to avoid side effects on other tests.
| System.setOut(new PrintStream(baos)); | |
| String[] args = new String[] { "describe", backupId }; | |
| // Run backup | |
| ret = ToolRunner.run(conf1, new BackupDriver(), args); | |
| assertTrue(ret == 0); | |
| String response = baos.toString(); | |
| assertTrue(response.indexOf(backupId) > 0); | |
| assertTrue(response.indexOf("COMPLETE") > 0); | |
| assertTrue(response.indexOf("IsContinuous=true") > 0); | |
| BackupInfo status = table.readBackupInfo(backupId); | |
| String desc = status.getShortDescription(); | |
| table.close(); | |
| assertTrue(response.indexOf(desc) >= 0); | |
| PrintStream originalOut = System.out; // Capture the original System.out | |
| System.setOut(new PrintStream(baos)); | |
| try { | |
| String[] args = new String[] { "describe", backupId }; | |
| // Run backup | |
| ret = ToolRunner.run(conf1, new BackupDriver(), args); | |
| assertTrue(ret == 0); | |
| String response = baos.toString(); | |
| assertTrue(response.indexOf(backupId) > 0); | |
| assertTrue(response.indexOf("COMPLETE") > 0); | |
| assertTrue(response.indexOf("IsContinuous=true") > 0); | |
| BackupInfo status = table.readBackupInfo(backupId); | |
| String desc = status.getShortDescription(); | |
| table.close(); | |
| assertTrue(response.indexOf(desc) >= 0); | |
| } finally { | |
| System.setOut(originalOut); // Restore the original System.out | |
| } |
| String response = baos.toString(); | ||
| assertTrue(response.indexOf(backupId) > 0); | ||
| assertTrue(response.indexOf("COMPLETE") > 0); | ||
| assertTrue(response.indexOf("IsContinuous=true") > 0); |
Copilot
AI
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a non‐positional check like assertTrue(response.contains("IsContinuous=true")) or at least >= 0 to correctly assert presence even at the start of the string.
| assertTrue(response.indexOf("IsContinuous=true") > 0); | |
| assertTrue(response.contains("IsContinuous=true")); |
| @Test | ||
| public void testBackupDescribeCommandForContinuousBackup() throws Exception { | ||
| LOG.info("test backup describe on a single table with data: command-line"); | ||
| BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: try-with-resources
| assertTrue(response.indexOf(desc) >= 0); | ||
|
|
||
| // cleanup | ||
| if (fs.exists(backupWalDir)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this in finally
| table1.getNameAsString(), "-" + OPTION_ENABLE_CONTINUOUS_BACKUP }; | ||
| int ret = ToolRunner.run(conf1, new BackupDriver(), backupArgs); | ||
| assertEquals("Backup should succeed", 0, ret); | ||
| String backupId = table.getBackupHistory().get(0).getBackupId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure this is empty before we start the test or maybe take the index + 1 if otherwise
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kgeisz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. I noticed HBASE-28994 mentions investigating changes for commands like merge, progress, etc. in addition to describe. Since this PR only makes changes for describe, I'm wondering if we should change the description of the ticket or at least make this a child-task of HBASE-28994.
|
Btw, I am also having trouble with |
taklwu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the JIRA https://issues.apache.org/jira/browse/HBASE-28994 , it said it may need to update more than one command, and here is backup describe.
do we need to modify any further ?
| assertTrue(ret == 0); | ||
| String response = baos.toString(); | ||
| assertTrue(response.indexOf(backupId) > 0); | ||
| assertTrue(response.indexOf("COMPLETE") > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: will we have more than one COMPLETE in the response? if not why don't check the occurrence of COMPLETE ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
| assertTrue(response.indexOf("COMPLETE") > 0); | ||
| assertTrue(response.contains("IsContinuous=true")); | ||
|
|
||
| BackupInfo status = table.readBackupInfo(backupId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the incr_committed_wal_ts and message of Committed WAL time for incremental backup= , is it possible to add a new assertion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, added now
|
Created subtask https://issues.apache.org/jira/browse/HBASE-29449 for "hbase backup describe" command |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
taklwu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Tak Lon (Stephen) Wu <[email protected]> Reviewed by: Kevin Geiszler <[email protected]>
…che#7045) Signed-off-by: Tak Lon (Stephen) Wu <[email protected]> Reviewed by: Kevin Geiszler <[email protected]>
…che#7045) Signed-off-by: Tak Lon (Stephen) Wu <[email protected]> Reviewed by: Kevin Geiszler <[email protected]>
Signed-off-by: Tak Lon (Stephen) Wu <[email protected]> Reviewed by: Kevin Geiszler <[email protected]>
Signed-off-by: Tak Lon (Stephen) Wu <[email protected]> Reviewed by: Kevin Geiszler <[email protected]>
This PR is to update "hbase backup describe" command for continuous backup. Here I have add continuousEnabled field in backupInfo proto which is returned when user runs this command
JIRA https://issues.apache.org/jira/browse/HBASE-29449