-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove some dead code #31993
Remove some dead code #31993
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ | |
import org.apache.logging.log4j.message.ParameterizedMessage; | ||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.action.FailedNodeException; | ||
import org.elasticsearch.action.NoSuchNodeException; | ||
import org.elasticsearch.action.support.ActionFilters; | ||
import org.elasticsearch.action.support.HandledTransportAction; | ||
import org.elasticsearch.cluster.ClusterState; | ||
|
@@ -179,37 +178,33 @@ void start() { | |
final DiscoveryNode node = nodes[i]; | ||
final String nodeId = node.getId(); | ||
try { | ||
if (node == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if that use is actually a bug.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. That use is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bleskes maybe you are familiar enough with this code to be able to judge whether node can be null here at all? From what I see so far, the nodes array is retrieved earlier in the method through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 remove the |
||
onFailure(idx, nodeId, new NoSuchNodeException(nodeId)); | ||
} else { | ||
TransportRequest nodeRequest = newNodeRequest(nodeId, request); | ||
if (task != null) { | ||
nodeRequest.setParentTask(clusterService.localNode().getId(), task.getId()); | ||
} | ||
|
||
transportService.sendRequest(node, transportNodeAction, nodeRequest, builder.build(), | ||
new TransportResponseHandler<NodeResponse>() { | ||
@Override | ||
public NodeResponse newInstance() { | ||
return newNodeResponse(); | ||
} | ||
|
||
@Override | ||
public void handleResponse(NodeResponse response) { | ||
onOperation(idx, response); | ||
} | ||
|
||
@Override | ||
public void handleException(TransportException exp) { | ||
onFailure(idx, node.getId(), exp); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return ThreadPool.Names.SAME; | ||
} | ||
}); | ||
TransportRequest nodeRequest = newNodeRequest(nodeId, request); | ||
if (task != null) { | ||
nodeRequest.setParentTask(clusterService.localNode().getId(), task.getId()); | ||
} | ||
|
||
transportService.sendRequest(node, transportNodeAction, nodeRequest, builder.build(), | ||
new TransportResponseHandler<NodeResponse>() { | ||
@Override | ||
public NodeResponse newInstance() { | ||
return newNodeResponse(); | ||
} | ||
|
||
@Override | ||
public void handleResponse(NodeResponse response) { | ||
onOperation(idx, response); | ||
} | ||
|
||
@Override | ||
public void handleException(TransportException exp) { | ||
onFailure(idx, node.getId(), exp); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return ThreadPool.Names.SAME; | ||
} | ||
}); | ||
} catch (Exception e) { | ||
onFailure(idx, nodeId, e); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
*/ | ||
package org.elasticsearch.common.geo.parsers; | ||
|
||
import org.locationtech.jts.geom.Coordinate; | ||
import org.elasticsearch.ElasticsearchParseException; | ||
import org.elasticsearch.common.Explicit; | ||
import org.elasticsearch.common.geo.GeoPoint; | ||
|
@@ -29,6 +28,7 @@ | |
import org.elasticsearch.common.unit.DistanceUnit; | ||
import org.elasticsearch.common.xcontent.XContentParser; | ||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper; | ||
import org.locationtech.jts.geom.Coordinate; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
@@ -130,10 +130,6 @@ protected static ShapeBuilder parse(XContentParser parser, GeoShapeFieldMapper s | |
CircleBuilder.TYPE); | ||
} | ||
|
||
if (shapeType == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason: shapeType is tested for null earlier, throws exception already there |
||
throw new ElasticsearchParseException("shape type [{}] not included", shapeType); | ||
} | ||
|
||
if (shapeType.equals(GeoShapeType.GEOMETRYCOLLECTION)) { | ||
return geometryCollections; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1478,11 +1478,8 @@ public void restore() throws IOException { | |
filesToRecover.add(fileInfo); | ||
recoveryState.getIndex().addFileDetail(fileInfo.name(), fileInfo.length(), false); | ||
if (logger.isTraceEnabled()) { | ||
if (md == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason: |
||
logger.trace("[{}] [{}] recovering [{}] from [{}], does not exists in local store", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name()); | ||
} else { | ||
logger.trace("[{}] [{}] recovering [{}] from [{}], exists in local store but is different", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name()); | ||
} | ||
logger.trace("[{}] [{}] recovering [{}] from [{}], exists in local store but is different", shardId, snapshotId, | ||
fileInfo.physicalName(), fileInfo.name()); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ | |
import org.elasticsearch.common.xcontent.ToXContent; | ||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||
import org.elasticsearch.common.xcontent.XContentFactory; | ||
import org.elasticsearch.xpack.ml.MachineLearning; | ||
import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent; | ||
import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig; | ||
import org.elasticsearch.xpack.core.ml.job.config.DefaultDetectorDescription; | ||
import org.elasticsearch.xpack.core.ml.job.config.DetectionRule; | ||
import org.elasticsearch.xpack.core.ml.job.config.Detector; | ||
import org.elasticsearch.xpack.core.ml.job.config.MlFilter; | ||
import org.elasticsearch.xpack.core.ml.utils.MlStrings; | ||
import org.elasticsearch.xpack.ml.MachineLearning; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStreamWriter; | ||
|
@@ -59,6 +59,7 @@ public FieldConfigWriter(AnalysisConfig config, Set<MlFilter> filters, List<Sche | |
/** | ||
* Write the Ml autodetect field options to the outputIndex stream. | ||
*/ | ||
@SuppressWarnings("unused") // CATEGORIZATION_TOKENIZATION_IN_JAVA seems to be used for performance testing | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L70-73 shows up as dead, but from the comment on the constant it appears this is used occassionaly, so maybe supressing and leaving a comment is a good idea. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of having this constant, could the if condition be commented out with a comment it should be uncommented when needed for debugging? If code must be changed to enable this, then it seems a constant isn't really helping anything here, and adding the unused suppression adds error room for other bugs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @droberts195 can probably comment. As far as I see the CATEGORIZATION_TOKENIZATION_IN_JAVA is used in several places throughout the ML test code, but needs to be enabled manually. I thing supressing the warning and commenting here is sufficient There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's used in 9 places. The alternative would be to get rid of the constant and comment out the code in the 9 places, but then somebody who wanted to run the test would have to remember all 9 places to uncomment. It's nice to just be able to change 1 constant. I guess the scope of suppression could be minimised by adding a new method |
||
public void write() throws IOException { | ||
StringBuilder contents = new StringBuilder(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reason: valueType is never changed