org.elasticsearch.indices.IndicesService.deleteShardStore()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.elasticsearch.indices.IndicesService.deleteShardStore()方法的一些代码示例,展示了IndicesService.deleteShardStore()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesService.deleteShardStore()方法的具体详情如下:
包路径:org.elasticsearch.indices.IndicesService
类名称:IndicesService
方法名:deleteShardStore

IndicesService.deleteShardStore介绍

[英]Deletes the shard with an already acquired shard lock.
[中]删除已获取碎片锁的碎片。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

if (shardLock != null) {
  try {
    deleteShardStore("pending delete", shardLock, delete.settings);
    iterator.remove();
  } catch (IOException ex) {

代码示例来源:origin: org.elasticsearch/elasticsearch

private void allNodesResponded() {
  if (activeCopies.get() != expectedActiveCopies) {
    logger.trace("not deleting shard {}, expected {} active copies, but only {} found active copies",
      shardId, expectedActiveCopies, activeCopies.get());
    return;
  }
  ClusterState latestClusterState = clusterService.state();
  if (clusterStateVersion != latestClusterState.getVersion()) {
    logger.trace("not deleting shard {}, the latest cluster state version[{}] is not equal to cluster state " +
      "before shard active api call [{}]", shardId, latestClusterState.getVersion(), clusterStateVersion);
    return;
  }
  clusterService.getClusterApplierService().runOnApplierThread("indices_store ([" + shardId + "] active fully on other nodes)",
    currentState -> {
      if (clusterStateVersion != currentState.getVersion()) {
        logger.trace("not deleting shard {}, the update task state version[{}] is not equal to cluster state before " +
          "shard active api call [{}]", shardId, currentState.getVersion(), clusterStateVersion);
        return;
      }
      try {
        indicesService.deleteShardStore("no longer used", shardId, currentState);
      } catch (Exception ex) {
        logger.debug(() -> new ParameterizedMessage("{} failed to delete unallocated shard, ignoring", shardId), ex);
      }
    },
    (source, e) -> logger.error(() -> new ParameterizedMessage("{} unexpected error during deletion of unallocated shard",
      shardId), e)
  );
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState) throws Exception {
  if (clusterStateVersion != currentState.getVersion()) {
    logger.trace("not deleting shard {}, the update task state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, currentState.getVersion(), clusterStateVersion);
    return unchanged();
  }
  try {
    indicesService.deleteShardStore("no longer used", shardId, currentState);
  } catch (Exception ex) {
    logger.debug((Supplier<?>) () -> new ParameterizedMessage("{} failed to delete unallocated shard, ignoring", shardId), ex);
  }
  return unchanged();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

if (shardLock != null) {
  try {
    deleteShardStore("pending delete", shardLock, delete.settings);
    iterator.remove();
  } catch (IOException ex) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

if (shardLock != null) {
  try {
    deleteShardStore("pending delete", shardLock, delete.settings);
    iterator.remove();
  } catch (IOException ex) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void allNodesResponded() {
  if (activeCopies.get() != expectedActiveCopies) {
    logger.trace("not deleting shard {}, expected {} active copies, but only {} found active copies", shardId, expectedActiveCopies, activeCopies.get());
    return;
  }
  ClusterState latestClusterState = clusterService.state();
  if (clusterStateVersion != latestClusterState.getVersion()) {
    logger.trace("not deleting shard {}, the latest cluster state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, latestClusterState.getVersion(), clusterStateVersion);
    return;
  }
  clusterService.getClusterApplierService().runOnApplierThread("indices_store ([" + shardId + "] active fully on other nodes)",
    currentState -> {
      if (clusterStateVersion != currentState.getVersion()) {
        logger.trace("not deleting shard {}, the update task state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, currentState.getVersion(), clusterStateVersion);
        return;
      }
      try {
        indicesService.deleteShardStore("no longer used", shardId, currentState);
      } catch (Exception ex) {
        logger.debug(() -> new ParameterizedMessage("{} failed to delete unallocated shard, ignoring", shardId), ex);
      }
    },
    (source, e) -> logger.error(() -> new ParameterizedMessage("{} unexpected error during deletion of unallocated shard", shardId), e)
  );
}

代码示例来源:origin: apache/servicemix-bundles

private void allNodesResponded() {
  if (activeCopies.get() != expectedActiveCopies) {
    logger.trace("not deleting shard {}, expected {} active copies, but only {} found active copies", shardId, expectedActiveCopies, activeCopies.get());
    return;
  }
  ClusterState latestClusterState = clusterService.state();
  if (clusterStateVersion != latestClusterState.getVersion()) {
    logger.trace("not deleting shard {}, the latest cluster state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, latestClusterState.getVersion(), clusterStateVersion);
    return;
  }
  clusterService.getClusterApplierService().runOnApplierThread("indices_store ([" + shardId + "] active fully on other nodes)",
    currentState -> {
      if (clusterStateVersion != currentState.getVersion()) {
        logger.trace("not deleting shard {}, the update task state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, currentState.getVersion(), clusterStateVersion);
        return;
      }
      try {
        indicesService.deleteShardStore("no longer used", shardId, currentState);
      } catch (Exception ex) {
        logger.debug(() -> new ParameterizedMessage("{} failed to delete unallocated shard, ignoring", shardId), ex);
      }
    },
    (source, e) -> logger.error(() -> new ParameterizedMessage("{} unexpected error during deletion of unallocated shard", shardId), e)
  );
}

代码示例来源:origin: harbby/presto-connectors

@Override
public ClusterState execute(ClusterState currentState) throws Exception {
  if (clusterStateVersion != currentState.getVersion()) {
    logger.trace("not deleting shard {}, the update task state version[{}] is not equal to cluster state before shard active api call [{}]", shardId, currentState.getVersion(), clusterStateVersion);
    return currentState;
  }
  try {
    indicesService.deleteShardStore("no longer used", shardId, currentState);
  } catch (Throwable ex) {
    logger.debug("{} failed to delete unallocated shard, ignoring", ex, shardId);
  }
  return currentState;
}

代码示例来源:origin: apache/servicemix-bundles

if (shardLock != null) {
  try {
    deleteShardStore("pending delete", shardLock, delete.settings);
    iterator.remove();
  } catch (IOException ex) {

代码示例来源:origin: harbby/presto-connectors

if (shardLock != null) {
  try {
    deleteShardStore("pending delete", shardLock, delete.settings);
    iterator.remove();
  } catch (IOException ex) {

代码示例来源:origin: harbby/presto-connectors

private void onShardClose(ShardLock lock, boolean ownsShard) {
  if (deleted.get()) { // we remove that shards content if this index has been deleted
    final Settings indexSettings = indexSettings();
    try {
      if (ownsShard) {
        try {
          indicesLifecycle.beforeIndexShardDeleted(lock.getShardId(), indexSettings);
        } finally {
          indicesServices.deleteShardStore("delete index", lock, indexSettings);
          indicesLifecycle.afterIndexShardDeleted(lock.getShardId(), indexSettings);
        }
      }
    } catch (IOException e) {
      indicesServices.addPendingDelete(lock.getShardId(), indexSettings);
      logger.debug("[{}] failed to delete shard content - scheduled a retry", e, lock.getShardId().id());
    }
  }
}

相关文章

微信公众号

最新文章

更多