Search in sources :

Example 6 with ExternalSpillableMap

use of org.apache.hudi.common.util.collection.ExternalSpillableMap in project hudi by apache.

the class SpillableMapBasedFileSystemView method createFileIdToPendingClusteringMap.

@Override
protected Map<HoodieFileGroupId, HoodieInstant> createFileIdToPendingClusteringMap(final Map<HoodieFileGroupId, HoodieInstant> fileGroupsInClustering) {
    try {
        LOG.info("Creating file group id to clustering instant map using external spillable Map. Max Mem=" + maxMemoryForClusteringFileGroups + ", BaseDir=" + baseStoreDir);
        new File(baseStoreDir).mkdirs();
        Map<HoodieFileGroupId, HoodieInstant> pendingMap = new ExternalSpillableMap<>(maxMemoryForClusteringFileGroups, baseStoreDir, new DefaultSizeEstimator(), new DefaultSizeEstimator<>(), diskMapType, isBitCaskDiskMapCompressionEnabled);
        pendingMap.putAll(fileGroupsInClustering);
        return pendingMap;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : HoodieInstant(org.apache.hudi.common.table.timeline.HoodieInstant) HoodieFileGroupId(org.apache.hudi.common.model.HoodieFileGroupId) ExternalSpillableMap(org.apache.hudi.common.util.collection.ExternalSpillableMap) IOException(java.io.IOException) DefaultSizeEstimator(org.apache.hudi.common.util.DefaultSizeEstimator) File(java.io.File)

Example 7 with ExternalSpillableMap

use of org.apache.hudi.common.util.collection.ExternalSpillableMap in project hudi by apache.

the class SpillableMapBasedFileSystemView method createFileIdToReplaceInstantMap.

@Override
protected Map<HoodieFileGroupId, HoodieInstant> createFileIdToReplaceInstantMap(final Map<HoodieFileGroupId, HoodieInstant> replacedFileGroups) {
    try {
        LOG.info("Creating file group id to replace instant map using external spillable Map. Max Mem=" + maxMemoryForReplaceFileGroups + ", BaseDir=" + baseStoreDir);
        new File(baseStoreDir).mkdirs();
        Map<HoodieFileGroupId, HoodieInstant> pendingMap = new ExternalSpillableMap<>(maxMemoryForReplaceFileGroups, baseStoreDir, new DefaultSizeEstimator(), new DefaultSizeEstimator<>(), diskMapType, isBitCaskDiskMapCompressionEnabled);
        pendingMap.putAll(replacedFileGroups);
        return pendingMap;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : HoodieInstant(org.apache.hudi.common.table.timeline.HoodieInstant) HoodieFileGroupId(org.apache.hudi.common.model.HoodieFileGroupId) ExternalSpillableMap(org.apache.hudi.common.util.collection.ExternalSpillableMap) IOException(java.io.IOException) DefaultSizeEstimator(org.apache.hudi.common.util.DefaultSizeEstimator) File(java.io.File)

Aggregations

ExternalSpillableMap (org.apache.hudi.common.util.collection.ExternalSpillableMap)7 IOException (java.io.IOException)6 File (java.io.File)5 DefaultSizeEstimator (org.apache.hudi.common.util.DefaultSizeEstimator)5 HoodieFileGroupId (org.apache.hudi.common.model.HoodieFileGroupId)4 HoodieInstant (org.apache.hudi.common.table.timeline.HoodieInstant)2 Map (java.util.Map)1 BootstrapBaseFileMapping (org.apache.hudi.common.model.BootstrapBaseFileMapping)1 HoodieFileGroup (org.apache.hudi.common.model.HoodieFileGroup)1 HoodieRecordLocation (org.apache.hudi.common.model.HoodieRecordLocation)1 HoodieWriteStat (org.apache.hudi.common.model.HoodieWriteStat)1 RuntimeStats (org.apache.hudi.common.model.HoodieWriteStat.RuntimeStats)1 Pair (org.apache.hudi.common.util.collection.Pair)1 HoodieIOException (org.apache.hudi.exception.HoodieIOException)1 HoodieUpsertException (org.apache.hudi.exception.HoodieUpsertException)1