Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public TypedTable(
// We should build cache after OM restart when clean up policy is
// NEVER. Setting epoch value -1, so that when it is marked for
// delete, this will be considered for cleanup.
cache.put(new CacheKey<>(kv.getKey()),
cache.loadInitial(new CacheKey<>(kv.getKey()),
new CacheValue<>(Optional.of(kv.getValue()), EPOCH_DEFAULT));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public interface TableCache<CACHEKEY extends CacheKey,
*/
CACHEVALUE get(CACHEKEY cacheKey);

/**
* This method should be called for tables with cache cleanup policy
* {@link TableCacheImpl.CacheCleanupPolicy#NEVER} after system restart to
* fill up the cache.
* @param cacheKey
* @param cacheValue
*/
void loadInitial(CACHEKEY cacheKey, CACHEVALUE cacheValue);

/**
* Add an entry to the cache, if the key already exists it overrides.
* @param cacheKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public CACHEVALUE get(CACHEKEY cachekey) {
return cache.get(cachekey);
}

@Override
public void loadInitial(CACHEKEY cacheKey, CACHEVALUE cacheValue) {
// No need to add entry to epochEntries. Adding to cache is required during
// normal put operation.
cache.put(cacheKey, cacheValue);
}

@Override
public void put(CACHEKEY cacheKey, CACHEVALUE value) {
cache.put(cacheKey, value);
Expand Down