/** * Check if commits need to be archived. If yes, archive commits. */ public boolean archiveIfRequired(final JavaSparkContext jsc) throws IOException { try { List<HoodieInstant> instantsToArchive = getInstantsToArchive(jsc).collect(Collectors.toList()); boolean success = true; if (instantsToArchive.iterator().hasNext()) { this.writer = openWriter(); log.info("Archiving instants " + instantsToArchive); archive(instantsToArchive); success = deleteArchivedInstants(instantsToArchive); } else { log.info("No Instants to archive"); } return success; } finally { close(); } }
/** * Check if commits need to be archived. If yes, archive commits. */ public boolean archiveIfRequired(final JavaSparkContext jsc) throws IOException { try { List<HoodieInstant> instantsToArchive = getInstantsToArchive(jsc).collect(Collectors.toList()); boolean success = true; if (instantsToArchive.iterator().hasNext()) { this.writer = openWriter(); log.info("Archiving instants " + instantsToArchive); archive(instantsToArchive); success = deleteArchivedInstants(instantsToArchive); } else { log.info("No Instants to archive"); } return success; } finally { close(); } }