belugabehr commented on a change in pull request #2312:
URL: https://github.com/apache/hive/pull/2312#discussion_r639710071
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
##########
@@ -726,35 +709,24 @@ private boolean entryMatches(LookupInfo lookupInfo,
CacheEntry entry, Set<CacheE
public void removeEntry(CacheEntry entry) {
entry.invalidate();
- rwLock.writeLock().lock();
+ cacheWriteLock.lock();
try {
- removeFromLookup(entry);
+ String queryString = entry.getQueryText();
+ if (!queryMap.remove(queryString, entry)) {
+ LOG.warn("Attempted to remove entry but it was not in the cache: {}",
entry);
+ }
+
+ // Remove this entry from the table usage mappings.
+ entry.getTableNames().forEach(tableName ->
tableToEntryMap.remove(tableName, entry));
+
lru.remove(entry);
// Should the cache size be updated here, or after the result data has
actually been deleted?
cacheSize -= entry.size;
} finally {
- rwLock.writeLock().unlock();
+ cacheWriteLock.unlock();
}
}
- private void removeFromLookup(CacheEntry entry) {
- String queryString = entry.getQueryText();
- if (!removeFromEntryMap(queryMap, queryString, entry)) {
- LOG.warn("Attempted to remove entry but it was not in the cache: {}",
entry);
- }
-
- // Remove this entry from the table usage mappings.
- entry.getTableNames()
- .forEach(tableName -> removeFromEntryMap(tableToEntryMap, tableName,
entry));
- }
-
- private void calculateEntrySize(CacheEntry entry, FetchWork fetchWork)
throws IOException {
- Path queryResultsPath = fetchWork.getTblDir();
- FileSystem resultsFs = queryResultsPath.getFileSystem(conf);
- ContentSummary cs = resultsFs.getContentSummary(queryResultsPath);
- entry.size = cs.getLength();
- }
-
Review comment:
Unused code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]