Class BaseMetastoreTableOperations
- All Implemented Interfaces:
- TableOperations
- Direct Known Subclasses:
- EcsTableOperations,- HiveTableOperations,- NessieTableOperations
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.iceberg.BaseMetastoreOperationsBaseMetastoreOperations.CommitStatus
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected BaseMetastoreOperations.CommitStatuscheckCommitStatus(String newMetadataLocation, TableMetadata config) Attempt to load the table and see if any current or past metadata location matches the one we were attempting to set.protected BaseMetastoreOperations.CommitStatuscheckCommitStatusStrict(String newMetadataLocation, TableMetadata config) Attempt to load the table and see if any current or past metadata location matches the one we were attempting to set.voidcommit(TableMetadata base, TableMetadata metadata) Replace the base table metadata with a new version.current()Return the currently loaded table metadata, without checking for updates.intprotected voidprotected voiddoCommit(TableMetadata base, TableMetadata metadata) protected voidReturns aLocationProviderthat supplies locations for new new data files.metadataFileLocation(String filename) Given the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.refresh()Return the current table metadata after checking for updates.protected voidrefreshFromMetadataLocation(String newLocation) protected voidrefreshFromMetadataLocation(String newLocation, int numRetries) protected voidrefreshFromMetadataLocation(String newLocation, Predicate<Exception> shouldRetry, int numRetries) protected voidrefreshFromMetadataLocation(String newLocation, Predicate<Exception> shouldRetry, int numRetries, Function<String, TableMetadata> metadataLoader) protected voidprotected abstract StringThe full name of the table used for logging purposes only.temp(TableMetadata uncommittedMetadata) Return a temporaryTableOperationsinstance that uses configuration from uncommitted metadata.protected StringwriteNewMetadata(TableMetadata metadata, int newVersion) protected StringwriteNewMetadataIfRequired(boolean newTable, TableMetadata metadata) Methods inherited from class org.apache.iceberg.BaseMetastoreOperationscheckCommitStatus, checkCommitStatusStrictMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.TableOperationsencryption, io, newSnapshotId, requireStrictCleanup
- 
Field Details- 
TABLE_TYPE_PROP- See Also:
 
- 
ICEBERG_TABLE_TYPE_VALUE- See Also:
 
- 
METADATA_LOCATION_PROP- See Also:
 
- 
PREVIOUS_METADATA_LOCATION_PROP- See Also:
 
 
- 
- 
Constructor Details- 
BaseMetastoreTableOperationsprotected BaseMetastoreTableOperations()
 
- 
- 
Method Details- 
tableNameThe full name of the table used for logging purposes only. For example for HiveTableOperations it is catalogName + "." + database + "." + table.- Returns:
- The full name
 
- 
currentDescription copied from interface:TableOperationsReturn the currently loaded table metadata, without checking for updates.- Specified by:
- currentin interface- TableOperations
- Returns:
- table metadata
 
- 
currentMetadataLocation
- 
currentVersionpublic int currentVersion()
- 
refreshDescription copied from interface:TableOperationsReturn the current table metadata after checking for updates.- Specified by:
- refreshin interface- TableOperations
- Returns:
- table metadata
 
- 
doRefreshprotected void doRefresh()
- 
commitDescription copied from interface:TableOperationsReplace the base table metadata with a new version.This method should implement and document atomicity guarantees. Implementations must check that the base metadata is current to avoid overwriting updates. Once the atomic commit operation succeeds, implementations must not perform any operations that may fail because failure in this method cannot be distinguished from commit failure. Implementations must throw a CommitStateUnknownExceptionin cases where it cannot be determined if the commit succeeded or failed. For example if a network partition causes the confirmation of the commit to be lost, the implementation should throw a CommitStateUnknownException. This is important because downstream users of this API need to know whether they can clean up the commit or not, if the state is unknown then it is not safe to remove any files. All other exceptions will be treated as if the commit has failed.- Specified by:
- commitin interface- TableOperations
- Parameters:
- base- table metadata on which changes were based
- metadata- new table metadata with updates
 
- 
doCommit
- 
requestRefreshprotected void requestRefresh()
- 
disableRefreshprotected void disableRefresh()
- 
writeNewMetadataIfRequired
- 
writeNewMetadata
- 
refreshFromMetadataLocation
- 
refreshFromMetadataLocation
- 
refreshFromMetadataLocation
- 
refreshFromMetadataLocation
- 
metadataFileLocationDescription copied from interface:TableOperationsGiven the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.The file may not exist yet, in which case the path should be returned as if it were to be created by e.g. FileIO.newOutputFile(String).- Specified by:
- metadataFileLocationin interface- TableOperations
 
- 
locationProviderDescription copied from interface:TableOperationsReturns aLocationProviderthat supplies locations for new new data files.- Specified by:
- locationProviderin interface- TableOperations
- Returns:
- a location provider configured for the current table state
 
- 
tempDescription copied from interface:TableOperationsReturn a temporaryTableOperationsinstance that uses configuration from uncommitted metadata.This is called by transactions when uncommitted table metadata should be used; for example, to create a metadata file location based on metadata in the transaction that has not been committed. Transactions will not call TableOperations.refresh()orTableOperations.commit(TableMetadata, TableMetadata).- Specified by:
- tempin interface- TableOperations
- Parameters:
- uncommittedMetadata- uncommitted table metadata
- Returns:
- a temporary table operations that behaves like the uncommitted metadata is current
 
- 
checkCommitStatusprotected BaseMetastoreOperations.CommitStatus checkCommitStatus(String newMetadataLocation, TableMetadata config) Attempt to load the table and see if any current or past metadata location matches the one we were attempting to set. This is used as a last resort when we are dealing with exceptions that may indicate the commit has failed but are not proof that this is the case. Past locations must also be searched on the chance that a second committer was able to successfully commit on top of our commit. When thenewMetadataLocationis not found, the method returnsBaseMetastoreOperations.CommitStatus.UNKNOWN.- Parameters:
- newMetadataLocation- the path of the new commit file
- config- metadata to use for configuration
- Returns:
- Commit Status of Success, Unknown
 
- 
checkCommitStatusStrictprotected BaseMetastoreOperations.CommitStatus checkCommitStatusStrict(String newMetadataLocation, TableMetadata config) Attempt to load the table and see if any current or past metadata location matches the one we were attempting to set. This is used as a last resort when we are dealing with exceptions that may indicate the commit has failed but are not proof that this is the case. Past locations must also be searched on the chance that a second committer was able to successfully commit on top of our commit. When thenewMetadataLocationis not found, the method returnsBaseMetastoreOperations.CommitStatus.FAILURE.- Parameters:
- newMetadataLocation- the path of the new commit file
- config- metadata to use for configuration
- Returns:
- Commit Status of Success, Failure or Unknown
 
 
-