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

转载请声明原文:

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 abovefinal 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死掉,进入这种死循环里。。

版权声明:本文为博主原创文章,未经博主允许不得转载。

我不敢说我明天便可以做一个快乐的人,面朝大海春暖花开。

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

相关文章:

你感兴趣的文章:

标签云: