public class MarkerUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
MARKER_TYPE_FILENAME |
static String |
MARKERS_FILENAME_PREFIX |
| Constructor and Description |
|---|
MarkerUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteMarkerTypeFile(HoodieStorage storage,
String markerDir)
Deletes `MARKERS.type` file.
|
static boolean |
doesMarkerTypeFileExist(HoodieStorage storage,
String markerDir) |
static List<StoragePath> |
getAllMarkerDir(StoragePath tempPath,
HoodieStorage storage)
Gets all marker directories.
|
static List<String> |
getCandidateInstants(HoodieActiveTimeline activeTimeline,
List<StoragePath> instants,
String currentInstantTime,
long maxAllowableHeartbeatIntervalInMs,
HoodieStorage storage,
String basePath)
Get Candidate Instant to do conflict checking:
1.
|
static boolean |
hasCommitConflict(HoodieActiveTimeline activeTimeline,
Set<String> currentFileIDs,
Set<HoodieInstant> completedCommitInstants)
Whether there is write conflict with completed commit among multiple writers.
|
static String |
makerToPartitionAndFileID(String marker)
Get fileID from full marker path, for example:
20210623/0/20210825/932a86d9-5c1d-44c7-ac99-cb88b8ef8478-0_85-15-1390_20220620181735781.parquet.marker.MERGE
==> get 20210623/0/20210825/932a86d9-5c1d-44c7-ac99-cb88b8ef8478-0
|
static String |
markerDirToInstantTime(String marker)
Get instantTime from full marker path, for example:
/var/folders/t3/th1dw75d0yz2x2k2qt6ys9zh0000gp/T/junit6502909693741900820/dataset/.hoodie/.temp/003
==> 003
|
static Set<String> |
readMarkersFromFile(StoragePath markersFilePath,
StorageConfiguration<?> conf)
Reads the markers stored in the underlying file.
|
static Set<String> |
readMarkersFromFile(StoragePath markersFilePath,
StorageConfiguration<?> conf,
boolean ignoreException)
Reads the markers stored in the underlying file.
|
static Option<MarkerType> |
readMarkerType(HoodieStorage storage,
String markerDir)
Reads the marker type from `MARKERS.type` file.
|
static Map<String,Set<String>> |
readTimelineServerBasedMarkersFromFileSystem(String markerDir,
HoodieStorage storage,
HoodieEngineContext context,
int parallelism)
Reads files containing the markers written by timeline-server-based marker mechanism.
|
static String |
stripMarkerFolderPrefix(String fullMarkerPath,
String markerDir)
Strips the marker folder prefix of any file path under the marker directory.
|
static String |
stripMarkerFolderPrefix(String fullMarkerPath,
String basePath,
String instantTime)
Strips the folder prefix of the marker file path corresponding to a data file.
|
static void |
writeMarkerTypeToFile(MarkerType markerType,
HoodieStorage storage,
String markerDir)
Writes the marker type to the file `MARKERS.type`.
|
public static final String MARKERS_FILENAME_PREFIX
public static final String MARKER_TYPE_FILENAME
public static String stripMarkerFolderPrefix(String fullMarkerPath, String basePath, String instantTime)
fullMarkerPath - the full path of the marker filebasePath - the base pathinstantTime - instant of interestpublic static String stripMarkerFolderPrefix(String fullMarkerPath, String markerDir)
fullMarkerPath - the full path of the filemarkerDir - marker directorypublic static boolean doesMarkerTypeFileExist(HoodieStorage storage, String markerDir) throws IOException
storage - HoodieStorage to use.markerDir - marker directory.true if the MARKERS.type file exists; false otherwise.IOExceptionpublic static Option<MarkerType> readMarkerType(HoodieStorage storage, String markerDir)
storage - HoodieStorage to use.markerDir - marker directory.public static void writeMarkerTypeToFile(MarkerType markerType, HoodieStorage storage, String markerDir)
markerType - marker type.storage - HoodieStorage to use.markerDir - marker directory.public static void deleteMarkerTypeFile(HoodieStorage storage, String markerDir)
storage - HoodieStorage to use.markerDir - marker directory.public static Map<String,Set<String>> readTimelineServerBasedMarkersFromFileSystem(String markerDir, HoodieStorage storage, HoodieEngineContext context, int parallelism)
markerDir - marker directory.storage - file system to use.context - instance of HoodieEngineContext to useparallelism - parallelism to useMap of file name to the set of markers stored in the file.public static Set<String> readMarkersFromFile(StoragePath markersFilePath, StorageConfiguration<?> conf)
markersFilePath - file path for the markersconf - storage configSet of String.public static Set<String> readMarkersFromFile(StoragePath markersFilePath, StorageConfiguration<?> conf, boolean ignoreException)
markersFilePath - File path for the markers.conf - storage config.ignoreException - Whether to ignore IOException.Set of String.public static List<StoragePath> getAllMarkerDir(StoragePath tempPath, HoodieStorage storage) throws IOException
tempPath - Temporary folder under .hoodie.storage - File system to use.IOException - upon error.public static boolean hasCommitConflict(HoodieActiveTimeline activeTimeline, Set<String> currentFileIDs, Set<HoodieInstant> completedCommitInstants)
activeTimeline - Active timeline.currentFileIDs - Current set of file IDs.completedCommitInstants - Completed commits.true if the conflict is detected; false otherwise.public static List<String> getCandidateInstants(HoodieActiveTimeline activeTimeline, List<StoragePath> instants, String currentInstantTime, long maxAllowableHeartbeatIntervalInMs, HoodieStorage storage, String basePath)
instants - public static String makerToPartitionAndFileID(String marker)
marker - Copyright © 2024 The Apache Software Foundation. All rights reserved.