@@ -305,9 +305,9 @@ protected PartitionedMobCompactionRequest select(List<FileStatus> candidates,
305
305
// all the files are selected
306
306
request .setCompactionType (CompactionType .ALL_FILES );
307
307
}
308
- LOG .info ("The compaction type is " + request . getCompactionType () + ", the request has "
309
- + totalDelFiles + " del files, " + selectedFileCount + " selected files, and "
310
- + irrelevantFileCount + " irrelevant files" );
308
+ LOG .info ("The compaction type is {}, the request has {} del files, {} selected files, and {} " +
309
+ "irrelevant files table '{}' and column '{}'" , request . getCompactionType (), totalDelFiles ,
310
+ selectedFileCount , irrelevantFileCount , tableName , column . getNameAsString () );
311
311
return request ;
312
312
}
313
313
@@ -347,10 +347,12 @@ protected List<Path> performCompaction(PartitionedMobCompactionRequest request)
347
347
totalDelFileCount ++;
348
348
}
349
349
}
350
- LOG .info ("After merging, there are " + totalDelFileCount + " del files" );
350
+ LOG .info ("After merging, there are {} del files. table='{}' column='{}'" , totalDelFileCount ,
351
+ tableName , column .getNameAsString ());
351
352
// compact the mob files by partitions.
352
353
paths = compactMobFiles (request );
353
- LOG .info ("After compaction, there are " + paths .size () + " mob files" );
354
+ LOG .info ("After compaction, there are {} mob files. table='{}' column='{}'" , paths .size (),
355
+ tableName , column .getNameAsString ());
354
356
} finally {
355
357
for (CompactionDelPartition delPartition : request .getDelPartitions ()) {
356
358
closeStoreFileReaders (delPartition .getStoreFiles ());
@@ -359,15 +361,17 @@ protected List<Path> performCompaction(PartitionedMobCompactionRequest request)
359
361
360
362
// archive the del files if all the mob files are selected.
361
363
if (request .type == CompactionType .ALL_FILES && !request .getDelPartitions ().isEmpty ()) {
362
- LOG .info (
363
- "After a mob compaction with all files selected, archiving the del files " );
364
+ LOG .info ("After a mob compaction with all files selected, archiving the del files for " +
365
+ "table='{}' and column='{}'" , tableName , column . getNameAsString () );
364
366
for (CompactionDelPartition delPartition : request .getDelPartitions ()) {
365
367
LOG .info (Objects .toString (delPartition .listDelFiles ()));
366
368
try {
367
369
MobUtils .removeMobFiles (conf , fs , tableName , mobTableDir , column .getName (),
368
370
delPartition .getStoreFiles ());
369
371
} catch (IOException e ) {
370
- LOG .error ("Failed to archive the del files " + delPartition .getStoreFiles (), e );
372
+ LOG .error ("Failed to archive the del files {} for partition {} table='{}' and " +
373
+ "column='{}'" , delPartition .getStoreFiles (), delPartition .getId (), tableName ,
374
+ column .getNameAsString (), e );
371
375
}
372
376
}
373
377
}
@@ -461,7 +465,8 @@ protected List<Path> compactMobFiles(final PartitionedMobCompactionRequest reque
461
465
throws IOException {
462
466
Collection <CompactionPartition > partitions = request .compactionPartitions ;
463
467
if (partitions == null || partitions .isEmpty ()) {
464
- LOG .info ("No partitions of mob files" );
468
+ LOG .info ("No partitions of mob files in table='{}' and column='{}'" , tableName ,
469
+ column .getNameAsString ());
465
470
return Collections .emptyList ();
466
471
}
467
472
List <Path > paths = new ArrayList <>();
@@ -483,7 +488,8 @@ protected List<Path> compactMobFiles(final PartitionedMobCompactionRequest reque
483
488
results .put (partition .getPartitionId (), pool .submit (new Callable <List <Path >>() {
484
489
@ Override
485
490
public List <Path > call () throws Exception {
486
- LOG .info ("Compacting mob files for partition " + partition .getPartitionId ());
491
+ LOG .info ("Compacting mob files for partition {} for table='{}' and column='{}'" ,
492
+ partition .getPartitionId (), tableName , column .getNameAsString ());
487
493
return compactMobFilePartition (request , partition , delFiles , c , table );
488
494
}
489
495
}));
@@ -495,13 +501,15 @@ public List<Path> call() throws Exception {
495
501
paths .addAll (result .getValue ().get ());
496
502
} catch (Exception e ) {
497
503
// just log the error
498
- LOG .error ("Failed to compact the partition " + result .getKey (), e );
504
+ LOG .error ("Failed to compact the partition {} for table='{}' and column='{}'" ,
505
+ result .getKey (), tableName , column .getNameAsString (), e );
499
506
failedPartitions .add (result .getKey ());
500
507
}
501
508
}
502
509
if (!failedPartitions .isEmpty ()) {
503
510
// if any partition fails in the compaction, directly throw an exception.
504
- throw new IOException ("Failed to compact the partitions " + failedPartitions );
511
+ throw new IOException ("Failed to compact the partitions " + failedPartitions +
512
+ " for table='" + tableName + "' column='" + column .getNameAsString () + "'" );
505
513
}
506
514
} finally {
507
515
try {
@@ -567,8 +575,9 @@ private List<Path> compactMobFilePartition(PartitionedMobCompactionRequest reque
567
575
// move to the next batch.
568
576
offset += batch ;
569
577
}
570
- LOG .info ("Compaction is finished. The number of mob files is changed from " + files .size ()
571
- + " to " + newFiles .size ());
578
+ LOG .info ("Compaction is finished. The number of mob files is changed from {} to {} for " +
579
+ "partition={} for table='{}' and column='{}'" , files .size (), newFiles .size (),
580
+ partition .getPartitionId (), tableName , column .getNameAsString ());
572
581
return newFiles ;
573
582
}
574
583
@@ -675,8 +684,12 @@ private void compactMobFilesInBatch(PartitionedMobCompactionRequest request,
675
684
cleanupTmpMobFile = false ;
676
685
cleanupCommittedMobFile = true ;
677
686
// bulkload the ref file
687
+ LOG .info ("start MOB ref bulkload for partition {} table='{}' column='{}'" ,
688
+ partition .getPartitionId (), tableName , column .getNameAsString ());
678
689
bulkloadRefFile (connection , table , bulkloadPathOfPartition , filePath .getName ());
679
690
cleanupCommittedMobFile = false ;
691
+ LOG .info ("end MOB ref bulkload for partition {} table='{}' column='{}'" ,
692
+ partition .getPartitionId (), tableName , column .getNameAsString ());
680
693
newFiles .add (new Path (mobFamilyDir , filePath .getName ()));
681
694
}
682
695
@@ -703,7 +716,11 @@ private void compactMobFilesInBatch(PartitionedMobCompactionRequest request,
703
716
}
704
717
705
718
if (cleanupCommittedMobFile ) {
706
- deletePath (new Path (mobFamilyDir , filePath .getName ()));
719
+ LOG .error ("failed MOB ref bulkload for partition {} table='{}' column='{}'" ,
720
+ partition .getPartitionId (), tableName , column .getNameAsString ());
721
+ MobUtils .removeMobFiles (conf , fs , tableName , mobTableDir , column .getName (),
722
+ Collections .singletonList (new HStoreFile (fs , new Path (mobFamilyDir , filePath .getName ()),
723
+ conf , compactionCacheConfig , BloomType .NONE , true )));
707
724
}
708
725
}
709
726
}
@@ -904,6 +921,7 @@ private Pair<Long, Long> getFileInfo(List<HStoreFile> storeFiles) throws IOExcep
904
921
* @param path The path of the file to be deleted.
905
922
*/
906
923
private void deletePath (Path path ) {
924
+ LOG .debug ("Cleanup, delete path '{}'" , path );
907
925
try {
908
926
if (path != null ) {
909
927
fs .delete (path , true );
0 commit comments