1919
2020import static org .apache .hadoop .hbase .backup .BackupRestoreConstants .CONF_CONTINUOUS_BACKUP_WAL_DIR ;
2121import static org .apache .hadoop .hbase .backup .BackupRestoreConstants .CONTINUOUS_BACKUP_REPLICATION_PEER ;
22+ import static org .apache .hadoop .hbase .backup .replication .BackupFileSystemManager .BULKLOAD_FILES_DIR ;
2223import static org .apache .hadoop .hbase .backup .replication .BackupFileSystemManager .WALS_DIR ;
2324import static org .apache .hadoop .hbase .backup .replication .ContinuousBackupReplicationEndpoint .DATE_FORMAT ;
2425import static org .apache .hadoop .hbase .backup .replication .ContinuousBackupReplicationEndpoint .ONE_DAY_IN_MILLISECONDS ;
@@ -164,7 +165,7 @@ public void testSingleBackupForceDelete() throws Exception {
164165
165166 // Step 6: Verify that the backup WAL directory is empty
166167 assertTrue ("WAL backup directory should be empty after force delete" ,
167- isWalDirsEmpty (conf1 , backupWalDir .toString ()));
168+ areWalAndBulkloadDirsEmpty (conf1 , backupWalDir .toString ()));
168169
169170 // Step 7: Take new full backup with continuous backup enabled
170171 String backupIdContinuous = fullTableBackupWithContinuous (Lists .newArrayList (table1 ));
@@ -189,38 +190,49 @@ private void setupBackupFolders(long currentTime) throws IOException {
189190 public static void setupBackupFolders (FileSystem fs , Path backupWalDir , long currentTime )
190191 throws IOException {
191192 Path walsDir = new Path (backupWalDir , WALS_DIR );
193+ Path bulkLoadDir = new Path (backupWalDir , BULKLOAD_FILES_DIR );
192194
193195 fs .mkdirs (walsDir );
196+ fs .mkdirs (bulkLoadDir );
194197
195198 SimpleDateFormat dateFormat = new SimpleDateFormat (DATE_FORMAT );
196199
197200 for (int i = 0 ; i < 5 ; i ++) {
198201 String dateStr = dateFormat .format (new Date (currentTime - (i * ONE_DAY_IN_MILLISECONDS )));
199202 fs .mkdirs (new Path (walsDir , dateStr ));
203+ fs .mkdirs (new Path (bulkLoadDir , dateStr ));
200204 }
201205 }
202206
203207 private static void verifyBackupCleanup (FileSystem fs , Path backupWalDir , long currentTime )
204208 throws IOException {
205209 Path walsDir = new Path (backupWalDir , WALS_DIR );
210+ Path bulkLoadDir = new Path (backupWalDir , BULKLOAD_FILES_DIR );
206211 SimpleDateFormat dateFormat = new SimpleDateFormat (DATE_FORMAT );
207212
208213 // Expect folders older than 3 days to be deleted
209214 for (int i = 3 ; i < 5 ; i ++) {
210215 String oldDateStr = dateFormat .format (new Date (currentTime - (i * ONE_DAY_IN_MILLISECONDS )));
211216 Path walPath = new Path (walsDir , oldDateStr );
217+ Path bulkLoadPath = new Path (bulkLoadDir , oldDateStr );
212218 assertFalse ("Old WAL directory (" + walPath + ") should be deleted, but it exists!" ,
213219 fs .exists (walPath ));
220+ assertFalse ("Old BulkLoad directory (" + bulkLoadPath + ") should be deleted, but it exists!" ,
221+ fs .exists (bulkLoadPath ));
214222 }
215223
216224 // Expect folders within the last 3 days to exist
217225 for (int i = 0 ; i < 3 ; i ++) {
218226 String recentDateStr =
219227 dateFormat .format (new Date (currentTime - (i * ONE_DAY_IN_MILLISECONDS )));
220228 Path walPath = new Path (walsDir , recentDateStr );
229+ Path bulkLoadPath = new Path (bulkLoadDir , recentDateStr );
221230
222231 assertTrue ("Recent WAL directory (" + walPath + ") should exist, but it is missing!" ,
223232 fs .exists (walPath ));
233+ assertTrue (
234+ "Recent BulkLoad directory (" + bulkLoadPath + ") should exist, but it is missing!" ,
235+ fs .exists (bulkLoadPath ));
224236 }
225237 }
226238
@@ -264,15 +276,16 @@ private boolean continuousBackupReplicationPeerExistsAndEnabled() throws IOExcep
264276 peer -> peer .getPeerId ().equals (CONTINUOUS_BACKUP_REPLICATION_PEER ) && peer .isEnabled ());
265277 }
266278
267- private static boolean isWalDirsEmpty (Configuration conf , String backupWalDir )
279+ private static boolean areWalAndBulkloadDirsEmpty (Configuration conf , String backupWalDir )
268280 throws IOException {
269281 BackupFileSystemManager manager =
270282 new BackupFileSystemManager (CONTINUOUS_BACKUP_REPLICATION_PEER , conf , backupWalDir );
271283
272284 FileSystem fs = manager .getBackupFs ();
273285 Path walDir = manager .getWalsDir ();
286+ Path bulkloadDir = manager .getBulkLoadFilesDir ();
274287
275- return isDirectoryEmpty (fs , walDir );
288+ return isDirectoryEmpty (fs , walDir ) && isDirectoryEmpty ( fs , bulkloadDir ) ;
276289 }
277290
278291 private static boolean isDirectoryEmpty (FileSystem fs , Path dirPath ) throws IOException {
0 commit comments