ankitsol commented on code in PR #7045:
URL: https://github.com/apache/hbase/pull/7045#discussion_r2198093485
##########
hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java:
##########
@@ -101,11 +106,58 @@ public void testBackupDescribeCommand() throws Exception {
String response = baos.toString();
assertTrue(response.indexOf(backupId) > 0);
assertTrue(response.indexOf("COMPLETE") > 0);
+ assertTrue(response.contains("IsContinuous=false"));
BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection());
BackupInfo status = table.readBackupInfo(backupId);
String desc = status.getShortDescription();
table.close();
assertTrue(response.indexOf(desc) >= 0);
}
+
+ @Test
+ public void testBackupDescribeCommandForContinuousBackup() throws Exception {
+ LOG.info("test backup describe on a single table with data: command-line");
+ Path root = TEST_UTIL.getDataTestDirOnTestFS();
+ Path backupWalDir = new Path(root, "testBackupDescribeCommand");
+ FileSystem fs = FileSystem.get(conf1);
+ fs.mkdirs(backupWalDir);
+ conf1.set(CONF_CONTINUOUS_BACKUP_WAL_DIR, backupWalDir.toString());
+
+ try (BackupSystemTable table = new
BackupSystemTable(TEST_UTIL.getConnection())) {
+ String[] backupArgs = new String[] { "create", BackupType.FULL.name(),
BACKUP_ROOT_DIR, "-t",
+ table2.getNameAsString(), "-" + OPTION_ENABLE_CONTINUOUS_BACKUP };
+ int ret = ToolRunner.run(conf1, new BackupDriver(), backupArgs);
+ assertEquals("Backup should succeed", 0, ret);
+ List<BackupInfo> backups = table.getBackupHistory();
+ String backupId = backups.get(0).getBackupId();
+ assertTrue(checkSucceeded(backupId));
+ LOG.info("backup complete");
+
+ BackupInfo info = getBackupAdmin().getBackupInfo(backupId);
+ assertTrue(info.getState() == BackupState.COMPLETE);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ 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.contains("IsContinuous=true"));
+
+ BackupInfo status = table.readBackupInfo(backupId);
Review Comment:
Makes sense, added now
##########
hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java:
##########
@@ -101,11 +106,58 @@ public void testBackupDescribeCommand() throws Exception {
String response = baos.toString();
assertTrue(response.indexOf(backupId) > 0);
assertTrue(response.indexOf("COMPLETE") > 0);
+ assertTrue(response.contains("IsContinuous=false"));
BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection());
BackupInfo status = table.readBackupInfo(backupId);
String desc = status.getShortDescription();
table.close();
assertTrue(response.indexOf(desc) >= 0);
}
+
+ @Test
+ public void testBackupDescribeCommandForContinuousBackup() throws Exception {
+ LOG.info("test backup describe on a single table with data: command-line");
+ Path root = TEST_UTIL.getDataTestDirOnTestFS();
+ Path backupWalDir = new Path(root, "testBackupDescribeCommand");
+ FileSystem fs = FileSystem.get(conf1);
+ fs.mkdirs(backupWalDir);
+ conf1.set(CONF_CONTINUOUS_BACKUP_WAL_DIR, backupWalDir.toString());
+
+ try (BackupSystemTable table = new
BackupSystemTable(TEST_UTIL.getConnection())) {
+ String[] backupArgs = new String[] { "create", BackupType.FULL.name(),
BACKUP_ROOT_DIR, "-t",
+ table2.getNameAsString(), "-" + OPTION_ENABLE_CONTINUOUS_BACKUP };
+ int ret = ToolRunner.run(conf1, new BackupDriver(), backupArgs);
+ assertEquals("Backup should succeed", 0, ret);
+ List<BackupInfo> backups = table.getBackupHistory();
+ String backupId = backups.get(0).getBackupId();
+ assertTrue(checkSucceeded(backupId));
+ LOG.info("backup complete");
+
+ BackupInfo info = getBackupAdmin().getBackupInfo(backupId);
+ assertTrue(info.getState() == BackupState.COMPLETE);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ 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);
Review Comment:
Sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]