SolrCloud 8.1.1 CDCR复制不起作用:由于实际的(409)版本冲突而失败= -1

问题描述 投票:0回答:1

尝试使用Solr 8.1.1设置单向CDCR,

在将数据目录从源同步到源日志中的目标副本(1到1)之后,我看到:

2020-03-09 11:04:28.873 INFO  (cdcr-replicator-17-thread-4) [   ] o.a.s.h.CdcrReplicator Forwarded 0 updates to target search1
2020-03-09 11:04:30.872 INFO  (cdcr-replicator-17-thread-5) [   ] o.a.s.h.CdcrReplicator Forwarded 0 updates to target search1
2020-03-09 11:04:32.873 INFO  (cdcr-replicator-17-thread-6) [   ] o.a.s.h.CdcrReplicator Forwarded 0 updates to target search1
2020-03-09 11:04:34.873 INFO  (cdcr-replicator-17-thread-7) [   ] o.a.s.h.CdcrReplicator Forwarded 0 updates to target search1
2020-03-09 11:04:36.873 INFO  (cdcr-replicator-17-thread-8) [   ] o.a.s.h.CdcrReplicator Forwarded 0 updates to target search1

我在源集合上启动了CDCR,当我将新数据索引到源集合中时,出现以下错误:

2020-03-09 11:14:22.933 ERROR (cdcr-replicator-17-thread-5) [   ] o.a.s.c.s.i.BaseCloudSolrClient Request to collection [search1] failed due to (409) org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://10.11.33.159:8983/solr/search1_shard1_replica_n1: version conflict for THREE_INDEXING_01 expected=1660684743870513152 actual=-1, retry=0 commError=false errorCode=409
2020-03-09 11:14:22.933 INFO  (cdcr-replicator-17-thread-5) [   ] o.a.s.c.s.i.BaseCloudSolrClient request was not communication error it seems
2020-03-09 11:14:22.933 WARN  (cdcr-replicator-17-thread-5) [   ] o.a.s.h.CdcrReplicator Failed to forward update request to target: search1 => org.apache.solr.client.solrj.impl.CloudSolrClient$RouteException: Error from server at http://10.11.33.159:8983/solr/search1_shard1_replica_n1: version conflict for THREE_INDEXING_01 expected=1660684743870513152 actual=-1
        at org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:125)
org.apache.solr.client.solrj.impl.CloudSolrClient$RouteException: Error from server at http://10.11.33.159:8983/solr/search1_shard1_replica_n1: version conflict for THREE_INDEXING_01 expected=1660684743870513152 actual=-1
        at org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:125) ~[?:?]
        at org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:46) ~[?:?]
        at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.directUpdate(BaseCloudSolrClient.java:489) ~[?:?]
        at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.sendRequest(BaseCloudSolrClient.java:977) ~[?:?]
        at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.requestWithRetryOnStaleState(BaseCloudSolrClient.java:837) ~[?:?]
        at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.request(BaseCloudSolrClient.java:769) ~[?:?]
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:207) ~[?:?]
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:224) ~[?:?]
        at org.apache.solr.handler.CdcrReplicator.sendRequest(CdcrReplicator.java:140) ~[?:?]
        at org.apache.solr.handler.CdcrReplicator.run(CdcrReplicator.java:120) ~[?:?]
        at org.apache.solr.handler.CdcrReplicatorScheduler.lambda$null$0(CdcrReplicatorScheduler.java:81) ~[?:?]
        at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_232]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://10.11.33.159:8983/solr/search1_shard1_replica_n1: version conflict for THREE_INDEXING_01 expected=1660684743870513152 actual=-1
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:649) ~[?:?]
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:255) ~[?:?]
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:244) ~[?:?]
        at org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:368) ~[?:?]
        at org.apache.solr.client.solrj.impl.LBSolrClient.request(LBSolrClient.java:296) ~[?:?]
        at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.lambda$directUpdate$0(BaseCloudSolrClient.java:465) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_232]
        ... 4 more
solr solrcloud solrconfig solr8
1个回答
0
投票

如果存在版本冲突(HTTP错误代码409,则您将获得HTTP错误代码409。

默认情况下,Solr的架构包括一个version字段,并且该字段会自动添加到每个新文档中。通过在索引中的所有文档上均要求一个version字段,并将其与作为update命令一部分指定的版本进行比较,可以使用此功能。

$ curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/techproducts/update?_version_=1632740120218042368&versions=true&commit=true&omitHeader=true' --data-binary '
[{ "id" : "aaa",
   "foo_s" : "update attempt with correct existing version" }]'

具有version的值的更新与索引中的值匹配,并且成功。因为我们在更新请求中包括了versions=true,所以响应为version字段包含了一个不同的值。

如果在文档本身中嵌入了具有version值的更新。请求失败,因为您指定了错误的版本。下面是它的错误。

{
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"version conflict for aaa expected=100 actual=1632740462042284032",
    "code":409
    }
}

这里的-1表示Solr无法找到该版本的文档。我建议您尝试在Solr管理员UI上手动发送一份文档以自己进行solr。选择您的核心/集合名称,然后单击“文档”链接(在solr管理员页面上),您将进入可以将文档发送到solr的页面。

请参阅solr文档以获取更多详细信息。Solr Documentation

© www.soinside.com 2019 - 2024. All rights reserved.