Optimize Node, remove duplicate Settings (#2703)
Removes duplicate Settings Signed-off-by: ruanwenjun <wenjun@apache.org>
This commit is contained in:
parent
6a2a33d187
commit
d848c63260
|
@ -216,25 +216,20 @@ public final class ShardGetService extends AbstractIndexShardComponent {
|
||||||
fetchSourceContext = normalizeFetchSourceContent(fetchSourceContext, gFields);
|
fetchSourceContext = normalizeFetchSourceContent(fetchSourceContext, gFields);
|
||||||
|
|
||||||
Term uidTerm = new Term(IdFieldMapper.NAME, Uid.encodeId(id));
|
Term uidTerm = new Term(IdFieldMapper.NAME, Uid.encodeId(id));
|
||||||
|
|
||||||
|
try (
|
||||||
Engine.GetResult get = indexShard.get(
|
Engine.GetResult get = indexShard.get(
|
||||||
new Engine.Get(realtime, true, id, uidTerm).version(version)
|
new Engine.Get(realtime, true, id, uidTerm).version(version)
|
||||||
.versionType(versionType)
|
.versionType(versionType)
|
||||||
.setIfSeqNo(ifSeqNo)
|
.setIfSeqNo(ifSeqNo)
|
||||||
.setIfPrimaryTerm(ifPrimaryTerm)
|
.setIfPrimaryTerm(ifPrimaryTerm)
|
||||||
);
|
)
|
||||||
if (get.exists() == false) {
|
) {
|
||||||
get.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get == null || get.exists() == false) {
|
if (get == null || get.exists() == false) {
|
||||||
return new GetResult(shardId.getIndexName(), id, UNASSIGNED_SEQ_NO, UNASSIGNED_PRIMARY_TERM, -1, false, null, null, null);
|
return new GetResult(shardId.getIndexName(), id, UNASSIGNED_SEQ_NO, UNASSIGNED_PRIMARY_TERM, -1, false, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
// break between having loaded it from translog (so we only have _source), and having a document to load
|
// break between having loaded it from translog (so we only have _source), and having a document to load
|
||||||
return innerGetLoadFromStoredFields(id, gFields, fetchSourceContext, get, mapperService);
|
return innerGetLoadFromStoredFields(id, gFields, fetchSourceContext, get, mapperService);
|
||||||
} finally {
|
|
||||||
get.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,11 +348,7 @@ public class Node implements Closeable {
|
||||||
Settings tmpSettings = Settings.builder()
|
Settings tmpSettings = Settings.builder()
|
||||||
.put(initialEnvironment.settings())
|
.put(initialEnvironment.settings())
|
||||||
.put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE)
|
.put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE)
|
||||||
.build();
|
|
||||||
|
|
||||||
// Enabling shard indexing backpressure node-attribute
|
// Enabling shard indexing backpressure node-attribute
|
||||||
tmpSettings = Settings.builder()
|
|
||||||
.put(tmpSettings)
|
|
||||||
.put(NODE_ATTRIBUTES.getKey() + SHARD_INDEXING_PRESSURE_ENABLED_ATTRIBUTE_KEY, "true")
|
.put(NODE_ATTRIBUTES.getKey() + SHARD_INDEXING_PRESSURE_ENABLED_ATTRIBUTE_KEY, "true")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue