add logging with a reason why the cache is cleared (filter and field)
This commit is contained in:
parent
d01f925000
commit
771225ccc9
|
@ -122,15 +122,15 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
boolean clearedAtLeastOne = false;
|
||||
if (request.filterCache()) {
|
||||
clearedAtLeastOne = true;
|
||||
service.cache().filter().clear();
|
||||
service.cache().filter().clear("api");
|
||||
}
|
||||
if (request.fieldDataCache()) {
|
||||
clearedAtLeastOne = true;
|
||||
if (request.fields() == null || request.fields().length == 0) {
|
||||
service.cache().fieldData().clear();
|
||||
service.cache().fieldData().clear("api");
|
||||
} else {
|
||||
for (String field : request.fields()) {
|
||||
service.cache().fieldData().clear(field);
|
||||
service.cache().fieldData().clear("api", field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
if (request.fields() != null && request.fields().length > 0) {
|
||||
// only clear caches relating to the specified fields
|
||||
for (String field : request.fields()) {
|
||||
service.cache().fieldData().clear(field);
|
||||
service.cache().fieldData().clear("api", field);
|
||||
}
|
||||
} else {
|
||||
service.cache().clear();
|
||||
service.cache().clear("api");
|
||||
}
|
||||
}
|
||||
service.cache().invalidateCache();
|
||||
|
|
|
@ -138,9 +138,9 @@ public class IndexCache extends AbstractIndexComponent implements CloseableCompo
|
|||
bloomCache.clear(reader);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
filterCache.clear();
|
||||
fieldDataCache.clear();
|
||||
public void clear(String reason) {
|
||||
filterCache.clear(reason);
|
||||
fieldDataCache.clear(reason);
|
||||
idCache.clear();
|
||||
queryParserCache.clear();
|
||||
bloomCache.clear();
|
||||
|
|
|
@ -36,9 +36,9 @@ public interface FieldDataCache extends IndexComponent, CloseableComponent {
|
|||
|
||||
String type();
|
||||
|
||||
void clear(String fieldName);
|
||||
void clear(String reason, String fieldName);
|
||||
|
||||
void clear();
|
||||
void clear(String reason);
|
||||
|
||||
void clear(IndexReader reader);
|
||||
|
||||
|
|
|
@ -54,12 +54,12 @@ public class NoneFieldDataCache extends AbstractIndexComponent implements FieldD
|
|||
}
|
||||
|
||||
@Override
|
||||
public void clear(String fieldName) {
|
||||
public void clear(String reason, String fieldName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public void clear(String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -125,7 +125,7 @@ public class ResidentFieldDataCache extends AbstractConcurrentMapFieldDataCache
|
|||
ResidentFieldDataCache.this.expire = expire;
|
||||
}
|
||||
if (changed) {
|
||||
clear();
|
||||
clear("update_settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,18 +53,20 @@ public abstract class AbstractConcurrentMapFieldDataCache extends AbstractIndexC
|
|||
|
||||
@Override
|
||||
public void close() throws ElasticSearchException {
|
||||
clear();
|
||||
clear("close");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(String fieldName) {
|
||||
public void clear(String reason, String fieldName) {
|
||||
logger.debug("clearing field [{}] cache, reason [{}]", fieldName, reason);
|
||||
for (Map.Entry<Object, Cache<String, FieldData>> entry : cache.entrySet()) {
|
||||
entry.getValue().invalidate(fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public void clear(String reason) {
|
||||
logger.debug("full cache clear, reason [{}]", reason);
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface FilterCache extends IndexComponent, CloseableComponent {
|
|||
|
||||
void clear(IndexReader reader);
|
||||
|
||||
void clear();
|
||||
void clear(String reason);
|
||||
|
||||
EntriesStats entriesStats();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class NoneFilterCache extends AbstractIndexComponent implements FilterCac
|
|||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public void clear(String reason) {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
|
|
|
@ -70,12 +70,13 @@ public class WeightedFilterCache extends AbstractIndexComponent implements Filte
|
|||
|
||||
@Override
|
||||
public void close() throws ElasticSearchException {
|
||||
clear();
|
||||
clear("close");
|
||||
indicesFilterCache.removeRemovalListener(index.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public void clear(String reason) {
|
||||
logger.debug("full cache clear, reason [{}]", reason);
|
||||
for (Object readerKey : seenReaders.keySet()) {
|
||||
Boolean removed = seenReaders.remove(readerKey);
|
||||
if (removed == null) {
|
||||
|
|
Loading…
Reference in New Issue