public class HoodieActiveTimeline extends HoodieDefaultTimeline
The timeline is not automatically reloaded on any mutation operation, clients have to manually call reload() so that they can chain multiple mutations to the timeline and then call reload() once.
This class can be serialized and de-serialized and on de-serialization the FileSystem is re-initialized.
| Modifier and Type | Field and Description |
|---|---|
protected HoodieTableMetaClient |
metaClient |
static Set<String> |
NOT_PARSABLE_TIMESTAMPS |
static Set<String> |
VALID_EXTENSIONS_IN_ACTIVE_TIMELINE |
detailsCLEAN_ACTION, CLEAN_EXTENSION, COMMIT_ACTION, COMMIT_EXTENSION, COMPACTION_ACTION, COMPLETED_COMPACTION_SUFFIX, COMPLETED_EXTENSION, DELTA_COMMIT_ACTION, DELTA_COMMIT_EXTENSION, EQUALS, FULL_BOOTSTRAP_INSTANT_TS, GREATER_THAN, GREATER_THAN_OR_EQUALS, INDEX_COMMIT_EXTENSION, INDEXING_ACTION, INFLIGHT_CLEAN_EXTENSION, INFLIGHT_COMMIT_EXTENSION, INFLIGHT_COMPACTION_EXTENSION, INFLIGHT_DELTA_COMMIT_EXTENSION, INFLIGHT_EXTENSION, INFLIGHT_INDEX_COMMIT_EXTENSION, INFLIGHT_LOG_COMPACTION_EXTENSION, INFLIGHT_REPLACE_COMMIT_EXTENSION, INFLIGHT_RESTORE_EXTENSION, INFLIGHT_ROLLBACK_EXTENSION, INFLIGHT_SAVE_SCHEMA_ACTION_EXTENSION, INFLIGHT_SAVEPOINT_EXTENSION, INIT_INSTANT_TS, INVALID_INSTANT_TS, LESSER_THAN, LESSER_THAN_OR_EQUALS, LOG_COMPACTION_ACTION, METADATA_BOOTSTRAP_INSTANT_TS, REPLACE_COMMIT_ACTION, REPLACE_COMMIT_EXTENSION, REQUESTED_CLEAN_EXTENSION, REQUESTED_COMMIT_EXTENSION, REQUESTED_COMPACTION_EXTENSION, REQUESTED_COMPACTION_SUFFIX, REQUESTED_DELTA_COMMIT_EXTENSION, REQUESTED_EXTENSION, REQUESTED_INDEX_COMMIT_EXTENSION, REQUESTED_LOG_COMPACTION_EXTENSION, REQUESTED_LOG_COMPACTION_SUFFIX, REQUESTED_REPLACE_COMMIT_EXTENSION, REQUESTED_RESTORE_EXTENSION, REQUESTED_ROLLBACK_EXTENSION, REQUESTED_SAVE_SCHEMA_ACTION_EXTENSION, RESTORE_ACTION, RESTORE_EXTENSION, ROLLBACK_ACTION, ROLLBACK_EXTENSION, SAVE_SCHEMA_ACTION_EXTENSION, SAVEPOINT_ACTION, SAVEPOINT_EXTENSION, SCHEMA_COMMIT_ACTION, VALID_ACTIONS_IN_TIMELINE| Modifier | Constructor and Description |
|---|---|
|
HoodieActiveTimeline()
Deprecated.
|
|
HoodieActiveTimeline(HoodieTableMetaClient metaClient) |
|
HoodieActiveTimeline(HoodieTableMetaClient metaClient,
boolean applyLayoutFilter) |
protected |
HoodieActiveTimeline(HoodieTableMetaClient metaClient,
Set<String> includedExtensions) |
protected |
HoodieActiveTimeline(HoodieTableMetaClient metaClient,
Set<String> includedExtensions,
boolean applyLayoutFilters) |
| Modifier and Type | Method and Description |
|---|---|
void |
copyInstant(HoodieInstant instant,
StoragePath dstDir) |
protected void |
createCompleteFileInMetaPath(boolean shouldLock,
HoodieInstant instant,
Option<byte[]> content) |
void |
createCompleteInstant(HoodieInstant instant)
Create a complete instant and save to storage with a completion time.
|
protected void |
createFileInMetaPath(String filename,
Option<byte[]> content,
boolean allowOverwrite) |
void |
createNewInstant(HoodieInstant instant)
Create a pending instant and save to storage.
|
static String |
createNewInstantTime(boolean shouldLock,
TimeGenerator timeGenerator)
Returns next instant time in the correct format.
|
static String |
createNewInstantTime(boolean shouldLock,
TimeGenerator timeGenerator,
long milliseconds)
Returns next instant time in the correct format.
|
void |
createRequestedReplaceCommit(String instantTime,
String actionType) |
void |
deleteCompactionRequested(HoodieInstant instant) |
void |
deleteCompletedRollback(HoodieInstant instant) |
void |
deleteEmptyInstantIfExists(HoodieInstant instant) |
void |
deleteInflight(HoodieInstant instant) |
protected void |
deleteInstantFile(HoodieInstant instant) |
static void |
deleteInstantFile(HoodieStorage storage,
StoragePath metaPath,
HoodieInstant instant) |
void |
deleteInstantFileIfExists(HoodieInstant instant)
Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
and completed commit instant in an archive operation.
|
void |
deletePending(HoodieInstant instant) |
static String |
formatDate(Date timestamp)
Format the Date to a String representing the timestamp of a Hoodie Instant.
|
Option<byte[]> |
getInstantDetails(HoodieInstant instant)
Read the completed instant details.
|
protected String |
getInstantFileName(HoodieInstant instant)
Many callers might not pass completionTime, here we have to search
timeline to get completionTime, the impact should be minor since
1.
|
Option<Pair<HoodieInstant,HoodieCommitMetadata>> |
getLastCommitMetadataWithValidData()
Get the last instant with valid data, and convert this to HoodieCommitMetadata
|
Option<Pair<HoodieInstant,HoodieCommitMetadata>> |
getLastCommitMetadataWithValidSchema()
Returns most recent instant having valid schema in its
HoodieCommitMetadata |
static Date |
parseDateFromInstantTime(String timestamp)
Parse the timestamp of an Instant and return a
Date. |
static Option<Date> |
parseDateFromInstantTimeSafely(String timestamp)
The same parsing method as above, but this method will mute ParseException.
|
Option<byte[]> |
readCleanerInfoAsBytes(HoodieInstant instant) |
Option<byte[]> |
readCompactionPlanAsBytes(HoodieInstant instant) |
protected Option<byte[]> |
readDataFromPath(StoragePath detailPath) |
Option<byte[]> |
readIndexPlanAsBytes(HoodieInstant instant) |
Option<byte[]> |
readRestoreInfoAsBytes(HoodieInstant instant) |
Option<byte[]> |
readRollbackInfoAsBytes(HoodieInstant instant) |
HoodieActiveTimeline |
reload() |
protected void |
revertCompleteToInflight(HoodieInstant completed,
HoodieInstant inflight) |
HoodieInstant |
revertIndexInflightToRequested(HoodieInstant inflightInstant)
Revert index instant state from inflight to requested.
|
HoodieInstant |
revertInstantFromInflightToRequested(HoodieInstant inflightInstant)
Revert instant state from inflight to requested.
|
HoodieInstant |
revertLogCompactionInflightToRequested(HoodieInstant inflightInstant)
TODO: This method is not needed, since log compaction plan is not a immutable plan.
|
HoodieInstant |
revertToInflight(HoodieInstant instant) |
void |
saveAsComplete(boolean shouldLock,
HoodieInstant instant,
Option<byte[]> data) |
void |
saveAsComplete(HoodieInstant instant,
Option<byte[]> data) |
void |
saveToCleanRequested(HoodieInstant instant,
Option<byte[]> content) |
void |
saveToCompactionRequested(HoodieInstant instant,
Option<byte[]> content) |
void |
saveToCompactionRequested(HoodieInstant instant,
Option<byte[]> content,
boolean overwrite) |
void |
saveToLogCompactionRequested(HoodieInstant instant,
Option<byte[]> content) |
void |
saveToLogCompactionRequested(HoodieInstant instant,
Option<byte[]> content,
boolean overwrite) |
void |
saveToPendingIndexAction(HoodieInstant instant,
Option<byte[]> content)
Save content for inflight/requested index instant.
|
void |
saveToPendingReplaceCommit(HoodieInstant instant,
Option<byte[]> content)
Saves content for requested REPLACE instant.
|
void |
saveToRestoreRequested(HoodieInstant instant,
Option<byte[]> content) |
void |
saveToRollbackRequested(HoodieInstant instant,
Option<byte[]> content) |
HoodieInstant |
transitionCleanInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition Clean State from inflight to Committed.
|
HoodieInstant |
transitionCleanRequestedToInflight(HoodieInstant requestedInstant,
Option<byte[]> data)
Transition Clean State from requested to inflight.
|
HoodieInstant |
transitionCompactionInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition Compaction State from inflight to Committed.
|
HoodieInstant |
transitionCompactionRequestedToInflight(HoodieInstant requestedInstant)
Transition Compaction State from requested to inflight.
|
HoodieInstant |
transitionIndexInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition index instant state from inflight to completed.
|
HoodieInstant |
transitionIndexRequestedToInflight(HoodieInstant requestedInstant,
Option<byte[]> data)
Transition index instant state from requested to inflight.
|
HoodieInstant |
transitionLogCompactionInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition Log Compaction State from inflight to Committed.
|
HoodieInstant |
transitionLogCompactionRequestedToInflight(HoodieInstant requestedInstant)
Transition LogCompaction State from requested to inflight.
|
protected void |
transitionPendingState(HoodieInstant fromInstant,
HoodieInstant toInstant,
Option<byte[]> data,
boolean allowRedundantTransitions) |
HoodieInstant |
transitionReplaceInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition replace inflight to Committed.
|
HoodieInstant |
transitionReplaceRequestedToInflight(HoodieInstant requestedInstant,
Option<byte[]> data)
Transition replace requested file to replace inflight.
|
void |
transitionRequestedToInflight(HoodieInstant requested,
Option<byte[]> content) |
void |
transitionRequestedToInflight(HoodieInstant requested,
Option<byte[]> content,
boolean allowRedundantTransitions) |
void |
transitionRequestedToInflight(String commitType,
String inFlightInstant) |
HoodieInstant |
transitionRestoreRequestedToInflight(HoodieInstant requestedInstant)
Transition Restore State from requested to inflight.
|
HoodieInstant |
transitionRollbackInflightToComplete(boolean shouldLock,
HoodieInstant inflightInstant,
Option<byte[]> data)
Transition Rollback State from inflight to Committed.
|
HoodieInstant |
transitionRollbackRequestedToInflight(HoodieInstant requestedInstant)
Transition Rollback State from requested to inflight.
|
protected void |
transitionStateToComplete(boolean shouldLock,
HoodieInstant fromInstant,
HoodieInstant toInstant,
Option<byte[]> data) |
appendInstants, containsInstant, containsInstant, containsOrBeforeTimelineStarts, countInstants, empty, filter, filterCompletedAndCompactionInstants, filterCompletedIndexTimeline, filterCompletedInstants, filterCompletedInstantsOrRewriteTimeline, filterCompletedOrMajorOrMinorCompactionInstants, filterInflights, filterInflightsAndRequested, filterInstantsByAction, filterPendingCompactionTimeline, filterPendingExcludingCompaction, filterPendingExcludingLogCompaction, filterPendingExcludingMajorAndMinorCompaction, filterPendingIndexTimeline, filterPendingLogCompactionTimeline, filterPendingMajorOrMinorCompactionTimeline, filterPendingReplaceTimeline, filterPendingRollbackTimeline, filterRequestedRollbackTimeline, findInstantBefore, findInstantsAfter, findInstantsAfter, findInstantsAfterOrEquals, findInstantsBefore, findInstantsBeforeOrEquals, findInstantsInClosedRange, findInstantsInRange, findInstantsInRangeByCompletionTime, findInstantsModifiedAfterByCompletionTime, firstInstant, firstInstant, getAllCommitsTimeline, getCleanerTimeline, getCommitAndReplaceTimeline, getCommitsAndCompactionTimeline, getCommitsTimeline, getCommitTimeline, getCompletedReplaceTimeline, getContiguousCompletedWriteTimeline, getDeltaCommitTimeline, getFirstNonSavepointCommit, getFirstPendingClusterInstant, getInstants, getInstantsAsStream, getInstantsOrderedByCompletionTime, getLastClusteringInstant, getLastPendingClusterInstant, getRestoreTimeline, getReverseOrderedInstants, getRollbackAndRestoreTimeline, getRollbackTimeline, getSavePointTimeline, getTimelineHash, getTimelineOfActions, getWriteTimeline, isBeforeTimelineStarts, isEmpty, isPendingClusterInstant, lastInstant, mergeTimeline, nthFromLastInstant, nthInstant, setInstants, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompareTimestamps, getCleanInflightInstant, getCleanRequestedInstant, getCommitFromCommitFile, getCompactionInflightInstant, getCompactionRequestedInstant, getIndexInflightInstant, getIndexRequestedInstant, getInflightInstant, getLogCompactionInflightInstant, getLogCompactionRequestedInstant, getReplaceCommitInflightInstant, getReplaceCommitRequestedInstant, getRequestedInstant, getRestoreRequestedInstant, getRollbackRequestedInstant, isInClosedOpenRange, isInClosedRange, isInRange, makeCleanerFileName, makeCommitFileName, makeDeltaFileName, makeFileNameAsComplete, makeFileNameAsInflight, makeIndexCommitFileName, makeInflightCleanerFileName, makeInflightCommitFileName, makeInflightCompactionFileName, makeInflightDeltaFileName, makeInflightIndexFileName, makeInflightLogCompactionFileName, makeInflightReplaceFileName, makeInflightRestoreFileName, makeInflightRollbackFileName, makeInflightSavePointFileName, makeInflightSchemaFileName, makeReplaceFileName, makeRequestedCleanerFileName, makeRequestedCommitFileName, makeRequestedCompactionFileName, makeRequestedDeltaFileName, makeRequestedIndexFileName, makeRequestedLogCompactionFileName, makeRequestedReplaceFileName, makeRequestedRestoreFileName, makeRequestedRollbackFileName, makeRequestSchemaFileName, makeRestoreFileName, makeRollbackFileName, makeSavePointFileName, makeSchemaFileName, maxInstant, minInstantpublic static final Set<String> VALID_EXTENSIONS_IN_ACTIVE_TIMELINE
protected HoodieTableMetaClient metaClient
protected HoodieActiveTimeline(HoodieTableMetaClient metaClient, Set<String> includedExtensions)
protected HoodieActiveTimeline(HoodieTableMetaClient metaClient, Set<String> includedExtensions, boolean applyLayoutFilters)
public HoodieActiveTimeline(HoodieTableMetaClient metaClient)
public HoodieActiveTimeline(HoodieTableMetaClient metaClient, boolean applyLayoutFilter)
@Deprecated public HoodieActiveTimeline()
public static Date parseDateFromInstantTime(String timestamp) throws ParseException
Date.
Throw ParseException if timestamp is not valid format as
HoodieInstantTimeGenerator.SECS_INSTANT_TIMESTAMP_FORMAT.timestamp - a timestamp String which follow pattern as
HoodieInstantTimeGenerator.SECS_INSTANT_TIMESTAMP_FORMAT.ParseExceptionpublic static Option<Date> parseDateFromInstantTimeSafely(String timestamp)
Option.empty.
Or a corresponding Date value if these timestamp strings are provided
HoodieTimeline.INIT_INSTANT_TS,
HoodieTimeline.METADATA_BOOTSTRAP_INSTANT_TS,
HoodieTimeline.FULL_BOOTSTRAP_INSTANT_TS.
This method is useful when parsing timestamp for metricstimestamp - a timestamp String which follow pattern as
HoodieInstantTimeGenerator.SECS_INSTANT_TIMESTAMP_FORMAT.Option<Date> of instant timestamp, Option.empty if invalid timestamppublic static String formatDate(Date timestamp)
public static String createNewInstantTime(boolean shouldLock, TimeGenerator timeGenerator)
shouldLock - whether the lock should be enabled to get the instant time.timeGenerator - TimeGenerator used to generate the instant time.public static String createNewInstantTime(boolean shouldLock, TimeGenerator timeGenerator, long milliseconds)
shouldLock - whether the lock should be enabled to get the instant time.timeGenerator - TimeGenerator used to generate the instant time.milliseconds - Milliseconds to add to current time while generating the new instant timepublic void createCompleteInstant(HoodieInstant instant)
instant - the complete instant.public void createNewInstant(HoodieInstant instant)
instant - the pending instant.public void createRequestedReplaceCommit(String instantTime, String actionType)
public void saveAsComplete(HoodieInstant instant, Option<byte[]> data)
public void saveAsComplete(boolean shouldLock,
HoodieInstant instant,
Option<byte[]> data)
public HoodieInstant revertToInflight(HoodieInstant instant)
public void deleteInflight(HoodieInstant instant)
public void deletePending(HoodieInstant instant)
public void deleteCompletedRollback(HoodieInstant instant)
public static void deleteInstantFile(HoodieStorage storage, StoragePath metaPath, HoodieInstant instant)
public void deleteEmptyInstantIfExists(HoodieInstant instant)
public void deleteCompactionRequested(HoodieInstant instant)
public void deleteInstantFileIfExists(HoodieInstant instant)
protected void deleteInstantFile(HoodieInstant instant)
protected String getInstantFileName(HoodieInstant instant)
TODO: [HUDI-6885] Depreciate HoodieActiveTimeline#getInstantFileName and fix related tests.
public Option<byte[]> getInstantDetails(HoodieInstant instant)
HoodieTimelinegetInstantDetails in interface HoodieTimelinegetInstantDetails in class HoodieDefaultTimelinepublic Option<Pair<HoodieInstant,HoodieCommitMetadata>> getLastCommitMetadataWithValidSchema()
HoodieCommitMetadatapublic Option<Pair<HoodieInstant,HoodieCommitMetadata>> getLastCommitMetadataWithValidData()
public Option<byte[]> readCleanerInfoAsBytes(HoodieInstant instant)
public Option<byte[]> readRollbackInfoAsBytes(HoodieInstant instant)
public Option<byte[]> readRestoreInfoAsBytes(HoodieInstant instant)
public Option<byte[]> readCompactionPlanAsBytes(HoodieInstant instant)
public Option<byte[]> readIndexPlanAsBytes(HoodieInstant instant)
public HoodieInstant revertInstantFromInflightToRequested(HoodieInstant inflightInstant)
inflightInstant - Inflight Instantpublic HoodieInstant revertLogCompactionInflightToRequested(HoodieInstant inflightInstant)
inflightInstant - Inflight Instantpublic HoodieInstant transitionCompactionRequestedToInflight(HoodieInstant requestedInstant)
requestedInstant - Requested instantpublic HoodieInstant transitionLogCompactionRequestedToInflight(HoodieInstant requestedInstant)
requestedInstant - Requested instantpublic HoodieInstant transitionCompactionInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight instantdata - Extra Metadatapublic HoodieInstant transitionLogCompactionInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight instantdata - Extra Metadatapublic HoodieInstant transitionCleanInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight instantdata - Extra Metadatapublic HoodieInstant transitionCleanRequestedToInflight(HoodieInstant requestedInstant, Option<byte[]> data)
requestedInstant - requested instantdata - Optional data to be storedpublic HoodieInstant transitionRollbackInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight instantdata - Extra Metadatapublic HoodieInstant transitionRollbackRequestedToInflight(HoodieInstant requestedInstant)
requestedInstant - requested instantpublic HoodieInstant transitionRestoreRequestedToInflight(HoodieInstant requestedInstant)
requestedInstant - requested instantpublic HoodieInstant transitionReplaceRequestedToInflight(HoodieInstant requestedInstant, Option<byte[]> data)
requestedInstant - Requested instantdata - Extra Metadatapublic HoodieInstant transitionReplaceInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight instantdata - Extra Metadataprotected void transitionStateToComplete(boolean shouldLock,
HoodieInstant fromInstant,
HoodieInstant toInstant,
Option<byte[]> data)
protected void transitionPendingState(HoodieInstant fromInstant, HoodieInstant toInstant, Option<byte[]> data, boolean allowRedundantTransitions)
protected void revertCompleteToInflight(HoodieInstant completed, HoodieInstant inflight)
public void transitionRequestedToInflight(String commitType, String inFlightInstant)
public void transitionRequestedToInflight(HoodieInstant requested, Option<byte[]> content)
public void transitionRequestedToInflight(HoodieInstant requested, Option<byte[]> content, boolean allowRedundantTransitions)
public void saveToCompactionRequested(HoodieInstant instant, Option<byte[]> content)
public void saveToCompactionRequested(HoodieInstant instant, Option<byte[]> content, boolean overwrite)
public void saveToLogCompactionRequested(HoodieInstant instant, Option<byte[]> content)
public void saveToLogCompactionRequested(HoodieInstant instant, Option<byte[]> content, boolean overwrite)
public void saveToPendingReplaceCommit(HoodieInstant instant, Option<byte[]> content)
public void saveToCleanRequested(HoodieInstant instant, Option<byte[]> content)
public void saveToRollbackRequested(HoodieInstant instant, Option<byte[]> content)
public void saveToRestoreRequested(HoodieInstant instant, Option<byte[]> content)
public HoodieInstant transitionIndexRequestedToInflight(HoodieInstant requestedInstant, Option<byte[]> data)
requestedInstant - Inflight Instantpublic HoodieInstant transitionIndexInflightToComplete(boolean shouldLock, HoodieInstant inflightInstant, Option<byte[]> data)
shouldLock - Whether to hold the lock when performing transitioninflightInstant - Inflight Instantpublic HoodieInstant revertIndexInflightToRequested(HoodieInstant inflightInstant)
inflightInstant - Inflight Instantpublic void saveToPendingIndexAction(HoodieInstant instant, Option<byte[]> content)
protected void createFileInMetaPath(String filename, Option<byte[]> content, boolean allowOverwrite)
protected void createCompleteFileInMetaPath(boolean shouldLock,
HoodieInstant instant,
Option<byte[]> content)
protected Option<byte[]> readDataFromPath(StoragePath detailPath)
public HoodieActiveTimeline reload()
public void copyInstant(HoodieInstant instant, StoragePath dstDir)
Copyright © 2024 The Apache Software Foundation. All rights reserved.