/** * Test whether the current index UUID is the same as the given one. Returns true if either are _na_ */ public boolean isSameUUID(String otherUUID) { assert otherUUID != null; assert getIndexUUID() != null; if (INDEX_UUID_NA_VALUE.equals(otherUUID) || INDEX_UUID_NA_VALUE.equals(getIndexUUID())) { return true; } return otherUUID.equals(getIndexUUID()); }
public IndexMetaData getSafe(Index index) { IndexMetaData indexMetaData = get(index.getName()); if (indexMetaData != null) { if(indexMetaData.getIndexUUID().equals(index.getUUID())) { return indexMetaData; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() + "] but got: [" + indexMetaData.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); }
public IndexMetaData index(Index index) { IndexMetaData metaData = index(index.getName()); if (metaData != null && metaData.getIndexUUID().equals(index.getUUID())) { return metaData; } return null; }
/** * Returns the {@link IndexMetaData} for this index. * @throws IndexNotFoundException if no metadata for this index is found */ public IndexMetaData getIndexSafe(Index index) { IndexMetaData metaData = index(index.getName()); if (metaData != null) { if(metaData.getIndexUUID().equals(index.getUUID())) { return metaData; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() + "] but got: [" + metaData.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); }
/** * 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(Index, IndexRemovalReason, String)} */ @Override public void deleteUnassignedIndex(String reason, IndexMetaData metaData, ClusterState clusterState) { if (nodeEnv.hasNodeFile()) { String indexName = metaData.getIndex().getName(); try { if (clusterState.metaData().hasIndex(indexName)) { final IndexMetaData index = clusterState.metaData().index(indexName); throw new IllegalStateException("Can't delete unassigned index store for [" + indexName + "] - it's still part of " + "the cluster state [" + index.getIndexUUID() + "] [" + metaData.getIndexUUID() + "]"); } deleteIndexStore(reason, metaData, clusterState); } catch (Exception e) { logger.warn(() -> new ParameterizedMessage("[{}] failed to delete unassigned index (reason [{}])", metaData.getIndex(), reason), e); } } }
final IndexMetaData indexMetaData, final List<IndexEventListener> builtInListeners) throws IOException { ensureChangesAllowed(); if (indexMetaData.getIndexUUID().equals(IndexMetaData.INDEX_UUID_NA_VALUE)) { throw new IllegalArgumentException("index must have a real UUID found value: [" + indexMetaData.getIndexUUID() + "]");
/** * 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. * * Package private for testing */ void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException { if (nodeEnv.hasNodeFile()) { synchronized (this) { Index index = metaData.getIndex(); if (hasIndex(index)) { String localUUid = indexService(index).indexUUID(); throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]"); } if (clusterState.metaData().hasIndex(index.getName()) && (clusterState.nodes().getLocalNode().isMasterNode() == 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 idxMeta = clusterState.metaData().index(index.getName()); throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the " + "cluster state [" + idxMeta.getIndexUUID() + "] [" + metaData.getIndexUUID() + "], " + "we are master eligible, so will keep the index metadata even if no shards are left."); } } final IndexSettings indexSettings = buildIndexSettings(metaData); deleteIndexStore(reason, indexSettings.getIndex(), indexSettings); } }
if (indexMetaData.getIndexUUID().equals(index.getUUID()) == false) { throw new IllegalStateException(index.getName() + " exists in routing does not exists in metadata with the same uuid");
nodeMappingRefreshAction.nodeMappingRefresh(state.nodes().getMasterNode(), new NodeMappingRefreshAction.NodeMappingRefreshRequest(indexMetaData.getIndex().getName(), indexMetaData.getIndexUUID(), state.nodes().getLocalNodeId()) );
/** * Test whether the current index UUID is the same as the given one. Returns true if either are _na_ */ public boolean isSameUUID(String otherUUID) { assert otherUUID != null; assert getIndexUUID() != null; if (INDEX_UUID_NA_VALUE.equals(otherUUID) || INDEX_UUID_NA_VALUE.equals(getIndexUUID())) { return true; } return otherUUID.equals(getIndexUUID()); }
/** * Test whether the current index UUID is the same as the given one. Returns true if either are _na_ */ public boolean isSameUUID(String otherUUID) { assert otherUUID != null; assert getIndexUUID() != null; if (INDEX_UUID_NA_VALUE.equals(otherUUID) || INDEX_UUID_NA_VALUE.equals(getIndexUUID())) { return true; } return otherUUID.equals(getIndexUUID()); }
/** * Test whether the current index UUID is the same as the given one. Returns true if either are _na_ */ public boolean isSameUUID(String otherUUID) { assert otherUUID != null; assert getIndexUUID() != null; if (INDEX_UUID_NA_VALUE.equals(otherUUID) || INDEX_UUID_NA_VALUE.equals(getIndexUUID())) { return true; } return otherUUID.equals(getIndexUUID()); }
@Override public void onRecoveryDone() { shardStateAction.shardStarted(shardRouting, indexMetaData.getIndexUUID(), "after recovery from store"); }
indexMdBuilder.settings(Settings.builder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, currentIndexMetaData.getIndexUUID())); IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndexName).build(); rtBuilder.addAsRestore(updatedIndexMetaData, recoverySource);
nodeMappingRefreshAction.nodeMappingRefresh(state.nodes().getMasterNode(), new NodeMappingRefreshAction.NodeMappingRefreshRequest(newIndexMetaData.getIndex().getName(), newIndexMetaData.getIndexUUID(), state.nodes().getLocalNodeId()) );
public IndexMetaData getSafe(Index index) { IndexMetaData indexMetaData = get(index.getName()); if (indexMetaData != null) { if(indexMetaData.getIndexUUID().equals(index.getUUID())) { return indexMetaData; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() + "] but got: [" + indexMetaData.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); }
public IndexMetaData getSafe(Index index) { IndexMetaData indexMetaData = get(index.getName()); if (indexMetaData != null) { if(indexMetaData.getIndexUUID().equals(index.getUUID())) { return indexMetaData; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() + "] but got: [" + indexMetaData.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); }
public IndexMetaData index(Index index) { IndexMetaData metaData = index(index.getName()); if (metaData != null && metaData.getIndexUUID().equals(index.getUUID())) { return metaData; } return null; }
public IndexMetaData index(Index index) { IndexMetaData metaData = index(index.getName()); if (metaData != null && metaData.getIndexUUID().equals(index.getUUID())) { return metaData; } return null; }
public IndexMetaData index(Index index) { IndexMetaData metaData = index(index.getName()); if (metaData != null && metaData.getIndexUUID().equals(index.getUUID())) { return metaData; } return null; }