Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1066,12 +1066,12 @@ public void afterIndexShardClosed(ShardId shardId, IndexShard indexShard, Settin
* but does not deal with in-memory structures. For those call {@link #removeIndex}
*/
@Override
public void deleteUnassignedIndex(String reason, IndexMetadata oldIndexMetadata, ClusterState clusterState) {
public void deleteUnassignedIndex(String reason, IndexMetadata oldIndexMetadata, @Nullable ProjectMetadata project) {
if (nodeEnv.hasNodeFile()) {
Index index = oldIndexMetadata.getIndex();
try {
if (clusterState.metadata().getProject().hasIndex(index)) {
final IndexMetadata currentMetadata = clusterState.metadata().getProject().index(index);
if (project != null && project.hasIndex(index)) {
final IndexMetadata currentMetadata = project.index(index);
throw new IllegalStateException(
"Can't delete unassigned index store for ["
+ index.getName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ private void deleteIndices(final ClusterChangedEvent event) {
indexServiceClosedListener = SubscribableListener.nullSuccess();
final IndexMetadata metadata = project.get().index(index);
indexSettings = new IndexSettings(metadata, settings);
indicesService.deleteUnassignedIndex("deleted index was not assigned to local node", metadata, state);
indicesService.deleteUnassignedIndex(
"deleted index was not assigned to local node",
metadata,
state.metadata().projects().get(project.get().id())
);
} else {
// The previous cluster state's metadata also does not contain the index,
// which is what happens on node startup when an index was deleted while the
Expand Down Expand Up @@ -1258,7 +1262,7 @@ U createIndex(IndexMetadata indexMetadata, List<IndexEventListener> builtInIndex
* Deletes an index that is not assigned to this node. This method cleans up all disk folders relating to the index
* but does not deal with in-memory structures. For those call {@link #removeIndex}
*/
void deleteUnassignedIndex(String reason, IndexMetadata metadata, ClusterState clusterState);
void deleteUnassignedIndex(String reason, IndexMetadata metadata, @Nullable ProjectMetadata project);

/**
* Removes the given index from this service and releases all associated resources. Persistent parts of the index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.ProjectMetadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.RoutingNode;
Expand Down Expand Up @@ -213,7 +214,7 @@ public IndexMetadata verifyIndexIsDeleted(Index index, ClusterState state) {
}

@Override
public void deleteUnassignedIndex(String reason, IndexMetadata metadata, ClusterState clusterState) {
public void deleteUnassignedIndex(String reason, IndexMetadata metadata, ProjectMetadata project) {

}

Expand Down