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,23 +213,23 @@ 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
|
||||
// this will also delete the _state of the index itself
|
||||
for (IndexMetaData current : currentMetaData) {
|
||||
if (danglingIndices.containsKey(current.index())) {
|
||||
continue;
|
||||
}
|
||||
if (!newMetaData.hasIndex(current.index())) {
|
||||
logger.debug("[{}] deleting index that is no longer part of the metadata (indices: [{}])", current.index(), newMetaData.indices().keySet());
|
||||
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
|
||||
// this will also delete the _state of the index itself
|
||||
for (IndexMetaData current : currentMetaData) {
|
||||
if (danglingIndices.containsKey(current.index())) {
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
logger.debug("[{}] failed to notify master on local index store deletion", e, current.index());
|
||||
}
|
||||
}
|
||||
try {
|
||||
nodeIndexDeletedAction.nodeIndexStoreDeleted(current.index(), event.state().nodes().masterNodeId());
|
||||
} catch (Exception e) {
|
||||
logger.debug("[{}] failed to notify master on local index store deletion", e, current.index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,18 +112,18 @@ 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 (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) {
|
||||
logger.debug("[{}] failed to notify master on local index store deletion", e, current.index());
|
||||
}
|
||||
}
|
||||
try {
|
||||
nodeIndexDeletedAction.nodeIndexStoreDeleted(current.index(), event.state().nodes().masterNodeId());
|
||||
} catch (Exception e) {
|
||||
logger.debug("[{}] failed to notify master on local index store deletion", e, current.index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue