process deleted index events on a node even if it has no local FS
this will not happen now, but in the future, if data nodes will only be in memory (including translog and such), then we need to fire the deleted events
This commit is contained in:
parent
420a3ed691
commit
433f0cc86c
|
@ -213,7 +213,6 @@ public class LocalGatewayMetaState extends AbstractComponent implements ClusterS
|
|||
|
||||
// delete indices that were there before, but are deleted now
|
||||
// we need to do it so they won't be detected as dangling
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
if (currentMetaData != null) {
|
||||
// only delete indices when we already received a state (currentMetaData != null)
|
||||
// and we had a go at processing dangling indices at least once
|
||||
|
@ -224,7 +223,9 @@ public class LocalGatewayMetaState extends AbstractComponent implements ClusterS
|
|||
}
|
||||
if (!newMetaData.hasIndex(current.index())) {
|
||||
logger.debug("[{}] deleting index that is no longer part of the metadata (indices: [{}])", current.index(), newMetaData.indices().keySet());
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
FileSystemUtils.deleteRecursively(nodeEnv.indexLocations(new Index(current.index())));
|
||||
}
|
||||
try {
|
||||
nodeIndexDeletedAction.nodeIndexStoreDeleted(current.index(), event.state().nodes().masterNodeId());
|
||||
} catch (Exception e) {
|
||||
|
@ -233,7 +234,6 @@ public class LocalGatewayMetaState extends AbstractComponent implements ClusterS
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handle dangling indices, we handle those for all nodes that have a node file (data or master)
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
|
|
|
@ -112,13 +112,14 @@ public class NoneGateway extends AbstractLifecycleComponent<Gateway> implements
|
|||
|
||||
// delete indices that were there before, but are deleted now
|
||||
// we need to do it so they won't be detected as dangling
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
if (currentMetaData != null) {
|
||||
// only delete indices when we already received a state (currentMetaData != null)
|
||||
for (IndexMetaData current : currentMetaData) {
|
||||
if (!newMetaData.hasIndex(current.index())) {
|
||||
logger.debug("[{}] deleting index that is no longer part of the metadata (indices: [{}])", current.index(), newMetaData.indices().keySet());
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
FileSystemUtils.deleteRecursively(nodeEnv.indexLocations(new Index(current.index())));
|
||||
}
|
||||
try {
|
||||
nodeIndexDeletedAction.nodeIndexStoreDeleted(current.index(), event.state().nodes().masterNodeId());
|
||||
} catch (Exception e) {
|
||||
|
@ -127,7 +128,6 @@ public class NoneGateway extends AbstractLifecycleComponent<Gateway> implements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentMetaData = newMetaData;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue