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