/** * Get only the cleaner action (inflight and completed) in the active timeline */ public HoodieTimeline getCleanerTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(CLEAN_ACTION), (Function<HoodieInstant, Optional<byte[]>> & Serializable) this::getInstantDetails); }
@Override public String toString() { return "[" + ((isInflight() || isRequested()) ? "==>" : "") + timestamp + "__" + action + "__" + state + "]"; } }
/** * Get the active instants as a timeline * * @return Active instants timeline */ public synchronized HoodieActiveTimeline getActiveTimeline() { if (activeTimeline == null) { activeTimeline = new HoodieActiveTimeline(this); } return activeTimeline; }
static HoodieInstant getCompletedInstant(final HoodieInstant instant) { return new HoodieInstant(false, instant.getAction(), instant.getTimestamp()); }
public void saveToInflight(HoodieInstant instant, Optional<byte[]> content) { Preconditions.checkArgument(instant.isInflight()); createFileInMetaPath(instant.getFileName(), content); }
public static void scheduleCompaction(HoodieTableMetaClient metaClient, String instantTime, HoodieCompactionPlan compactionPlan) throws IOException { metaClient.getActiveTimeline().saveToCompactionRequested( new HoodieInstant(State.REQUESTED, COMPACTION_ACTION, instantTime), AvroUtils.serializeCompactionPlan(compactionPlan)); }
static HoodieInstant getCompactionRequestedInstant(final String timestamp) { return new HoodieInstant(State.REQUESTED, COMPACTION_ACTION, timestamp); }
public void deleteCompactionRequested(HoodieInstant instant) { Preconditions.checkArgument(instant.isRequested()); Preconditions.checkArgument(instant.getAction() == HoodieTimeline.COMPACTION_ACTION); deleteInstantFile(instant); }
public void createInflight(HoodieInstant instant) { log.info("Creating a new in-flight instant " + instant); // Create the in-flight file createFileInMetaPath(instant.getFileName(), Optional.empty()); }
@Override public Optional<byte[]> getInstantDetails(HoodieInstant instant) { Path detailPath = new Path(metaClient.getMetaPath(), instant.getFileName()); return readDataFromPath(detailPath); }
public void deleteInflight(HoodieInstant instant) { Preconditions.checkArgument(instant.isInflight()); deleteInstantFile(instant); }
@Override public String apply(HoodieInstant hoodieInstant) { return hoodieInstant.getFileName(); } })).collect(Collectors.toList());
/** * Get the archived commits as a timeline. This is costly operation, as all data from the archived * files are read. This should not be used, unless for historical debugging purposes * * @return Active commit timeline */ public synchronized HoodieArchivedTimeline getArchivedTimeline() { if (archivedTimeline == null) { archivedTimeline = new HoodieArchivedTimeline(this); } return archivedTimeline; }
static HoodieInstant getInflightInstant(final HoodieInstant instant) { return new HoodieInstant(true, instant.getAction(), instant.getTimestamp()); }
static HoodieInstant getCompactionInflightInstant(final String timestamp) { return new HoodieInstant(State.INFLIGHT, COMPACTION_ACTION, timestamp); }
/** * Get only the save point action (inflight and completed) in the active timeline */ public HoodieTimeline getSavePointTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(SAVEPOINT_ACTION), (Function<HoodieInstant, Optional<byte[]>> & Serializable) this::getInstantDetails); }
public HoodieActiveTimeline reload() { return new HoodieActiveTimeline(metaClient); } }
public HoodieArchivedTimeline reload() { return new HoodieArchivedTimeline(metaClient); }
/** * Get only the delta commits (inflight and completed) in the active timeline */ public HoodieTimeline getDeltaCommitTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(DELTA_COMMIT_ACTION), (Function<HoodieInstant, Optional<byte[]>> & Serializable) this::getInstantDetails); }
/** * Get only the rollback action (inflight and completed) in the active timeline */ public HoodieTimeline getRollbackTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(ROLLBACK_ACTION), (Function<HoodieInstant, Optional<byte[]>> & Serializable) this::getInstantDetails); }