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 tableName,
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 |
compactManifest()
Compact the manifest entries only.
|
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 tableName, 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)
FileStoreCommit
withLock
in interface FileStoreCommit
public FileStoreCommit ignoreEmptyCommit(boolean ignoreEmptyCommit)
ignoreEmptyCommit
in interface FileStoreCommit
public FileStoreCommit withPartitionExpire(PartitionExpire partitionExpire)
withPartitionExpire
in interface FileStoreCommit
public List<ManifestCommittable> filterCommitted(List<ManifestCommittable> committables)
FileStoreCommit
filterCommitted
in interface FileStoreCommit
public void commit(ManifestCommittable committable, Map<String,String> properties)
FileStoreCommit
commit
in interface FileStoreCommit
public void commit(ManifestCommittable committable, Map<String,String> properties, boolean checkAppendFiles)
FileStoreCommit
commit
in interface FileStoreCommit
public void overwrite(Map<String,String> partition, ManifestCommittable committable, Map<String,String> properties)
FileStoreCommit
overwrite
in interface FileStoreCommit
partition
- 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)
FileStoreCommit
Snapshot.CommitKind
of generated snapshot is Snapshot.CommitKind#OVERWRITE
.dropPartitions
in interface FileStoreCommit
partitions
- A list of partition Map
s. NOTE: cannot be empty!public void truncateTable(long commitIdentifier)
truncateTable
in interface FileStoreCommit
public void abort(List<CommitMessage> commitMessages)
FileStoreCommit
abort
in interface FileStoreCommit
public FileStoreCommit withMetrics(CommitMetrics metrics)
FileStoreCommit
withMetrics
in interface FileStoreCommit
public void commitStatistics(Statistics stats, long commitIdentifier)
FileStoreCommit
Snapshot.CommitKind
of generated snapshot is Snapshot.CommitKind#ANALYZE
.commitStatistics
in interface FileStoreCommit
public FileStorePathFactory pathFactory()
pathFactory
in interface FileStoreCommit
public FileIO fileIO()
fileIO
in interface FileStoreCommit
public void compactManifest()
FileStoreCommit
compactManifest
in interface FileStoreCommit
public void close()
close
in interface AutoCloseable
close
in interface FileStoreCommit
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.