public class HoodieTableMetaClient extends Object implements Serializable
HoodieTableMetaClient allows to access meta-data about a hoodie table It returns meta-data about
commits, savepoints, compactions, cleanups as a HoodieTimeline Create an instance of the
HoodieTableMetaClient with FileSystem and basePath to start getting the meta-data.
All the timelines are computed lazily, once computed the timeline is cached and never refreshed. Use the
HoodieTimeline.reload() to refresh timelines.
HoodieTimeline,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
HoodieTableMetaClient.Builder
Builder for
HoodieTableMetaClient. |
static class |
HoodieTableMetaClient.PropertyBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected HoodieActiveTimeline |
activeTimeline |
static String |
AUXILIARYFOLDER_NAME |
protected SerializablePath |
basePath |
static String |
BOOTSTRAP_INDEX_BY_FILE_ID_FOLDER_PATH |
static String |
BOOTSTRAP_INDEX_BY_PARTITION_FOLDER_PATH |
static String |
BOOTSTRAP_INDEX_ROOT_FOLDER_PATH |
protected SerializableConfiguration |
hadoopConf |
static String |
HASHING_METADATA_FOLDER_NAME |
static String |
HEARTBEAT_FOLDER_NAME |
static String |
MARKER_EXTN |
static String |
METADATA_TABLE_FOLDER_PATH |
static String |
METAFOLDER_NAME |
protected SerializablePath |
metaPath |
protected HoodieMetastoreConfig |
metastoreConfig |
static String |
SCHEMA_FOLDER_NAME |
protected HoodieTableConfig |
tableConfig |
static String |
TEMPFOLDER_NAME |
| Modifier | Constructor and Description |
|---|---|
|
HoodieTableMetaClient()
Deprecated.
|
protected |
HoodieTableMetaClient(org.apache.hadoop.conf.Configuration conf,
String basePath,
boolean loadActiveTimelineOnLoad,
ConsistencyGuardConfig consistencyGuardConfig,
Option<TimelineLayoutVersion> layoutVersion,
String payloadClassName,
FileSystemRetryConfig fileSystemRetryConfig) |
| Modifier and Type | Method and Description |
|---|---|
static HoodieTableMetaClient.Builder |
builder() |
boolean |
equals(Object o) |
HoodieActiveTimeline |
getActiveTimeline()
Get the active instants as a timeline.
|
HoodieArchivedTimeline |
getArchivedTimeline()
Get the archived commits as a timeline.
|
HoodieArchivedTimeline |
getArchivedTimeline(String startTs)
Returns fresh new archived commits as a timeline from startTs (inclusive).
|
String |
getArchivePath() |
String |
getBasePath()
Deprecated.
please use
getBasePathV2() |
org.apache.hadoop.fs.Path |
getBasePathV2()
Returns base path of the table
|
String |
getBootstrapIndexByFileIdFolderNameFolderPath() |
String |
getBootstrapIndexByPartitionFolderPath() |
String |
getCommitActionType()
Gets the commit action type.
|
HoodieTimeline |
getCommitsAndCompactionTimeline()
Get the commit + pending-compaction timeline visible for this table.
|
HoodieTimeline |
getCommitsTimeline()
Get the commit timeline visible for this table.
|
HoodieTimeline |
getCommitTimeline()
Get the compacted commit timeline visible for this table.
|
ConsistencyGuardConfig |
getConsistencyGuardConfig() |
FileSystemRetryConfig |
getFileSystemRetryConfig() |
HoodieWrapperFileSystem |
getFs()
Get the FS implementation for this table.
|
org.apache.hadoop.conf.Configuration |
getHadoopConf() |
String |
getHashingMetadataPath() |
static String |
getHeartbeatFolderPath(String basePath) |
String |
getMarkerFolderPath(String instantTs)
Returns Marker folder path.
|
String |
getMetaAuxiliaryPath() |
String |
getMetaPath() |
HoodieMetastoreConfig |
getMetastoreConfig() |
org.apache.hadoop.fs.FileSystem |
getRawFs()
Return raw file-system.
|
String |
getSchemaFolderName() |
HoodieTableConfig |
getTableConfig() |
HoodieTableType |
getTableType() |
String |
getTempFolderPath() |
TimelineLayoutVersion |
getTimelineLayoutVersion() |
int |
hashCode() |
void |
initializeBootstrapDirsIfNotExists() |
static void |
initializeBootstrapDirsIfNotExists(org.apache.hadoop.conf.Configuration hadoopConf,
String basePath,
org.apache.hadoop.fs.FileSystem fs) |
static HoodieTableMetaClient |
initTableAndGetMetaClient(org.apache.hadoop.conf.Configuration hadoopConf,
String basePath,
Properties props)
Helper method to initialize a given path as a hoodie table with configs passed in as Properties.
|
boolean |
isTimelineNonEmpty() |
static HoodieTableMetaClient |
reload(HoodieTableMetaClient oldMetaClient) |
HoodieActiveTimeline |
reloadActiveTimeline()
Reload ActiveTimeline and cache.
|
static org.apache.hadoop.fs.FileStatus[] |
scanFiles(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path metaPath,
org.apache.hadoop.fs.PathFilter nameFilter)
Helper method to scan all hoodie-instant metafiles.
|
List<HoodieInstant> |
scanHoodieInstantsFromFileSystem(org.apache.hadoop.fs.Path timelinePath,
Set<String> includedExtensions,
boolean applyLayoutVersionFilters)
Helper method to scan all hoodie-instant metafiles and construct HoodieInstant objects.
|
List<HoodieInstant> |
scanHoodieInstantsFromFileSystem(Set<String> includedExtensions,
boolean applyLayoutVersionFilters)
Helper method to scan all hoodie-instant metafiles and construct HoodieInstant objects.
|
void |
setFs(HoodieWrapperFileSystem fs) |
String |
toString() |
void |
validateTableProperties(Properties properties)
Validate table properties.
|
static HoodieTableMetaClient.PropertyBuilder |
withPropertyBuilder() |
public static final String METAFOLDER_NAME
public static final String TEMPFOLDER_NAME
public static final String AUXILIARYFOLDER_NAME
public static final String BOOTSTRAP_INDEX_ROOT_FOLDER_PATH
public static final String HEARTBEAT_FOLDER_NAME
public static final String METADATA_TABLE_FOLDER_PATH
public static final String HASHING_METADATA_FOLDER_NAME
public static final String BOOTSTRAP_INDEX_BY_PARTITION_FOLDER_PATH
public static final String BOOTSTRAP_INDEX_BY_FILE_ID_FOLDER_PATH
public static final String SCHEMA_FOLDER_NAME
public static final String MARKER_EXTN
protected SerializablePath basePath
protected SerializablePath metaPath
protected SerializableConfiguration hadoopConf
protected HoodieTableConfig tableConfig
protected HoodieActiveTimeline activeTimeline
protected HoodieMetastoreConfig metastoreConfig
protected HoodieTableMetaClient(org.apache.hadoop.conf.Configuration conf,
String basePath,
boolean loadActiveTimelineOnLoad,
ConsistencyGuardConfig consistencyGuardConfig,
Option<TimelineLayoutVersion> layoutVersion,
String payloadClassName,
FileSystemRetryConfig fileSystemRetryConfig)
public HoodieTableMetaClient()
public static HoodieTableMetaClient reload(HoodieTableMetaClient oldMetaClient)
public org.apache.hadoop.fs.Path getBasePathV2()
@Deprecated public String getBasePath()
getBasePathV2()public HoodieTableType getTableType()
public String getMetaPath()
public String getSchemaFolderName()
public String getHashingMetadataPath()
public String getTempFolderPath()
public String getMarkerFolderPath(String instantTs)
instantTs - Instant Timestamppublic String getMetaAuxiliaryPath()
public static String getHeartbeatFolderPath(String basePath)
public String getBootstrapIndexByPartitionFolderPath()
public String getBootstrapIndexByFileIdFolderNameFolderPath()
public String getArchivePath()
public HoodieTableConfig getTableConfig()
public TimelineLayoutVersion getTimelineLayoutVersion()
public HoodieWrapperFileSystem getFs()
public void setFs(HoodieWrapperFileSystem fs)
public org.apache.hadoop.fs.FileSystem getRawFs()
public org.apache.hadoop.conf.Configuration getHadoopConf()
public HoodieActiveTimeline getActiveTimeline()
public HoodieActiveTimeline reloadActiveTimeline()
public ConsistencyGuardConfig getConsistencyGuardConfig()
public FileSystemRetryConfig getFileSystemRetryConfig()
public HoodieArchivedTimeline getArchivedTimeline()
public HoodieMetastoreConfig getMetastoreConfig()
public HoodieArchivedTimeline getArchivedTimeline(String startTs)
This is costly operation if really early endTs is specified. Be caution to use this only when the time range is short.
This method is not thread safe.
public void validateTableProperties(Properties properties)
properties - Properties from writeConfig.public static HoodieTableMetaClient initTableAndGetMetaClient(org.apache.hadoop.conf.Configuration hadoopConf, String basePath, Properties props) throws IOException
IOExceptionpublic static void initializeBootstrapDirsIfNotExists(org.apache.hadoop.conf.Configuration hadoopConf,
String basePath,
org.apache.hadoop.fs.FileSystem fs)
throws IOException
IOExceptionpublic static org.apache.hadoop.fs.FileStatus[] scanFiles(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path metaPath,
org.apache.hadoop.fs.PathFilter nameFilter)
throws IOException
fs - The file system implementation for this tablemetaPath - The meta path where meta files are storednameFilter - The name filter to filter meta filesIOException - In case of failurepublic boolean isTimelineNonEmpty()
true if any commits are found, else false.public HoodieTimeline getCommitsTimeline()
public HoodieTimeline getCommitsAndCompactionTimeline()
public HoodieTimeline getCommitTimeline()
public String getCommitActionType()
public List<HoodieInstant> scanHoodieInstantsFromFileSystem(Set<String> includedExtensions, boolean applyLayoutVersionFilters) throws IOException
includedExtensions - Included hoodie extensionsapplyLayoutVersionFilters - Depending on Timeline layout version, if there are multiple states for the same
action instant, only include the highest stateIOException - in case of failurepublic List<HoodieInstant> scanHoodieInstantsFromFileSystem(org.apache.hadoop.fs.Path timelinePath, Set<String> includedExtensions, boolean applyLayoutVersionFilters) throws IOException
timelinePath - MetaPath where instant files are storedincludedExtensions - Included hoodie extensionsapplyLayoutVersionFilters - Depending on Timeline layout version, if there are multiple states for the same
action instant, only include the highest stateIOException - in case of failurepublic void initializeBootstrapDirsIfNotExists()
throws IOException
IOExceptionpublic static HoodieTableMetaClient.Builder builder()
public static HoodieTableMetaClient.PropertyBuilder withPropertyBuilder()
Copyright © 2022 The Apache Software Foundation. All rights reserved.