Merge branch 'master' into feature/seq_no
* master: (192 commits) [TEST] Fix rare OBOE in AbstractBytesReferenceTestCase Reindex from remote Rename writeThrowable to writeException Start transport client round-robin randomly Reword Refresh API reference (#19270) Update fielddata.asciidoc Fix stored_fields message Add missing footer notes in mapper size docs Remote BucketStreams Add doc values support to the _size field in the mapper-size plugin Bump version to 5.0.0-alpha5. Update refresh.asciidoc Update shrink-index.asciidoc Change Debian repository for Vagrant debian-8 box [TEST] fix test to account for internal empyt reference optimization Upgrade to netty 3.10.6.Final (#19235) [TEST] fix histogram test when extended bounds overlaps data Remove redundant modifier Simplify TcpTransport interface by reducing send code to a single send method (#19223) Fix style violation in InstallPluginCommand.java ...
This commit is contained in:
commit
d0765d0761
|
@ -42,7 +42,7 @@ Vagrant.configure(2) do |config|
|
|||
# debian and it works fine.
|
||||
config.vm.define "debian-8" do |config|
|
||||
config.vm.box = "elastic/debian-8-x86_64"
|
||||
deb_common config, 'echo deb http://http.debian.net/debian jessie-backports main > /etc/apt/sources.list.d/backports.list', 'backports'
|
||||
deb_common config, 'echo deb http://cloudfront.debian.net/debian jessie-backports main > /etc/apt/sources.list.d/backports.list', 'backports'
|
||||
end
|
||||
config.vm.define "centos-6" do |config|
|
||||
config.vm.box = "elastic/centos-6-x86_64"
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
||||
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.gateway.GatewayAllocator;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public final class Allocators {
|
|||
}
|
||||
|
||||
public static DiscoveryNode newNode(String nodeId, Map<String, String> attributes) {
|
||||
return new DiscoveryNode("", nodeId, DummyTransportAddress.INSTANCE, attributes, Sets.newHashSet(DiscoveryNode.Role.MASTER,
|
||||
return new DiscoveryNode("", nodeId, LocalTransportAddress.buildUnique(), attributes, Sets.newHashSet(DiscoveryNode.Role.MASTER,
|
||||
DiscoveryNode.Role.DATA), Version.CURRENT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,6 @@ import org.gradle.api.logging.LogLevel
|
|||
import org.gradle.api.logging.Logger
|
||||
import org.junit.runner.Description
|
||||
|
||||
import javax.sound.sampled.AudioSystem
|
||||
import javax.sound.sampled.Clip
|
||||
import javax.sound.sampled.Line
|
||||
import javax.sound.sampled.LineEvent
|
||||
import javax.sound.sampled.LineListener
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
import static com.carrotsearch.ant.tasks.junit4.FormattingUtils.formatDescription
|
||||
|
@ -123,36 +117,9 @@ class TestReportLogger extends TestsSummaryEventListener implements AggregatedEv
|
|||
formatTime(e.getCurrentTime()) + ", stalled for " +
|
||||
formatDurationInSeconds(e.getNoEventDuration()) + " at: " +
|
||||
(e.getDescription() == null ? "<unknown>" : formatDescription(e.getDescription())))
|
||||
try {
|
||||
playBeat();
|
||||
} catch (Exception nosound) { /* handling exceptions with style */ }
|
||||
slowTestsFound = true
|
||||
}
|
||||
|
||||
void playBeat() throws Exception {
|
||||
Clip clip = (Clip)AudioSystem.getLine(new Line.Info(Clip.class));
|
||||
final AtomicBoolean stop = new AtomicBoolean();
|
||||
clip.addLineListener(new LineListener() {
|
||||
@Override
|
||||
public void update(LineEvent event) {
|
||||
if (event.getType() == LineEvent.Type.STOP) {
|
||||
stop.set(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
InputStream stream = getClass().getResourceAsStream("/beat.wav");
|
||||
try {
|
||||
clip.open(AudioSystem.getAudioInputStream(stream));
|
||||
clip.start();
|
||||
while (!stop.get()) {
|
||||
Thread.sleep(20);
|
||||
}
|
||||
clip.close();
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
void onQuit(AggregatedQuitEvent e) throws IOException {
|
||||
if (config.showNumFailuresAtEnd > 0 && !failedTests.isEmpty()) {
|
||||
|
|
|
@ -131,8 +131,9 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
|
|||
}
|
||||
|
||||
private void response(Snippet response) {
|
||||
current.println(" - response_body: |")
|
||||
response.contents.eachLine { current.println(" $it") }
|
||||
current.println(" - match: ")
|
||||
current.println(" \$body: ")
|
||||
response.contents.eachLine { current.println(" $it") }
|
||||
}
|
||||
|
||||
void emitDo(String method, String pathAndQuery,
|
||||
|
|
|
@ -62,6 +62,7 @@ public class RestIntegTestTask extends RandomizedTestingTask {
|
|||
project.gradle.projectsEvaluated {
|
||||
NodeInfo node = ClusterFormationTasks.setup(project, this, clusterConfig)
|
||||
systemProperty('tests.rest.cluster', "${-> node.httpUri()}")
|
||||
systemProperty('tests.config.dir', "${-> node.confDir}")
|
||||
// TODO: our "client" qa tests currently use the rest-test plugin. instead they should have their own plugin
|
||||
// that sets up the test cluster and passes this transport uri instead of http uri. Until then, we pass
|
||||
// both as separate sysprops
|
||||
|
|
Binary file not shown.
|
@ -39,6 +39,27 @@
|
|||
|
||||
<module name="EqualsHashCode" />
|
||||
|
||||
<!-- Checks that the order of modifiers conforms to the suggestions in the
|
||||
Java Language specification, sections 8.1.1, 8.3.1 and 8.4.3. It is not that
|
||||
the standard is perfect, but having a consistent order makes the code more
|
||||
readable and no other order is compellingly better than the standard.
|
||||
The correct order is:
|
||||
public
|
||||
protected
|
||||
private
|
||||
abstract
|
||||
static
|
||||
final
|
||||
transient
|
||||
volatile
|
||||
synchronized
|
||||
native
|
||||
strictfp
|
||||
-->
|
||||
<module name="ModifierOrder" />
|
||||
|
||||
<module name="RedundantModifier" />
|
||||
|
||||
<!-- We don't use Java's builtin serialization and we suppress all warning
|
||||
about it. The flip side of that coin is that we shouldn't _try_ to use
|
||||
it. We can't outright ban it with ForbiddenApis because it complain about
|
||||
|
|
|
@ -266,7 +266,6 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]metadata[/\\]MetaDataMappingService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]metadata[/\\]MetaDataUpdateSettingsService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]metadata[/\\]RepositoriesMetaData.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]node[/\\]DiscoveryNodes.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]routing[/\\]IndexRoutingTable.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]routing[/\\]IndexShardRoutingTable.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]routing[/\\]OperationRouting.java" checks="LineLength" />
|
||||
|
@ -323,7 +322,6 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]recycler[/\\]Recyclers.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]rounding[/\\]Rounding.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]unit[/\\]ByteSizeValue.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]unit[/\\]TimeValue.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]BigArrays.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]CancellableThreads.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]CollectionUtils.java" checks="LineLength" />
|
||||
|
@ -342,12 +340,9 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]DiscoveryService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]DiscoverySettings.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]local[/\\]LocalDiscovery.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]NodeJoinController.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]ZenDiscovery.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]elect[/\\]ElectMasterService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]fd[/\\]FaultDetection.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]fd[/\\]MasterFaultDetection.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]fd[/\\]NodesFaultDetection.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]membership[/\\]MembershipAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]ping[/\\]ZenPing.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]publish[/\\]PendingClusterStatesQueue.java" checks="LineLength" />
|
||||
|
@ -358,7 +353,6 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]GatewayMetaState.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]GatewayService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]LocalAllocateDangledIndices.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]MetaDataStateFormat.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]PrimaryShardAllocator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]ReplicaShardAllocator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]TransportNodesListGatewayMetaState.java" checks="LineLength" />
|
||||
|
@ -477,8 +471,6 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndexingMemoryController.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndicesService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndicesWarmer.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analysis[/\\]AnalysisModule.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analysis[/\\]HunspellService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analysis[/\\]PreBuiltCacheFactory.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analysis[/\\]PreBuiltTokenFilters.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]breaker[/\\]HierarchyCircuitBreakerService.java" checks="LineLength" />
|
||||
|
@ -629,7 +621,6 @@
|
|||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]percentiles[/\\]tdigest[/\\]AbstractTDigestPercentilesAggregator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]percentiles[/\\]tdigest[/\\]TDigestPercentileRanksAggregator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]percentiles[/\\]tdigest[/\\]TDigestPercentilesAggregator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]scripted[/\\]InternalScriptedMetric.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]scripted[/\\]ScriptedMetricAggregator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]stats[/\\]extended[/\\]ExtendedStatsAggregator.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]metrics[/\\]tophits[/\\]TopHitsAggregator.java" checks="LineLength" />
|
||||
|
@ -851,7 +842,6 @@
|
|||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]BlockingClusterStatePublishResponseHandlerTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]DiscoveryWithServiceDisruptionsIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]ZenUnicastDiscoveryIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]NodeJoinControllerTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]ZenDiscoveryUnitTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]publish[/\\]PublishClusterStateActionTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]document[/\\]DocumentActionsIT.java" checks="LineLength" />
|
||||
|
@ -879,9 +869,6 @@
|
|||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]IndexingSlowLogTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]MergePolicySettingsTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]SearchSlowLogTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]AnalysisModuleTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]AnalysisServiceTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]CompoundAnalysisTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]NGramTokenizerFactoryTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PatternCaptureTokenFilterTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PreBuiltAnalyzerProviderFactoryTests.java" checks="LineLength" />
|
||||
|
@ -1174,7 +1161,6 @@
|
|||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportShardMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]RestPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorRequestTests.java" checks="LineLength" />
|
||||
|
@ -1186,12 +1172,10 @@
|
|||
<suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]JapaneseStopTokenFilterFactory.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]KuromojiAnalysisTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-phonetic[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PhoneticTokenFilterFactory.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-smartcn[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]SimpleSmartChineseAnalysisTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-stempel[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PolishAnalysisTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]AbstractAzureTestCase.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureMinimumMasterNodesTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureSimpleTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureTwoStartedNodesTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]AbstractAzureTestCase.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureMinimumMasterNodesTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureSimpleTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureTwoStartedNodesTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]aws[/\\]AbstractAwsTestCase.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]ec2[/\\]AmazonEC2Mock.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]GceNetworkTests.java" checks="LineLength" />
|
||||
|
@ -1216,10 +1200,6 @@
|
|||
<suppress files="plugins[/\\]mapper-murmur3[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]murmur3[/\\]Murmur3FieldMapper.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-murmur3[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]murmur3[/\\]Murmur3FieldMapperTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-murmur3[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]murmur3[/\\]Murmur3FieldMapperUpgradeTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-size[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]size[/\\]SizeFieldMapper.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-size[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]size[/\\]SizeFieldMapperUpgradeTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-size[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]size[/\\]SizeMappingIT.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]mapper-size[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]size[/\\]SizeMappingTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]repository-azure[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]blobstore[/\\]AzureBlobContainer.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]repository-azure[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]blobstore[/\\]AzureBlobStore.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]repository-azure[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]storage[/\\]AzureStorageServiceImpl.java" checks="LineLength" />
|
||||
|
@ -1272,26 +1252,8 @@
|
|||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]engine[/\\]MockEngineSupport.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]hamcrest[/\\]ElasticsearchAssertions.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]junit[/\\]listeners[/\\]LoggingListener.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]json[/\\]JsonPath.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]GreaterThanEqualToParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]GreaterThanParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]LessThanOrEqualToParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]LessThanParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]RestTestSuiteParseContext.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]RestTestSuiteParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]GreaterThanAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]GreaterThanEqualToAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]LengthAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]LessThanAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]LessThanOrEqualToAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]section[/\\]MatchAssertion.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]spec[/\\]RestApiParser.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]support[/\\]FileUtils.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]store[/\\]MockFSDirectoryService.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]store[/\\]MockFSIndexStore.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]test[/\\]FileUtilsTests.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]test[/\\]JsonPathTests.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]test[/\\]RestTestParserTests.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]test[/\\]InternalTestClusterTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]cli[/\\]CliTool.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]admin[/\\]indices[/\\]settings[/\\]RestGetSettingsAction.java" checks="LineLength" />
|
||||
|
|
|
@ -36,7 +36,7 @@ public class NamingConventionsCheckBadClasses {
|
|||
public void testDummy() {}
|
||||
}
|
||||
|
||||
public static abstract class DummyAbstractTests extends UnitTestCase {
|
||||
public abstract static class DummyAbstractTests extends UnitTestCase {
|
||||
}
|
||||
|
||||
public interface DummyInterfaceTests {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
elasticsearch = 5.0.0-alpha4
|
||||
elasticsearch = 5.0.0-alpha5
|
||||
lucene = 6.1.0
|
||||
|
||||
# optional dependencies
|
||||
|
|
|
@ -26,6 +26,8 @@ apply plugin: 'ru.vyarus.animalsniffer'
|
|||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
group = 'org.elasticsearch.client'
|
||||
|
||||
dependencies {
|
||||
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
|
||||
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.net.URI;
|
|||
*/
|
||||
final class HttpDeleteWithEntity extends HttpEntityEnclosingRequestBase {
|
||||
|
||||
final static String METHOD_NAME = HttpDelete.METHOD_NAME;
|
||||
static final String METHOD_NAME = HttpDelete.METHOD_NAME;
|
||||
|
||||
HttpDeleteWithEntity(final URI uri) {
|
||||
setURI(uri);
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.net.URI;
|
|||
*/
|
||||
final class HttpGetWithEntity extends HttpEntityEnclosingRequestBase {
|
||||
|
||||
final static String METHOD_NAME = HttpGet.METHOD_NAME;
|
||||
static final String METHOD_NAME = HttpGet.METHOD_NAME;
|
||||
|
||||
HttpGetWithEntity(final URI uri) {
|
||||
setURI(uri);
|
||||
|
|
|
@ -26,6 +26,8 @@ apply plugin: 'ru.vyarus.animalsniffer'
|
|||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
group = 'org.elasticsearch.client'
|
||||
|
||||
dependencies {
|
||||
compile "org.elasticsearch.client:rest:${version}"
|
||||
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
|
||||
|
|
|
@ -26,6 +26,9 @@ apply plugin: 'ru.vyarus.animalsniffer'
|
|||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
install.enabled = false
|
||||
uploadArchives.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
|
||||
compile "junit:junit:${versions.junit}"
|
||||
|
|
|
@ -75,7 +75,7 @@ dependencies {
|
|||
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
|
||||
|
||||
// network stack
|
||||
compile 'io.netty:netty:3.10.5.Final'
|
||||
compile 'io.netty:netty:3.10.6.Final'
|
||||
// percentiles aggregation
|
||||
compile 'com.tdunning:t-digest:3.0'
|
||||
// precentil ranks aggregation
|
||||
|
|
|
@ -1110,7 +1110,7 @@ public long ramBytesUsed() {
|
|||
this.analyzed.copyBytes(analyzed);
|
||||
}
|
||||
|
||||
private final static class SurfaceFormAndPayload implements Comparable<SurfaceFormAndPayload> {
|
||||
private static final class SurfaceFormAndPayload implements Comparable<SurfaceFormAndPayload> {
|
||||
BytesRef payload;
|
||||
long weight;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.unit.ByteSizeValue;
|
|||
*/
|
||||
public class StoreRateLimiting {
|
||||
|
||||
public static interface Provider {
|
||||
public interface Provider {
|
||||
|
||||
StoreRateLimiting rateLimiting();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.transport.TcpTransport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -99,7 +100,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
}
|
||||
|
||||
public ElasticsearchException(StreamInput in) throws IOException {
|
||||
super(in.readOptionalString(), in.readThrowable());
|
||||
super(in.readOptionalString(), in.readException());
|
||||
readStackTrace(this, in);
|
||||
int numKeys = in.readVInt();
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
|
@ -161,7 +162,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
* Unwraps the actual cause from the exception for cases when the exception is a
|
||||
* {@link ElasticsearchWrapperException}.
|
||||
*
|
||||
* @see org.elasticsearch.ExceptionsHelper#unwrapCause(Throwable)
|
||||
* @see ExceptionsHelper#unwrapCause(Throwable)
|
||||
*/
|
||||
public Throwable unwrapCause() {
|
||||
return ExceptionsHelper.unwrapCause(this);
|
||||
|
@ -203,7 +204,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeOptionalString(this.getMessage());
|
||||
out.writeThrowable(this.getCause());
|
||||
out.writeException(this.getCause());
|
||||
writeStackTraces(this, out);
|
||||
out.writeVInt(headers.size());
|
||||
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
|
@ -414,7 +415,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
|
||||
int numSuppressed = in.readVInt();
|
||||
for (int i = 0; i < numSuppressed; i++) {
|
||||
throwable.addSuppressed(in.readThrowable());
|
||||
throwable.addSuppressed(in.readException());
|
||||
}
|
||||
return throwable;
|
||||
}
|
||||
|
@ -434,7 +435,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
Throwable[] suppressed = throwable.getSuppressed();
|
||||
out.writeVInt(suppressed.length);
|
||||
for (Throwable t : suppressed) {
|
||||
out.writeThrowable(t);
|
||||
out.writeException(t);
|
||||
}
|
||||
return throwable;
|
||||
}
|
||||
|
@ -496,7 +497,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
org.elasticsearch.index.shard.IndexShardStartedException::new, 23),
|
||||
SEARCH_CONTEXT_MISSING_EXCEPTION(org.elasticsearch.search.SearchContextMissingException.class,
|
||||
org.elasticsearch.search.SearchContextMissingException::new, 24),
|
||||
GENERAL_SCRIPT_EXCEPTION(org.elasticsearch.script.GeneralScriptException.class,
|
||||
GENERAL_SCRIPT_EXCEPTION(org.elasticsearch.script.GeneralScriptException.class,
|
||||
org.elasticsearch.script.GeneralScriptException::new, 25),
|
||||
BATCH_OPERATION_EXCEPTION(org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException.class,
|
||||
org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException::new, 26),
|
||||
|
@ -676,8 +677,8 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
org.elasticsearch.indices.IndexAlreadyExistsException::new, 123),
|
||||
SCRIPT_PARSE_EXCEPTION(org.elasticsearch.script.Script.ScriptParseException.class,
|
||||
org.elasticsearch.script.Script.ScriptParseException::new, 124),
|
||||
HTTP_ON_TRANSPORT_EXCEPTION(org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException.class,
|
||||
org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException::new, 125),
|
||||
HTTP_ON_TRANSPORT_EXCEPTION(TcpTransport.HttpOnTransportException.class,
|
||||
TcpTransport.HttpOnTransportException::new, 125),
|
||||
MAPPER_PARSING_EXCEPTION(org.elasticsearch.index.mapper.MapperParsingException.class,
|
||||
org.elasticsearch.index.mapper.MapperParsingException::new, 126),
|
||||
SEARCH_CONTEXT_EXCEPTION(org.elasticsearch.search.SearchContextException.class,
|
||||
|
@ -793,9 +794,9 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void renderThrowable(XContentBuilder builder, Params params, Throwable t) throws IOException {
|
||||
public static void renderException(XContentBuilder builder, Params params, Exception e) throws IOException {
|
||||
builder.startObject("error");
|
||||
final ElasticsearchException[] rootCauses = ElasticsearchException.guessRootCauses(t);
|
||||
final ElasticsearchException[] rootCauses = ElasticsearchException.guessRootCauses(e);
|
||||
builder.field("root_cause");
|
||||
builder.startArray();
|
||||
for (ElasticsearchException rootCause : rootCauses) {
|
||||
|
@ -805,7 +806,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
builder.endObject();
|
||||
}
|
||||
builder.endArray();
|
||||
ElasticsearchException.toXContent(builder, params, t);
|
||||
ElasticsearchException.toXContent(builder, params, e);
|
||||
builder.endObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ElasticsearchSecurityException extends ElasticsearchException {
|
|||
this.status = status ;
|
||||
}
|
||||
|
||||
public ElasticsearchSecurityException(String msg, Throwable cause, Object... args) {
|
||||
public ElasticsearchSecurityException(String msg, Exception cause, Object... args) {
|
||||
this(msg, ExceptionsHelper.status(cause), cause, args);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,25 +37,22 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final class ExceptionsHelper {
|
||||
|
||||
private static final ESLogger logger = Loggers.getLogger(ExceptionsHelper.class);
|
||||
|
||||
public static RuntimeException convertToRuntime(Throwable t) {
|
||||
if (t instanceof RuntimeException) {
|
||||
return (RuntimeException) t;
|
||||
public static RuntimeException convertToRuntime(Exception e) {
|
||||
if (e instanceof RuntimeException) {
|
||||
return (RuntimeException) e;
|
||||
}
|
||||
return new ElasticsearchException(t);
|
||||
return new ElasticsearchException(e);
|
||||
}
|
||||
|
||||
public static ElasticsearchException convertToElastic(Throwable t) {
|
||||
if (t instanceof ElasticsearchException) {
|
||||
return (ElasticsearchException) t;
|
||||
public static ElasticsearchException convertToElastic(Exception e) {
|
||||
if (e instanceof ElasticsearchException) {
|
||||
return (ElasticsearchException) e;
|
||||
}
|
||||
return new ElasticsearchException(t);
|
||||
return new ElasticsearchException(e);
|
||||
}
|
||||
|
||||
public static RestStatus status(Throwable t) {
|
||||
|
@ -89,15 +86,14 @@ public final class ExceptionsHelper {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Don't swallow exceptions, allow them to propagate.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String detailedMessage(Throwable t) {
|
||||
return detailedMessage(t, false, 0);
|
||||
}
|
||||
|
||||
public static String detailedMessage(Throwable t, boolean newLines, int initialCounter) {
|
||||
if (t == null) {
|
||||
return "Unknown";
|
||||
}
|
||||
int counter = initialCounter + 1;
|
||||
if (t.getCause() != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (t != null) {
|
||||
|
@ -107,21 +103,11 @@ public final class ExceptionsHelper {
|
|||
sb.append(t.getMessage());
|
||||
sb.append("]");
|
||||
}
|
||||
if (!newLines) {
|
||||
sb.append("; ");
|
||||
}
|
||||
sb.append("; ");
|
||||
t = t.getCause();
|
||||
if (t != null) {
|
||||
if (newLines) {
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < counter; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
} else {
|
||||
sb.append("nested: ");
|
||||
}
|
||||
sb.append("nested: ");
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
return sb.toString();
|
||||
} else {
|
||||
|
@ -175,8 +161,8 @@ public final class ExceptionsHelper {
|
|||
}
|
||||
|
||||
public static IOException unwrapCorruption(Throwable t) {
|
||||
return (IOException) unwrap(t, CorruptIndexException.class,
|
||||
IndexFormatTooOldException.class,
|
||||
return (IOException) unwrap(t, CorruptIndexException.class,
|
||||
IndexFormatTooOldException.class,
|
||||
IndexFormatTooNewException.class);
|
||||
}
|
||||
|
||||
|
@ -220,7 +206,6 @@ public final class ExceptionsHelper {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deduplicate the failures by exception message and index.
|
||||
*/
|
||||
|
|
|
@ -77,7 +77,9 @@ public class Version {
|
|||
public static final Version V_5_0_0_alpha3 = new Version(V_5_0_0_alpha3_ID, org.apache.lucene.util.Version.LUCENE_6_0_0);
|
||||
public static final int V_5_0_0_alpha4_ID = 5000004;
|
||||
public static final Version V_5_0_0_alpha4 = new Version(V_5_0_0_alpha4_ID, org.apache.lucene.util.Version.LUCENE_6_1_0);
|
||||
public static final Version CURRENT = V_5_0_0_alpha4;
|
||||
public static final int V_5_0_0_alpha5_ID = 5000005;
|
||||
public static final Version V_5_0_0_alpha5 = new Version(V_5_0_0_alpha5_ID, org.apache.lucene.util.Version.LUCENE_6_1_0);
|
||||
public static final Version CURRENT = V_5_0_0_alpha5;
|
||||
|
||||
static {
|
||||
assert CURRENT.luceneVersion.equals(org.apache.lucene.util.Version.LATEST) : "Version must be upgraded to ["
|
||||
|
@ -90,6 +92,8 @@ public class Version {
|
|||
|
||||
public static Version fromId(int id) {
|
||||
switch (id) {
|
||||
case V_5_0_0_alpha5_ID:
|
||||
return V_5_0_0_alpha5;
|
||||
case V_5_0_0_alpha4_ID:
|
||||
return V_5_0_0_alpha4;
|
||||
case V_5_0_0_alpha3_ID:
|
||||
|
|
|
@ -32,5 +32,5 @@ public interface ActionListener<Response> {
|
|||
/**
|
||||
* A failure caused by an exception at some phase of the task.
|
||||
*/
|
||||
void onFailure(Throwable e);
|
||||
void onFailure(Exception e);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,12 @@ import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
|
|||
import org.elasticsearch.action.admin.cluster.state.TransportClusterStateAction;
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsAction;
|
||||
import org.elasticsearch.action.admin.cluster.stats.TransportClusterStatsAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportDeleteStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportPutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.TransportPendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
|
@ -151,18 +157,12 @@ import org.elasticsearch.action.get.TransportMultiGetAction;
|
|||
import org.elasticsearch.action.get.TransportShardMultiGetAction;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportDeleteStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportPutStoredScriptAction;
|
||||
import org.elasticsearch.action.ingest.IngestActionFilter;
|
||||
import org.elasticsearch.action.ingest.IngestProxyActionFilter;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineAction;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineTransportAction;
|
||||
import org.elasticsearch.action.ingest.GetPipelineAction;
|
||||
import org.elasticsearch.action.ingest.GetPipelineTransportAction;
|
||||
import org.elasticsearch.action.ingest.IngestActionFilter;
|
||||
import org.elasticsearch.action.ingest.IngestProxyActionFilter;
|
||||
import org.elasticsearch.action.ingest.PutPipelineAction;
|
||||
import org.elasticsearch.action.ingest.PutPipelineTransportAction;
|
||||
import org.elasticsearch.action.ingest.SimulatePipelineAction;
|
||||
|
@ -189,189 +189,480 @@ import org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction
|
|||
import org.elasticsearch.action.termvectors.TransportTermVectorsAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.NamedRegistry;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.inject.multibindings.MapBinder;
|
||||
import org.elasticsearch.common.inject.multibindings.Multibinder;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.rest.action.admin.cluster.allocation.RestClusterAllocationExplainAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.health.RestClusterHealthAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.hotthreads.RestNodesHotThreadsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.info.RestNodesInfoAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.stats.RestNodesStatsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestCancelTasksAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestGetTaskAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.repositories.delete.RestDeleteRepositoryAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.repositories.get.RestGetRepositoriesAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.repositories.put.RestPutRepositoryAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.repositories.verify.RestVerifyRepositoryAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.reroute.RestClusterRerouteAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.settings.RestClusterGetSettingsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.settings.RestClusterUpdateSettingsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.shards.RestClusterSearchShardsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.snapshots.create.RestCreateSnapshotAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.snapshots.delete.RestDeleteSnapshotAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.snapshots.get.RestGetSnapshotsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.snapshots.restore.RestRestoreSnapshotAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.snapshots.status.RestSnapshotsStatusAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.state.RestClusterStateAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.stats.RestClusterStatsAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestDeleteStoredScriptAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestGetStoredScriptAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestPutStoredScriptAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.tasks.RestPendingClusterTasksAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.RestShrinkIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.alias.RestIndicesAliasesAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.alias.delete.RestIndexDeleteAliasesAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.alias.get.RestGetAliasesAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.alias.head.RestAliasesExistAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.alias.put.RestIndexPutAliasAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.analyze.RestAnalyzeAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.cache.clear.RestClearIndicesCacheAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.close.RestCloseIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.create.RestCreateIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.delete.RestDeleteIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.exists.indices.RestIndicesExistsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.exists.types.RestTypesExistsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.flush.RestFlushAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.flush.RestSyncedFlushAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.forcemerge.RestForceMergeAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.get.RestGetIndicesAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.mapping.get.RestGetFieldMappingAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.mapping.get.RestGetMappingAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.mapping.put.RestPutMappingAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.open.RestOpenIndexAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.recovery.RestRecoveryAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.refresh.RestRefreshAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.segments.RestIndicesSegmentsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.settings.RestGetSettingsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.settings.RestUpdateSettingsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.shards.RestIndicesShardStoresAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.stats.RestIndicesStatsAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.template.delete.RestDeleteIndexTemplateAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.template.get.RestGetIndexTemplateAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.template.head.RestHeadIndexTemplateAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.template.put.RestPutIndexTemplateAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.upgrade.RestUpgradeAction;
|
||||
import org.elasticsearch.rest.action.admin.indices.validate.query.RestValidateQueryAction;
|
||||
import org.elasticsearch.rest.action.bulk.RestBulkAction;
|
||||
import org.elasticsearch.rest.action.cat.AbstractCatAction;
|
||||
import org.elasticsearch.rest.action.cat.RestAliasAction;
|
||||
import org.elasticsearch.rest.action.cat.RestAllocationAction;
|
||||
import org.elasticsearch.rest.action.cat.RestCatAction;
|
||||
import org.elasticsearch.rest.action.cat.RestFielddataAction;
|
||||
import org.elasticsearch.rest.action.cat.RestHealthAction;
|
||||
import org.elasticsearch.rest.action.cat.RestIndicesAction;
|
||||
import org.elasticsearch.rest.action.cat.RestMasterAction;
|
||||
import org.elasticsearch.rest.action.cat.RestNodeAttrsAction;
|
||||
import org.elasticsearch.rest.action.cat.RestNodesAction;
|
||||
import org.elasticsearch.rest.action.cat.RestPluginsAction;
|
||||
import org.elasticsearch.rest.action.cat.RestRepositoriesAction;
|
||||
import org.elasticsearch.rest.action.cat.RestSegmentsAction;
|
||||
import org.elasticsearch.rest.action.cat.RestShardsAction;
|
||||
import org.elasticsearch.rest.action.cat.RestSnapshotAction;
|
||||
import org.elasticsearch.rest.action.cat.RestTasksAction;
|
||||
import org.elasticsearch.rest.action.cat.RestThreadPoolAction;
|
||||
import org.elasticsearch.rest.action.delete.RestDeleteAction;
|
||||
import org.elasticsearch.rest.action.explain.RestExplainAction;
|
||||
import org.elasticsearch.rest.action.fieldstats.RestFieldStatsAction;
|
||||
import org.elasticsearch.rest.action.get.RestGetAction;
|
||||
import org.elasticsearch.rest.action.get.RestGetSourceAction;
|
||||
import org.elasticsearch.rest.action.get.RestHeadAction;
|
||||
import org.elasticsearch.rest.action.get.RestMultiGetAction;
|
||||
import org.elasticsearch.rest.action.index.RestIndexAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestDeletePipelineAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestGetPipelineAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestPutPipelineAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction;
|
||||
import org.elasticsearch.rest.action.main.RestMainAction;
|
||||
import org.elasticsearch.rest.action.search.RestClearScrollAction;
|
||||
import org.elasticsearch.rest.action.search.RestMultiSearchAction;
|
||||
import org.elasticsearch.rest.action.search.RestSearchAction;
|
||||
import org.elasticsearch.rest.action.search.RestSearchScrollAction;
|
||||
import org.elasticsearch.rest.action.suggest.RestSuggestAction;
|
||||
import org.elasticsearch.rest.action.termvectors.RestMultiTermVectorsAction;
|
||||
import org.elasticsearch.rest.action.termvectors.RestTermVectorsAction;
|
||||
import org.elasticsearch.rest.action.update.RestUpdateAction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Collections.unmodifiableList;
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* Builds and binds the generic action map, all {@link TransportAction}s, and {@link ActionFilters}.
|
||||
*/
|
||||
public class ActionModule extends AbstractModule {
|
||||
|
||||
private final Map<String, ActionEntry> actions = new HashMap<>();
|
||||
private final List<Class<? extends ActionFilter>> actionFilters = new ArrayList<>();
|
||||
private final boolean transportClient;
|
||||
private final Settings settings;
|
||||
private final List<ActionPlugin> actionPlugins;
|
||||
private final Map<String, ActionHandler<?, ?>> actions;
|
||||
private final List<Class<? extends ActionFilter>> actionFilters;
|
||||
private final AutoCreateIndex autoCreateIndex;
|
||||
private final DestructiveOperations destructiveOperations;
|
||||
private final RestController restController;
|
||||
|
||||
static class ActionEntry<Request extends ActionRequest<Request>, Response extends ActionResponse> {
|
||||
public final GenericAction<Request, Response> action;
|
||||
public final Class<? extends TransportAction<Request, Response>> transportAction;
|
||||
public final Class[] supportTransportActions;
|
||||
public ActionModule(boolean ingestEnabled, boolean transportClient, Settings settings, IndexNameExpressionResolver resolver,
|
||||
ClusterSettings clusterSettings, List<ActionPlugin> actionPlugins) {
|
||||
this.transportClient = transportClient;
|
||||
this.settings = settings;
|
||||
this.actionPlugins = actionPlugins;
|
||||
actions = setupActions(actionPlugins);
|
||||
actionFilters = setupActionFilters(actionPlugins, ingestEnabled);
|
||||
autoCreateIndex = transportClient ? null : new AutoCreateIndex(settings, resolver);
|
||||
destructiveOperations = new DestructiveOperations(settings, clusterSettings);
|
||||
restController = new RestController(settings);
|
||||
}
|
||||
|
||||
ActionEntry(GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction, Class... supportTransportActions) {
|
||||
this.action = action;
|
||||
this.transportAction = transportAction;
|
||||
this.supportTransportActions = supportTransportActions;
|
||||
static Map<String, ActionHandler<?, ?>> setupActions(List<ActionPlugin> actionPlugins) {
|
||||
// Subclass NamedRegistry for easy registration
|
||||
class ActionRegistry extends NamedRegistry<ActionHandler<?, ?>> {
|
||||
public ActionRegistry() {
|
||||
super("action");
|
||||
}
|
||||
|
||||
public void register(ActionHandler<?, ?> handler) {
|
||||
register(handler.getAction().name(), handler);
|
||||
}
|
||||
|
||||
public <Request extends ActionRequest<Request>, Response extends ActionResponse> void register(
|
||||
GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
|
||||
Class<?>... supportTransportActions) {
|
||||
register(new ActionHandler<>(action, transportAction, supportTransportActions));
|
||||
}
|
||||
}
|
||||
ActionRegistry actions = new ActionRegistry();
|
||||
|
||||
actions.register(MainAction.INSTANCE, TransportMainAction.class);
|
||||
actions.register(NodesInfoAction.INSTANCE, TransportNodesInfoAction.class);
|
||||
actions.register(NodesStatsAction.INSTANCE, TransportNodesStatsAction.class);
|
||||
actions.register(NodesHotThreadsAction.INSTANCE, TransportNodesHotThreadsAction.class);
|
||||
actions.register(ListTasksAction.INSTANCE, TransportListTasksAction.class);
|
||||
actions.register(GetTaskAction.INSTANCE, TransportGetTaskAction.class);
|
||||
actions.register(CancelTasksAction.INSTANCE, TransportCancelTasksAction.class);
|
||||
|
||||
actions.register(ClusterAllocationExplainAction.INSTANCE, TransportClusterAllocationExplainAction.class);
|
||||
actions.register(ClusterStatsAction.INSTANCE, TransportClusterStatsAction.class);
|
||||
actions.register(ClusterStateAction.INSTANCE, TransportClusterStateAction.class);
|
||||
actions.register(ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class);
|
||||
actions.register(ClusterUpdateSettingsAction.INSTANCE, TransportClusterUpdateSettingsAction.class);
|
||||
actions.register(ClusterRerouteAction.INSTANCE, TransportClusterRerouteAction.class);
|
||||
actions.register(ClusterSearchShardsAction.INSTANCE, TransportClusterSearchShardsAction.class);
|
||||
actions.register(PendingClusterTasksAction.INSTANCE, TransportPendingClusterTasksAction.class);
|
||||
actions.register(PutRepositoryAction.INSTANCE, TransportPutRepositoryAction.class);
|
||||
actions.register(GetRepositoriesAction.INSTANCE, TransportGetRepositoriesAction.class);
|
||||
actions.register(DeleteRepositoryAction.INSTANCE, TransportDeleteRepositoryAction.class);
|
||||
actions.register(VerifyRepositoryAction.INSTANCE, TransportVerifyRepositoryAction.class);
|
||||
actions.register(GetSnapshotsAction.INSTANCE, TransportGetSnapshotsAction.class);
|
||||
actions.register(DeleteSnapshotAction.INSTANCE, TransportDeleteSnapshotAction.class);
|
||||
actions.register(CreateSnapshotAction.INSTANCE, TransportCreateSnapshotAction.class);
|
||||
actions.register(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
|
||||
actions.register(SnapshotsStatusAction.INSTANCE, TransportSnapshotsStatusAction.class);
|
||||
|
||||
actions.register(IndicesStatsAction.INSTANCE, TransportIndicesStatsAction.class);
|
||||
actions.register(IndicesSegmentsAction.INSTANCE, TransportIndicesSegmentsAction.class);
|
||||
actions.register(IndicesShardStoresAction.INSTANCE, TransportIndicesShardStoresAction.class);
|
||||
actions.register(CreateIndexAction.INSTANCE, TransportCreateIndexAction.class);
|
||||
actions.register(ShrinkAction.INSTANCE, TransportShrinkAction.class);
|
||||
actions.register(RolloverAction.INSTANCE, TransportRolloverAction.class);
|
||||
actions.register(DeleteIndexAction.INSTANCE, TransportDeleteIndexAction.class);
|
||||
actions.register(GetIndexAction.INSTANCE, TransportGetIndexAction.class);
|
||||
actions.register(OpenIndexAction.INSTANCE, TransportOpenIndexAction.class);
|
||||
actions.register(CloseIndexAction.INSTANCE, TransportCloseIndexAction.class);
|
||||
actions.register(IndicesExistsAction.INSTANCE, TransportIndicesExistsAction.class);
|
||||
actions.register(TypesExistsAction.INSTANCE, TransportTypesExistsAction.class);
|
||||
actions.register(GetMappingsAction.INSTANCE, TransportGetMappingsAction.class);
|
||||
actions.register(GetFieldMappingsAction.INSTANCE, TransportGetFieldMappingsAction.class,
|
||||
TransportGetFieldMappingsIndexAction.class);
|
||||
actions.register(PutMappingAction.INSTANCE, TransportPutMappingAction.class);
|
||||
actions.register(IndicesAliasesAction.INSTANCE, TransportIndicesAliasesAction.class);
|
||||
actions.register(UpdateSettingsAction.INSTANCE, TransportUpdateSettingsAction.class);
|
||||
actions.register(AnalyzeAction.INSTANCE, TransportAnalyzeAction.class);
|
||||
actions.register(PutIndexTemplateAction.INSTANCE, TransportPutIndexTemplateAction.class);
|
||||
actions.register(GetIndexTemplatesAction.INSTANCE, TransportGetIndexTemplatesAction.class);
|
||||
actions.register(DeleteIndexTemplateAction.INSTANCE, TransportDeleteIndexTemplateAction.class);
|
||||
actions.register(ValidateQueryAction.INSTANCE, TransportValidateQueryAction.class);
|
||||
actions.register(RefreshAction.INSTANCE, TransportRefreshAction.class);
|
||||
actions.register(FlushAction.INSTANCE, TransportFlushAction.class);
|
||||
actions.register(SyncedFlushAction.INSTANCE, TransportSyncedFlushAction.class);
|
||||
actions.register(ForceMergeAction.INSTANCE, TransportForceMergeAction.class);
|
||||
actions.register(UpgradeAction.INSTANCE, TransportUpgradeAction.class);
|
||||
actions.register(UpgradeStatusAction.INSTANCE, TransportUpgradeStatusAction.class);
|
||||
actions.register(UpgradeSettingsAction.INSTANCE, TransportUpgradeSettingsAction.class);
|
||||
actions.register(ClearIndicesCacheAction.INSTANCE, TransportClearIndicesCacheAction.class);
|
||||
actions.register(GetAliasesAction.INSTANCE, TransportGetAliasesAction.class);
|
||||
actions.register(AliasesExistAction.INSTANCE, TransportAliasesExistAction.class);
|
||||
actions.register(GetSettingsAction.INSTANCE, TransportGetSettingsAction.class);
|
||||
|
||||
actions.register(IndexAction.INSTANCE, TransportIndexAction.class);
|
||||
actions.register(GetAction.INSTANCE, TransportGetAction.class);
|
||||
actions.register(TermVectorsAction.INSTANCE, TransportTermVectorsAction.class);
|
||||
actions.register(MultiTermVectorsAction.INSTANCE, TransportMultiTermVectorsAction.class,
|
||||
TransportShardMultiTermsVectorAction.class);
|
||||
actions.register(DeleteAction.INSTANCE, TransportDeleteAction.class);
|
||||
actions.register(UpdateAction.INSTANCE, TransportUpdateAction.class);
|
||||
actions.register(MultiGetAction.INSTANCE, TransportMultiGetAction.class,
|
||||
TransportShardMultiGetAction.class);
|
||||
actions.register(BulkAction.INSTANCE, TransportBulkAction.class,
|
||||
TransportShardBulkAction.class);
|
||||
actions.register(SearchAction.INSTANCE, TransportSearchAction.class);
|
||||
actions.register(SearchScrollAction.INSTANCE, TransportSearchScrollAction.class);
|
||||
actions.register(MultiSearchAction.INSTANCE, TransportMultiSearchAction.class);
|
||||
actions.register(ExplainAction.INSTANCE, TransportExplainAction.class);
|
||||
actions.register(ClearScrollAction.INSTANCE, TransportClearScrollAction.class);
|
||||
actions.register(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
|
||||
|
||||
//Indexed scripts
|
||||
actions.register(PutStoredScriptAction.INSTANCE, TransportPutStoredScriptAction.class);
|
||||
actions.register(GetStoredScriptAction.INSTANCE, TransportGetStoredScriptAction.class);
|
||||
actions.register(DeleteStoredScriptAction.INSTANCE, TransportDeleteStoredScriptAction.class);
|
||||
|
||||
actions.register(FieldStatsAction.INSTANCE, TransportFieldStatsAction.class);
|
||||
|
||||
actions.register(PutPipelineAction.INSTANCE, PutPipelineTransportAction.class);
|
||||
actions.register(GetPipelineAction.INSTANCE, GetPipelineTransportAction.class);
|
||||
actions.register(DeletePipelineAction.INSTANCE, DeletePipelineTransportAction.class);
|
||||
actions.register(SimulatePipelineAction.INSTANCE, SimulatePipelineTransportAction.class);
|
||||
|
||||
actionPlugins.stream().flatMap(p -> p.getActions().stream()).forEach(actions::register);
|
||||
|
||||
return unmodifiableMap(actions.getRegistry());
|
||||
}
|
||||
|
||||
private final boolean ingestEnabled;
|
||||
private final boolean proxy;
|
||||
private List<Class<? extends ActionFilter>> setupActionFilters(List<ActionPlugin> actionPlugins, boolean ingestEnabled) {
|
||||
List<Class<? extends ActionFilter>> filters = new ArrayList<>();
|
||||
if (transportClient == false) {
|
||||
if (ingestEnabled) {
|
||||
filters.add(IngestActionFilter.class);
|
||||
} else {
|
||||
filters.add(IngestProxyActionFilter.class);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionModule(boolean ingestEnabled, boolean proxy) {
|
||||
this.ingestEnabled = ingestEnabled;
|
||||
this.proxy = proxy;
|
||||
for (ActionPlugin plugin : actionPlugins) {
|
||||
filters.addAll(plugin.getActionFilters());
|
||||
}
|
||||
return unmodifiableList(filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an action.
|
||||
*
|
||||
* @param action The action type.
|
||||
* @param transportAction The transport action implementing the actual action.
|
||||
* @param supportTransportActions Any support actions that are needed by the transport action.
|
||||
* @param <Request> The request type.
|
||||
* @param <Response> The response type.
|
||||
*/
|
||||
public <Request extends ActionRequest<Request>, Response extends ActionResponse> void registerAction(GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction, Class... supportTransportActions) {
|
||||
actions.put(action.name(), new ActionEntry<>(action, transportAction, supportTransportActions));
|
||||
static Set<Class<? extends RestHandler>> setupRestHandlers(List<ActionPlugin> actionPlugins) {
|
||||
Set<Class<? extends RestHandler>> handlers = new HashSet<>();
|
||||
registerRestHandler(handlers, RestMainAction.class);
|
||||
registerRestHandler(handlers, RestNodesInfoAction.class);
|
||||
registerRestHandler(handlers, RestNodesStatsAction.class);
|
||||
registerRestHandler(handlers, RestNodesHotThreadsAction.class);
|
||||
registerRestHandler(handlers, RestClusterAllocationExplainAction.class);
|
||||
registerRestHandler(handlers, RestClusterStatsAction.class);
|
||||
registerRestHandler(handlers, RestClusterStateAction.class);
|
||||
registerRestHandler(handlers, RestClusterHealthAction.class);
|
||||
registerRestHandler(handlers, RestClusterUpdateSettingsAction.class);
|
||||
registerRestHandler(handlers, RestClusterGetSettingsAction.class);
|
||||
registerRestHandler(handlers, RestClusterRerouteAction.class);
|
||||
registerRestHandler(handlers, RestClusterSearchShardsAction.class);
|
||||
registerRestHandler(handlers, RestPendingClusterTasksAction.class);
|
||||
registerRestHandler(handlers, RestPutRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestGetRepositoriesAction.class);
|
||||
registerRestHandler(handlers, RestDeleteRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestVerifyRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestGetSnapshotsAction.class);
|
||||
registerRestHandler(handlers, RestCreateSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestRestoreSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestDeleteSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestSnapshotsStatusAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestIndicesExistsAction.class);
|
||||
registerRestHandler(handlers, RestTypesExistsAction.class);
|
||||
registerRestHandler(handlers, RestGetIndicesAction.class);
|
||||
registerRestHandler(handlers, RestIndicesStatsAction.class);
|
||||
registerRestHandler(handlers, RestIndicesSegmentsAction.class);
|
||||
registerRestHandler(handlers, RestIndicesShardStoresAction.class);
|
||||
registerRestHandler(handlers, RestGetAliasesAction.class);
|
||||
registerRestHandler(handlers, RestAliasesExistAction.class);
|
||||
registerRestHandler(handlers, RestIndexDeleteAliasesAction.class);
|
||||
registerRestHandler(handlers, RestIndexPutAliasAction.class);
|
||||
registerRestHandler(handlers, RestIndicesAliasesAction.class);
|
||||
registerRestHandler(handlers, RestCreateIndexAction.class);
|
||||
registerRestHandler(handlers, RestShrinkIndexAction.class);
|
||||
registerRestHandler(handlers, RestRolloverIndexAction.class);
|
||||
registerRestHandler(handlers, RestDeleteIndexAction.class);
|
||||
registerRestHandler(handlers, RestCloseIndexAction.class);
|
||||
registerRestHandler(handlers, RestOpenIndexAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestUpdateSettingsAction.class);
|
||||
registerRestHandler(handlers, RestGetSettingsAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestAnalyzeAction.class);
|
||||
registerRestHandler(handlers, RestGetIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestPutIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestDeleteIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestHeadIndexTemplateAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestPutMappingAction.class);
|
||||
registerRestHandler(handlers, RestGetMappingAction.class);
|
||||
registerRestHandler(handlers, RestGetFieldMappingAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestRefreshAction.class);
|
||||
registerRestHandler(handlers, RestFlushAction.class);
|
||||
registerRestHandler(handlers, RestSyncedFlushAction.class);
|
||||
registerRestHandler(handlers, RestForceMergeAction.class);
|
||||
registerRestHandler(handlers, RestUpgradeAction.class);
|
||||
registerRestHandler(handlers, RestClearIndicesCacheAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestIndexAction.class);
|
||||
registerRestHandler(handlers, RestGetAction.class);
|
||||
registerRestHandler(handlers, RestGetSourceAction.class);
|
||||
registerRestHandler(handlers, RestHeadAction.Document.class);
|
||||
registerRestHandler(handlers, RestHeadAction.Source.class);
|
||||
registerRestHandler(handlers, RestMultiGetAction.class);
|
||||
registerRestHandler(handlers, RestDeleteAction.class);
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.count.RestCountAction.class);
|
||||
registerRestHandler(handlers, RestSuggestAction.class);
|
||||
registerRestHandler(handlers, RestTermVectorsAction.class);
|
||||
registerRestHandler(handlers, RestMultiTermVectorsAction.class);
|
||||
registerRestHandler(handlers, RestBulkAction.class);
|
||||
registerRestHandler(handlers, RestUpdateAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestSearchAction.class);
|
||||
registerRestHandler(handlers, RestSearchScrollAction.class);
|
||||
registerRestHandler(handlers, RestClearScrollAction.class);
|
||||
registerRestHandler(handlers, RestMultiSearchAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestValidateQueryAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestExplainAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestRecoveryAction.class);
|
||||
|
||||
// Scripts API
|
||||
registerRestHandler(handlers, RestGetStoredScriptAction.class);
|
||||
registerRestHandler(handlers, RestPutStoredScriptAction.class);
|
||||
registerRestHandler(handlers, RestDeleteStoredScriptAction.class);
|
||||
|
||||
registerRestHandler(handlers, RestFieldStatsAction.class);
|
||||
|
||||
// Tasks API
|
||||
registerRestHandler(handlers, RestListTasksAction.class);
|
||||
registerRestHandler(handlers, RestGetTaskAction.class);
|
||||
registerRestHandler(handlers, RestCancelTasksAction.class);
|
||||
|
||||
// Ingest API
|
||||
registerRestHandler(handlers, RestPutPipelineAction.class);
|
||||
registerRestHandler(handlers, RestGetPipelineAction.class);
|
||||
registerRestHandler(handlers, RestDeletePipelineAction.class);
|
||||
registerRestHandler(handlers, RestSimulatePipelineAction.class);
|
||||
|
||||
// CAT API
|
||||
registerRestHandler(handlers, RestCatAction.class);
|
||||
registerRestHandler(handlers, RestAllocationAction.class);
|
||||
registerRestHandler(handlers, RestShardsAction.class);
|
||||
registerRestHandler(handlers, RestMasterAction.class);
|
||||
registerRestHandler(handlers, RestNodesAction.class);
|
||||
registerRestHandler(handlers, RestTasksAction.class);
|
||||
registerRestHandler(handlers, RestIndicesAction.class);
|
||||
registerRestHandler(handlers, RestSegmentsAction.class);
|
||||
// Fully qualified to prevent interference with rest.action.count.RestCountAction
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestCountAction.class);
|
||||
// Fully qualified to prevent interference with rest.action.indices.RestRecoveryAction
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestRecoveryAction.class);
|
||||
registerRestHandler(handlers, RestHealthAction.class);
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction.class);
|
||||
registerRestHandler(handlers, RestAliasAction.class);
|
||||
registerRestHandler(handlers, RestThreadPoolAction.class);
|
||||
registerRestHandler(handlers, RestPluginsAction.class);
|
||||
registerRestHandler(handlers, RestFielddataAction.class);
|
||||
registerRestHandler(handlers, RestNodeAttrsAction.class);
|
||||
registerRestHandler(handlers, RestRepositoriesAction.class);
|
||||
registerRestHandler(handlers, RestSnapshotAction.class);
|
||||
for (ActionPlugin plugin : actionPlugins) {
|
||||
for (Class<? extends RestHandler> handler : plugin.getRestHandlers()) {
|
||||
registerRestHandler(handlers, handler);
|
||||
}
|
||||
}
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public ActionModule registerFilter(Class<? extends ActionFilter> actionFilter) {
|
||||
actionFilters.add(actionFilter);
|
||||
return this;
|
||||
private static void registerRestHandler(Set<Class<? extends RestHandler>> handlers, Class<? extends RestHandler> handler) {
|
||||
if (handlers.contains(handler)) {
|
||||
throw new IllegalArgumentException("can't register the same [rest_handler] more than once for [" + handler.getName() + "]");
|
||||
}
|
||||
handlers.add(handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
if (proxy == false) {
|
||||
if (ingestEnabled) {
|
||||
registerFilter(IngestActionFilter.class);
|
||||
} else {
|
||||
registerFilter(IngestProxyActionFilter.class);
|
||||
}
|
||||
}
|
||||
|
||||
Multibinder<ActionFilter> actionFilterMultibinder = Multibinder.newSetBinder(binder(), ActionFilter.class);
|
||||
for (Class<? extends ActionFilter> actionFilter : actionFilters) {
|
||||
actionFilterMultibinder.addBinding().to(actionFilter);
|
||||
}
|
||||
bind(ActionFilters.class).asEagerSingleton();
|
||||
bind(AutoCreateIndex.class).asEagerSingleton();
|
||||
bind(DestructiveOperations.class).asEagerSingleton();
|
||||
registerAction(MainAction.INSTANCE, TransportMainAction.class);
|
||||
registerAction(NodesInfoAction.INSTANCE, TransportNodesInfoAction.class);
|
||||
registerAction(NodesStatsAction.INSTANCE, TransportNodesStatsAction.class);
|
||||
registerAction(NodesHotThreadsAction.INSTANCE, TransportNodesHotThreadsAction.class);
|
||||
registerAction(ListTasksAction.INSTANCE, TransportListTasksAction.class);
|
||||
registerAction(GetTaskAction.INSTANCE, TransportGetTaskAction.class);
|
||||
registerAction(CancelTasksAction.INSTANCE, TransportCancelTasksAction.class);
|
||||
|
||||
registerAction(ClusterAllocationExplainAction.INSTANCE, TransportClusterAllocationExplainAction.class);
|
||||
registerAction(ClusterStatsAction.INSTANCE, TransportClusterStatsAction.class);
|
||||
registerAction(ClusterStateAction.INSTANCE, TransportClusterStateAction.class);
|
||||
registerAction(ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class);
|
||||
registerAction(ClusterUpdateSettingsAction.INSTANCE, TransportClusterUpdateSettingsAction.class);
|
||||
registerAction(ClusterRerouteAction.INSTANCE, TransportClusterRerouteAction.class);
|
||||
registerAction(ClusterSearchShardsAction.INSTANCE, TransportClusterSearchShardsAction.class);
|
||||
registerAction(PendingClusterTasksAction.INSTANCE, TransportPendingClusterTasksAction.class);
|
||||
registerAction(PutRepositoryAction.INSTANCE, TransportPutRepositoryAction.class);
|
||||
registerAction(GetRepositoriesAction.INSTANCE, TransportGetRepositoriesAction.class);
|
||||
registerAction(DeleteRepositoryAction.INSTANCE, TransportDeleteRepositoryAction.class);
|
||||
registerAction(VerifyRepositoryAction.INSTANCE, TransportVerifyRepositoryAction.class);
|
||||
registerAction(GetSnapshotsAction.INSTANCE, TransportGetSnapshotsAction.class);
|
||||
registerAction(DeleteSnapshotAction.INSTANCE, TransportDeleteSnapshotAction.class);
|
||||
registerAction(CreateSnapshotAction.INSTANCE, TransportCreateSnapshotAction.class);
|
||||
registerAction(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
|
||||
registerAction(SnapshotsStatusAction.INSTANCE, TransportSnapshotsStatusAction.class);
|
||||
|
||||
registerAction(IndicesStatsAction.INSTANCE, TransportIndicesStatsAction.class);
|
||||
registerAction(IndicesSegmentsAction.INSTANCE, TransportIndicesSegmentsAction.class);
|
||||
registerAction(IndicesShardStoresAction.INSTANCE, TransportIndicesShardStoresAction.class);
|
||||
registerAction(CreateIndexAction.INSTANCE, TransportCreateIndexAction.class);
|
||||
registerAction(ShrinkAction.INSTANCE, TransportShrinkAction.class);
|
||||
registerAction(RolloverAction.INSTANCE, TransportRolloverAction.class);
|
||||
registerAction(DeleteIndexAction.INSTANCE, TransportDeleteIndexAction.class);
|
||||
registerAction(GetIndexAction.INSTANCE, TransportGetIndexAction.class);
|
||||
registerAction(OpenIndexAction.INSTANCE, TransportOpenIndexAction.class);
|
||||
registerAction(CloseIndexAction.INSTANCE, TransportCloseIndexAction.class);
|
||||
registerAction(IndicesExistsAction.INSTANCE, TransportIndicesExistsAction.class);
|
||||
registerAction(TypesExistsAction.INSTANCE, TransportTypesExistsAction.class);
|
||||
registerAction(GetMappingsAction.INSTANCE, TransportGetMappingsAction.class);
|
||||
registerAction(GetFieldMappingsAction.INSTANCE, TransportGetFieldMappingsAction.class, TransportGetFieldMappingsIndexAction.class);
|
||||
registerAction(PutMappingAction.INSTANCE, TransportPutMappingAction.class);
|
||||
registerAction(IndicesAliasesAction.INSTANCE, TransportIndicesAliasesAction.class);
|
||||
registerAction(UpdateSettingsAction.INSTANCE, TransportUpdateSettingsAction.class);
|
||||
registerAction(AnalyzeAction.INSTANCE, TransportAnalyzeAction.class);
|
||||
registerAction(PutIndexTemplateAction.INSTANCE, TransportPutIndexTemplateAction.class);
|
||||
registerAction(GetIndexTemplatesAction.INSTANCE, TransportGetIndexTemplatesAction.class);
|
||||
registerAction(DeleteIndexTemplateAction.INSTANCE, TransportDeleteIndexTemplateAction.class);
|
||||
registerAction(ValidateQueryAction.INSTANCE, TransportValidateQueryAction.class);
|
||||
registerAction(RefreshAction.INSTANCE, TransportRefreshAction.class);
|
||||
registerAction(FlushAction.INSTANCE, TransportFlushAction.class);
|
||||
registerAction(SyncedFlushAction.INSTANCE, TransportSyncedFlushAction.class);
|
||||
registerAction(ForceMergeAction.INSTANCE, TransportForceMergeAction.class);
|
||||
registerAction(UpgradeAction.INSTANCE, TransportUpgradeAction.class);
|
||||
registerAction(UpgradeStatusAction.INSTANCE, TransportUpgradeStatusAction.class);
|
||||
registerAction(UpgradeSettingsAction.INSTANCE, TransportUpgradeSettingsAction.class);
|
||||
registerAction(ClearIndicesCacheAction.INSTANCE, TransportClearIndicesCacheAction.class);
|
||||
registerAction(GetAliasesAction.INSTANCE, TransportGetAliasesAction.class);
|
||||
registerAction(AliasesExistAction.INSTANCE, TransportAliasesExistAction.class);
|
||||
registerAction(GetSettingsAction.INSTANCE, TransportGetSettingsAction.class);
|
||||
|
||||
registerAction(IndexAction.INSTANCE, TransportIndexAction.class);
|
||||
registerAction(GetAction.INSTANCE, TransportGetAction.class);
|
||||
registerAction(TermVectorsAction.INSTANCE, TransportTermVectorsAction.class);
|
||||
registerAction(MultiTermVectorsAction.INSTANCE, TransportMultiTermVectorsAction.class,
|
||||
TransportShardMultiTermsVectorAction.class);
|
||||
registerAction(DeleteAction.INSTANCE, TransportDeleteAction.class);
|
||||
registerAction(UpdateAction.INSTANCE, TransportUpdateAction.class);
|
||||
registerAction(MultiGetAction.INSTANCE, TransportMultiGetAction.class,
|
||||
TransportShardMultiGetAction.class);
|
||||
registerAction(BulkAction.INSTANCE, TransportBulkAction.class,
|
||||
TransportShardBulkAction.class);
|
||||
registerAction(SearchAction.INSTANCE, TransportSearchAction.class);
|
||||
registerAction(SearchScrollAction.INSTANCE, TransportSearchScrollAction.class);
|
||||
registerAction(MultiSearchAction.INSTANCE, TransportMultiSearchAction.class);
|
||||
registerAction(ExplainAction.INSTANCE, TransportExplainAction.class);
|
||||
registerAction(ClearScrollAction.INSTANCE, TransportClearScrollAction.class);
|
||||
registerAction(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
|
||||
|
||||
//Indexed scripts
|
||||
registerAction(PutStoredScriptAction.INSTANCE, TransportPutStoredScriptAction.class);
|
||||
registerAction(GetStoredScriptAction.INSTANCE, TransportGetStoredScriptAction.class);
|
||||
registerAction(DeleteStoredScriptAction.INSTANCE, TransportDeleteStoredScriptAction.class);
|
||||
|
||||
registerAction(FieldStatsAction.INSTANCE, TransportFieldStatsAction.class);
|
||||
|
||||
registerAction(PutPipelineAction.INSTANCE, PutPipelineTransportAction.class);
|
||||
registerAction(GetPipelineAction.INSTANCE, GetPipelineTransportAction.class);
|
||||
registerAction(DeletePipelineAction.INSTANCE, DeletePipelineTransportAction.class);
|
||||
registerAction(SimulatePipelineAction.INSTANCE, SimulatePipelineTransportAction.class);
|
||||
bind(DestructiveOperations.class).toInstance(destructiveOperations);
|
||||
|
||||
// register Name -> GenericAction Map that can be injected to instances.
|
||||
@SuppressWarnings("rawtypes")
|
||||
MapBinder<String, GenericAction> actionsBinder
|
||||
= MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
|
||||
|
||||
for (Map.Entry<String, ActionEntry> entry : actions.entrySet()) {
|
||||
actionsBinder.addBinding(entry.getKey()).toInstance(entry.getValue().action);
|
||||
for (Map.Entry<String, ActionHandler<?, ?>> entry : actions.entrySet()) {
|
||||
actionsBinder.addBinding(entry.getKey()).toInstance(entry.getValue().getAction());
|
||||
}
|
||||
// register GenericAction -> transportAction Map that can be injected to instances.
|
||||
// also register any supporting classes
|
||||
if (!proxy) {
|
||||
if (false == transportClient) {
|
||||
// Supporting classes only used when not a transport client
|
||||
bind(AutoCreateIndex.class).toInstance(autoCreateIndex);
|
||||
bind(TransportLivenessAction.class).asEagerSingleton();
|
||||
|
||||
// register GenericAction -> transportAction Map used by NodeClient
|
||||
@SuppressWarnings("rawtypes")
|
||||
MapBinder<GenericAction, TransportAction> transportActionsBinder
|
||||
= MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
|
||||
for (Map.Entry<String, ActionEntry> entry : actions.entrySet()) {
|
||||
for (ActionHandler<?, ?> action : actions.values()) {
|
||||
// bind the action as eager singleton, so the map binder one will reuse it
|
||||
bind(entry.getValue().transportAction).asEagerSingleton();
|
||||
transportActionsBinder.addBinding(entry.getValue().action).to(entry.getValue().transportAction).asEagerSingleton();
|
||||
for (Class supportAction : entry.getValue().supportTransportActions) {
|
||||
bind(action.getTransportAction()).asEagerSingleton();
|
||||
transportActionsBinder.addBinding(action.getAction()).to(action.getTransportAction()).asEagerSingleton();
|
||||
for (Class<?> supportAction : action.getSupportTransportActions()) {
|
||||
bind(supportAction).asEagerSingleton();
|
||||
}
|
||||
}
|
||||
|
||||
// Bind the RestController which is required (by Node) even if rest isn't enabled.
|
||||
bind(RestController.class).toInstance(restController);
|
||||
|
||||
// Setup the RestHandlers
|
||||
if (NetworkModule.HTTP_ENABLED.get(settings)) {
|
||||
Multibinder<RestHandler> restHandlers = Multibinder.newSetBinder(binder(), RestHandler.class);
|
||||
Multibinder<AbstractCatAction> catHandlers = Multibinder.newSetBinder(binder(), AbstractCatAction.class);
|
||||
for (Class<? extends RestHandler> handler : setupRestHandlers(actionPlugins)) {
|
||||
bind(handler).asEagerSingleton();
|
||||
if (AbstractCatAction.class.isAssignableFrom(handler)) {
|
||||
catHandlers.addBinding().to(handler.asSubclass(AbstractCatAction.class));
|
||||
} else {
|
||||
restHandlers.addBinding().to(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ package org.elasticsearch.action;
|
|||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||
|
||||
/**
|
||||
* Base class for {@link Runnable}s that need to call {@link ActionListener#onFailure(Throwable)} in case an uncaught
|
||||
* Base class for {@link Runnable}s that need to call {@link ActionListener#onFailure(Exception)} in case an uncaught
|
||||
* exception or error is thrown while the actual action is run.
|
||||
*/
|
||||
public abstract class ActionRunnable<Response> extends AbstractRunnable {
|
||||
|
||||
|
||||
protected final ActionListener<Response> listener;
|
||||
|
||||
public ActionRunnable(ActionListener<Response> listener) {
|
||||
|
@ -34,11 +34,11 @@ public abstract class ActionRunnable<Response> extends AbstractRunnable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calls the action listeners {@link ActionListener#onFailure(Throwable)} method with the given exception.
|
||||
* Calls the action listeners {@link ActionListener#onFailure(Exception)} method with the given exception.
|
||||
* This method is invoked for all exception thrown by {@link #doRun()}
|
||||
*/
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class LatchedActionListener<T> implements ActionListener<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
delegate.onFailure(e);
|
||||
} finally {
|
||||
|
|
|
@ -43,15 +43,15 @@ public final class TaskOperationFailure implements Writeable, ToXContent {
|
|||
|
||||
private final long taskId;
|
||||
|
||||
private final Throwable reason;
|
||||
private final Exception reason;
|
||||
|
||||
private final RestStatus status;
|
||||
|
||||
public TaskOperationFailure(String nodeId, long taskId, Throwable t) {
|
||||
public TaskOperationFailure(String nodeId, long taskId, Exception e) {
|
||||
this.nodeId = nodeId;
|
||||
this.taskId = taskId;
|
||||
this.reason = t;
|
||||
status = ExceptionsHelper.status(t);
|
||||
this.reason = e;
|
||||
status = ExceptionsHelper.status(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ public final class TaskOperationFailure implements Writeable, ToXContent {
|
|||
public TaskOperationFailure(StreamInput in) throws IOException {
|
||||
nodeId = in.readString();
|
||||
taskId = in.readLong();
|
||||
reason = in.readThrowable();
|
||||
reason = in.readException();
|
||||
status = RestStatus.readFrom(in);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public final class TaskOperationFailure implements Writeable, ToXContent {
|
|||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeString(nodeId);
|
||||
out.writeLong(taskId);
|
||||
out.writeThrowable(reason);
|
||||
out.writeException(reason);
|
||||
RestStatus.writeTo(out, status);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class NodeExplanation implements Writeable, ToXContent {
|
|||
private final String finalExplanation;
|
||||
|
||||
public NodeExplanation(final DiscoveryNode node, final Decision nodeDecision, final Float nodeWeight,
|
||||
final @Nullable IndicesShardStoresResponse.StoreStatus storeStatus,
|
||||
@Nullable final IndicesShardStoresResponse.StoreStatus storeStatus,
|
||||
final ClusterAllocationExplanation.FinalDecision finalDecision,
|
||||
final String finalExplanation,
|
||||
final ClusterAllocationExplanation.StoreCopy storeCopy) {
|
||||
|
|
|
@ -145,7 +145,7 @@ public class TransportClusterAllocationExplainAction
|
|||
// No copies of the data
|
||||
storeCopy = ClusterAllocationExplanation.StoreCopy.NONE;
|
||||
} else {
|
||||
final Throwable storeErr = storeStatus.getStoreException();
|
||||
final Exception storeErr = storeStatus.getStoreException();
|
||||
if (storeErr != null) {
|
||||
if (ExceptionsHelper.unwrapCause(storeErr) instanceof CorruptIndexException) {
|
||||
storeCopy = ClusterAllocationExplanation.StoreCopy.CORRUPT;
|
||||
|
@ -323,7 +323,7 @@ public class TransportClusterAllocationExplainAction
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -104,9 +104,9 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String source, Throwable t) {
|
||||
logger.error("unexpected failure during [{}]", t, source);
|
||||
listener.onFailure(t);
|
||||
public void onFailure(String source, Exception e) {
|
||||
logger.error("unexpected failure during [{}]", e, source);
|
||||
listener.onFailure(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,8 +46,6 @@ import static java.util.Collections.unmodifiableMap;
|
|||
* Node information (static, does not change over time).
|
||||
*/
|
||||
public class NodeInfo extends BaseNodeResponse {
|
||||
@Nullable
|
||||
private Map<String, String> serviceAttributes;
|
||||
|
||||
private Version version;
|
||||
private Build build;
|
||||
|
@ -85,14 +83,13 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
public NodeInfo() {
|
||||
}
|
||||
|
||||
public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Map<String, String> serviceAttributes, @Nullable Settings settings,
|
||||
public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Settings settings,
|
||||
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool,
|
||||
@Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsAndModules plugins, @Nullable IngestInfo ingest,
|
||||
@Nullable ByteSizeValue totalIndexingBuffer) {
|
||||
super(node);
|
||||
this.version = version;
|
||||
this.build = build;
|
||||
this.serviceAttributes = serviceAttributes;
|
||||
this.settings = settings;
|
||||
this.os = os;
|
||||
this.process = process;
|
||||
|
@ -127,14 +124,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
return this.build;
|
||||
}
|
||||
|
||||
/**
|
||||
* The service attributes of the node.
|
||||
*/
|
||||
@Nullable
|
||||
public Map<String, String> getServiceAttributes() {
|
||||
return this.serviceAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The settings of the node.
|
||||
*/
|
||||
|
@ -213,14 +202,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
} else {
|
||||
totalIndexingBuffer = null;
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
Map<String, String> builder = new HashMap<>();
|
||||
int size = in.readVInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
builder.put(in.readString(), in.readString());
|
||||
}
|
||||
serviceAttributes = unmodifiableMap(builder);
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
settings = Settings.readSettingsFromStream(in);
|
||||
}
|
||||
|
@ -262,16 +243,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
out.writeBoolean(true);
|
||||
out.writeLong(totalIndexingBuffer.bytes());
|
||||
}
|
||||
if (getServiceAttributes() == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
out.writeVInt(serviceAttributes.size());
|
||||
for (Map.Entry<String, String> entry : serviceAttributes.entrySet()) {
|
||||
out.writeString(entry.getKey());
|
||||
out.writeString(entry.getValue());
|
||||
}
|
||||
}
|
||||
if (settings == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
|
|
|
@ -73,12 +73,6 @@ public class NodesInfoResponse extends BaseNodesResponse<NodeInfo> implements To
|
|||
builder.byteSizeField("total_indexing_buffer", "total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer());
|
||||
}
|
||||
|
||||
if (nodeInfo.getServiceAttributes() != null) {
|
||||
for (Map.Entry<String, String> nodeAttribute : nodeInfo.getServiceAttributes().entrySet()) {
|
||||
builder.field(nodeAttribute.getKey(), nodeAttribute.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
builder.startArray("roles");
|
||||
for (DiscoveryNode.Role role : nodeInfo.getNode().getRoles()) {
|
||||
builder.value(role.getRoleName());
|
||||
|
|
|
@ -154,8 +154,8 @@ public class TransportGetTaskAction extends HandledTransportAction<GetTaskReques
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -179,7 +179,7 @@ public class TransportGetTaskAction extends HandledTransportAction<GetTaskReques
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
/*
|
||||
* We couldn't load the task from the task index. Instead of 404 we should use the snapshot we took after it finished. If
|
||||
* the error isn't a 404 then we'll just throw it back to the user.
|
||||
|
@ -207,13 +207,13 @@ public class TransportGetTaskAction extends HandledTransportAction<GetTaskReques
|
|||
public void onResponse(GetResponse getResponse) {
|
||||
try {
|
||||
onGetFinishedTaskFromIndex(getResponse, listener);
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
if (ExceptionsHelper.unwrap(e, IndexNotFoundException.class) != null) {
|
||||
// We haven't yet created the index for the task results so it can't be found.
|
||||
listener.onFailure(new ResourceNotFoundException("task [{}] isn't running or persisted", e, request.getTaskId()));
|
||||
|
|
|
@ -76,7 +76,7 @@ public class TransportDeleteRepositoryAction extends TransportMasterNodeAction<D
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TransportVerifyRepositoryAction extends TransportMasterNodeAction<V
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -102,9 +102,9 @@ public class TransportClusterRerouteAction extends TransportMasterNodeAction<Clu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String source, Throwable t) {
|
||||
logger.debug("failed to perform [{}]", t, source);
|
||||
super.onFailure(source, t);
|
||||
public void onFailure(String source, Exception e) {
|
||||
logger.debug("failed to perform [{}]", e, source);
|
||||
super.onFailure(source, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,7 +77,7 @@ final class SettingsUpdater {
|
|||
Settings settings = build.metaData().settings();
|
||||
// now we try to apply things and if they are invalid we fail
|
||||
// this dryRun will validate & parse settings but won't actually apply them.
|
||||
clusterSettings.dryRun(settings);
|
||||
clusterSettings.validateUpdate(settings);
|
||||
return build;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,11 +93,11 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeAct
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAllNodesAcked(@Nullable Throwable t) {
|
||||
public void onAllNodesAcked(@Nullable Exception e) {
|
||||
if (changed) {
|
||||
reroute(true);
|
||||
} else {
|
||||
super.onAllNodesAcked(t);
|
||||
super.onAllNodesAcked(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,10 +146,10 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeAct
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String source, Throwable t) {
|
||||
public void onFailure(String source, Exception e) {
|
||||
//if the reroute fails we only log
|
||||
logger.debug("failed to perform [{}]", t, source);
|
||||
listener.onFailure(new ElasticsearchException("reroute after update settings failed", t));
|
||||
logger.debug("failed to perform [{}]", e, source);
|
||||
listener.onFailure(new ElasticsearchException("reroute after update settings failed", e));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,9 +165,9 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeAct
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String source, Throwable t) {
|
||||
logger.debug("failed to perform [{}]", t, source);
|
||||
super.onFailure(source, t);
|
||||
public void onFailure(String source, Exception e) {
|
||||
logger.debug("failed to perform [{}]", e, source);
|
||||
super.onFailure(source, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,10 +94,10 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeAction<Cre
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSnapshotFailure(Snapshot snapshot, Throwable t) {
|
||||
public void onSnapshotFailure(Snapshot snapshot, Exception e) {
|
||||
if (snapshot.getRepository().equals(request.repository()) &&
|
||||
snapshot.getSnapshotId().getName().equals(request.snapshot())) {
|
||||
listener.onFailure(t);
|
||||
listener.onFailure(e);
|
||||
snapshotsService.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeAction<Cre
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ public class TransportDeleteSnapshotAction extends TransportMasterNodeAction<Del
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeAction<GetSn
|
|||
snapshotInfoBuilder.addAll(snapshotsService.snapshots(repository, new ArrayList<>(toResolve), request.ignoreUnavailable()));
|
||||
}
|
||||
listener.onResponse(new GetSnapshotsResponse(snapshotInfoBuilder));
|
||||
} catch (Throwable t) {
|
||||
listener.onFailure(t);
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public class TransportRestoreSnapshotAction extends TransportMasterNodeAction<Re
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
@ -104,7 +104,7 @@ public class TransportRestoreSnapshotAction extends TransportMasterNodeAction<Re
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
listener.onFailure(t);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -125,13 +125,13 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<Sn
|
|||
List<SnapshotsInProgress.Entry> currentSnapshots =
|
||||
snapshotsService.currentSnapshots(request.repository(), Arrays.asList(request.snapshots()));
|
||||
listener.onResponse(buildResponse(request, currentSnapshots, nodeSnapshotStatuses));
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
@ -207,15 +207,14 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<Sn
|
|||
.filter(s -> requestedSnapshotNames.contains(s.getName()))
|
||||
.collect(Collectors.toMap(SnapshotId::getName, Function.identity()));
|
||||
for (final String snapshotName : request.snapshots()) {
|
||||
if (currentSnapshotNames.contains(snapshotName)) {
|
||||
// we've already found this snapshot in the current snapshot entries, so skip over
|
||||
continue;
|
||||
}
|
||||
SnapshotId snapshotId = matchedSnapshotIds.get(snapshotName);
|
||||
if (snapshotId == null) {
|
||||
if (currentSnapshotNames.contains(snapshotName)) {
|
||||
// we've already found this snapshot in the current snapshot entries, so skip over
|
||||
continue;
|
||||
} else {
|
||||
// neither in the current snapshot entries nor found in the repository
|
||||
throw new SnapshotMissingException(repositoryName, snapshotName);
|
||||
}
|
||||
// neither in the current snapshot entries nor found in the repository
|
||||
throw new SnapshotMissingException(repositoryName, snapshotName);
|
||||
}
|
||||
SnapshotInfo snapshotInfo = snapshotsService.snapshot(repositoryName, snapshotId);
|
||||
List<SnapshotIndexShardStatus> shardStatusBuilder = new ArrayList<>();
|
||||
|
|
|
@ -119,7 +119,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction<Ind
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to perform aliases", t);
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to close indices [{}]", t, (Object)concreteIndices);
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
|||
throw new ElasticsearchParseException("failed to parse source for create index", e);
|
||||
}
|
||||
} else {
|
||||
settings(new String(source.toBytes(), StandardCharsets.UTF_8));
|
||||
settings(source.utf8ToString());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TransportCreateIndexAction extends TransportMasterNodeAction<Create
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
if (t instanceof IndexAlreadyExistsException) {
|
||||
logger.trace("[{}] failed to create", t, request.index());
|
||||
} else {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction<Delete
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to delete indices [{}]", t, concreteIndices);
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TransportGetFieldMappingsAction extends HandledTransportAction<GetF
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
int index = indexCounter.getAndIncrement();
|
||||
indexResponses.set(index, e);
|
||||
if (completionCounter.decrementAndGet() == 0) {
|
||||
|
|
|
@ -130,7 +130,7 @@ public class TransportGetFieldMappingsIndexAction extends TransportSingleShardAc
|
|||
|
||||
private static final ToXContent.Params includeDefaultsParams = new ToXContent.Params() {
|
||||
|
||||
final static String INCLUDE_DEFAULTS = "include_defaults";
|
||||
static final String INCLUDE_DEFAULTS = "include_defaults";
|
||||
|
||||
@Override
|
||||
public String param(String key) {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TransportPutMappingAction extends TransportMasterNodeAction<PutMapp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to put mappings on indices [{}], type [{}]", t, concreteIndices, request.type());
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TransportOpenIndexAction extends TransportMasterNodeAction<OpenInde
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to open indices [{}]", t, (Object)concreteIndices);
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||
* when the index is at least {@link #value} old
|
||||
*/
|
||||
public class MaxAgeCondition extends Condition<TimeValue> {
|
||||
public final static String NAME = "max_age";
|
||||
public static final String NAME = "max_age";
|
||||
|
||||
public MaxAgeCondition(TimeValue value) {
|
||||
super(NAME);
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||
* when the index has at least {@link #value} docs
|
||||
*/
|
||||
public class MaxDocsCondition extends Condition<Long> {
|
||||
public final static String NAME = "max_docs";
|
||||
public static final String NAME = "max_docs";
|
||||
|
||||
public MaxDocsCondition(Long value) {
|
||||
super(NAME);
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.shard.DocsStats;
|
||||
import org.elasticsearch.indices.IndexAlreadyExistsException;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -132,14 +131,14 @@ public class TransportRolloverAction extends TransportMasterNodeAction<RolloverR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
listener.onFailure(t);
|
||||
}
|
||||
});
|
||||
|
@ -152,7 +151,7 @@ public class TransportRolloverAction extends TransportMasterNodeAction<RolloverR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeAction<Upd
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to update settings on indices [{}]", t, (Object)concreteIndices);
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon
|
|||
private DiscoveryNode node;
|
||||
private long legacyVersion;
|
||||
private String allocationId;
|
||||
private Throwable storeException;
|
||||
private Exception storeException;
|
||||
private AllocationStatus allocationStatus;
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon
|
|||
private StoreStatus() {
|
||||
}
|
||||
|
||||
public StoreStatus(DiscoveryNode node, long legacyVersion, String allocationId, AllocationStatus allocationStatus, Throwable storeException) {
|
||||
public StoreStatus(DiscoveryNode node, long legacyVersion, String allocationId, AllocationStatus allocationStatus, Exception storeException) {
|
||||
this.node = node;
|
||||
this.legacyVersion = legacyVersion;
|
||||
this.allocationId = allocationId;
|
||||
|
@ -150,7 +150,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon
|
|||
* Exception while trying to open the
|
||||
* shard index or from when the shard failed
|
||||
*/
|
||||
public Throwable getStoreException() {
|
||||
public Exception getStoreException() {
|
||||
return storeException;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon
|
|||
allocationId = in.readOptionalString();
|
||||
allocationStatus = AllocationStatus.readFrom(in);
|
||||
if (in.readBoolean()) {
|
||||
storeException = in.readThrowable();
|
||||
storeException = in.readException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon
|
|||
allocationStatus.writeTo(out);
|
||||
if (storeException != null) {
|
||||
out.writeBoolean(true);
|
||||
out.writeThrowable(storeException);
|
||||
out.writeException(storeException);
|
||||
} else {
|
||||
out.writeBoolean(false);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TransportShrinkAction extends TransportMasterNodeAction<ShrinkReque
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
if (t instanceof IndexAlreadyExistsException) {
|
||||
logger.trace("[{}] failed to create shrink index", t, updateRequest.index());
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ public class TransportShrinkAction extends TransportMasterNodeAction<ShrinkReque
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -31,8 +31,8 @@ import java.util.EnumSet;
|
|||
*/
|
||||
public class CommonStatsFlags implements Streamable, Cloneable {
|
||||
|
||||
public final static CommonStatsFlags ALL = new CommonStatsFlags().all();
|
||||
public final static CommonStatsFlags NONE = new CommonStatsFlags().clear();
|
||||
public static final CommonStatsFlags ALL = new CommonStatsFlags().all();
|
||||
public static final CommonStatsFlags NONE = new CommonStatsFlags().clear();
|
||||
|
||||
private EnumSet<Flag> flags = EnumSet.allOf(Flag.class);
|
||||
private String[] types = null;
|
||||
|
|
|
@ -72,9 +72,9 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeActio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
logger.debug("failed to delete templates [{}]", t, request.name());
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
logger.debug("failed to delete templates [{}]", e, request.name());
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
logger.debug("failed to put template [{}]", t, request.name());
|
||||
listener.onFailure(t);
|
||||
public void onFailure(Exception e) {
|
||||
logger.debug("failed to put template [{}]", e, request.name());
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -190,13 +190,13 @@ public class TransportUpgradeAction extends TransportBroadcastByNodeAction<Upgra
|
|||
} else {
|
||||
updateSettings(upgradeResponse, listener);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
listener.onFailure(t);
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
};
|
||||
|
@ -212,7 +212,7 @@ public class TransportUpgradeAction extends TransportBroadcastByNodeAction<Upgra
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<Up
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
logger.debug("failed to upgrade minimum compatibility version settings on indices [{}]", t, request.versions().keySet());
|
||||
listener.onFailure(t);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,13 @@ public abstract class BackoffPolicy implements Iterable<TimeValue> {
|
|||
return new ExponentialBackoff((int) checkDelay(initialDelay).millis(), maxNumberOfRetries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the backoff policy in one that calls a method every time a new backoff is taken from the policy.
|
||||
*/
|
||||
public static BackoffPolicy wrap(BackoffPolicy delegate, Runnable onBackoff) {
|
||||
return new WrappedBackoffPolicy(delegate, onBackoff);
|
||||
}
|
||||
|
||||
private static TimeValue checkDelay(TimeValue delay) {
|
||||
if (delay.millis() > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("delay must be <= " + Integer.MAX_VALUE + " ms");
|
||||
|
@ -200,4 +207,43 @@ public abstract class BackoffPolicy implements Iterable<TimeValue> {
|
|||
return delay;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class WrappedBackoffPolicy extends BackoffPolicy {
|
||||
private final BackoffPolicy delegate;
|
||||
private final Runnable onBackoff;
|
||||
|
||||
public WrappedBackoffPolicy(BackoffPolicy delegate, Runnable onBackoff) {
|
||||
this.delegate = delegate;
|
||||
this.onBackoff = onBackoff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<TimeValue> iterator() {
|
||||
return new WrappedBackoffIterator(delegate.iterator(), onBackoff);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class WrappedBackoffIterator implements Iterator<TimeValue> {
|
||||
private final Iterator<TimeValue> delegate;
|
||||
private final Runnable onBackoff;
|
||||
|
||||
public WrappedBackoffIterator(Iterator<TimeValue> delegate, Runnable onBackoff) {
|
||||
this.delegate = delegate;
|
||||
this.onBackoff = onBackoff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return delegate.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeValue next() {
|
||||
if (false == delegate.hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
onBackoff.run();
|
||||
return delegate.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,12 +91,12 @@ public class BulkItemResponse implements Streamable, StatusToXContent {
|
|||
private final Throwable cause;
|
||||
private final RestStatus status;
|
||||
|
||||
public Failure(String index, String type, String id, Throwable t) {
|
||||
public Failure(String index, String type, String id, Throwable cause) {
|
||||
this.index = index;
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
this.cause = t;
|
||||
this.status = ExceptionsHelper.status(t);
|
||||
this.cause = cause;
|
||||
this.status = ExceptionsHelper.status(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ public class BulkItemResponse implements Streamable, StatusToXContent {
|
|||
index = in.readString();
|
||||
type = in.readString();
|
||||
id = in.readOptionalString();
|
||||
cause = in.readThrowable();
|
||||
cause = in.readException();
|
||||
status = ExceptionsHelper.status(cause);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class BulkItemResponse implements Streamable, StatusToXContent {
|
|||
out.writeString(getIndex());
|
||||
out.writeString(getType());
|
||||
out.writeOptionalString(getId());
|
||||
out.writeThrowable(getCause());
|
||||
out.writeException(getCause());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ abstract class BulkRequestHandler {
|
|||
if (!afterCalled) {
|
||||
listener.afterBulk(executionId, bulkRequest, e);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Failed to execute bulk request {}.", t, executionId);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to execute bulk request {}.", e, executionId);
|
||||
if (!afterCalled) {
|
||||
listener.afterBulk(executionId, bulkRequest, t);
|
||||
listener.afterBulk(executionId, bulkRequest, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ abstract class BulkRequestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
listener.afterBulk(executionId, bulkRequest, e);
|
||||
} finally {
|
||||
|
@ -144,9 +144,9 @@ abstract class BulkRequestHandler {
|
|||
Thread.currentThread().interrupt();
|
||||
logger.info("Bulk request {} has been cancelled.", e, executionId);
|
||||
listener.afterBulk(executionId, bulkRequest, e);
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Failed to execute bulk request {}.", t, executionId);
|
||||
listener.afterBulk(executionId, bulkRequest, t);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to execute bulk request {}.", e, executionId);
|
||||
listener.afterBulk(executionId, bulkRequest, e);
|
||||
} finally {
|
||||
if (!bulkRequestSetupSuccessful && acquired) { // if we fail on client.bulk() release the semaphore
|
||||
semaphore.release();
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Iterator;
|
|||
*/
|
||||
public class BulkResponse extends ActionResponse implements Iterable<BulkItemResponse> {
|
||||
|
||||
public final static long NO_INGEST_TOOK = -1L;
|
||||
public static final long NO_INGEST_TOOK = -1L;
|
||||
|
||||
private BulkItemResponse[] responses;
|
||||
private long tookInMillis;
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BulkShardRequest extends ReplicatedWriteRequest<BulkShardRequest> {
|
|||
public BulkShardRequest() {
|
||||
}
|
||||
|
||||
BulkShardRequest(BulkRequest bulkRequest, ShardId shardId, RefreshPolicy refreshPolicy, BulkItemRequest[] items) {
|
||||
BulkShardRequest(ShardId shardId, RefreshPolicy refreshPolicy, BulkItemRequest[] items) {
|
||||
super(shardId);
|
||||
this.items = items;
|
||||
setRefreshPolicy(refreshPolicy);
|
||||
|
|
|
@ -130,7 +130,7 @@ public class Retry {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
listener.onFailure(e);
|
||||
} finally {
|
||||
|
@ -163,8 +163,8 @@ public class Retry {
|
|||
}
|
||||
for (BulkItemResponse bulkItemResponse : bulkItemResponses) {
|
||||
if (bulkItemResponse.isFailed()) {
|
||||
Throwable cause = bulkItemResponse.getFailure().getCause();
|
||||
Throwable rootCause = ExceptionsHelper.unwrapCause(cause);
|
||||
final Throwable cause = bulkItemResponse.getFailure().getCause();
|
||||
final Throwable rootCause = ExceptionsHelper.unwrapCause(cause);
|
||||
if (!rootCause.getClass().equals(retryOnThrowable)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -150,14 +150,14 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
if (counter.decrementAndGet() == 0) {
|
||||
try {
|
||||
executeBulk(task, bulkRequest, startTime, listener, responses);
|
||||
} catch (Throwable t) {
|
||||
listener.onFailure(t);
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
if (!(ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException)) {
|
||||
// fail all requests involving this index, if create didnt work
|
||||
for (int i = 0; i < bulkRequest.requests.size(); i++) {
|
||||
|
@ -170,8 +170,9 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
if (counter.decrementAndGet() == 0) {
|
||||
try {
|
||||
executeBulk(task, bulkRequest, startTime, listener, responses);
|
||||
} catch (Throwable t) {
|
||||
listener.onFailure(t);
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
listener.onFailure(inner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +196,7 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
return autoCreateIndex.shouldAutoCreate(index, state);
|
||||
}
|
||||
|
||||
private boolean setResponseFailureIfIndexMatches(AtomicArray<BulkItemResponse> responses, int idx, ActionRequest request, String index, Throwable e) {
|
||||
private boolean setResponseFailureIfIndexMatches(AtomicArray<BulkItemResponse> responses, int idx, ActionRequest request, String index, Exception e) {
|
||||
if (request instanceof IndexRequest) {
|
||||
IndexRequest indexRequest = (IndexRequest) request;
|
||||
if (index.equals(indexRequest.index())) {
|
||||
|
@ -344,7 +345,7 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
for (Map.Entry<ShardId, List<BulkItemRequest>> entry : requestsByShard.entrySet()) {
|
||||
final ShardId shardId = entry.getKey();
|
||||
final List<BulkItemRequest> requests = entry.getValue();
|
||||
BulkShardRequest bulkShardRequest = new BulkShardRequest(bulkRequest, shardId, bulkRequest.getRefreshPolicy(),
|
||||
BulkShardRequest bulkShardRequest = new BulkShardRequest(shardId, bulkRequest.getRefreshPolicy(),
|
||||
requests.toArray(new BulkItemRequest[requests.size()]));
|
||||
bulkShardRequest.consistencyLevel(bulkRequest.consistencyLevel());
|
||||
bulkShardRequest.timeout(bulkRequest.timeout());
|
||||
|
@ -367,7 +368,7 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
// create failures for all relevant requests
|
||||
for (BulkItemRequest request : requests) {
|
||||
final String indexName = concreteIndices.getConcreteIndex(request.index()).getName();
|
||||
|
|
|
@ -71,8 +71,8 @@ import static org.elasticsearch.action.support.replication.ReplicationOperation.
|
|||
*/
|
||||
public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequest, BulkShardResponse> {
|
||||
|
||||
private final static String OP_TYPE_UPDATE = "update";
|
||||
private final static String OP_TYPE_DELETE = "delete";
|
||||
private static final String OP_TYPE_UPDATE = "update";
|
||||
private static final String OP_TYPE_DELETE = "delete";
|
||||
|
||||
public static final String ACTION_NAME = BulkAction.NAME + "[s]";
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
// add the response
|
||||
IndexResponse indexResponse = result.getResponse();
|
||||
setResponse(item, new BulkItemResponse(item.id(), indexRequest.opType().lowercase(), indexResponse));
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
// nocommit: since we now have RetryOnPrimaryException, retrying doesn't always mean the shard is closed.
|
||||
// some operations were already perform and have a seqno assigned. we shouldn't just reindex them
|
||||
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
|
||||
|
@ -183,11 +183,11 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
return location;
|
||||
}
|
||||
|
||||
private <ReplicationRequestT extends ReplicationRequest<ReplicationRequestT>> void logFailure(Throwable e, String operation, ShardId shardId, ReplicationRequest<ReplicationRequestT> request) {
|
||||
if (ExceptionsHelper.status(e) == RestStatus.CONFLICT) {
|
||||
logger.trace("{} failed to execute bulk item ({}) {}", e, shardId, operation, request);
|
||||
private <ReplicationRequestT extends ReplicationRequest<ReplicationRequestT>> void logFailure(Throwable t, String operation, ShardId shardId, ReplicationRequest<ReplicationRequestT> request) {
|
||||
if (ExceptionsHelper.status(t) == RestStatus.CONFLICT) {
|
||||
logger.trace("{} failed to execute bulk item ({}) {}", t, shardId, operation, request);
|
||||
} else {
|
||||
logger.debug("{} failed to execute bulk item ({}) {}", e, shardId, operation, request);
|
||||
logger.debug("{} failed to execute bulk item ({}) {}", t, shardId, operation, request);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
DeleteResponse deleteResponse = writeResult.getResponse();
|
||||
location = locationToSync(location, writeResult.getLocation());
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_DELETE, deleteResponse));
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
// nocommit: since we now have RetryOnPrimaryException, retrying doesn't always mean the shard is closed.
|
||||
// some operations were already perform and have a seqno assigned. we shouldn't just reindex them
|
||||
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
|
||||
|
@ -236,7 +236,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
UpdateResult updateResult;
|
||||
try {
|
||||
updateResult = shardUpdateOperation(metaData, request, updateRequest, indexShard);
|
||||
} catch (Throwable t) {
|
||||
} catch (Exception t) {
|
||||
updateResult = new UpdateResult(null, null, false, t, null);
|
||||
}
|
||||
if (updateResult.success()) {
|
||||
|
@ -279,45 +279,45 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
// NOTE: Breaking out of the retry_on_conflict loop!
|
||||
break;
|
||||
} else if (updateResult.failure()) {
|
||||
Throwable t = updateResult.error;
|
||||
Throwable e = updateResult.error;
|
||||
if (updateResult.retry) {
|
||||
// updateAttemptCount is 0 based and marks current attempt, if it's equal to retryOnConflict we are going out of the iteration
|
||||
if (updateAttemptsCount >= updateRequest.retryOnConflict()) {
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_UPDATE,
|
||||
new BulkItemResponse.Failure(request.index(), updateRequest.type(), updateRequest.id(), t)));
|
||||
new BulkItemResponse.Failure(request.index(), updateRequest.type(), updateRequest.id(), e)));
|
||||
}
|
||||
} else {
|
||||
// nocommit: since we now have RetryOnPrimaryException, retrying doesn't always mean the shard is closed.
|
||||
// some operations were already perform and have a seqno assigned. we shouldn't just reindex them
|
||||
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
|
||||
if (retryPrimaryException(t)) {
|
||||
if (retryPrimaryException(e)) {
|
||||
// restore updated versions...
|
||||
for (int j = 0; j < requestIndex; j++) {
|
||||
applyVersion(request.items()[j], preVersions[j], preVersionTypes[j]);
|
||||
}
|
||||
throw (ElasticsearchException) t;
|
||||
throw (ElasticsearchException) e;
|
||||
}
|
||||
// if its a conflict failure, and we already executed the request on a primary (and we execute it
|
||||
// again, due to primary relocation and only processing up to N bulk items when the shard gets closed)
|
||||
// then just use the response we got from the successful execution
|
||||
if (item.getPrimaryResponse() != null && isConflictException(t)) {
|
||||
if (item.getPrimaryResponse() != null && isConflictException(e)) {
|
||||
setResponse(item, item.getPrimaryResponse());
|
||||
} else if (updateResult.result == null) {
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_UPDATE, new BulkItemResponse.Failure(request.index(), updateRequest.type(), updateRequest.id(), t)));
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_UPDATE, new BulkItemResponse.Failure(request.index(), updateRequest.type(), updateRequest.id(), e)));
|
||||
} else {
|
||||
switch (updateResult.result.operation()) {
|
||||
case UPSERT:
|
||||
case INDEX:
|
||||
IndexRequest indexRequest = updateResult.request();
|
||||
logFailure(t, "index", request.shardId(), indexRequest);
|
||||
logFailure(e, "index", request.shardId(), indexRequest);
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_UPDATE,
|
||||
new BulkItemResponse.Failure(request.index(), indexRequest.type(), indexRequest.id(), t)));
|
||||
new BulkItemResponse.Failure(request.index(), indexRequest.type(), indexRequest.id(), e)));
|
||||
break;
|
||||
case DELETE:
|
||||
DeleteRequest deleteRequest = updateResult.request();
|
||||
logFailure(t, "delete", request.shardId(), deleteRequest);
|
||||
logFailure(e, "delete", request.shardId(), deleteRequest);
|
||||
setResponse(item, new BulkItemResponse(item.id(), OP_TYPE_DELETE,
|
||||
new BulkItemResponse.Failure(request.index(), deleteRequest.type(), deleteRequest.id(), t)));
|
||||
new BulkItemResponse.Failure(request.index(), deleteRequest.type(), deleteRequest.id(), e)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
}
|
||||
|
||||
private WriteResult<IndexResponse> shardIndexOperation(BulkShardRequest request, IndexRequest indexRequest, IndexMetaData metaData,
|
||||
IndexShard indexShard, boolean processed) throws Throwable {
|
||||
IndexShard indexShard, boolean processed) throws Exception {
|
||||
|
||||
MappingMetaData mappingMd = metaData.mappingOrDefault(indexRequest.type());
|
||||
if (!processed) {
|
||||
|
@ -412,26 +412,26 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
try {
|
||||
WriteResult result = shardIndexOperation(bulkShardRequest, indexRequest, metaData, indexShard, false);
|
||||
return new UpdateResult(translate, indexRequest, result);
|
||||
} catch (Throwable t) {
|
||||
t = ExceptionsHelper.unwrapCause(t);
|
||||
} catch (Exception e) {
|
||||
final Throwable cause = ExceptionsHelper.unwrapCause(e);
|
||||
boolean retry = false;
|
||||
if (t instanceof VersionConflictEngineException) {
|
||||
if (cause instanceof VersionConflictEngineException) {
|
||||
retry = true;
|
||||
}
|
||||
return new UpdateResult(translate, indexRequest, retry, t, null);
|
||||
return new UpdateResult(translate, indexRequest, retry, cause, null);
|
||||
}
|
||||
case DELETE:
|
||||
DeleteRequest deleteRequest = translate.action();
|
||||
try {
|
||||
WriteResult<DeleteResponse> result = TransportDeleteAction.executeDeleteRequestOnPrimary(deleteRequest, indexShard);
|
||||
return new UpdateResult(translate, deleteRequest, result);
|
||||
} catch (Throwable t) {
|
||||
t = ExceptionsHelper.unwrapCause(t);
|
||||
} catch (Exception e) {
|
||||
final Throwable cause = ExceptionsHelper.unwrapCause(e);
|
||||
boolean retry = false;
|
||||
if (t instanceof VersionConflictEngineException) {
|
||||
if (cause instanceof VersionConflictEngineException) {
|
||||
retry = true;
|
||||
}
|
||||
return new UpdateResult(translate, deleteRequest, retry, t, null);
|
||||
return new UpdateResult(translate, deleteRequest, retry, cause, null);
|
||||
}
|
||||
case NONE:
|
||||
UpdateResponse updateResponse = translate.action();
|
||||
|
@ -455,7 +455,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
try {
|
||||
Engine.Index operation = TransportIndexAction.executeIndexRequestOnReplica(indexRequest, indexShard);
|
||||
location = locationToSync(location, operation.getTranslogLocation());
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
// if its not an ignore replica failure, we need to make sure to bubble up the failure
|
||||
// so we will fail the shard
|
||||
if (!ignoreReplicaException(e)) {
|
||||
|
@ -468,7 +468,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
Engine.Delete delete = TransportDeleteAction.executeDeleteRequestOnReplica(deleteRequest, indexShard);
|
||||
indexShard.delete(delete);
|
||||
location = locationToSync(location, delete.getTranslogLocation());
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
// if its not an ignore replica failure, we need to make sure to bubble up the failure
|
||||
// so we will fail the shard
|
||||
if (!ignoreReplicaException(e)) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TransportDeleteAction extends TransportWriteAction<DeleteRequest, D
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) {
|
||||
// we have the index, do it
|
||||
innerExecute(task, request, listener);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class TransportExplainAction extends TransportSingleShardAction<ExplainRe
|
|||
// Advantage is that we're not opening a second searcher to retrieve the _source. Also
|
||||
// because we are working in the same searcher in engineGetResult we can be sure that a
|
||||
// doc isn't deleted between the initial get and this call.
|
||||
GetResult getResult = indexShard.getService().get(result, request.id(), request.type(), request.fields(), request.fetchSourceContext(), false);
|
||||
GetResult getResult = indexShard.getService().get(result, request.id(), request.type(), request.fields(), request.fetchSourceContext());
|
||||
return new ExplainResponse(shardId.getIndexName(), request.type(), request.id(), true, explanation, getResult);
|
||||
} else {
|
||||
return new ExplainResponse(shardId.getIndexName(), request.type(), request.id(), true, explanation);
|
||||
|
|
|
@ -616,18 +616,18 @@ public abstract class FieldStats<T> implements Writeable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
private final static class Fields {
|
||||
final static String MAX_DOC = new String("max_doc");
|
||||
final static String DOC_COUNT = new String("doc_count");
|
||||
final static String DENSITY = new String("density");
|
||||
final static String SUM_DOC_FREQ = new String("sum_doc_freq");
|
||||
final static String SUM_TOTAL_TERM_FREQ = new String("sum_total_term_freq");
|
||||
final static String SEARCHABLE = new String("searchable");
|
||||
final static String AGGREGATABLE = new String("aggregatable");
|
||||
final static String MIN_VALUE = new String("min_value");
|
||||
final static String MIN_VALUE_AS_STRING = new String("min_value_as_string");
|
||||
final static String MAX_VALUE = new String("max_value");
|
||||
final static String MAX_VALUE_AS_STRING = new String("max_value_as_string");
|
||||
private static final class Fields {
|
||||
static final String MAX_DOC = new String("max_doc");
|
||||
static final String DOC_COUNT = new String("doc_count");
|
||||
static final String DENSITY = new String("density");
|
||||
static final String SUM_DOC_FREQ = new String("sum_doc_freq");
|
||||
static final String SUM_TOTAL_TERM_FREQ = new String("sum_total_term_freq");
|
||||
static final String SEARCHABLE = new String("searchable");
|
||||
static final String AGGREGATABLE = new String("aggregatable");
|
||||
static final String MIN_VALUE = new String("min_value");
|
||||
static final String MIN_VALUE_AS_STRING = new String("min_value_as_string");
|
||||
static final String MAX_VALUE = new String("max_value");
|
||||
static final String MAX_VALUE_AS_STRING = new String("max_value_as_string");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.util.List;
|
|||
*/
|
||||
public class FieldStatsRequest extends BroadcastRequest<FieldStatsRequest> {
|
||||
|
||||
public final static String DEFAULT_LEVEL = "cluster";
|
||||
public static final String DEFAULT_LEVEL = "cluster";
|
||||
|
||||
private String[] fields = Strings.EMPTY_ARRAY;
|
||||
private String level = DEFAULT_LEVEL;
|
||||
|
|
|
@ -40,17 +40,17 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe
|
|||
private String index;
|
||||
private String type;
|
||||
private String id;
|
||||
private Throwable throwable;
|
||||
private Exception exception;
|
||||
|
||||
Failure() {
|
||||
|
||||
}
|
||||
|
||||
public Failure(String index, String type, String id, Throwable throwable) {
|
||||
public Failure(String index, String type, String id, Exception exception) {
|
||||
this.index = index;
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
this.throwable = throwable;
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe
|
|||
* The failure message.
|
||||
*/
|
||||
public String getMessage() {
|
||||
return throwable != null ? throwable.getMessage() : null;
|
||||
return exception != null ? exception.getMessage() : null;
|
||||
}
|
||||
|
||||
public static Failure readFailure(StreamInput in) throws IOException {
|
||||
|
@ -92,7 +92,7 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe
|
|||
index = in.readString();
|
||||
type = in.readOptionalString();
|
||||
id = in.readString();
|
||||
throwable = in.readThrowable();
|
||||
exception = in.readException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,11 +100,11 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe
|
|||
out.writeString(index);
|
||||
out.writeOptionalString(type);
|
||||
out.writeString(id);
|
||||
out.writeThrowable(throwable);
|
||||
out.writeException(exception);
|
||||
}
|
||||
|
||||
public Throwable getFailure() {
|
||||
return throwable;
|
||||
public Exception getFailure() {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe
|
|||
builder.field(Fields._INDEX, failure.getIndex());
|
||||
builder.field(Fields._TYPE, failure.getType());
|
||||
builder.field(Fields._ID, failure.getId());
|
||||
ElasticsearchException.renderThrowable(builder, params, failure.getFailure());
|
||||
ElasticsearchException.renderException(builder, params, failure.getFailure());
|
||||
builder.endObject();
|
||||
} else {
|
||||
GetResponse getResponse = response.getResponse();
|
||||
|
|
|
@ -105,7 +105,7 @@ public class TransportMultiGetAction extends HandledTransportAction<MultiGetRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
// create failures for all relevant requests
|
||||
for (int i = 0; i < shardRequest.locations.size(); i++) {
|
||||
MultiGetRequest.Item item = shardRequest.items.get(i);
|
||||
|
|
|
@ -88,12 +88,12 @@ public class TransportShardMultiGetAction extends TransportSingleShardAction<Mul
|
|||
try {
|
||||
GetResult getResult = indexShard.getService().get(item.type(), item.id(), item.fields(), request.realtime(), item.version(), item.versionType(), item.fetchSourceContext(), request.ignoreErrorsOnGeneratedFields());
|
||||
response.add(request.locations.get(i), new GetResponse(getResult));
|
||||
} catch (Throwable t) {
|
||||
if (TransportActions.isShardNotAvailableException(t)) {
|
||||
throw (ElasticsearchException) t;
|
||||
} catch (Exception e) {
|
||||
if (TransportActions.isShardNotAvailableException(e)) {
|
||||
throw (ElasticsearchException) e;
|
||||
} else {
|
||||
logger.debug("{} failed to execute multi_get for [{}]/[{}]", t, shardId, item.type(), item.id());
|
||||
response.add(request.locations.get(i), new MultiGetResponse.Failure(request.index(), item.type(), item.id(), t));
|
||||
logger.debug("{} failed to execute multi_get for [{}]/[{}]", e, shardId, item.type(), item.id());
|
||||
response.add(request.locations.get(i), new MultiGetResponse.Failure(request.index(), item.type(), item.id(), e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,13 +101,14 @@ public class TransportIndexAction extends TransportWriteAction<IndexRequest, Ind
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) {
|
||||
// we have the index, do it
|
||||
try {
|
||||
innerExecute(task, request, listener);
|
||||
} catch (Throwable e1) {
|
||||
listener.onFailure(e1);
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
listener.onFailure(inner);
|
||||
}
|
||||
} else {
|
||||
listener.onFailure(e);
|
||||
|
|
|
@ -104,13 +104,13 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
void processBulkIndexRequest(Task task, BulkRequest original, String action, ActionFilterChain chain, ActionListener<BulkResponse> listener) {
|
||||
long ingestStartTimeInNanos = System.nanoTime();
|
||||
BulkRequestModifier bulkRequestModifier = new BulkRequestModifier(original);
|
||||
executionService.executeBulkRequest(() -> bulkRequestModifier, (indexRequest, throwable) -> {
|
||||
logger.debug("failed to execute pipeline [{}] for document [{}/{}/{}]", throwable, indexRequest.getPipeline(), indexRequest.index(), indexRequest.type(), indexRequest.id());
|
||||
bulkRequestModifier.markCurrentItemAsFailed(throwable);
|
||||
}, (throwable) -> {
|
||||
if (throwable != null) {
|
||||
logger.error("failed to execute pipeline for a bulk request", throwable);
|
||||
listener.onFailure(throwable);
|
||||
executionService.executeBulkRequest(() -> bulkRequestModifier, (indexRequest, exception) -> {
|
||||
logger.debug("failed to execute pipeline [{}] for document [{}/{}/{}]", exception, indexRequest.getPipeline(), indexRequest.index(), indexRequest.type(), indexRequest.id());
|
||||
bulkRequestModifier.markCurrentItemAsFailed(exception);
|
||||
}, (exception) -> {
|
||||
if (exception != null) {
|
||||
logger.error("failed to execute pipeline for a bulk request", exception);
|
||||
listener.onFailure(exception);
|
||||
} else {
|
||||
long ingestTookInMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - ingestStartTimeInNanos);
|
||||
BulkRequest bulkRequest = bulkRequestModifier.getBulkRequest();
|
||||
|
@ -132,7 +132,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
final static class BulkRequestModifier implements Iterator<ActionRequest<?>> {
|
||||
static final class BulkRequestModifier implements Iterator<ActionRequest<?>> {
|
||||
|
||||
final BulkRequest bulkRequest;
|
||||
final Set<Integer> failedSlots;
|
||||
|
@ -188,7 +188,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
actionListener.onFailure(e);
|
||||
}
|
||||
};
|
||||
|
@ -197,7 +197,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
}
|
||||
}
|
||||
|
||||
void markCurrentItemAsFailed(Throwable e) {
|
||||
void markCurrentItemAsFailed(Exception e) {
|
||||
IndexRequest indexRequest = (IndexRequest) bulkRequest.requests().get(currentSlot);
|
||||
// We hit a error during preprocessing a request, so we:
|
||||
// 1) Remember the request item slot from the bulk, so that we're done processing all requests we know what failed
|
||||
|
@ -210,7 +210,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
|
||||
}
|
||||
|
||||
final static class IngestBulkResponseListener implements ActionListener<BulkResponse> {
|
||||
static final class IngestBulkResponseListener implements ActionListener<BulkResponse> {
|
||||
|
||||
private final long ingestTookInMillis;
|
||||
private final int[] originalSlots;
|
||||
|
@ -233,7 +233,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
actionListener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class PutPipelineTransportAction extends TransportMasterNodeAction<PutPip
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class SimulateDocumentBaseResult implements SimulateDocumentResult
|
|||
public SimulateDocumentBaseResult(StreamInput in) throws IOException {
|
||||
if (in.readBoolean()) {
|
||||
ingestDocument = null;
|
||||
failure = in.readThrowable();
|
||||
failure = in.readException();
|
||||
} else {
|
||||
ingestDocument = new WriteableIngestDocument(in);
|
||||
failure = null;
|
||||
|
@ -63,7 +63,7 @@ public final class SimulateDocumentBaseResult implements SimulateDocumentResult
|
|||
ingestDocument.writeTo(out);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
out.writeThrowable(failure);
|
||||
out.writeException(failure);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public final class SimulateDocumentBaseResult implements SimulateDocumentResult
|
|||
if (failure == null) {
|
||||
ingestDocument.toXContent(builder, params);
|
||||
} else {
|
||||
ElasticsearchException.renderThrowable(builder, params, failure);
|
||||
ElasticsearchException.renderException(builder, params, failure);
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.ingest.AbstractProcessorFactory;
|
||||
import org.elasticsearch.ingest.ConfigurationUtils;
|
||||
import org.elasticsearch.ingest.IngestDocument;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -52,7 +52,7 @@ public class SimulateProcessorResult implements Writeable, ToXContent {
|
|||
public SimulateProcessorResult(StreamInput in) throws IOException {
|
||||
this.processorTag = in.readString();
|
||||
if (in.readBoolean()) {
|
||||
this.failure = in.readThrowable();
|
||||
this.failure = in.readException();
|
||||
this.ingestDocument = null;
|
||||
} else {
|
||||
this.ingestDocument = new WriteableIngestDocument(in);
|
||||
|
@ -68,7 +68,7 @@ public class SimulateProcessorResult implements Writeable, ToXContent {
|
|||
ingestDocument.writeTo(out);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
out.writeThrowable(failure);
|
||||
out.writeException(failure);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,12 +91,12 @@ public class SimulateProcessorResult implements Writeable, ToXContent {
|
|||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject();
|
||||
if (processorTag != null) {
|
||||
builder.field(AbstractProcessorFactory.TAG_KEY, processorTag);
|
||||
builder.field(ConfigurationUtils.TAG_KEY, processorTag);
|
||||
}
|
||||
if (failure == null) {
|
||||
ingestDocument.toXContent(builder, params);
|
||||
} else {
|
||||
ElasticsearchException.renderThrowable(builder, params, failure);
|
||||
ElasticsearchException.renderException(builder, params, failure);
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -167,7 +167,7 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
onFirstPhaseResult(shardIndex, shard, node.getId(), shardIt, t);
|
||||
}
|
||||
});
|
||||
|
@ -188,9 +188,9 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
if (xTotalOps == expectedTotalOps) {
|
||||
try {
|
||||
innerMoveToSecondPhase();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "] while moving to second phase", e);
|
||||
logger.debug("{}: Failed to execute [{}] while moving to second phase", e, shardIt.shardId(), request);
|
||||
}
|
||||
raiseEarlyFailure(new ReduceSearchPhaseException(firstPhaseName(), "", e, buildShardFailures()));
|
||||
}
|
||||
|
@ -201,37 +201,34 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
}
|
||||
|
||||
void onFirstPhaseResult(final int shardIndex, @Nullable ShardRouting shard, @Nullable String nodeId,
|
||||
final ShardIterator shardIt, Throwable t) {
|
||||
final ShardIterator shardIt, Exception e) {
|
||||
// we always add the shard failure for a specific shard instance
|
||||
// we do make sure to clean it on a successful response from a shard
|
||||
SearchShardTarget shardTarget = new SearchShardTarget(nodeId, shardIt.shardId().getIndex(), shardIt.shardId().getId());
|
||||
addShardFailure(shardIndex, shardTarget, t);
|
||||
addShardFailure(shardIndex, shardTarget, e);
|
||||
|
||||
if (totalOps.incrementAndGet() == expectedTotalOps) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (t != null && !TransportActions.isShardNotAvailableException(t)) {
|
||||
if (shard != null) {
|
||||
logger.debug(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
||||
} else {
|
||||
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
||||
}
|
||||
if (e != null && !TransportActions.isShardNotAvailableException(e)) {
|
||||
logger.debug("{}: Failed to execute [{}]", e, shard != null ? shard.shortSummary() : shardIt.shardId(), request);
|
||||
} else if (logger.isTraceEnabled()) {
|
||||
logger.trace("{}: Failed to execute [{}]", t, shard, request);
|
||||
logger.trace("{}: Failed to execute [{}]", e, shard, request);
|
||||
}
|
||||
}
|
||||
final ShardSearchFailure[] shardSearchFailures = buildShardFailures();
|
||||
if (successfulOps.get() == 0) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("All shards failed for phase: [{}]", t, firstPhaseName());
|
||||
logger.debug("All shards failed for phase: [{}]", e, firstPhaseName());
|
||||
}
|
||||
|
||||
// no successful ops, raise an exception
|
||||
raiseEarlyFailure(new SearchPhaseExecutionException(firstPhaseName(), "all shards failed", t, shardSearchFailures));
|
||||
raiseEarlyFailure(new SearchPhaseExecutionException(firstPhaseName(), "all shards failed", e, shardSearchFailures));
|
||||
} else {
|
||||
try {
|
||||
innerMoveToSecondPhase();
|
||||
} catch (Throwable e) {
|
||||
raiseEarlyFailure(new ReduceSearchPhaseException(firstPhaseName(), "", e, shardSearchFailures));
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
raiseEarlyFailure(new ReduceSearchPhaseException(firstPhaseName(), "", inner, shardSearchFailures));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -239,34 +236,28 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
final boolean lastShard = nextShard == null;
|
||||
// trace log this exception
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(executionFailureMsg(shard, shardIt, request, lastShard), t);
|
||||
logger.trace("{}: Failed to execute [{}] lastShard [{}]", e, shard != null ? shard.shortSummary() : shardIt.shardId(),
|
||||
request, lastShard);
|
||||
}
|
||||
if (!lastShard) {
|
||||
try {
|
||||
performFirstPhase(shardIndex, shardIt, nextShard);
|
||||
} catch (Throwable t1) {
|
||||
onFirstPhaseResult(shardIndex, shard, shard.currentNodeId(), shardIt, t1);
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
onFirstPhaseResult(shardIndex, shard, shard.currentNodeId(), shardIt, inner);
|
||||
}
|
||||
} else {
|
||||
// no more shards active, add a failure
|
||||
if (logger.isDebugEnabled() && !logger.isTraceEnabled()) { // do not double log this exception
|
||||
if (t != null && !TransportActions.isShardNotAvailableException(t)) {
|
||||
logger.debug(executionFailureMsg(shard, shardIt, request, lastShard), t);
|
||||
if (e != null && !TransportActions.isShardNotAvailableException(e)) {
|
||||
logger.debug("{}: Failed to execute [{}] lastShard [{}]", e,
|
||||
shard != null ? shard.shortSummary() : shardIt.shardId(), request, lastShard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String executionFailureMsg(@Nullable ShardRouting shard, final ShardIterator shardIt, SearchRequest request,
|
||||
boolean lastShard) {
|
||||
if (shard != null) {
|
||||
return shard.shortSummary() + ": Failed to execute [" + request + "] lastShard [" + lastShard + "]";
|
||||
} else {
|
||||
return shardIt.shardId() + ": Failed to execute [" + request + "] lastShard [" + lastShard + "]";
|
||||
}
|
||||
}
|
||||
|
||||
protected final ShardSearchFailure[] buildShardFailures() {
|
||||
AtomicArray<ShardSearchFailure> shardFailures = this.shardFailures;
|
||||
if (shardFailures == null) {
|
||||
|
@ -280,9 +271,9 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
return failures;
|
||||
}
|
||||
|
||||
protected final void addShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Throwable t) {
|
||||
protected final void addShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Exception e) {
|
||||
// we don't aggregate shard failures on non active shards (but do keep the header counts right)
|
||||
if (TransportActions.isShardNotAvailableException(t)) {
|
||||
if (TransportActions.isShardNotAvailableException(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -296,26 +287,27 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
}
|
||||
ShardSearchFailure failure = shardFailures.get(shardIndex);
|
||||
if (failure == null) {
|
||||
shardFailures.set(shardIndex, new ShardSearchFailure(t, shardTarget));
|
||||
shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
|
||||
} else {
|
||||
// the failure is already present, try and not override it with an exception that is less meaningless
|
||||
// for example, getting illegal shard state
|
||||
if (TransportActions.isReadOverrideException(t)) {
|
||||
shardFailures.set(shardIndex, new ShardSearchFailure(t, shardTarget));
|
||||
if (TransportActions.isReadOverrideException(e)) {
|
||||
shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void raiseEarlyFailure(Throwable t) {
|
||||
private void raiseEarlyFailure(Exception e) {
|
||||
for (AtomicArray.Entry<FirstResult> entry : firstResults.asList()) {
|
||||
try {
|
||||
DiscoveryNode node = nodes.get(entry.value.shardTarget().nodeId());
|
||||
sendReleaseSearchContext(entry.value.id(), node);
|
||||
} catch (Throwable t1) {
|
||||
logger.trace("failed to release context", t1);
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
logger.trace("failed to release context", inner);
|
||||
}
|
||||
}
|
||||
listener.onFailure(t);
|
||||
listener.onFailure(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -335,8 +327,8 @@ abstract class AbstractSearchAsyncAction<FirstResult extends SearchPhaseResult>
|
|||
try {
|
||||
DiscoveryNode node = nodes.get(entry.value.queryResult().shardTarget().nodeId());
|
||||
sendReleaseSearchContext(entry.value.queryResult().id(), node);
|
||||
} catch (Throwable t1) {
|
||||
logger.trace("failed to release context", t1);
|
||||
} catch (Exception e) {
|
||||
logger.trace("failed to release context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.io.stream.Streamable;
|
|||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
@ -45,22 +44,22 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult
|
|||
*/
|
||||
public static class Item implements Streamable {
|
||||
private SearchResponse response;
|
||||
private Throwable throwable;
|
||||
private Exception exception;
|
||||
|
||||
Item() {
|
||||
|
||||
}
|
||||
|
||||
public Item(SearchResponse response, Throwable throwable) {
|
||||
public Item(SearchResponse response, Exception exception) {
|
||||
this.response = response;
|
||||
this.throwable = throwable;
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is it a failed search?
|
||||
*/
|
||||
public boolean isFailure() {
|
||||
return throwable != null;
|
||||
return exception != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +67,7 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult
|
|||
*/
|
||||
@Nullable
|
||||
public String getFailureMessage() {
|
||||
return throwable == null ? null : throwable.getMessage();
|
||||
return exception == null ? null : exception.getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +90,7 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult
|
|||
this.response = new SearchResponse();
|
||||
response.readFrom(in);
|
||||
} else {
|
||||
throwable = in.readThrowable();
|
||||
exception = in.readException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,12 +101,12 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult
|
|||
response.writeTo(out);
|
||||
} else {
|
||||
out.writeBoolean(false);
|
||||
out.writeThrowable(throwable);
|
||||
out.writeException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public Throwable getFailure() {
|
||||
return throwable;
|
||||
public Exception getFailure() {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +155,7 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult
|
|||
for (Item item : items) {
|
||||
builder.startObject();
|
||||
if (item.isFailure()) {
|
||||
ElasticsearchException.renderThrowable(builder, params, item.getFailure());
|
||||
ElasticsearchException.renderException(builder, params, item.getFailure());
|
||||
builder.field(Fields.STATUS, ExceptionsHelper.status(item.getFailure()).getStatus());
|
||||
} else {
|
||||
item.getResponse().toXContent(builder, params);
|
||||
|
|
|
@ -89,7 +89,7 @@ class SearchDfsQueryAndFetchAsyncAction extends AbstractSearchAsyncAction<DfsSea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
try {
|
||||
onSecondPhaseFailure(t, querySearchRequest, shardIndex, dfsResult, counter);
|
||||
} finally {
|
||||
|
@ -102,12 +102,12 @@ class SearchDfsQueryAndFetchAsyncAction extends AbstractSearchAsyncAction<DfsSea
|
|||
});
|
||||
}
|
||||
|
||||
void onSecondPhaseFailure(Throwable t, QuerySearchRequest querySearchRequest, int shardIndex, DfsSearchResult dfsResult,
|
||||
void onSecondPhaseFailure(Exception e, QuerySearchRequest querySearchRequest, int shardIndex, DfsSearchResult dfsResult,
|
||||
AtomicInteger counter) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
|
||||
logger.debug("[{}] Failed to execute query phase", e, querySearchRequest.id());
|
||||
}
|
||||
this.addShardFailure(shardIndex, dfsResult.shardTarget(), t);
|
||||
this.addShardFailure(shardIndex, dfsResult.shardTarget(), e);
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
finishHim();
|
||||
|
@ -130,12 +130,12 @@ class SearchDfsQueryAndFetchAsyncAction extends AbstractSearchAsyncAction<DfsSea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("query_fetch", "", t, buildShardFailures());
|
||||
public void onFailure(Exception e) {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("query_fetch", "", e, buildShardFailures());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("failed to reduce search", failure);
|
||||
}
|
||||
super.onFailure(t);
|
||||
super.onFailure(e);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
try {
|
||||
onQueryFailure(t, querySearchRequest, shardIndex, dfsResult, counter);
|
||||
} finally {
|
||||
|
@ -110,12 +110,12 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
});
|
||||
}
|
||||
|
||||
void onQueryFailure(Throwable t, QuerySearchRequest querySearchRequest, int shardIndex, DfsSearchResult dfsResult,
|
||||
void onQueryFailure(Exception e, QuerySearchRequest querySearchRequest, int shardIndex, DfsSearchResult dfsResult,
|
||||
AtomicInteger counter) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
|
||||
logger.debug("[{}] Failed to execute query phase", e, querySearchRequest.id());
|
||||
}
|
||||
this.addShardFailure(shardIndex, dfsResult.shardTarget(), t);
|
||||
this.addShardFailure(shardIndex, dfsResult.shardTarget(), e);
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
if (successfulOps.get() == 0) {
|
||||
|
@ -129,7 +129,7 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
void executeFetchPhase() {
|
||||
try {
|
||||
innerExecuteFetchPhase();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(new ReduceSearchPhaseException("query", "", e, buildShardFailures()));
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
// the search context might not be cleared on the node where the fetch was executed for example
|
||||
// because the action was rejected by the thread pool. in this case we need to send a dedicated
|
||||
// request to clear the search context. by setting docIdsToLoad to null, the context will be cleared
|
||||
|
@ -180,12 +180,12 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
});
|
||||
}
|
||||
|
||||
void onFetchFailure(Throwable t, ShardFetchSearchRequest fetchSearchRequest, int shardIndex,
|
||||
void onFetchFailure(Exception e, ShardFetchSearchRequest fetchSearchRequest, int shardIndex,
|
||||
SearchShardTarget shardTarget, AtomicInteger counter) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
|
||||
logger.debug("[{}] Failed to execute fetch phase", e, fetchSearchRequest.id());
|
||||
}
|
||||
this.addShardFailure(shardIndex, shardTarget, t);
|
||||
this.addShardFailure(shardIndex, shardTarget, e);
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
finishHim();
|
||||
|
@ -208,9 +208,9 @@ class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<DfsSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("merge", "", t, buildShardFailures());
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("merge", "", e, buildShardFailures());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("failed to reduce search", failure);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SearchPhaseExecutionException extends ElasticsearchException {
|
||||
private final String phaseName;
|
||||
private final ShardSearchFailure[] shardFailures;
|
||||
|
@ -69,7 +66,7 @@ public class SearchPhaseExecutionException extends ElasticsearchException {
|
|||
}
|
||||
}
|
||||
|
||||
private static final Throwable deduplicateCause(Throwable cause, ShardSearchFailure[] shardFailures) {
|
||||
private static Throwable deduplicateCause(Throwable cause, ShardSearchFailure[] shardFailures) {
|
||||
if (shardFailures == null) {
|
||||
throw new IllegalArgumentException("shardSearchFailures must not be null");
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ class SearchQueryAndFetchAsyncAction extends AbstractSearchAsyncAction<QueryFetc
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("merge", "", t, buildShardFailures());
|
||||
public void onFailure(Exception e) {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("merge", "", e, buildShardFailures());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("failed to reduce search", failure);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class SearchQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<QuerySea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
// the search context might not be cleared on the node where the fetch was executed for example
|
||||
// because the action was rejected by the thread pool. in this case we need to send a dedicated
|
||||
// request to clear the search context. by setting docIdsToLoad to null, the context will be cleared
|
||||
|
@ -113,12 +113,12 @@ class SearchQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<QuerySea
|
|||
});
|
||||
}
|
||||
|
||||
void onFetchFailure(Throwable t, ShardFetchSearchRequest fetchSearchRequest, int shardIndex, SearchShardTarget shardTarget,
|
||||
void onFetchFailure(Exception e, ShardFetchSearchRequest fetchSearchRequest, int shardIndex, SearchShardTarget shardTarget,
|
||||
AtomicInteger counter) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
|
||||
logger.debug("[{}] Failed to execute fetch phase", e, fetchSearchRequest.id());
|
||||
}
|
||||
this.addShardFailure(shardIndex, shardTarget, t);
|
||||
this.addShardFailure(shardIndex, shardTarget, e);
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
finishHim();
|
||||
|
@ -141,9 +141,9 @@ class SearchQueryThenFetchAsyncAction extends AbstractSearchAsyncAction<QuerySea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("fetch", "", t, buildShardFailures());
|
||||
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("fetch", "", e, buildShardFailures());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("failed to reduce search", failure);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class SearchResponse extends ActionResponse implements StatusToXContent {
|
|||
*
|
||||
* @return The profile results or an empty map
|
||||
*/
|
||||
public @Nullable Map<String, ProfileShardResult> getProfileResults() {
|
||||
@Nullable public Map<String, ProfileShardResult> getProfileResults() {
|
||||
return internalResponse.profile();
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class SearchScrollQueryAndFetchAsyncAction extends AbstractAsyncAction {
|
|||
executePhase(i, node, target.getScrollId());
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Node [" + target.getNode() + "] not available for scroll request [" + scrollId.getSource() + "]");
|
||||
logger.debug("Node [{}] not available for scroll request [{}]", target.getNode(), scrollId.getSource());
|
||||
}
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
|
@ -116,7 +116,7 @@ class SearchScrollQueryAndFetchAsyncAction extends AbstractAsyncAction {
|
|||
DiscoveryNode node = nodes.get(target.getNode());
|
||||
if (node == null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Node [" + target.getNode() + "] not available for scroll request [" + scrollId.getSource() + "]");
|
||||
logger.debug("Node [{}] not available for scroll request [{}]", target.getNode(), scrollId.getSource());
|
||||
}
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
|
@ -138,21 +138,21 @@ class SearchScrollQueryAndFetchAsyncAction extends AbstractAsyncAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
onPhaseFailure(t, searchId, shardIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onPhaseFailure(Throwable t, long searchId, int shardIndex) {
|
||||
private void onPhaseFailure(Exception e, long searchId, int shardIndex) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute query phase", t, searchId);
|
||||
logger.debug("[{}] Failed to execute query phase", e, searchId);
|
||||
}
|
||||
addShardFailure(shardIndex, new ShardSearchFailure(t));
|
||||
addShardFailure(shardIndex, new ShardSearchFailure(e));
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
if (successfulOps.get() == 0) {
|
||||
listener.onFailure(new SearchPhaseExecutionException("query_fetch", "all shards failed", t, buildShardFailures()));
|
||||
listener.onFailure(new SearchPhaseExecutionException("query_fetch", "all shards failed", e, buildShardFailures()));
|
||||
} else {
|
||||
finishHim();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ class SearchScrollQueryAndFetchAsyncAction extends AbstractAsyncAction {
|
|||
private void finishHim() {
|
||||
try {
|
||||
innerFinishHim();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,13 +107,13 @@ class SearchScrollQueryThenFetchAsyncAction extends AbstractAsyncAction {
|
|||
executeQueryPhase(i, counter, node, target.getScrollId());
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Node [" + target.getNode() + "] not available for scroll request [" + scrollId.getSource() + "]");
|
||||
logger.debug("Node [{}] not available for scroll request [{}]", target.getNode(), scrollId.getSource());
|
||||
}
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
try {
|
||||
executeFetchPhase();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(new SearchPhaseExecutionException("query", "Fetch failed", e, ShardSearchFailure.EMPTY_ARRAY));
|
||||
return;
|
||||
}
|
||||
|
@ -131,32 +131,33 @@ class SearchScrollQueryThenFetchAsyncAction extends AbstractAsyncAction {
|
|||
if (counter.decrementAndGet() == 0) {
|
||||
try {
|
||||
executeFetchPhase();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
onFailure(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
onQueryPhaseFailure(shardIndex, counter, searchId, t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void onQueryPhaseFailure(final int shardIndex, final AtomicInteger counter, final long searchId, Throwable t) {
|
||||
void onQueryPhaseFailure(final int shardIndex, final AtomicInteger counter, final long searchId, Exception failure) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] Failed to execute query phase", t, searchId);
|
||||
logger.debug("[{}] Failed to execute query phase", failure, searchId);
|
||||
}
|
||||
addShardFailure(shardIndex, new ShardSearchFailure(t));
|
||||
addShardFailure(shardIndex, new ShardSearchFailure(failure));
|
||||
successfulOps.decrementAndGet();
|
||||
if (counter.decrementAndGet() == 0) {
|
||||
if (successfulOps.get() == 0) {
|
||||
listener.onFailure(new SearchPhaseExecutionException("query", "all shards failed", t, buildShardFailures()));
|
||||
listener.onFailure(new SearchPhaseExecutionException("query", "all shards failed", failure, buildShardFailures()));
|
||||
} else {
|
||||
try {
|
||||
executeFetchPhase();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
e.addSuppressed(failure);
|
||||
listener.onFailure(new SearchPhaseExecutionException("query", "Fetch failed", e, ShardSearchFailure.EMPTY_ARRAY));
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +194,7 @@ class SearchScrollQueryThenFetchAsyncAction extends AbstractAsyncAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void onFailure(Exception t) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to execute fetch phase", t);
|
||||
}
|
||||
|
@ -209,8 +210,8 @@ class SearchScrollQueryThenFetchAsyncAction extends AbstractAsyncAction {
|
|||
private void finishHim() {
|
||||
try {
|
||||
innerFinishHim();
|
||||
} catch (Throwable e) {
|
||||
listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures()));
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(new ReduceSearchPhaseException("fetch", "inner finish failed", e, buildShardFailures()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,19 +48,19 @@ public class ShardSearchFailure implements ShardOperationFailedException {
|
|||
|
||||
}
|
||||
|
||||
public ShardSearchFailure(Throwable t) {
|
||||
this(t, null);
|
||||
public ShardSearchFailure(Exception e) {
|
||||
this(e, null);
|
||||
}
|
||||
|
||||
public ShardSearchFailure(Throwable t, @Nullable SearchShardTarget shardTarget) {
|
||||
Throwable actual = ExceptionsHelper.unwrapCause(t);
|
||||
public ShardSearchFailure(Exception e, @Nullable SearchShardTarget shardTarget) {
|
||||
final Throwable actual = ExceptionsHelper.unwrapCause(e);
|
||||
if (actual != null && actual instanceof SearchException) {
|
||||
this.shardTarget = ((SearchException) actual).shard();
|
||||
} else if (shardTarget != null) {
|
||||
this.shardTarget = shardTarget;
|
||||
}
|
||||
status = ExceptionsHelper.status(actual);
|
||||
this.reason = ExceptionsHelper.detailedMessage(t);
|
||||
this.reason = ExceptionsHelper.detailedMessage(e);
|
||||
this.cause = actual;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class ShardSearchFailure implements ShardOperationFailedException {
|
|||
}
|
||||
reason = in.readString();
|
||||
status = RestStatus.readFrom(in);
|
||||
cause = in.readThrowable();
|
||||
cause = in.readException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,7 +148,7 @@ public class ShardSearchFailure implements ShardOperationFailedException {
|
|||
}
|
||||
out.writeString(reason);
|
||||
RestStatus.writeTo(out, status);
|
||||
out.writeThrowable(cause);
|
||||
out.writeException(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -103,7 +103,7 @@ public class TransportClearScrollAction extends HandledTransportAction<ClearScro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
onFailedFreedContext(e, node);
|
||||
}
|
||||
});
|
||||
|
@ -124,7 +124,7 @@ public class TransportClearScrollAction extends HandledTransportAction<ClearScro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
onFailedFreedContext(e, node);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -119,7 +118,7 @@ public class TransportMultiSearchAction extends HandledTransportAction<MultiSear
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
public void onFailure(Exception e) {
|
||||
responses.set(request.responseSlot, new MultiSearchResponse.Item(null, e));
|
||||
handleResponse();
|
||||
}
|
||||
|
@ -134,7 +133,7 @@ public class TransportMultiSearchAction extends HandledTransportAction<MultiSear
|
|||
});
|
||||
}
|
||||
|
||||
final static class SearchRequestSlot {
|
||||
static final class SearchRequestSlot {
|
||||
|
||||
final SearchRequest request;
|
||||
final int responseSlot;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TransportSearchScrollAction extends HandledTransportAction<SearchSc
|
|||
throw new IllegalArgumentException("Scroll id type [" + scrollId.getType() + "] unrecognized");
|
||||
}
|
||||
action.start();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
*/
|
||||
public abstract class AbstractListenableActionFuture<T, L> extends AdapterActionFuture<T, L> implements ListenableActionFuture<T> {
|
||||
|
||||
private final static ESLogger logger = Loggers.getLogger(AbstractListenableActionFuture.class);
|
||||
private static final ESLogger logger = Loggers.getLogger(AbstractListenableActionFuture.class);
|
||||
|
||||
final ThreadPool threadPool;
|
||||
volatile Object listeners;
|
||||
|
@ -53,7 +53,7 @@ public abstract class AbstractListenableActionFuture<T, L> extends AdapterAction
|
|||
}
|
||||
|
||||
public void internalAddListener(ActionListener<T> listener) {
|
||||
listener = new ThreadedActionListener<>(logger, threadPool, ThreadPool.Names.LISTENER, listener);
|
||||
listener = new ThreadedActionListener<>(logger, threadPool, ThreadPool.Names.LISTENER, listener, false);
|
||||
boolean executeImmediate = false;
|
||||
synchronized (this) {
|
||||
if (executedListeners) {
|
||||
|
@ -102,8 +102,8 @@ public abstract class AbstractListenableActionFuture<T, L> extends AdapterAction
|
|||
// we use a timeout of 0 to by pass assertion forbidding to call actionGet() (blocking) on a network thread.
|
||||
// here we know we will never block
|
||||
listener.onResponse(actionGet(0));
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public interface ActionFilter {
|
|||
* filter chain. This base class should serve any action filter implementations that doesn't require
|
||||
* to apply async filtering logic.
|
||||
*/
|
||||
public static abstract class Simple extends AbstractComponent implements ActionFilter {
|
||||
public abstract static class Simple extends AbstractComponent implements ActionFilter {
|
||||
|
||||
protected Simple(Settings settings) {
|
||||
super(settings);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue