rmdmattingly commented on code in PR #6018:
URL: https://github.com/apache/hbase/pull/6018#discussion_r1650183058
##########
hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java:
##########
@@ -115,6 +118,38 @@ public IncrementalTableBackupClientForTest(Connection
conn, String backupId,
super(conn, backupId, request);
}
+ @Before
+ public void ensurePreviousBackupTestsAreCleanedUp() throws Exception {
+ // Every operation here may not be necessary for any given test,
+ // some often being no-ops. the goal is to help ensure atomicity
+ // of that tests that implement TestBackupBase
+ try (BackupAdmin backupAdmin = getBackupAdmin()) {
+ backupManager.finishBackupSession();
+ backupAdmin.listBackupSets().forEach(backupSet -> {
+ try {
+ backupAdmin.deleteBackupSet(backupSet.getName());
+ } catch (IOException ignored) {
+ }
+ });
+ } catch (Exception ignored) {
+ }
+ Arrays.stream(TEST_UTIL.getAdmin().listTableNames())
+ .filter(tableName -> !tableName.isSystemTable()).forEach(tableName -> {
+ try {
+ TEST_UTIL.truncateTable(tableName);
+ } catch (IOException ignored) {
+ }
+ });
+ TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(rst -> {
+ try {
+ LogRoller walRoller = rst.getRegionServer().getWalRoller();
+ walRoller.requestRollAll();
+ walRoller.waitUntilWalRollFinished();
+ } catch (Exception ignored) {
+ }
+ });
+ }
Review Comment:
After some playing around, this seemed like a pretty good way to get
`TestBackupMerge`, and others, to consistently pass even when ran in bulk.
Another option would be to get rid of the TestBackupMerge inheritance, but that
would be a really annoying change to implement, and would probably be
significantly slower in the build pipeline
--
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]