I - The HoodieTable implementation's input typeT - The HoodieTable implementation's output typeO - The BaseHoodieWriteClient implementation's output type (differs in case of spark)public abstract class BaseHoodieTableServiceClient<I,T,O> extends BaseHoodieClient implements RunsTableService
| Modifier and Type | Field and Description |
|---|---|
protected AsyncArchiveService |
asyncArchiveService |
protected AsyncCleanerService |
asyncCleanerService |
protected com.codahale.metrics.Timer.Context |
clusteringTimer |
protected com.codahale.metrics.Timer.Context |
compactionTimer |
protected com.codahale.metrics.Timer.Context |
logCompactionTimer |
protected Set<String> |
pendingInflightAndRequestedInstants |
basePath, config, context, heartbeatClient, metrics, storage, storageConf, txnManager| Modifier | Constructor and Description |
|---|---|
protected |
BaseHoodieTableServiceClient(HoodieEngineContext context,
HoodieWriteConfig clientConfig,
Option<EmbeddedTimelineService> timelineService) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
archive(HoodieTable table)
Trigger archival for the table.
|
protected void |
asyncArchive() |
protected void |
asyncClean() |
HoodieCleanMetadata |
clean(String cleanInstantTime,
boolean scheduleInline)
Clean up any stale/old files/data lying around (either on file storage or index storage) based on the
configurations and CleaningPolicy used.
|
HoodieCleanMetadata |
clean(String cleanInstantTime,
boolean scheduleInline,
boolean skipLocking)
Deprecated.
|
void |
close()
Releases any resources used by the client.
|
HoodieWriteMetadata<O> |
cluster(String clusteringInstant,
boolean shouldComplete)
Ensures clustering instant is in expected state and performs clustering for the plan stored in metadata.
|
void |
commitCompaction(String compactionInstantTime,
HoodieCommitMetadata metadata,
Option<Map<String,String>> extraMetadata)
Commit a compaction operation.
|
protected HoodieWriteMetadata<O> |
compact(String compactionInstantTime,
boolean shouldComplete)
Ensures compaction instant is in expected state and performs Compaction for the workload stored in instant-time.
|
protected void |
completeCompaction(HoodieCommitMetadata metadata,
HoodieTable table,
String compactionCommitTime)
Commit Compaction and track metrics.
|
protected void |
completeLogCompaction(HoodieCommitMetadata metadata,
HoodieTable table,
String logCompactionCommitTime)
Commit Log Compaction and track metrics.
|
protected abstract HoodieWriteMetadata<O> |
convertToOutputMetadata(HoodieWriteMetadata<T> writeMetadata) |
protected HoodieTable<?,I,?,T> |
createTable(HoodieWriteConfig config,
StorageConfiguration<?> storageConf) |
protected abstract HoodieTable<?,I,?,T> |
createTable(HoodieWriteConfig config,
StorageConfiguration<?> storageConf,
boolean skipValidation) |
protected HoodieTable |
createTableAndValidate(HoodieWriteConfig config,
BiFunction<HoodieWriteConfig,HoodieEngineContext,HoodieTable> createTableFn,
boolean skipValidation) |
protected List<String> |
getInstantsToRollback(HoodieTableMetaClient metaClient,
HoodieFailedWritesCleaningPolicy cleaningPolicy,
Option<String> curInstantTime) |
protected Option<HoodiePendingRollbackInfo> |
getPendingRollbackInfo(HoodieTableMetaClient metaClient,
String commitToRollback) |
Option<HoodiePendingRollbackInfo> |
getPendingRollbackInfo(HoodieTableMetaClient metaClient,
String commitToRollback,
boolean ignoreCompactionAndClusteringInstants) |
protected Map<String,Option<HoodiePendingRollbackInfo>> |
getPendingRollbackInfos(HoodieTableMetaClient metaClient) |
protected Map<String,Option<HoodiePendingRollbackInfo>> |
getPendingRollbackInfos(HoodieTableMetaClient metaClient,
boolean ignoreCompactionAndClusteringInstants)
Fetch map of pending commits to be rolled-back to
HoodiePendingRollbackInfo. |
protected void |
handleWriteErrors(List<HoodieWriteStat> writeStats,
TableServiceType tableServiceType) |
protected Option<String> |
inlineClustering(Option<Map<String,String>> extraMetadata)
Executes a clustering plan on a table, serially before or after an insert/upsert action.
|
protected Option<String> |
inlineCompaction(Option<Map<String,String>> extraMetadata)
Performs a compaction operation on a table, serially before or after an insert/upsert action.
|
protected Option<String> |
inlineLogCompact(Option<Map<String,String>> extraMetadata)
Performs a log compaction operation on a table, serially before or after an insert/upsert action.
|
protected Option<String> |
inlineScheduleClustering(Option<Map<String,String>> extraMetadata)
Schedules clustering inline.
|
protected Option<String> |
inlineScheduleCompaction(Option<Map<String,String>> extraMetadata)
Schedules compaction inline.
|
protected boolean |
isPreCommitRequired()
Some writers use SparkAllowUpdateStrategy and treat replacecommit plan as revocable plan.
|
HoodieWriteMetadata<O> |
logCompact(String logCompactionInstantTime)
Performs Log Compaction for the workload stored in instant-time.
|
protected HoodieWriteMetadata<O> |
logCompact(String logCompactionInstantTime,
boolean shouldComplete)
Ensures compaction instant is in expected state and performs Log Compaction for the workload stored in instant-time.s
|
HoodieWriteMetadata<T> |
managePartitionTTL(String instantTime)
Delete expired partition by config.
|
protected void |
preCommit(HoodieCommitMetadata metadata)
Any pre-commit actions like conflict resolution goes here.
|
boolean |
purgePendingClustering(String clusteringInstant) |
protected void |
releaseResources(String instantTime)
Called after each commit of a compaction or clustering table service,
to release any resources used.
|
boolean |
rollback(String commitInstantTime,
Option<HoodiePendingRollbackInfo> pendingRollbackInfo,
boolean skipLocking,
boolean skipVersionCheck)
Deprecated.
|
boolean |
rollback(String commitInstantTime,
Option<HoodiePendingRollbackInfo> pendingRollbackInfo,
String rollbackInstantTime,
boolean skipLocking,
boolean skipVersionCheck)
Deprecated.
|
void |
rollbackFailedBootstrap()
Main API to rollback failed bootstrap.
|
protected boolean |
rollbackFailedIndexingCommits()
Rolls back the failed delta commits corresponding to the indexing action.
|
protected Boolean |
rollbackFailedWrites()
Rollback all failed writes.
|
protected void |
rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback) |
protected void |
rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback,
boolean skipLocking,
boolean skipVersionCheck) |
protected void |
runAnyPendingClustering(HoodieTable table) |
protected void |
runAnyPendingCompactions(HoodieTable table) |
protected void |
runAnyPendingLogCompactions(HoodieTable table) |
protected void |
runTableServicesInline(HoodieTable table,
HoodieCommitMetadata metadata,
Option<Map<String,String>> extraMetadata) |
Option<String> |
scheduleClustering(Option<Map<String,String>> extraMetadata)
Schedules a new clustering instant.
|
boolean |
scheduleClusteringAtInstant(String instantTime,
Option<Map<String,String>> extraMetadata)
Schedules a new clustering instant with passed-in instant time.
|
Option<String> |
scheduleCompaction(Option<Map<String,String>> extraMetadata)
Schedules a new compaction instant.
|
boolean |
scheduleCompactionAtInstant(String instantTime,
Option<Map<String,String>> extraMetadata)
Schedules a new compaction instant with passed-in instant time.
|
Option<String> |
scheduleLogCompaction(Option<Map<String,String>> extraMetadata)
Schedules a new log compaction instant.
|
boolean |
scheduleLogCompactionAtInstant(String instantTime,
Option<Map<String,String>> extraMetadata)
Schedules a new log compaction instant with passed-in instant time.
|
Option<String> |
scheduleTableService(String instantTime,
Option<Map<String,String>> extraMetadata,
TableServiceType tableServiceType)
Schedule table services such as clustering, compaction & cleaning.
|
protected Option<String> |
scheduleTableServiceInternal(String instantTime,
Option<Map<String,String>> extraMetadata,
TableServiceType tableServiceType) |
protected void |
setPendingInflightAndRequestedInstants(Set<String> pendingInflightAndRequestedInstants) |
protected void |
setTableServiceTimer(WriteOperationType operationType) |
protected void |
startAsyncArchiveService(BaseHoodieWriteClient writeClient) |
protected void |
startAsyncCleanerService(BaseHoodieWriteClient writeClient) |
protected abstract void |
validateClusteringCommit(HoodieWriteMetadata<O> clusteringMetadata,
String clusteringCommitTime,
HoodieTable table) |
createMetaClient, createNewInstantTime, createNewInstantTime, finalizeWrite, getConfig, getEngineContext, getHeartbeatClient, getTimelineServer, initWrapperFSMetrics, resolveWriteConflict, writeTableMetadataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshouldDelegateToTableServiceManager, tableServicesEnabledprotected transient com.codahale.metrics.Timer.Context compactionTimer
protected transient com.codahale.metrics.Timer.Context clusteringTimer
protected transient com.codahale.metrics.Timer.Context logCompactionTimer
protected transient AsyncCleanerService asyncCleanerService
protected transient AsyncArchiveService asyncArchiveService
protected BaseHoodieTableServiceClient(HoodieEngineContext context, HoodieWriteConfig clientConfig, Option<EmbeddedTimelineService> timelineService)
protected void startAsyncCleanerService(BaseHoodieWriteClient writeClient)
protected void startAsyncArchiveService(BaseHoodieWriteClient writeClient)
protected void asyncClean()
protected void asyncArchive()
protected void setTableServiceTimer(WriteOperationType operationType)
protected void setPendingInflightAndRequestedInstants(Set<String> pendingInflightAndRequestedInstants)
protected void preCommit(HoodieCommitMetadata metadata)
metadata - commit metadata for which pre commit is being invoked.protected Option<String> inlineCompaction(Option<Map<String,String>> extraMetadata)
protected HoodieWriteMetadata<O> logCompact(String logCompactionInstantTime, boolean shouldComplete)
logCompactionInstantTime - Compaction Instant Timeprotected Option<String> inlineLogCompact(Option<Map<String,String>> extraMetadata)
protected void runAnyPendingCompactions(HoodieTable table)
protected void runAnyPendingLogCompactions(HoodieTable table)
protected Option<String> inlineScheduleCompaction(Option<Map<String,String>> extraMetadata)
extraMetadata - extra metadata to be used.public Option<String> scheduleCompaction(Option<Map<String,String>> extraMetadata) throws HoodieIOException
extraMetadata - Extra Metadata to be storedHoodieIOExceptionprotected HoodieWriteMetadata<O> compact(String compactionInstantTime, boolean shouldComplete)
compactionInstantTime - Compaction Instant Timepublic void commitCompaction(String compactionInstantTime, HoodieCommitMetadata metadata, Option<Map<String,String>> extraMetadata)
compactionInstantTime - Compaction Instant Timemetadata - All the metadata that gets stored along with a commitextraMetadata - Extra Metadata to be storedprotected void completeCompaction(HoodieCommitMetadata metadata, HoodieTable table, String compactionCommitTime)
public Option<String> scheduleLogCompaction(Option<Map<String,String>> extraMetadata) throws HoodieIOException
extraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic boolean scheduleLogCompactionAtInstant(String instantTime, Option<Map<String,String>> extraMetadata) throws HoodieIOException
instantTime - Log Compaction Instant TimeextraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic HoodieWriteMetadata<O> logCompact(String logCompactionInstantTime)
logCompactionInstantTime - Log Compaction Instant Timeprotected void completeLogCompaction(HoodieCommitMetadata metadata, HoodieTable table, String logCompactionCommitTime)
public boolean scheduleCompactionAtInstant(String instantTime, Option<Map<String,String>> extraMetadata) throws HoodieIOException
instantTime - Compaction Instant TimeextraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic Option<String> scheduleClustering(Option<Map<String,String>> extraMetadata) throws HoodieIOException
extraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic boolean scheduleClusteringAtInstant(String instantTime, Option<Map<String,String>> extraMetadata) throws HoodieIOException
instantTime - clustering Instant TimeextraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic HoodieWriteMetadata<O> cluster(String clusteringInstant, boolean shouldComplete)
clusteringInstant - Clustering Instant Timepublic boolean purgePendingClustering(String clusteringInstant)
public HoodieWriteMetadata<T> managePartitionTTL(String instantTime)
instantTime - Instant Time for the actionprotected abstract void validateClusteringCommit(HoodieWriteMetadata<O> clusteringMetadata, String clusteringCommitTime, HoodieTable table)
protected abstract HoodieWriteMetadata<O> convertToOutputMetadata(HoodieWriteMetadata<T> writeMetadata)
protected void runTableServicesInline(HoodieTable table, HoodieCommitMetadata metadata, Option<Map<String,String>> extraMetadata)
public Option<String> scheduleTableService(String instantTime, Option<Map<String,String>> extraMetadata, TableServiceType tableServiceType)
extraMetadata - Metadata to pass onto the scheduled service instanttableServiceType - Type of table service to scheduleprotected Option<String> scheduleTableServiceInternal(String instantTime, Option<Map<String,String>> extraMetadata, TableServiceType tableServiceType)
protected HoodieTable createTableAndValidate(HoodieWriteConfig config, BiFunction<HoodieWriteConfig,HoodieEngineContext,HoodieTable> createTableFn, boolean skipValidation)
protected HoodieTable<?,I,?,T> createTable(HoodieWriteConfig config, StorageConfiguration<?> storageConf)
protected abstract HoodieTable<?,I,?,T> createTable(HoodieWriteConfig config, StorageConfiguration<?> storageConf, boolean skipValidation)
protected Option<String> inlineClustering(Option<Map<String,String>> extraMetadata)
protected Option<String> inlineScheduleClustering(Option<Map<String,String>> extraMetadata)
extraMetadata - extra metadata to use.protected void runAnyPendingClustering(HoodieTable table)
@Nullable @Deprecated public HoodieCleanMetadata clean(String cleanInstantTime, boolean scheduleInline, boolean skipLocking) throws HoodieIOException
scheduleTableService(String, Option, TableServiceType) and disable inline scheduling
of clean.cleanInstantTime - instant time for clean.scheduleInline - true if needs to be scheduled inline. false otherwise.HoodieIOException@Nullable public HoodieCleanMetadata clean(String cleanInstantTime, boolean scheduleInline) throws HoodieIOException
scheduleTableService(String, Option, TableServiceType) and disable inline scheduling
of clean.cleanInstantTime - instant time for clean.scheduleInline - true if needs to be scheduled inline. false otherwise.HoodieIOExceptionprotected void archive(HoodieTable table)
table - table to commit on.protected Option<HoodiePendingRollbackInfo> getPendingRollbackInfo(HoodieTableMetaClient metaClient, String commitToRollback)
public Option<HoodiePendingRollbackInfo> getPendingRollbackInfo(HoodieTableMetaClient metaClient, String commitToRollback, boolean ignoreCompactionAndClusteringInstants)
protected Map<String,Option<HoodiePendingRollbackInfo>> getPendingRollbackInfos(HoodieTableMetaClient metaClient)
protected Map<String,Option<HoodiePendingRollbackInfo>> getPendingRollbackInfos(HoodieTableMetaClient metaClient, boolean ignoreCompactionAndClusteringInstants)
HoodiePendingRollbackInfo.metaClient - instance of HoodieTableMetaClient to use.protected boolean rollbackFailedIndexingCommits()
TODO(HUDI-5733): This should be cleaned up once the proper fix of rollbacks in the metadata table is landed.
true if rollback happens; false otherwise.protected Boolean rollbackFailedWrites()
protected void rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback)
protected void rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback, boolean skipLocking, boolean skipVersionCheck)
protected List<String> getInstantsToRollback(HoodieTableMetaClient metaClient, HoodieFailedWritesCleaningPolicy cleaningPolicy, Option<String> curInstantTime)
@Deprecated public boolean rollback(String commitInstantTime, Option<HoodiePendingRollbackInfo> pendingRollbackInfo, boolean skipLocking, boolean skipVersionCheck) throws HoodieRollbackException
commitInstantTime - Instant time of the commitpendingRollbackInfo - pending rollback instant and plan if rollback failed from previous attempt.skipLocking - if this is triggered by another parent transaction, locking can be skipped.HoodieRollbackException - if rollback cannot be performed successfully@Deprecated public boolean rollback(String commitInstantTime, Option<HoodiePendingRollbackInfo> pendingRollbackInfo, String rollbackInstantTime, boolean skipLocking, boolean skipVersionCheck) throws HoodieRollbackException
commitInstantTime - Instant time of the commitpendingRollbackInfo - pending rollback instant and plan if rollback failed from previous attempt.skipLocking - if this is triggered by another parent transaction, locking can be skipped.HoodieRollbackException - if rollback cannot be performed successfullypublic void rollbackFailedBootstrap()
protected boolean isPreCommitRequired()
public void close()
BaseHoodieClientclose in interface AutoCloseableclose in class BaseHoodieClientprotected void handleWriteErrors(List<HoodieWriteStat> writeStats, TableServiceType tableServiceType)
protected void releaseResources(String instantTime)
Copyright © 2024 The Apache Software Foundation. All rights reserved.