gpt4 book ai didi

SOLR: -1 的 autoSoftCommit maxtime 是什么意思?

转载 作者:行者123 更新时间:2023-12-03 23:33:58 26 4
gpt4 key购买 nike

这是我的 solrconfig.xml 文件中的默认设置:

 <autoSoftCommit> 
<maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
</autoSoftCommit>

“-1”的 maxTime 是否意味着自动软提交已关闭?如果是这样,如果我完全删除标签,我会得到相同的结果吗?如果我必须手动进行软提交,可以使用“commitWithin”来完成吗(我用谷歌搜索了这个但得到了相互矛盾的答案)?

哦,我正在使用 Solr 4.5.0

最佳答案

首先,您可以看到表达式 ${solr.autoSoftCommit.maxTime:-1}标签内。这允许您使用 Solr 的 变量替换 .详细描述了该功能 here in the reference .如果该变量没有被任何这些方法替换 -1被视为该配置的值。

将 commitMaxTime 设为 -1 有效地关闭自动提交。如果你看看下面的相关代码,你可以看到commitMaxTime否决 maxDocs 的任何值,因为 scheduleCommitWithin 方法会立即返回。我没有发现这种行为记录,所以我查找了代码。

private void _scheduleCommitWithin(long commitMaxTime) {
if (commitMaxTime <= 0) return;
synchronized (this) {
if (pending != null && pending.getDelay(TimeUnit.MILLISECONDS) <= commitMaxTime) {
// There is already a pending commit that will happen first, so
// nothing else to do here.
// log.info("###returning since getDelay()==" + pending.getDelay(TimeUnit.MILLISECONDS) + " less than " + commitMaxTime);

return;
}

if (pending != null) {
// we need to schedule a commit to happen sooner than the existing one,
// so lets try to cancel the existing one first.
boolean canceled = pending.cancel(false);
if (!canceled) {
// It looks like we can't cancel... it must have just started running!
// this is possible due to thread scheduling delays and a low commitMaxTime.
// Nothing else to do since we obviously can't schedule our commit *before*
// the one that just started running (or has just completed).
// log.info("###returning since cancel failed");
return;
}
}

// log.info("###scheduling for " + commitMaxTime);

// schedule our new commit
pending = scheduler.schedule(this, commitMaxTime, TimeUnit.MILLISECONDS);
}
}

取自 https://github.com/apache/lucene-solr/blob/lucene_solr_4_5/solr/core/src/java/org/apache/solr/update/CommitTracker.java

对于您问题的第二部分,如果您 移除标签 总之,这将与将值设置为 -1 具有相同的结果。正如您在下面看到的,如果 xpath 表达式返回 null,您将获得 -1 作为默认值。

但是从配置中删除整个表达式也会删除通过 Solr 的变量替换覆盖该配置的选项。

protected UpdateHandlerInfo loadUpdatehandlerInfo() {
return new UpdateHandlerInfo(get("updateHandler/@class",null),
getInt("updateHandler/autoCommit/maxDocs",-1),
getInt("updateHandler/autoCommit/maxTime",-1),
getBool("updateHandler/autoCommit/openSearcher",true),
getInt("updateHandler/commitIntervalLowerBound",-1),
getInt("updateHandler/autoSoftCommit/maxDocs",-1),
getInt("updateHandler/autoSoftCommit/maxTime",-1),
getBool("updateHandler/commitWithin/softCommit",true));
}

取自 https://github.com/apache/lucene-solr/blob/lucene_solr_4_5/solr/core/src/java/org/apache/solr/core/SolrConfig.java

关于SOLR: -1 的 autoSoftCommit maxtime 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20130788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com