public class FileStoreCommitImpl extends Object implements FileStoreCommit
FileStoreCommit.
This class provides an atomic commit method to the user.
commit(org.apache.paimon.manifest.ManifestCommittable, java.util.Map<java.lang.String, java.lang.String>), if user cannot determine if this commit
is done before, user should first call filterCommitted(java.util.List<org.apache.paimon.manifest.ManifestCommittable>).
lock (if provided) or the atomic
rename of the file system to ensure atomicity.
NOTE: If you want to modify this class, any exception during commit MUST NOT BE IGNORED. They must be thrown to restart the job. It is recommended to run FileStoreCommitTest thousands of times to make sure that your changes are correct.
| Constructor and Description |
|---|
FileStoreCommitImpl(FileIO fileIO,
SchemaManager schemaManager,
String commitUser,
RowType partitionType,
String partitionDefaultName,
FileStorePathFactory pathFactory,
SnapshotManager snapshotManager,
ManifestFile.Factory manifestFileFactory,
ManifestList.Factory manifestListFactory,
IndexManifestFile.Factory indexManifestFileFactory,
FileStoreScan scan,
int numBucket,
MemorySize manifestTargetSize,
MemorySize manifestFullCompactionSize,
int manifestMergeMinCount,
boolean dynamicPartitionOverwrite,
Comparator<InternalRow> keyComparator,
String branchName,
StatsFileHandler statsFileHandler,
BucketMode bucketMode,
Integer manifestReadParallelism,
List<CommitCallback> commitCallbacks,
int commitMaxRetries) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(List<CommitMessage> commitMessages)
Abort an unsuccessful commit.
|
void |
close() |
void |
commit(ManifestCommittable committable,
Map<String,String> properties)
Commit from manifest committable.
|
void |
commit(ManifestCommittable committable,
Map<String,String> properties,
boolean checkAppendFiles)
Commit from manifest committable with checkAppendFiles.
|
void |
commitStatistics(Statistics stats,
long commitIdentifier)
Commit new statistics.
|
void |
dropPartitions(List<Map<String,String>> partitions,
long commitIdentifier)
Drop multiple partitions.
|
FileIO |
fileIO() |
List<ManifestCommittable> |
filterCommitted(List<ManifestCommittable> committables)
Find out which committables need to be retried when recovering from the failure.
|
FileStoreCommit |
ignoreEmptyCommit(boolean ignoreEmptyCommit) |
void |
overwrite(Map<String,String> partition,
ManifestCommittable committable,
Map<String,String> properties)
Overwrite from manifest committable and partition.
|
FileStorePathFactory |
pathFactory() |
void |
truncateTable(long commitIdentifier) |
FileStoreCommit |
withLock(Lock lock)
With global lock.
|
FileStoreCommit |
withMetrics(CommitMetrics metrics)
With metrics to measure commits.
|
FileStoreCommit |
withPartitionExpire(PartitionExpire partitionExpire) |
public FileStoreCommitImpl(FileIO fileIO, SchemaManager schemaManager, String commitUser, RowType partitionType, String partitionDefaultName, FileStorePathFactory pathFactory, SnapshotManager snapshotManager, ManifestFile.Factory manifestFileFactory, ManifestList.Factory manifestListFactory, IndexManifestFile.Factory indexManifestFileFactory, FileStoreScan scan, int numBucket, MemorySize manifestTargetSize, MemorySize manifestFullCompactionSize, int manifestMergeMinCount, boolean dynamicPartitionOverwrite, @Nullable Comparator<InternalRow> keyComparator, String branchName, StatsFileHandler statsFileHandler, BucketMode bucketMode, @Nullable Integer manifestReadParallelism, List<CommitCallback> commitCallbacks, int commitMaxRetries)
public FileStoreCommit withLock(Lock lock)
FileStoreCommitwithLock in interface FileStoreCommitpublic FileStoreCommit ignoreEmptyCommit(boolean ignoreEmptyCommit)
ignoreEmptyCommit in interface FileStoreCommitpublic FileStoreCommit withPartitionExpire(PartitionExpire partitionExpire)
withPartitionExpire in interface FileStoreCommitpublic List<ManifestCommittable> filterCommitted(List<ManifestCommittable> committables)
FileStoreCommitfilterCommitted in interface FileStoreCommitpublic void commit(ManifestCommittable committable, Map<String,String> properties)
FileStoreCommitcommit in interface FileStoreCommitpublic void commit(ManifestCommittable committable, Map<String,String> properties, boolean checkAppendFiles)
FileStoreCommitcommit in interface FileStoreCommitpublic void overwrite(Map<String,String> partition, ManifestCommittable committable, Map<String,String> properties)
FileStoreCommitoverwrite in interface FileStoreCommitpartition - A single partition maps each partition key to a partition value. Depending
on the user-defined statement, the partition might not include all partition keys. Also
note that this partition does not necessarily equal to the partitions of the newly added
key-values. This is just the partition to be cleaned up.public void dropPartitions(List<Map<String,String>> partitions, long commitIdentifier)
FileStoreCommitSnapshot.CommitKind of generated snapshot is Snapshot.CommitKind#OVERWRITE.dropPartitions in interface FileStoreCommitpartitions - A list of partition Maps. NOTE: cannot be empty!public void truncateTable(long commitIdentifier)
truncateTable in interface FileStoreCommitpublic void abort(List<CommitMessage> commitMessages)
FileStoreCommitabort in interface FileStoreCommitpublic FileStoreCommit withMetrics(CommitMetrics metrics)
FileStoreCommitwithMetrics in interface FileStoreCommitpublic void commitStatistics(Statistics stats, long commitIdentifier)
FileStoreCommitSnapshot.CommitKind of generated snapshot is Snapshot.CommitKind#ANALYZE.commitStatistics in interface FileStoreCommitpublic FileStorePathFactory pathFactory()
pathFactory in interface FileStoreCommitpublic FileIO fileIO()
fileIO in interface FileStoreCommitpublic void close()
close in interface AutoCloseableclose in interface FileStoreCommitCopyright © 2023–2024 The Apache Software Foundation. All rights reserved.