T - Sub type of HoodieRecordPayloadI - Type of inputsK - Type of keysO - Type of outputspublic abstract class BaseHoodieWriteClient<T extends HoodieRecordPayload,I,K,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 Option<Pair<HoodieInstant,Map<String,String>>> |
lastCompletedTxnAndMetadata |
protected static String |
LOOKUP_STR |
protected HoodieMetrics |
metrics |
protected Set<String> |
pendingInflightAndRequestedInstants |
protected TransactionManager |
txnManager |
protected com.codahale.metrics.Timer.Context |
writeTimer |
basePath, config, context, fs, hadoopConf, heartbeatClient| Constructor and Description |
|---|
BaseHoodieWriteClient(HoodieEngineContext context,
HoodieWriteConfig writeConfig,
Option<EmbeddedTimelineService> timelineService,
SupportsUpgradeDowngrade upgradeDowngradeHelper)
Deprecated.
|
BaseHoodieWriteClient(HoodieEngineContext context,
HoodieWriteConfig writeConfig,
SupportsUpgradeDowngrade upgradeDowngradeHelper)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(String colName,
org.apache.avro.Schema schema) |
void |
addColumn(String colName,
org.apache.avro.Schema schema,
String doc,
String position,
TableChange.ColumnPositionChange.ColumnPositionType positionType)
add columns to table.
|
void |
archive()
Trigger archival for the table.
|
protected void |
archive(HoodieTable table,
boolean acquireLockForArchival)
Trigger archival for the table.
|
protected void |
autoArchiveOnCommit(HoodieTable table,
boolean acquireLockForArchival) |
protected void |
autoCleanOnCommit() |
void |
bootstrap(Option<Map<String,String>> extraMetadata)
Main API to run bootstrap to hudi.
|
abstract O |
bulkInsert(I records,
String instantTime)
Loads the given HoodieRecords, as inserts into the table.
|
abstract O |
bulkInsert(I records,
String instantTime,
Option<BulkInsertPartitioner> userDefinedBulkInsertPartitioner)
Loads the given HoodieRecords, as inserts into the table.
|
abstract O |
bulkInsertPreppedRecords(I preppedRecords,
String instantTime,
Option<BulkInsertPartitioner> bulkInsertPartitioner)
Loads the given HoodieRecords, as inserts into the table.
|
HoodieCleanMetadata |
clean() |
HoodieCleanMetadata |
clean(boolean skipLocking)
Triggers clean for the table.
|
HoodieCleanMetadata |
clean(String cleanInstantTime)
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 skipLocking)
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)
Clean up any stale/old files/data lying around (either on file storage or index storage) based on the
configurations and CleaningPolicy used.
|
void |
close()
Releases any resources used by the client.
|
abstract HoodieWriteMetadata<O> |
cluster(String clusteringInstant,
boolean shouldComplete)
Ensures clustering instant is in expected state and performs clustering for the plan stored in metadata.
|
protected void |
commit(HoodieTable table,
String commitActionType,
String instantTime,
HoodieCommitMetadata metadata,
List<HoodieWriteStat> stats) |
boolean |
commit(String instantTime,
O writeStatuses)
Commit changes performed at the given instantTime marker.
|
boolean |
commit(String instantTime,
O writeStatuses,
Option<Map<String,String>> extraMetadata)
Commit changes performed at the given instantTime marker.
|
abstract boolean |
commit(String instantTime,
O writeStatuses,
Option<Map<String,String>> extraMetadata,
String commitActionType,
Map<String,List<String>> partitionToReplacedFileIds) |
abstract void |
commitCompaction(String compactionInstantTime,
HoodieCommitMetadata metadata,
Option<Map<String,String>> extraMetadata)
Commit a compaction operation.
|
boolean |
commitStats(String instantTime,
List<HoodieWriteStat> stats,
Option<Map<String,String>> extraMetadata,
String commitActionType) |
boolean |
commitStats(String instantTime,
List<HoodieWriteStat> stats,
Option<Map<String,String>> extraMetadata,
String commitActionType,
Map<String,List<String>> partitionToReplaceFileIds) |
HoodieWriteMetadata<O> |
compact(String compactionInstantTime)
Performs Compaction for the workload stored in instant-time.
|
protected abstract 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 abstract void |
completeCompaction(HoodieCommitMetadata metadata,
HoodieTable table,
String compactionCommitTime)
Commit Compaction and track metrics.
|
protected abstract HoodieIndex<?,?> |
createIndex(HoodieWriteConfig writeConfig) |
protected HoodieTable |
createTable(HoodieWriteConfig config,
org.apache.hadoop.conf.Configuration hadoopConf) |
protected abstract HoodieTable |
createTable(HoodieWriteConfig config,
org.apache.hadoop.conf.Configuration hadoopConf,
boolean refreshTimeline) |
abstract O |
delete(K keys,
String instantTime)
|
void |
deleteColumns(String... colNames)
delete columns to table.
|
void |
deleteSavepoint(String savepointTime)
Delete a savepoint that was created.
|
protected abstract HoodieTable |
doInitTable(HoodieTableMetaClient metaClient,
Option<String> instantTime,
boolean initialMetadataTableIfNecessary)
Instantiates engine-specific instance of
HoodieTable as well as performs necessary
bootstrapping operations (for ex, validating whether Metadata Table has to be bootstrapped)
NOTE: THIS OPERATION IS EXECUTED UNDER LOCK, THEREFORE SHOULD AVOID ANY OPERATIONS
NOT REQUIRING EXTERNAL SYNCHRONIZATION |
void |
dropIndex(List<MetadataPartitionType> partitionTypes)
Drops the index and removes the metadata partitions.
|
abstract I |
filterExists(I hoodieRecords)
Filter out HoodieRecords that already exists in the output folder.
|
protected void |
finalizeWrite(HoodieTable table,
String instantTime,
List<HoodieWriteStat> stats)
Finalize Write operation.
|
HoodieIndex<?,?> |
getIndex() |
protected List<String> |
getInstantsToRollback(HoodieTableMetaClient metaClient,
HoodieFailedWritesCleaningPolicy cleaningPolicy,
Option<String> curInstantTime) |
HoodieMetrics |
getMetrics() |
WriteOperationType |
getOperationType() |
protected Option<HoodiePendingRollbackInfo> |
getPendingRollbackInfo(HoodieTableMetaClient metaClient,
String commitToRollback) |
protected 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. |
Option<HoodieIndexCommitMetadata> |
index(String indexInstantTime)
Runs INDEX action to build out the metadata partitions as planned for the given instant time.
|
protected HoodieTable |
initTable(WriteOperationType operationType,
Option<String> instantTime) |
protected HoodieTable |
initTable(WriteOperationType operationType,
Option<String> instantTime,
boolean initialMetadataTableIfNecessary)
Instantiates and initializes instance of
HoodieTable, performing crucial bootstrapping
operations such as:
NOTE: This method is engine-agnostic and SHOULD NOT be overloaded, please check on
doInitTable(HoodieTableMetaClient, Option, boolean) instead
Checking whether upgrade/downgrade is required
Bootstrapping Metadata Table (if required)
Initializing metrics contexts
|
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> |
inlineScheduleClustering(Option<Map<String,String>> extraMetadata)
Schedules clustering inline.
|
protected Option<String> |
inlineScheduleCompaction(Option<Map<String,String>> extraMetadata)
Schedules compaction inline.
|
abstract O |
insert(I records,
String instantTime)
Inserts the given HoodieRecords, into the table.
|
abstract O |
insertPreppedRecords(I preppedRecords,
String instantTime)
Inserts the given prepared records into the Hoodie table, at the supplied instantTime.
|
protected void |
postCommit(HoodieTable table,
HoodieCommitMetadata metadata,
String instantTime,
Option<Map<String,String>> extraMetadata,
boolean acquireLockForArchival)
Post Commit Hook.
|
protected abstract O |
postWrite(HoodieWriteMetadata<O> result,
String instantTime,
HoodieTable hoodieTable)
Common method containing steps to be performed after write (upsert/insert/..) operations including auto-commit.
|
protected void |
preCommit(HoodieInstant inflightInstant,
HoodieCommitMetadata metadata)
Any pre-commit actions like conflict resolution goes here.
|
protected void |
preWrite(String instantTime,
WriteOperationType writeOperationType,
HoodieTableMetaClient metaClient)
Common method containing steps to be performed before write (upsert/insert/...
|
protected void |
releaseResources()
Called after each write, to release any resources used.
|
void |
renameColumn(String colName,
String newName)
rename col name for hudi table.
|
void |
reOrderColPosition(String colName,
String referColName,
TableChange.ColumnPositionChange.ColumnPositionType orderType)
reorder the position of col.
|
HoodieRestoreMetadata |
restoreToInstant(String instantTime,
boolean initialMetadataTableIfNecessary)
NOTE : This action requires all writers (ingest and compact) to a table to be stopped before proceeding.
|
void |
restoreToSavepoint(String savepointTime)
Restore the data to the savepoint.
|
boolean |
rollback(String commitInstantTime)
Deprecated.
|
boolean |
rollback(String commitInstantTime,
Option<HoodiePendingRollbackInfo> pendingRollbackInfo,
boolean skipLocking)
Deprecated.
|
protected void |
rollbackFailedBootstrap()
Main API to rollback failed bootstrap.
|
protected Boolean |
rollbackFailedWrites()
Rollback all failed writes.
|
protected Boolean |
rollbackFailedWrites(boolean skipLocking)
Rollback all failed writes.
|
protected void |
rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback,
boolean skipLocking) |
protected void |
rollbackInflightClustering(HoodieInstant inflightInstant,
HoodieTable table) |
protected void |
runAnyPendingClustering(HoodieTable table) |
void |
runAnyPendingCompactions()
Run any pending compactions.
|
protected void |
runAnyPendingCompactions(HoodieTable table) |
protected void |
runTableServicesInline(HoodieTable table,
HoodieCommitMetadata metadata,
Option<Map<String,String>> extraMetadata) |
void |
savepoint(String user,
String comment)
Create a savepoint based on the latest commit action on the timeline.
|
void |
savepoint(String instantTime,
String user,
String comment)
Savepoint a specific commit instant time.
|
protected Option<String> |
scheduleCleaning(Option<Map<String,String>> extraMetadata)
Schedules a new cleaning instant.
|
protected boolean |
scheduleCleaningAtInstant(String instantTime,
Option<Map<String,String>> extraMetadata)
Schedules a new cleaning instant with passed-in instant time.
|
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> |
scheduleIndexing(List<MetadataPartitionType> partitionTypes)
Schedules INDEX action.
|
Option<String> |
scheduleTableService(Option<Map<String,String>> extraMetadata,
TableServiceType tableServiceType)
Schedule table services such as clustering, compaction & cleaning.
|
Option<String> |
scheduleTableService(String instantTime,
Option<Map<String,String>> extraMetadata,
TableServiceType tableServiceType)
Schedule table services such as clustering, compaction & cleaning.
|
void |
setOperationType(WriteOperationType operationType) |
protected void |
setWriteSchemaForDeletes(HoodieTableMetaClient metaClient)
Sets write schema from last instant since deletes may not have schema set in the config.
|
String |
startCommit()
Provides a new commit time for a write operation (insert/update/delete).
|
String |
startCommit(String actionType,
HoodieTableMetaClient metaClient)
Provides a new commit time for a write operation (insert/update/delete/insert_overwrite/insert_overwrite_table) with specified action.
|
void |
startCommitWithTime(String instantTime)
Provides a new commit time for a write operation (insert/update/delete/insert_overwrite/insert_overwrite_table) without specified action.
|
void |
startCommitWithTime(String instantTime,
String actionType)
Completes a new commit time for a write operation (insert/update/delete/insert_overwrite/insert_overwrite_table) with specified action.
|
void |
updateColumnComment(String colName,
String doc)
update col comment for hudi table.
|
void |
updateColumnNullability(String colName,
boolean nullable)
update col nullable attribute for hudi table.
|
void |
updateColumnType(String colName,
Type newType)
update col Type for hudi table.
|
abstract O |
upsert(I records,
String instantTime)
Upsert a batch of new records into Hoodie table at the supplied instantTime.
|
abstract O |
upsertPreppedRecords(I preppedRecords,
String instantTime)
Upserts the given prepared records into the Hoodie table, at the supplied instantTime.
|
protected void |
writeTableMetadata(HoodieTable table,
String instantTime,
String actionType,
HoodieCommitMetadata metadata)
Write the HoodieCommitMetadata to metadata table if available.
|
createMetaClient, getConfig, getEngineContext, getHeartbeatClient, getTimelineServer, initWrapperFSMetricsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittableServicesEnabledprotected static final String LOOKUP_STR
protected final transient HoodieMetrics metrics
protected transient com.codahale.metrics.Timer.Context writeTimer
protected transient com.codahale.metrics.Timer.Context compactionTimer
protected transient com.codahale.metrics.Timer.Context clusteringTimer
protected transient AsyncCleanerService asyncCleanerService
protected transient AsyncArchiveService asyncArchiveService
protected final TransactionManager txnManager
protected Option<Pair<HoodieInstant,Map<String,String>>> lastCompletedTxnAndMetadata
@Deprecated public BaseHoodieWriteClient(HoodieEngineContext context, HoodieWriteConfig writeConfig, SupportsUpgradeDowngrade upgradeDowngradeHelper)
context - HoodieEngineContextwriteConfig - instance of HoodieWriteConfigupgradeDowngradeHelper - engine-specific instance of SupportsUpgradeDowngrade@Deprecated public BaseHoodieWriteClient(HoodieEngineContext context, HoodieWriteConfig writeConfig, Option<EmbeddedTimelineService> timelineService, SupportsUpgradeDowngrade upgradeDowngradeHelper)
context - HoodieEngineContextwriteConfig - instance of HoodieWriteConfigtimelineService - Timeline Service that runs as part of write client.protected abstract HoodieIndex<?,?> createIndex(HoodieWriteConfig writeConfig)
public void setOperationType(WriteOperationType operationType)
public WriteOperationType getOperationType()
public boolean commit(String instantTime, O writeStatuses)
public boolean commit(String instantTime, O writeStatuses, Option<Map<String,String>> extraMetadata)
public abstract boolean commit(String instantTime, O writeStatuses, Option<Map<String,String>> extraMetadata, String commitActionType, Map<String,List<String>> partitionToReplacedFileIds)
public boolean commitStats(String instantTime, List<HoodieWriteStat> stats, Option<Map<String,String>> extraMetadata, String commitActionType)
public boolean commitStats(String instantTime, List<HoodieWriteStat> stats, Option<Map<String,String>> extraMetadata, String commitActionType, Map<String,List<String>> partitionToReplaceFileIds)
protected void commit(HoodieTable table, String commitActionType, String instantTime, HoodieCommitMetadata metadata, List<HoodieWriteStat> stats) throws IOException
IOExceptionprotected HoodieTable createTable(HoodieWriteConfig config, org.apache.hadoop.conf.Configuration hadoopConf)
protected abstract HoodieTable createTable(HoodieWriteConfig config, org.apache.hadoop.conf.Configuration hadoopConf, boolean refreshTimeline)
protected void preCommit(HoodieInstant inflightInstant, HoodieCommitMetadata metadata)
inflightInstant - instant of inflight operation.metadata - commit metadata for which pre commit is being invoked.protected void writeTableMetadata(HoodieTable table, String instantTime, String actionType, HoodieCommitMetadata metadata)
table - HoodieTable of interest.instantTime - instant time of the commit.actionType - action type of the commit.metadata - instance of HoodieCommitMetadata.public abstract I filterExists(I hoodieRecords)
hoodieRecords - Input Hoodie records.public void bootstrap(Option<Map<String,String>> extraMetadata)
protected void rollbackFailedBootstrap()
public abstract O upsert(I records, String instantTime)
records - hoodieRecords to upsertinstantTime - Instant time of the commitpublic abstract O upsertPreppedRecords(I preppedRecords, String instantTime)
This implementation requires that the input records are already tagged, and de-duped if needed.
preppedRecords - Prepared HoodieRecords to upsertinstantTime - Instant time of the commitpublic abstract O insert(I records, String instantTime)
This implementation skips the index check and is able to leverage benefits such as small file handling/blocking alignment, as with upsert(), by profiling the workload
records - HoodieRecords to insertinstantTime - Instant time of the commitpublic abstract O insertPreppedRecords(I preppedRecords, String instantTime)
This implementation skips the index check, skips de-duping and is able to leverage benefits such as small file handling/blocking alignment, as with insert(), by profiling the workload. The prepared HoodieRecords should be de-duped if needed.
preppedRecords - HoodieRecords to insertinstantTime - Instant time of the commitpublic abstract O bulkInsert(I records, String instantTime)
This implementation uses sortBy (which does range partitioning based on reservoir sampling) and attempts to control
the numbers of files with less memory compared to the BaseHoodieWriteClient#insert(I, String)
records - HoodieRecords to insertinstantTime - Instant time of the commitpublic abstract O bulkInsert(I records, String instantTime, Option<BulkInsertPartitioner> userDefinedBulkInsertPartitioner)
This implementation uses sortBy (which does range partitioning based on reservoir sampling) and attempts to control
the numbers of files with less memory compared to the BaseHoodieWriteClient#insert(I, String). Optionally
it allows users to specify their own partitioner. If specified then it will be used for repartitioning records. See
BulkInsertPartitioner.
records - HoodieRecords to insertinstantTime - Instant time of the commituserDefinedBulkInsertPartitioner - If specified then it will be used to partition input records before they are inserted
into hoodie.public abstract O bulkInsertPreppedRecords(I preppedRecords, String instantTime, Option<BulkInsertPartitioner> bulkInsertPartitioner)
This implementation uses sortBy (which does range partitioning based on reservoir sampling) and attempts to control
the numbers of files with less memory compared to the BaseHoodieWriteClient#insert(I, String). Optionally
it allows users to specify their own partitioner. If specified then it will be used for repartitioning records. See
BulkInsertPartitioner.
preppedRecords - HoodieRecords to insertinstantTime - Instant time of the commitbulkInsertPartitioner - If specified then it will be used to partition input records before they are inserted
into hoodie.protected void preWrite(String instantTime, WriteOperationType writeOperationType, HoodieTableMetaClient metaClient)
instantTime - writeOperationType - metaClient - protected abstract O postWrite(HoodieWriteMetadata<O> result, String instantTime, HoodieTable hoodieTable)
result - Commit Action ResultinstantTime - Instant TimehoodieTable - Hoodie Tableprotected void postCommit(HoodieTable table, HoodieCommitMetadata metadata, String instantTime, Option<Map<String,String>> extraMetadata, boolean acquireLockForArchival)
table - table to commit onmetadata - Commit Metadata corresponding to committed instantinstantTime - Instant TimeextraMetadata - Additional Metadata passed by useracquireLockForArchival - true if lock has to be acquired for archival. false otherwise.protected void runTableServicesInline(HoodieTable table, HoodieCommitMetadata metadata, Option<Map<String,String>> extraMetadata)
protected void runAnyPendingCompactions(HoodieTable table)
protected void runAnyPendingClustering(HoodieTable table)
protected void autoCleanOnCommit()
protected void autoArchiveOnCommit(HoodieTable table, boolean acquireLockForArchival)
public void runAnyPendingCompactions()
public void savepoint(String user, String comment)
user - - User creating the savepointcomment - - Comment for the savepointpublic void savepoint(String instantTime, String user, String comment)
This gives an option to rollback the state to the savepoint anytime. Savepoint needs to be manually created and deleted.
Savepoint should be on a commit that could not have been cleaned.
instantTime - - commit that should be savepointeduser - - User creating the savepointcomment - - Comment for the savepointpublic void deleteSavepoint(String savepointTime)
savepointTime - - delete the savepointpublic void restoreToSavepoint(String savepointTime)
savepointTime - - savepoint time to rollback to@Deprecated public boolean rollback(String commitInstantTime) throws HoodieRollbackException
HoodieRollbackException@Deprecated public boolean rollback(String commitInstantTime, Option<HoodiePendingRollbackInfo> pendingRollbackInfo, boolean skipLocking) 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 HoodieRestoreMetadata restoreToInstant(String instantTime, boolean initialMetadataTableIfNecessary) throws HoodieRestoreException
instantTime - Instant time to which restoration is requestedHoodieRestoreExceptionpublic HoodieCleanMetadata clean(String cleanInstantTime) throws HoodieIOException
HoodieIOExceptionpublic HoodieCleanMetadata clean(String cleanInstantTime, boolean skipLocking) throws HoodieIOException
cleanInstantTime - instant time for clean.skipLocking - if this is triggered by another parent transaction, locking can be skipped.HoodieCleanMetadata.HoodieIOExceptionpublic 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.skipLocking - if this is triggered by another parent transaction, locking can be skipped.HoodieIOExceptionpublic HoodieCleanMetadata clean()
public HoodieCleanMetadata clean(boolean skipLocking)
skipLocking - if this is triggered by another parent transaction, locking can be skipped.HoodieCleanMetadata.protected void archive(HoodieTable table, boolean acquireLockForArchival)
table - table to commit on.acquireLockForArchival - true if lock has to be acquired for archival. false otherwise.public void archive()
public String startCommit()
public String startCommit(String actionType, HoodieTableMetaClient metaClient)
public void startCommitWithTime(String instantTime)
instantTime - Instant time to be generatedpublic void startCommitWithTime(String instantTime, String actionType)
public Option<String> scheduleCompaction(Option<Map<String,String>> extraMetadata) throws HoodieIOException
extraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic boolean scheduleCompactionAtInstant(String instantTime, Option<Map<String,String>> extraMetadata) throws HoodieIOException
instantTime - Compaction Instant TimeextraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic Option<String> scheduleIndexing(List<MetadataPartitionType> partitionTypes)
partitionTypes - - list of MetadataPartitionType which needs to be indexedpublic Option<HoodieIndexCommitMetadata> index(String indexInstantTime)
indexInstantTime - - instant time for the requested INDEX actionOption after successful indexing.public void dropIndex(List<MetadataPartitionType> partitionTypes)
partitionTypes - - list of MetadataPartitionType which needs to be indexedpublic HoodieWriteMetadata<O> compact(String compactionInstantTime)
compactionInstantTime - Compaction Instant Timepublic abstract 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 abstract void completeCompaction(HoodieCommitMetadata metadata, HoodieTable table, String compactionCommitTime)
protected Option<HoodiePendingRollbackInfo> getPendingRollbackInfo(HoodieTableMetaClient metaClient, String commitToRollback)
protected 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 rollbackFailedWrites()
protected Boolean rollbackFailedWrites(boolean skipLocking)
skipLocking - if this is triggered by another parent transaction, locking can be skipped.protected void rollbackFailedWrites(Map<String,Option<HoodiePendingRollbackInfo>> instantsToRollback, boolean skipLocking)
protected List<String> getInstantsToRollback(HoodieTableMetaClient metaClient, HoodieFailedWritesCleaningPolicy cleaningPolicy, Option<String> curInstantTime)
protected abstract HoodieWriteMetadata<O> compact(String compactionInstantTime, boolean shouldComplete)
compactionInstantTime - Compaction Instant Timeprotected Option<String> inlineCompaction(Option<Map<String,String>> extraMetadata)
protected Option<String> inlineScheduleCompaction(Option<Map<String,String>> extraMetadata)
extraMetadata - extrametada to be used.public 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 storedHoodieIOExceptionprotected Option<String> scheduleCleaning(Option<Map<String,String>> extraMetadata) throws HoodieIOException
extraMetadata - Extra Metadata to be storedHoodieIOExceptionprotected boolean scheduleCleaningAtInstant(String instantTime, Option<Map<String,String>> extraMetadata) throws HoodieIOException
instantTime - cleaning Instant TimeextraMetadata - Extra Metadata to be storedHoodieIOExceptionpublic abstract HoodieWriteMetadata<O> cluster(String clusteringInstant, boolean shouldComplete)
clusteringInstant - Clustering Instant Timepublic Option<String> scheduleTableService(Option<Map<String,String>> extraMetadata, TableServiceType tableServiceType)
extraMetadata - Metadata to pass onto the scheduled service instanttableServiceType - Type of table service to schedulepublic 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> inlineClustering(Option<Map<String,String>> extraMetadata)
protected Option<String> inlineScheduleClustering(Option<Map<String,String>> extraMetadata)
extraMetadata - extrametadata to use.protected void rollbackInflightClustering(HoodieInstant inflightInstant, HoodieTable table)
protected void finalizeWrite(HoodieTable table, String instantTime, List<HoodieWriteStat> stats)
table - HoodieTableinstantTime - Instant Timestats - Hoodie Write Statpublic HoodieMetrics getMetrics()
public HoodieIndex<?,?> getIndex()
protected abstract HoodieTable doInitTable(HoodieTableMetaClient metaClient, Option<String> instantTime, boolean initialMetadataTableIfNecessary)
HoodieTable as well as performs necessary
bootstrapping operations (for ex, validating whether Metadata Table has to be bootstrapped)
NOTE: THIS OPERATION IS EXECUTED UNDER LOCK, THEREFORE SHOULD AVOID ANY OPERATIONS
NOT REQUIRING EXTERNAL SYNCHRONIZATIONmetaClient - instance of HoodieTableMetaClientinstantTime - current inflight instant timeHoodieTableprotected final HoodieTable initTable(WriteOperationType operationType, Option<String> instantTime, boolean initialMetadataTableIfNecessary)
HoodieTable, performing crucial bootstrapping
operations such as:
NOTE: This method is engine-agnostic and SHOULD NOT be overloaded, please check on
doInitTable(HoodieTableMetaClient, Option, boolean) instead
protected final HoodieTable initTable(WriteOperationType operationType, Option<String> instantTime)
protected void setWriteSchemaForDeletes(HoodieTableMetaClient metaClient)
protected void releaseResources()
public void close()
BaseHoodieClientclose in interface AutoCloseableclose in class BaseHoodieClientpublic void addColumn(String colName, org.apache.avro.Schema schema, String doc, String position, TableChange.ColumnPositionChange.ColumnPositionType positionType)
colName - col name to be added. if we want to add col to a nested filed, the fullName should be specifyschema - col type to be added.doc - col doc to be added.position - col position to be addedpositionType - col position change type. now support three change types: first/after/beforepublic void addColumn(String colName, org.apache.avro.Schema schema)
public void deleteColumns(String... colNames)
colNames - col name to be deleted. if we want to delete col from a nested filed, the fullName should be specifypublic void renameColumn(String colName, String newName)
colName - col name to be renamed. if we want to rename col from a nested filed, the fullName should be specifynewName - new name for current col. no need to specify fullName.public void updateColumnNullability(String colName, boolean nullable)
colName - col name to be changed. if we want to change col from a nested filed, the fullName should be specifynullable - .public void updateColumnType(String colName, Type newType)
colName - col name to be changed. if we want to change col from a nested filed, the fullName should be specifynewType - .public void updateColumnComment(String colName, String doc)
colName - col name to be changed. if we want to change col from a nested filed, the fullName should be specifydoc - .public void reOrderColPosition(String colName, String referColName, TableChange.ColumnPositionChange.ColumnPositionType orderType)
colName - column which need to be reordered. if we want to change col from a nested filed, the fullName should be specify.referColName - reference position.orderType - col position change type. now support three change types: first/after/beforeCopyright © 2022 The Apache Software Foundation. All rights reserved.