Commit Graph

23810 Commits

Author SHA1 Message Date
Jason Tedor 2d1b0587dd Introduce Netty 4
This commit adds transport-netty4, a transport and HTTP implementation
based on Netty 4.

Relates #19526
2016-07-22 22:26:35 -04:00
David Pilato f33d103e76 Use `DefaultAWSCredentialsProviderChain` AWS SDK class for credentials
Follow up discussion at https://github.com/elastic/elasticsearch/pull/18690#issuecomment-234505083

Reading the best practices [recommended by AWS](http://docs.aws.amazon.com/java-sdk/latest/developer-guide/credentials.html), we should use `DefaultAWSCredentialsProviderChain` instead of providing the detail of the chain ourselves.

For now, we read credentials (if not provided in `elasticsearch.yml`) using:

```java
credentials = new AWSCredentialsProviderChain(
   new SystemPropertiesCredentialsProvider(),
   new EnvironmentVariableCredentialsProvider(),
   new InstanceProfileCredentialsProvider()
);
```

Which means that we read from:

* Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET), or `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` (only recognized by Java SDK)
* Java System Properties - `aws.accessKeyId` and `aws.secretKey`
* Instance profile credentials delivered through the Amazon EC2 metadata service

Using instead:

```java
credentials = new DefaultAWSCredentialsProviderChain();
```

Will give us two new more methods out of the box:

> * Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI
> * Credentials delivered through the Amazon EC2 container service if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` environment variable is set and security manager has permission to access the variable

Cherry on the cake: as soon as AWS SDK will propose a new implementation, we will benefit from it without any modification (just updating the SDK).

We also simplify

```
new AWSCredentialsProviderChain(new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)));
```

As there is no need to wrap StaticCredentialsProvider in AWSCredentialsProviderChain.

Closes #19556.
2016-07-23 01:28:39 +02:00
David Pilato 43c15f2b23 Merge branch 'test/check-s3-settings' 2016-07-23 00:38:55 +02:00
David Pilato 7aa4568a9c Fix s3 settings
Follow up for #18662 and #18690.

* For consistency, we rename method parameters and use `key` and `secret` instead of `account` and `key`.
* We add some tests to check that settings are correctly applied.
* Tests revealed that some checks are bad like for #18662.

Add test and fix issue for getting the right S3 endpoint
Test when Repository, Repositories or global settings are defined
But ignore testAWSCredentialsWithSystemProviders test
Add tests for AWS Client Configuration
Fix NPE when no region is set

We used to transform region="" to region=null but it's not needed anymore and would actually cause NPE from now.
2016-07-23 00:37:29 +02:00
David Pilato 0578925423 Fix ec2 settings
Follow up for #18662

We add some tests to check that settings are correctly applied.
Tests revealed that some checks were missing.

But we ignore `testAWSCredentialsWithSystemProviders` test for now.
2016-07-23 00:09:18 +02:00
Alexander Kazakov 0216cef7bd Fix EC2 discovery setting
Closes #18652
2016-07-23 00:09:18 +02:00
Luca Cavanna d4366f8493 Merge pull request #19400 from javanna/feature/async_rest_client
Introduce async performRequest method
2016-07-22 22:36:06 +02:00
javanna 36becd9bfe Merge branch 'master' into feature/async_rest_client 2016-07-22 22:22:03 +02:00
javanna 061ea1bd8c [TEST] move assertions outside of listener in testAsyncRequests for clearer test failures 2016-07-22 22:19:59 +02:00
javanna c9c7af791c update nextHost method javadocs 2016-07-22 21:42:42 +02:00
javanna 46cb3f36ff fix concurrency bug when getting the host for a given request
It can happen that the list of healthy hosts is empty, then we get one from the blacklist. but some other operation might have sneaked in and emptied the blacklist in the meantime, so we have to retry till we manage to get some host, either from the healthy list or from the blacklist.
2016-07-22 21:35:43 +02:00
Mike McCandless 98c39533d7 Guard against negative result from FileStore.getUsableSpace when picking data path for a new shard 2016-07-22 15:02:31 -04:00
Ali Beyad d9ec959dfc Index folder names now use a UUID (not the index UUID but one specific
to snapshot/restore) and the index to UUID mapping is stored in the
repository index file.
2016-07-22 13:59:13 -04:00
Ali Beyad a0a4d67eae All snapshot metadata files use UUID for the blob ID 2016-07-22 13:52:13 -04:00
Ali Beyad 630218a16f Change the BlobContainer interface to throw a NoSuchFileFoundException
for reads and deletes if the blob does not exist.
2016-07-22 13:49:25 -04:00
Ali Beyad abaf8443e5 More robust handling of snapshot deletions
Makes deleting snapshots more robust by first deleting the
snapshot from the index generational file, then handling
individual deletion file errors with log messages instead of
failing the entire operation.
2016-07-22 13:49:25 -04:00
gfyoung 6a9f488b17 Caught exceptions during compromised snapshot deletion 2016-07-22 13:48:45 -04:00
gfyoung 95a118d9c6 Changed Files.deleteIfExists to Files.delete in FsBlobContainer 2016-07-22 13:48:45 -04:00
gfyoung dfcdadb59f Added HdfsBlobStoreContainer tests
Added BlobContainer tests for HDFS storage
and caught a bug at the same time in which
deleteBlob was not raising an IOException
when the blobName did not exist.
2016-07-22 13:48:45 -04:00
gfyoung 5eb4797955 Added AzureBlobStoreContainer tests
Added BlobContainer tests for Azure storage
and caught a bug at the same time in which
deleteBlob was not raising an IOException
when the blobName did not exist.
2016-07-22 13:48:45 -04:00
gfyoung c2c40d51db Added S3BlobStoreContainer tests 2016-07-22 13:48:45 -04:00
gfyoung d98fd36dad Added deleteBlob IOException test 2016-07-22 13:48:45 -04:00
gfyoung b02a6da8fd Properly raise IOException for Azure, Fs, Hdfs, and S3 2016-07-22 13:48:45 -04:00
gfyoung 0620a3d6c2 Raised IOException on deleteBlob
Closes gh-18530.
2016-07-22 13:48:45 -04:00
Jason Tedor c27237be9f Revert "Allow to listen on virtual interfaces"
This reverts commit 4cb8b620c3.
2016-07-22 13:30:05 -04:00
javanna e6054a931e add async request unit test 2016-07-22 19:01:56 +02:00
Michael Nitschinger 4cb8b620c3 Allow to listen on virtual interfaces
Previously when trying to listen on virtual interfaces during
bootstrap the application would stop working - the interface
couldn't be found by the NetworkUtils class.

The NetworkUtils utilize the underlying JDK NetworkInterface
class which, when asked to lookup by name only takes physical
interfaces into account, failing at virtual (or subinterfaces)
ones (returning null).

Note that when interating over all interfaces, both physical and
virtual ones are taken into account.

This changeset asks for all known interfaces, iterates over them
and matches on the given name as part of the loop, allowing it
to catch both physical and virtual interfaces.

As a result, elasticsearch can now also serve on virtual
interfaces.

A test case has been added which at least makes sure that all
iterable interfaces can be found by their respective name. (It's
not easily possible in a unit test to "fake" virtual interfaces).

Relates #19537
2016-07-22 12:33:21 -04:00
Ali Beyad 2b9cfff90f Fixes CORS handling so that it uses the defaults
Fixes CORS handling so that it uses the defaults for http.cors.allow-methods
and http.cors.allow-headers if none are specified in the config.

Closes #19520
2016-07-22 12:25:28 -04:00
javanna 4e8ee1f0ab add some javadocs to clarify internal listeners behaviour 2016-07-22 17:44:50 +02:00
javanna 835d8cecdc [TEST] add unit tests for internal TrackingFailureListener
Any provided listener will always be wrapped into FailureTrackingListener to handle retries
2016-07-22 17:31:11 +02:00
javanna d13a3d3761 Reindex from remote: add fallback in case content-type header is not set
We better read the header, but who knows what can happen, maybe headers are filtered out for some reasons and we don't want to run into an NPE, then we fallback to auto-detection.
2016-07-22 16:46:17 +02:00
javanna a6a685b0f6 make Response class final 2016-07-22 16:36:14 +02:00
Simon Willnauer 6adfeb4dde [TEST] Add Netty3RestIT to actually run REST tests on netty3 2016-07-22 16:29:14 +02:00
javanna db8beeba3b Merge branch 'master' into feature/async_rest_client 2016-07-22 15:51:03 +02:00
javanna a579866b42 rename mayRetry to isRetryStatus 2016-07-22 15:49:39 +02:00
javanna 37e075a506 Make SyncResponseListener safer
Throw explicit IllegalStateException in unexpected situations, like where both response and exception are set, or when both are unset. Add unit test for SyncResponseListener.
2016-07-22 15:48:15 +02:00
Boaz Leskes bd574d92ae Verify lower level transport exceptions don't bubble up on disconnects (#19518)
#19096 introduced a generic TCPTransport base class so we can have multiple TCP based transport implementation. These implementations can vary in how they respond internally to situations where we concurrently send, receive and handle disconnects and can have different exceptions. However, disconnects are important events for the rest of the code base and should be distinguished from other errors (for example, it signals TransportMasterAction that it needs to retry and wait for the a (new) master to come back).  Therefore, we should make sure that all the implementations do the proper translation from their internal exceptions into ConnectTransportException which is used externally. 

Similarly we should make sure that the transport implementation properly recognize errors that were caused by a disconnect as such and deal with them correctly. This was, for example, the source of a build failure at https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-intake/1080 , where a concurrency issue cause SocketException to bubble out of MockTcpTransport.

This PR adds a tests which concurrently simulates connects, disconnects, sending and receiving and makes sure the above holds. It also fixes anything (not much!) that was found it.
2016-07-22 14:35:47 +02:00
Tal Levy 19e7b1c737 fix: no other processors should be executed after on_failure is called in a compound processor (#19545) 2016-07-21 14:27:04 -07:00
Ali Beyad 9765b4a6ff Fixes the ActiveShardsObserverIT tests that have a very short index (#19540)
creation timeout so they process the index creation cluster state update
before the test finishes and attempts to cleanup. Otherwise, the index
creation cluster state update could be processed after the test finishes
and cleans up, thereby leaking an index in the cluster state that could
cause issues for other tests that wouldn't expect the index to exist.

Closes #19530
2016-07-21 11:47:21 -04:00
Nik Everett 4d89aa97e9 Vagrant tests should use plugin zips
Fixes failing packaging tests:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+packaging-tests/1049/console
2016-07-21 10:02:51 -04:00
Ali Beyad 83a137b25c Fixes REST test that is designed to timeout on index creation by
making the test wait until all urgent requests are completed before
finishing, so that tear down can properly delete the created index
and cleanup. Without this wait, it was possible that the test would
finish and cleanup the deleted indices would happen before the
index creation even processed, causing the test to leave a created
index behind.
2016-07-21 09:14:41 -04:00
David Pilato 3bcf2653bb ping_timeout is documented in discovery-ec2 but does not exist in code
Also mentioned in discovery-gce

Actually ping timeout can be set using `discovery.zen.ping_timeout`.

Closes #16600.
2016-07-21 15:03:56 +02:00
Yannick Welsch d4771b993f Use executor's describeTasks method to log task information in cluster service (#19531)
This fixes the log output in some places of ClusterService where the executor's describeTasks wasn't used to log task information.
2016-07-21 14:32:37 +02:00
Sakthipriyan Vairamani 96b0b1091f minor documentation improvements (#19500)
* minor documentation improvements

* remove unnecessary commas
2016-07-21 14:26:56 +02:00
Karel Minarik 8c721b10af Test: Fixed incorrect YAML indentation in the `indices.put_template/10_basic.yaml` test
The Ruby YAML parser ignores the `do` actions when they are not indented,
making the test suite fail.

Related: #19506

Closes #19529
2016-07-21 14:17:17 +02:00
David Pilato e22bd08e3c Clarify cloud.service.name entry
Closes #18577.
2016-07-21 14:10:43 +02:00
javanna 175c327e17 validate bufferLimit is positive in HeapBufferedAsyncResponseConsumer 2016-07-21 13:59:28 +02:00
Folusho Oladipo 1e7495a7fa corrected the use of two synonymous words (#19498)
Two synonyms were jointly used in the sentence(i.e "problems" and "issues"), so I deleted one of them.
2016-07-21 12:21:12 +02:00
David Pilato 5e57febe53 Add DiscoveryPlugin interface
So we have a Pull interface easier to use which reduce the need of Guice.

See 2a9d7f68a1 (commitcomment-18335161)
2016-07-21 11:35:29 +02:00
David Pilato 2a9d7f68a1 Move custom name resolver registration to the NetworkModule
As explained in https://github.com/elastic/elasticsearch/pull/15765#discussion_r65804713
2016-07-21 10:27:38 +02:00