Package org.apache.flink.runtime.blob
Class BlobCacheSizeTracker
java.lang.Object
org.apache.flink.runtime.blob.BlobCacheSizeTracker
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckLimit(long size) Check the size limit and return the BLOBs to delete.voidRegister the BLOB to the tracker.voidRemove the BLOB from the tracker.voiduntrackAll(org.apache.flink.api.common.JobID jobId) Unregister all the tracked BLOBs related to the given job.voidUpdate the least used index for the BLOBs so that the tracker can easily find out the least recently used BLOBs.
-
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
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
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.
-