首页 > 其他分享 >dremio source 禁用source 不可用禁止移除与反射的一些问题

dremio source 禁用source 不可用禁止移除与反射的一些问题

时间:2024-02-18 09:03:15浏览次数:23  
标签:dremio refresh source state 移除 sourceKey append

实际上dremio 的反射比较有意思,而且也比较强大,比如我们可以会想通过反射,当上游系统不可用的时候依然可以查询
但是实际效果并不是这样的

参考配置

如下

问题

  • The source [s3] is currently unavailable. Metadata is not accessible; please check node health (or external storage) and permissions. Info: [com.amazonaws.SdkClientException: Unable to execute HTTP request: minio]

原因

尽管我们配置了不移除元数据信息,但是实际上存在一个问题就是,dremio 的ManagedStoragePlugin 在获取source plugin 的时候会进行checkState

  • 参考处理
 
  // 获取的状态,具体状态是通过PluginsManager处理的
  protected void checkState() {
    try(AutoCloseableLock l = readLock()) {
      SourceState state = this.state;
      if(state.getStatus() == SourceState.SourceStatus.bad) {
        final String msg = state.getMessages().stream()
          .map(m -> m.getMessage())
          .collect(Collectors.joining(", "));
 
        StringBuilder badStateMessage = new StringBuilder();
        badStateMessage.append("The source [").append(sourceKey).append("] is currently unavailable. Metadata is not ");
        badStateMessage.append("accessible; please check node health (or external storage) and permissions.");
        if (!Strings.isNullOrEmpty(msg)) {
          badStateMessage.append(" Info: [").append(msg).append("]");
        }
        String suggestedUserAction = this.state.getSuggestedUserAction();
        if (!Strings.isNullOrEmpty(suggestedUserAction)) {
          badStateMessage.append("\nAdditional actions: [").append(suggestedUserAction).append("]");
        }
        UserException.Builder builder = UserException.sourceInBadState().message(badStateMessage.toString());
 
        for(Message message : state.getMessages()) {
          builder.addContext(message.getLevel().name(), message.getMessage());
        }
 
        throw builder.buildSilently();
      }
    }
  }

参考调用

  • SourceMetadataManager 元数据刷新处理
    实际上就是基于以前说的调度任务
 
  if(isMaster) {
    // we can schedule on all nodes since this is a clustered singleton and will only run on a single node.
    this.wakeupTask = modifiableScheduler.schedule(
        Schedule.Builder.everyMillis(WAKEUP_FREQUENCY_MS)
          .asClusteredSingleton(METADATA_REFRESH_TASK_NAME_PREFIX + sourceKey)
          .build(),
          new WakeupWorker());
  }

状态处理

private void wakeup() {
 
    monitor.onWakeup();
 
    // if we've never refreshed, initialize the refresh start times. We do this on wakeup since that will happen if this
    // node gets assigned refresh responsibilities much later than the node initially comes up. It does leave the gap
    // where we may refresh early if we do a refresh and then the task immediately migrates but that is probably okay
    // for now.
    if (!initialized) {
      initializeRefresh();
      // on first wakeup, we'll skip work so we can avoid a bunch of distracting exceptions when a plugin is first starting.
      return;
    }
 
    try { 
     // bridge实际上就是ManagedStoragePlugin
      bridge.refreshState();
    } catch (TimeoutException ex) {
      logger.debug("Source '{}' timed out while refreshing state, skipping refresh.", sourceKey, ex);
      return;
    } catch (Exception ex) {
      logger.debug("Source '{}' refresh failed as we were unable to retrieve refresh it's state.", sourceKey, ex);
      return;
    }
 
    if (!runLock.tryLock()) {
      logger.info("Source '{}' delaying refresh since an adhoc refresh is currently active.", sourceKey);
      return;
    }
 
    try (Closeable c = AutoCloseableLock.ofAlreadyOpen(runLock, true)) {
      if ( !(fullRefresh.shouldRun() || namesRefresh.shouldRun()) ) {
        return;
      }
 
      final SourceState sourceState = bridge.getState();
      if (sourceState == null || sourceState.getStatus() == SourceStatus.bad) {
        logger.info("Source '{}' skipping metadata refresh since it is currently in a bad state of {}.",
            sourceKey, sourceState);
        return;
      }
 
      final BackgroundRefresh refresh;
      if(fullRefresh.shouldRun()) {
        refresh = new BackgroundRefresh(fullRefresh, true);
      } else {
        refresh = new BackgroundRefresh(namesRefresh, false);
      }
      refresh.run();
    } catch (RuntimeException e) {
      logger.warn("Source '{}' metadata refresh failed to complete due to an exception.", sourceKey, e);
    }
 
  }

说明

目前来说dremio 对于部分source 的state check 没有进行配置的处理,所以当source 不可用的时候尽管我们进行了反射处理(同时查询计划实际上也是使用的反射存储),但是过一段实践还是会出现查询不能用的问题

参考资料

sabot/kernel/src/main/java/com/dremio/exec/catalog/ManagedStoragePlugin.java
sabot/kernel/src/main/java/com/dremio/exec/catalog/PluginsManager.java
sabot/kernel/src/main/java/com/dremio/exec/catalog/SourceMetadataManager.java

标签:dremio,refresh,source,state,移除,sourceKey,append
From: https://www.cnblogs.com/rongfengliang/p/18012592

相关文章

  • dremio SystemStoragePluginInitializer 简单说明.
    以前在关于ManagedStoragePlugin部分,简单说明了下SystemStoragePluginInitializer,今天再明确说明下SystemStoragePluginInitializer的特点继承自Initializer接口,可以实现一些轻量级服务的启动SystemStoragePluginInitializer的启动是通过InitializerRegistry类实现的,Initia......
  • 947. 移除最多的同行或同列石头
    原题链接根据题意我们可以得到一个很有趣的结论:处于同一行或者同一列的石头是共处一个集合的,而一个集合最终可以消除到只剩一个石头。(可以实验一下)因此我们采取并查集实现。Code classSolution{public:intsum=0;intfather[1005];map<int,int>mapx;......
  • Debug: tf_ditribute_strategy_worker.yaml: resource mapping not found for name:
    [ERROR:resourcemappingnotfoundforname:"dist-strat-example-worker-0"namespace:""from"maye_template.yaml":nomatchesforkind"Deployment"inversion"v1"]apiVersion:apps/v1kind:Deploymentme......
  • dremio 的InformationSchemaCatalog 服务三
    以前简单写过一些关于dremio的InformationSchemaCatalog,也说过dremio为了方便提供标准的INFORMATION_SCHEMA自己开发了存储扩展,以下是关于存储扩展的创建以及刷新说明创建创建是在CatalogService中处理的,具体的实现是CatalogServiceImpl参考处理if(roles.conta......
  • dremio CTAS STORE AS && WITH SINGLE WRITER 简单说明
    dremioCTAS支持存储格式以及写入的文件数量(相对分区还说)参考CTAS格式CREATETABLE"s3"."91733d30-d1d2-46bf-8f2b-3c34d587a96c"STOREAS(type=>'text',fieldDelimiter=>',',lineDelimiter=>'')WITHSINGLE......
  • dremio SchedulerService 服务简单说明
    SchedulerService内部调度服务算是一个比较重要的模块,比如dremio的功能都依赖此模块(元数据获取,一些数据清理任务,反射加速)参考实现子类SchedulerService实现也比较多,因为dremio集群中的节点有多种角色,为了保证数据的一致性会对于不同集群角色的节点进行不同的处理如下图......
  • [Ngbatis源码学习] Ngbatis 源码学习之资源加载器 DaoResourceLoader
    Ngbatis源码阅读之资源加载器DaoResourceLoaderDaoResourceLoader是Ngbatis的资源文件加载器,扩展自MapperResourceLoader。本篇文章主要分析这两个类。1.相关类MapperResourceLoaderDaoResourceLoader2.MapperResourceLoader在介绍DaoResourceLoader之前有必要......
  • Maven3.9.6 构建项目报错 Failed to execute goal org.apache.maven.plugins:maven-re
    在使用Maven3.9.6构建项目时,出现以下错误:[INFO][INFO]---resources:3.3.1:resources(default-resources)@service-sample---[INFO]Copying18resourcesfromsrc/main/javatotarget/classes[INFO]Copying15resourcesfromsrc/main/resourcestotarget/classes[IN......
  • dremio FileSystem 简单说明
    dremio尽管对于文件系统的使用很多底层都是hdfs的(s3,发射加速),dremio为了减少直接依赖hdfs,自己抽象了一个FileSystem接口对于不同的实现可以方便进行扩展,当然和刚才说的一样,不少底层依赖的是hdfs的FileSystem参考子类如下图简单说明:FilterFileSystem实现了FileSy......
  • dremio cloud cache 简单说明
    dremiocloudcache实际上就是对于云文件系统的cache加速(比如hdfs,s3。。。),在处理的时候使用了ce包装的包,详细源码并没有开源我们可以通过一些代码整体看下实现参考处理dremio-ce-services-cachemanager中的处理cecaache管理配置dremio:{classpath.scan......