You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/10/15 11:38:53 UTC

[lucene] branch main updated: Remove redundant null check (#378)

This is an automated email from the ASF dual-hosted git repository.

mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d5df2d  Remove redundant null check (#378)
7d5df2d is described below

commit 7d5df2d6fee7834967884209cf1668210f25df80
Author: Shintaro Murakami <mr...@gmail.com>
AuthorDate: Fri Oct 15 20:38:46 2021 +0900

    Remove redundant null check (#378)
    
    In commit method, mgr is already used without null check before this null check.
---
 .../src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java    | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
index ee0becb..eadff6a 100644
--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
@@ -380,9 +380,7 @@ public abstract class ReplicaNode extends Node {
       // Notify current infos (which may have changed while we were doing dir.sync above) what
       // generation we are up to; this way future
       // commits are guaranteed to go to the next (unwritten) generations:
-      if (mgr != null) {
-        ((SegmentInfosSearcherManager) mgr).getCurrentInfos().updateGeneration(infos);
-      }
+      ((SegmentInfosSearcherManager) mgr).getCurrentInfos().updateGeneration(infos);
       String segmentsFileName = infos.getSegmentsFileName();
       message(
           "top: commit wrote segments file "
@@ -444,9 +442,7 @@ public abstract class ReplicaNode extends Node {
       message("  version=" + infos.getVersion() + " segments=" + infos.toString());
 
       // Cutover to new searcher:
-      if (mgr != null) {
-        ((SegmentInfosSearcherManager) mgr).setCurrentInfos(infos);
-      }
+      ((SegmentInfosSearcherManager) mgr).setCurrentInfos(infos);
 
       // Must first incRef new NRT files, then decRef old ones, to make sure we don't remove an NRT
       // file that's in common to both: