Class BlobCacheSizeTracker

java.lang.Object
org.apache.flink.runtime.blob.BlobCacheSizeTracker

public class BlobCacheSizeTracker extends Object
BlobCacheSizeTracker uses LinkedHashMap to maintain the LRU order for the files in the cache. When new files are intended to be put into cache, checkLimit is called to query the files should be removed. This tracker maintains a lock to avoid concurrent modification. To avoid the inconsistency, make sure that hold the READ/WRITE lock in PermanentBlobCache first and then hold the lock here.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlobCacheSizeTracker(long sizeLimit)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey>>
    checkLimit(long size)
    Check the size limit and return the BLOBs to delete.
    void
    track(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, long size)
    Register the BLOB to the tracker.
    void
    untrack(org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey> key)
    Remove the BLOB from the tracker.
    void
    untrackAll(org.apache.flink.api.common.JobID jobId)
    Unregister all the tracked BLOBs related to the given job.
    void
    update(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)
    Update the least used index for the BLOBs so that the tracker can easily find out the least recently used BLOBs.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sizeLimit

      protected final long sizeLimit
  • Constructor Details

    • BlobCacheSizeTracker

      public BlobCacheSizeTracker(long sizeLimit)
  • Method Details

    • checkLimit

      public List<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey>> checkLimit(long size)
      Check the size limit and return the BLOBs to delete.
      Parameters:
      size - size of the BLOB intended to put into the cache
      Returns:
      list of BLOBs to delete before putting into the target BLOB
    • track

      public void track(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, long size)
      Register the BLOB to the tracker.
    • untrack

      public void untrack(org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey> key)
      Remove the BLOB from the tracker.
    • update

      public void update(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)
      Update the least used index for the BLOBs so that the tracker can easily find out the least recently used BLOBs.
    • untrackAll

      public void untrackAll(org.apache.flink.api.common.JobID jobId)
      Unregister all the tracked BLOBs related to the given job.