solrCloud 管理colleciton操作,可能出现的重大Bug

转载请声明原文:http://blog.csdn.net/duck_genuine/article/details/8440125


solrCloud 管理colleciton操作,可能出现的重大Bug


当删除某一个不存在的collection后,就会出现很大问题,任何对collection的命令都会失败,不过这个bug已在4.1解决

https://issues.apache.org/jira/browse/SOLR-4008



OverseerCollectionProcessor 这个类会抛出运行时异常,导致Thread死掉,所以后面的命令都没有接收到


最致命的是这个异常,除非clear掉zookeeper上的数据, overseer collection queue,才可以解决。


修改bug的代码修改很简单,只是catch到这个异常,返回false的操作标识。





 @Override
  public void run() {
    log.info("Process current queue of collection creations");
    while (amILeader() && !isClosed) {
      try {
        byte[] head = workQueue.peek(true);
        
        //if (head != null) {    // should not happen since we block above
          final ZkNodeProps message = ZkNodeProps.load(head);
          final String operation = message.getStr(QUEUE_OPERATION);
          
          boolean success = processMessage(message, operation);
          if (!success) {
            // TODO: what to do on failure / partial failure
            // if we fail, do we clean up then ?
            SolrException.log(log, "Collection creation of " + message.getStr("name") + " failed");
          }
        //}
        workQueue.remove();
      } catch (KeeperException e) {
        if (e.code() == KeeperException.Code.SESSIONEXPIRED
            || e.code() == KeeperException.Code.CONNECTIONLOSS) {
          log.warn("Overseer cannot talk to ZK");
          return;
        }
        SolrException.log(log, "", e);
        throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
            e);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        return;
      }
    }
  }

代码上有一个地方是执行分布式队列里的消息,当执行成功后就会remove掉该信息,但由于没有catch 到运行时异常,就没有执行 workQueue.remove().这样这条信息一直没被处理掉,即使将服务关闭,重启,又抛运行时异常,thread死掉,进入这种死循环里。。


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值