public static boolean createCompactionRequiredFile(String metaFolderPath,CompactionType compactionType){
  String statusFile;
  if (compactionType.equals(CompactionType.MINOR_COMPACTION)) {
    statusFile=metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR + CarbonCommonConstants.minorCompactionRequiredFile;
  }
 else {
    statusFile=metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR + CarbonCommonConstants.majorCompactionRequiredFile;
  }
  try {
    if (!FileFactory.isFileExist(statusFile,FileFactory.getFileType(statusFile))) {
      if (FileFactory.createNewFile(statusFile,FileFactory.getFileType(statusFile))) {
        LOGGER.info("successfully created a compaction required file - " + statusFile);
        return true;
      }
 else {
        LOGGER.error("Not able to create a compaction required file - " + statusFile);
        return false;
      }
    }
 else {
      LOGGER.info("Compaction request file : " + statusFile + " already exist.");
    }
  }
 catch (  IOException e) {
    LOGGER.error("Exception in creating the compaction request file " + e.getMessage());
  }
  return false;
}

public static boolean createCompactionRequiredFile ( String metaFolderPath , CompactionType compactionType ) { String statusFile ; if ( compactionType . equals ( CompactionType . MINOR_COMPACTION ) ) { statusFile = metaFolderPath + CarbonCommonConstants . FILE_SEPARATOR + CarbonCommonConstants . minorCompactionRequiredFile ; } else { statusFile = metaFolderPath + CarbonCommonConstants . FILE_SEPARATOR + CarbonCommonConstants . majorCompactionRequiredFile ; } try { if ( ! FileFactory . isFileExist ( statusFile , FileFactory . getFileType ( statusFile ) ) ) { if ( FileFactory . createNewFile ( statusFile , FileFactory . getFileType ( statusFile ) ) ) { LOGGER . info ( "successfully created a compaction required file - " + statusFile ) ; return true ; } else { LOGGER . error ( "Not able to create a compaction required file - " + statusFile ) ; return false ; } } else { LOGGER . info ( "Compaction request file : " + statusFile + " already exist." ) ; } } catch ( IOException e ) { LOGGER . error ( "Exception in creating the compaction request file " + e . getMessage ( ) ) ; } return false ; }
creation of the compaction request if someother compaction is in progress .
