core/src/main/java/org/elasticsearch/indices/IndicesService.java
public void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState, boolean closed) throws IOException {
        if (nodeEnv.hasNodeFile()) {
            synchronized (this) {
                String indexName = metaData.getIndex().getName();
                if (indices.containsKey(indexName)) {
                    String localUUid = indices.get(indexName).indexUUID();
                    throw new IllegalStateException("Can't delete index store for [" + indexName + "] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]");
                }
                if (clusterState.metaData().hasIndex(indexName) && (clusterState.nodes().localNode().masterNode() == true)) {
                    // we do not delete the store if it is a master eligible node and the index is still in the cluster state
                    // because we want to keep the meta data for indices around even if no shards are left here
                    final IndexMetaData index = clusterState.metaData().index(indexName);
                    throw new IllegalStateException("Can't delete closed index store for [" + indexName + "] - it's still part of the cluster state [" + index.getIndexUUID() + "] [" + metaData.getIndexUUID() + "]");
                }
            }
            final IndexSettings indexSettings = buildIndexSettings(metaData);
            deleteIndexStore(reason, indexSettings.getIndex(), indexSettings, closed);
        }
    }
/**
     * Deletes the index store trying to acquire all shards locks for this index.
     * This method will delete the metadata for the index even if the actual shards can't be locked.
     */
Deletes the index store trying to acquire all shards locks for this index.
This method will delete the metadata for the index even if the actual shards can't be locked.
Deletes the index store trying to acquire all shards locks for this index . This method will delete the metadata for the index even if the actual shards can ' t be locked .
public void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState, boolean closed) throws IOException {
        if (nodeEnv.hasNodeFile()) {
            synchronized (this) {
                String indexName = metaData.getIndex().getName();
                if (indices.containsKey(indexName)) {
                    String localUUid = indices.get(indexName).indexUUID();
                    throw new IllegalStateException("Can't delete index store for [" + indexName + "] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]");
                }
                if (clusterState.metaData().hasIndex(indexName) && (clusterState.nodes().localNode().masterNode() == true)) {
                    final IndexMetaData index = clusterState.metaData().index(indexName);
                    throw new IllegalStateException("Can't delete closed index store for [" + indexName + "] - it's still part of the cluster state [" + index.getIndexUUID() + "] [" + metaData.getIndexUUID() + "]");
                }
            }
            final IndexSettings indexSettings = buildIndexSettings(metaData);
            deleteIndexStore(reason, indexSettings.getIndex(), indexSettings, closed);
        }
    }
public void deleteIndexStore ( String reason , IndexMetaData metaData , ClusterState clusterState , boolean closed ) throws IOException { if ( nodeEnv . hasNodeFile ( ) ) { synchronized ( this ) { String indexName = metaData . getIndex ( ) . getName ( ) ; if ( indices . containsKey ( indexName ) ) { String localUUid = indices . get ( indexName ) . indexUUID ( ) ; throw new IllegalStateException ( "Can't delete index store for [" + indexName + "] - it's still part of the indices service [" + localUUid + "] [" + metaData . getIndexUUID ( ) + "]" ) ; } if ( clusterState . metaData ( ) . hasIndex ( indexName ) && ( clusterState . nodes ( ) . localNode ( ) . masterNode ( ) == true ) ) { final IndexMetaData index = clusterState . metaData ( ) . index ( indexName ) ; throw new IllegalStateException ( "Can't delete closed index store for [" + indexName + "] - it's still part of the cluster state [" + index . getIndexUUID ( ) + "] [" + metaData . getIndexUUID ( ) + "]" ) ; } } final IndexSettings indexSettings = buildIndexSettings ( metaData ) ; deleteIndexStore ( reason , indexSettings . getIndex ( ) , indexSettings , closed ) ; } }
Deletes the index store trying to acquire all shards locks for this index.
Deletes the index store trying to acquire all shards locks for this index .
// we do not delete the store if it is a master eligible node and the index is still in the cluster state // because we want to keep the meta data for indices around even if no shards are left here