org.elasticsearch.cluster.metadata.IndexMetaData.isOnSharedFilesystem()方法的使用及代码示例

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

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

IndexMetaData.isOnSharedFilesystem介绍

[英]Returns true iff the given settings indicate that the index associated with these settings allocates it's shards on a shared filesystem. Otherwise false. The default setting for this is the returned value from #isIndexUsingShadowReplicas(org.elasticsearch.common.settings.Settings).
[中]如果给定设置指示与这些设置关联的索引在共享文件系统上分配其碎片,则返回true。否则false。默认设置是#isindexusingshadowreplications(org.elasticsearch.common.settings.settings)返回的值。

代码示例

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

/**
 * Return {@code true} if the index is configured to allow shards to be
 * recovered on any node
 */
private boolean recoverOnAnyNode(Settings idxSettings) {
  return IndexMetaData.isOnSharedFilesystem(idxSettings) &&
      idxSettings.getAsBoolean(IndexMetaData.SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE, false);
}

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

/**
 * Returns <code>true</code> iff the given settings indicate that the index
 * associated with these settings allocates it's shards on a shared
 * filesystem.
 */
public boolean isOnSharedFilesystem() {
  return IndexMetaData.isOnSharedFilesystem(getSettings());
}

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

/**
 * Return {@code true} if the index is configured to allow shards to be
 * recovered on any node
 */
private boolean recoverOnAnyNode(IndexMetaData metaData) {
  // don't use the setting directly, not to trigger verbose deprecation logging
  return (IndexMetaData.isOnSharedFilesystem(metaData.getSettings()) || IndexMetaData.isOnSharedFilesystem(this.settings))
    && (metaData.getSettings().getAsBoolean(IndexMetaData.SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE, false) ||
      this.settings.getAsBoolean(IndexMetaData.SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE, false));
}

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

/**
 * This method returns true if the current node is allowed to delete the
 * given index. If the index uses a shared filesystem this method always
 * returns false.
 * @param index {@code Index} to check whether deletion is allowed
 * @param indexSettings {@code Settings} for the given index
 * @return true if the index can be deleted on this node
 */
public boolean canDeleteIndexContents(Index index, Settings indexSettings, boolean closed) {
  final IndexServiceInjectorPair indexServiceInjectorPair = this.indices.get(index.name());
  // Closed indices may be deleted, even if they are on a shared
  // filesystem. Since it is closed we aren't deleting it for relocation
  if (IndexMetaData.isOnSharedFilesystem(indexSettings) == false || closed) {
    if (indexServiceInjectorPair == null && nodeEnv.hasNodeFile()) {
      return true;
    }
  } else {
    logger.trace("{} skipping index directory deletion due to shadow replicas", index);
  }
  return false;
}

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

private boolean canDeleteShardContent(ShardId shardId, Settings indexSettings) {
  final IndexServiceInjectorPair indexServiceInjectorPair = this.indices.get(shardId.getIndex());
  if (IndexMetaData.isOnSharedFilesystem(indexSettings) == false) {
     if (nodeEnv.hasNodeFile()) {
      boolean isAllocated = indexServiceInjectorPair != null && indexServiceInjectorPair
        .getIndexService().hasShard(shardId.getId());
      if (isAllocated) {
        return false; // we are allocated - can't delete the shard
      }
      if (NodeEnvironment.hasCustomDataPath(indexSettings)) {
        // lets see if it's on a custom path (return false if the shared doesn't exist)
        // we don't need to delete anything that is not there
        return Files.exists(nodeEnv.resolveCustomLocation(indexSettings, shardId));
      } else {
        // lets see if it's path is available (return false if the shared doesn't exist)
        // we don't need to delete anything that is not there
        return FileSystemUtils.exists(nodeEnv.availableShardPaths(shardId));
      }
    }
  } else {
    logger.trace("{} skipping shard directory deletion due to shadow replicas", shardId);
  }
  return false;
}

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

final boolean canDeleteShardContent = IndexMetaData.isOnSharedFilesystem(indexSettings) == false ||
    (primary && IndexMetaData.isOnSharedFilesystem(indexSettings));
ModulesBuilder modules = new ModulesBuilder();

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

if (IndexMetaData.isOnSharedFilesystem(shard.indexSettings())) {
  handler = new SharedFSRecoverySourceHandler(shard, request, recoverySettings, transportService, logger);
} else {

相关文章

微信公众号

最新文章

更多

IndexMetaData类方法