Commit Graph

2893 Commits

Author SHA1 Message Date
Jason Tedor a10b25e185
Fix security manager bug writing large blobs to GCS (#55421)
* Fix security manager bug writing large blobs to GCS

This commit addresses a security manager permissions issue writing large
blobs (on the resumable upload path) to GCS. The underlying issue here
is that we need to wrap the close and write calls on the channel. It is
not enough to do this:

SocketAccess.doPrivilegedVoidIOException(
  () -> Streams.copy(
    inputStream,
    Channels.newOutputStream(client().writer(blobInfo, writeOptions))));

This reason that this is not enough is because Streams#copy will be in
the stacktrace and it is not granted the security manager permissions
needed to close or write this channel. We only grant those permissions
to classes loaded in the plugin classloader, and Streams#copy is from
the parent classloader. This is why we must wrap the close and write
calls as privileged, to truncate the Streams#copy call out of the
stacktrace.

The reason that this issue is not caught in testing is because the size
of data that we use in testing is too small to trigger the large blob
resumable upload path. Therefore, we address this by adding a system
property to control the threshold, which we can then set in tests to
exercise this code path. Prior to rewriting the writeBlobResumable
method to wrap the close and write calls as privileged, with this
additional test, we are able to reproduce the security manager
permissions issue. After adding the wrapping, this test now passes.

* Fix forbidden APIs issue

* Remove leftover debugging
2020-04-17 18:48:34 -04:00
William Brafford 92c8a73348
Deprecate disabling basic-license features (#54816)
We believe there's no longer a need to be able to disable basic-license
features completely using the "xpack.*.enabled" settings. If users don't
want to use those features, they simply don't need to use them. Having
such features always available lets us build more complex features that
assume basic-license features are present.

This commit deprecates settings of the form "xpack.*.enabled" for
basic-license features, excluding "security", which is a special case.
It also removes deprecated settings from integration tests and unit
tests where they're not directly relevant; e.g. monitoring and ILM are
no longer disabled in many integration tests.
2020-04-17 09:18:55 -04:00
Rory Hunter 8638d08ebf
Always use deprecateAndMaybeLog for deprecation warnings (#55115)
Closes #53137. Replace calls to deprecate(String,Object...) with deprecateAndMaybeLog(...), with an appropriate key, so that all messages
can potentially be deduplicated.
2020-04-16 16:19:45 +01:00
William Brafford 38cd668ad0
Remove deprecated third-party methods from tests (#55255)
I've noticed that a lot of our tests are using deprecated static methods
from the Hamcrest matchers. While this is not a big deal in any
objective sense, it seems like a small good thing to reduce compilation
warnings and be ready for a new release of the matcher library if we
need to upgrade. I've also switched a few other methods in tests that
have drop-in replacements.
2020-04-15 16:31:51 -04:00
Ryan Ernst 842ce32870
Use task avoidance with forbidden apis (#55034)
Currently forbidden apis accounts for 800+ tasks in the build. These
tasks are aggressively created by the plugin. In forbidden apis 3.0, we
will get task avoidance
(https://github.com/policeman-tools/forbidden-apis/pull/162), but we
need to ourselves use the same task avoidance mechanisms to not trigger
these task creations. This commit does that for our foribdden apis
usages, in preparation for upgrading to 3.0 when it is released.
2020-04-15 13:23:55 -07:00
Ignacio Vera a18fca65d6
Upgrade to lucene 8.5.1 release (#55229)
Upgrade to lucene 8.5.1 release that contains a bug fix for a bug that might introduce index corruption when deleting data from an index that was previously shrunk.
2020-04-15 15:14:38 +02:00
Mark Vieira 0e55fdeae9
Re-add origin url information to publish POM files (#55171) 2020-04-14 11:48:36 -07:00
Tim Brooks b54ee89511
Introduce mechanism to stub request handling (#55091)
Currently there is a clear mechanism to stub sending a request through
the transport. However, this is limited to testing exceptions on the
sender side. This commit reworks our transport related testing
infrastructure to allow stubbing request handling on the receiving side.
2020-04-14 11:32:37 -06:00
Yannick Welsch 03a60769f3
Provide repository-level stats for searchable snapshots (#55051)
Provides basic repository-level stats that will allow us to get some insight into how many
requests are actually being made by the underlying SDK. Currently only tracks GET and LIST
calls for S3 repositories. Most of the code is unfortunately boiler plate to add a new endpoint
that will help us better understand some of the low-level dynamics of searchable snapshots.
2020-04-14 14:12:48 +02:00
Jason Tedor a0cb977f23
Clarify available processors (#54907)
The use of available processors, the terminology, and the settings
around it have evolved over time. This commit cleans up some places in
the codes and in the docs to adjust to the current terminology.
2020-04-10 08:38:00 -04:00
Armin Braun 86d1268294
Fix S3 Blob Container Retries Test Range Handling (#55000)
The ranges in HTTP headers are using inclusive values for start and end of the range.
The math we used was off in so far that start equals end for the range resulted in length `0`
instead of the correct value of `1`.
Closes #54981
Closes #54995
2020-04-09 10:08:28 +02:00
Mark Vieira 2b23cd5488
Mute S3BlobContainerRetriesTests.testReadRangeBlobWithRetries 2020-04-08 16:45:01 -07:00
Jake Landis abed62e246
Lazy test cluster module and plugins (#54852)
This change converts the module and plugin parameters
for testClusters to be lazy. Meaning that the values
are not resolved until they are actually used. This
removes the requirement to use project.afterEvaluate to
be able to resolve the bundle artifact.

Note - this does not completely remove the need for afterEvaluate
since it is still needed for the custom resource extension.
2020-04-08 15:19:52 -05:00
Mark Vieira df395cad51
Mute S3BlobContainerRetriesTests.testReadBlobWithPrematureConnectionClose 2020-04-08 13:05:11 -07:00
Armin Braun 73b5f58f38
Fix Broken Math in S3 Retries Tests (#54952)
If we run into `length == 0` we trip an assertion in `randomIntBetween(0, length -1)`.
2020-04-08 19:41:25 +02:00
Armin Braun f7c2cbdb5e
Fix Race in Snapshot Abort (#54873)
We can be a little more efficient when aborting a snapshot. Since we know the new repository
data after finalizing the aborted snapshot when can pass it down to the snapshot completion listeners.
This way, we don't have to fork off to the snapshot threadpool to get the repository data when the listener completes and can directly submit the delete task with high priority straight from the cluster state thread.
2020-04-07 18:27:16 +02:00
Tim Brooks 4f0ccd3c25
Implement transport circuit breaking in aggregator (#54610)
This commit moves the action name validation and circuit breaking into
the InboundAggregator. This work is valuable because it lays the
groundwork for incrementally circuit breaking as data is received.

This PR includes the follow behavioral change:

Handshakes contribute to circuit breaking, but cannot be broken. They
currently do not contribute nor are they broken.
2020-04-07 09:51:30 -06:00
Jason Tedor cda31879b5
Update link to JDK 14 compiler bug
This commit updates the link to the JDK 14 compiler bug that we have
found. At the time that we committed the workaround, we had a submission
ID, but not yet the public bug URL. This commit adds the public bug URL.
2020-04-07 06:25:00 -04:00
Tanguy Leroux f6feb6c2c8
Merge feature/searchable-snapshots branch into master (#54803)
This commit merges the searchable-snapshots feature branch into master.
See #54803 for the complete list of squashed commits.

Co-authored-by: David Turner <david.turner@elastic.co>
Co-authored-by: Yannick Welsch <yannick@welsch.lu>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Co-authored-by: Andrei Dan <andrei.dan@elastic.co>
2020-04-06 15:51:05 +02:00
Jason Tedor 376c70ddc1
Workaround JDK 14 compiler bug (#54689)
This commit workarounds a bug in the JDK 14 compiler. It is choking on a
method reference, so we substitute a lambda expression instead. The JDK
bug ID is 9064309.
2020-04-02 19:44:31 -04:00
Ryan Ernst 9191c933ca
Remove guava from transitive compile classpath (#54309)
Guava was removed from Elasticsearch many years ago, but remnants of it
remain due to transitive dependencies. When a dependency pulls guava
into the compile classpath, devs can inadvertently begin using methods
from guava without realizing it. This commit moves guava to a runtime
dependency in the modules that it is needed.

Note that one special case is the html sanitizer in watcher. The third
party dep uses guava in the PolicyFactory class signature. However, only
calling a method on the PolicyFactory actually causes the class to be
loaded, a reference alone does not trigger compilation to look at the
class implementation. There we utilize a MethodHandle for invoking the
relevant method at runtime, where guava will continue to exist.
2020-04-02 12:54:39 -07:00
Jason Tedor 95a7eed9aa
Rename MetaData to Metadata in all of the places (#54519)
This is a simple naming change PR, to fix the fact that "metadata" is a
single English word, and for too long we have not followed general
naming conventions for it. We are also not consistent about it, for
example, METADATA instead of META_DATA if we were trying to be
consistent with MetaData (although METADATA is correct when considered
in the context of "metadata"). This was a simple find and replace across
the code base, only taking a few minutes to fix this naming issue
forever.
2020-03-31 15:52:01 -04:00
Tim Brooks 9d861bff71
Move network stats marking into InboundPipeline (#54393)
This is a follow-up to #48263. It moves the inbound stats tracking
inside of the InboundPipeline.
2020-03-31 12:00:01 -06:00
Martijn van Groningen b7af852422
Refactor AliasOrIndex abstraction. (#53982)
In order to prepare the `AliasOrIndex` abstraction for the introduction of data streams,
the abstraction needs to be made more flexible, because currently it really can be only
an alias or an index.

* Renamed `AliasOrIndex` to `IndexAbstraction`.
* Introduced a `IndexAbstraction.Type` enum to indicate what a `IndexAbstraction` instance is.
* Replaced the `isAlias()` method that returns a boolean with the `getType()` method that returns the new Type enum.
* Moved `getWriteIndex()` up from the `IndexAbstraction.Alias` to the `IndexAbstraction` interface.
* Moved `getAliasName()` up from the `IndexAbstraction.Alias` to the `IndexAbstraction` interface and renamed it to `getName()`.
* Removed unnecessary casting to `IndexAbstraction.Alias` by just checking the `getType()` method.

Relates to #53100
2020-03-30 08:10:07 +02:00
Tim Brooks 42150d3674
Move transport decoding and aggregation to server (#48263)
Currently all of our transport protocol decoding and aggregation occurs
in the individual transport modules. This means that each implementation
(test, netty, nio) must implement this logic. Additionally, it means
that the entire message has been read from the network before the server
package receives it.

This commit creates a pipeline in server which can be passed arbitrary
bytes to handle. Internally, the pipeline will decode, decompress, and
aggregate the messages. Additionally, this allows us to run many
megabytes of bytes through the pipeline in tests to ensure that the
logic works.

This work will enable future work:

Circuit breaking or backoff logic based on message type and byte
in the content aggregator.
Sharing bytes with the application layer using the ref counted
releasable network bytes.
Improved network monitoring based specifically on channels.
Finally, this fixes the bug where we do not circuit break on the correct
message size when compression is enabled.
2020-03-27 10:40:26 -06:00
Armin Braun 009f3693d9
Remove Unused Apache Http Dependency from GCS Repo Plugin (#54331)
We are not using the Apache HTTP client backed http transport
with the GCS repo. Same as with the app engine type transport
we can save ourselves the dependency on the http client here
and ignore the missing classes.
2020-03-27 14:23:13 +01:00
Tim Brooks 519c8c4a33
Remove netty BytesReference implementations (#54025)
Elasticsearch has a number of different BytesReference implementations.
These implementations can all implement the interface in different ways
with subtly different behavior and performance characteristics. On the
other-hand, the JVM only represents bytes as an array or a direct byte
buffer. This commit deletes the specialized Netty implementations and
moves to using a generic ByteBuffer reference type. This will allow us
to focus on standardizing performance and behave around a smaller number
of implementations that can be used by all components in Elasticsearch.
2020-03-25 16:00:41 -06:00
Ioannis Kakavas 53f44e069f
Upgrade Tika to 1.24 (#54130)
Also updates commons-compress to 1.19, pdfbox to 2.0.19 and
POI to 4.1.2. Adds a compile dependency to commons-math3 
3.6.1 and SparseBitSet 1.2
2020-03-25 09:29:25 +02:00
James Baiera fe24848666
Update the HDFS version used by HDFS Repo (#53693) 2020-03-24 15:40:40 -04:00
Armin Braun aa141c02cd
Upgrade GCS Dependency to 1.106.0 (#54092)
Upgrading GCS Dep + related dependencies as it seems some more retry bugs were fixed between .104 and .106
2020-03-24 18:11:47 +01:00
Armin Braun c94be58b5a
Revert "Use Azure Bulk Deletes in Azure Repository (#53919)" (#54089)
This reverts commit 23cccf0888.
Unfortunately SAS token auth still doesn't work with bulk deletes so we can't use them yet.

Closes #54080
2020-03-24 17:32:36 +01:00
Armin Braun a8a7f105a5
Reenable Incorrectly Muted GCS Test (#54078)
Failure #52906 does not happen in master and is limited to the `7.x` branch
so it wasn't unmuted when the `7.x` fix for this landed => unmuting it here.
2020-03-24 15:46:02 +01:00
Alan Woodward a371113d20
Upgrade to lucene 8.5.0 release (#54077)
Upgrades our lucene dependency to the released 8.5.0 version.
2020-03-24 13:44:28 +00:00
Namgyu Kim 8d4ff290cc
Add nori_number token filter in analysis-nori (#53583)
This change adds the `nori_number` token filter.
It also adds a `discard_punctuation` option in nori_tokenizer that should be used in conjunction with the new filter.
2020-03-23 19:28:49 +01:00
Armin Braun d56d2cf08c
Upgrade to AWS SDK 1.11.749 (#53962)
Upgrading AWS SDK to v1.11.749.
Required building clients inside privileged contexts because some class loading that requires privileges now happens there and working around a new SDK bug in the S3 client builder.

Closes #53191
2020-03-23 13:50:02 +01:00
Armin Braun 23cccf0888
Use Azure Bulk Deletes in Azure Repository (#53919)
Now that we upgraded the Azure SDK to 8.6.2 in #53865 we can make use of
bulk deletes.
2020-03-23 12:22:37 +01:00
Armin Braun 25d3912ede
Fix Azure Repository with HTTPs Endpoint (#53903)
Upgrading to 8.6.2 in #53865 broke running against HTTPs endpoints (and hence real azure)
because the https url connection needs the newly added permission to work.
2020-03-23 11:12:42 +01:00
Armin Braun f31c6e969b
Upgrade to Azure SDK 8.6.2 (#53865)
This fixes some bugs around retrying and URL encoding and should enable a follow-up
that finally adds bulk deletes on Azure.
2020-03-20 17:24:27 +01:00
Armin Braun 8aee647300
Longer Timeout in S3 Retries Test (#53841)
The lower end of the timeout range of 100ms is prone to time out
on CI before the mock REST server gets to sending a response that
is not supposed to be a timeout.
Using 1-3s here should make this safe at the cost of randomly making
this test take a few seconds.

Closes #53506
2020-03-20 11:18:23 +01:00
Jake Landis afc2383b72
Optimize which Rest resources are used by the Rest tests. (#53299)
This should help with Gradle's incremental compile such that projects
only depend upon the resources they use.

related #52114
2020-03-18 09:09:29 -05:00
Ryan Ernst d63cda1bcb
Upgrade jackson to 2.10.3 and GeoIP to 2.13.1 (#53642)
Re-applies the change from #53523 along with test fixes.

closes #53626
closes #53624
closes #53622
closes #53625

Co-authored-by: Nik Everett <nik9000@gmail.com>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Co-authored-by: Jake Landis <jake.landis@elastic.co>
2020-03-17 10:26:35 -07:00
Alan Woodward 3e607d9e93
Rename AtomicFieldData to LeafFieldData (#53554)
This conforms with lucene's LeafReader naming convention, and
matches other per-segment structures in elasticsearch.
2020-03-17 12:25:51 +00:00
Mark Vieira 060b4eed59
Revert "Upgrade to Jackson 2.10.3 and GeoIP2 to 2.13.1 (#53523)"
This reverts commit 7bc75f48

Signed-off-by: Mark Vieira <portugee@gmail.com>
2020-03-15 18:10:14 -07:00
Jason Tedor 7bc75f48d8
Upgrade to Jackson 2.10.3 and GeoIP2 to 2.13.1 (#53523)
This commit upgrades our Jackson dependency to 2.10.3 and our GeoIP2
dependency to 2.13.1.
2020-03-14 10:22:29 -04:00
Jason Tedor 99a4fa354d
Update jackson-databind to 2.8.11.6 (#53522)
This commit upgrades the jackson-databind depdendency to
2.8.11.6. Additionally, we revert a previous change that put
ingest-geoip on the version of jackson-databind from the version
properties file. This is because upgrading ingest-geoip to a later
version of jackson-databind also requires an upgrade to the geoip2
dependency which is currently blocked. Therefore, if we can get to a
point where we otherwise upgrade our Jackson dependencies, we do not
want ingest-geoip to automatically come along with it.
2020-03-12 20:14:30 -04:00
Alan Woodward 5d716bc16c
Upgrade to final lucene 8.5.0 snapshot (#53293)
Lucene 8.5.0 release candidates are imminent. This commit upgrades master to use
the latest snapshot to check that there are no last-minute bugs or regressions.
2020-03-10 09:30:37 +00:00
Nhat Nguyen 8f17b21de8 Revert "upgrade to lucene-snapshot-fa75139efea (#53150)"
This reverts commit 59b841751d.
2020-03-05 17:30:06 -05:00
Armin Braun 40bd334b12
Upgrade GCS SDK to 1.104.0 (#52839)
Upgrading the GCS SDK to the most recent version.
Adjusting (i.e. improving) the REST mock accordingly.
This should significantly boost performance by pulling in
https://github.com/googleapis/java-core/issues/86 in some cases.
2020-03-05 09:10:09 +01:00
Ignacio Vera 59b841751d
upgrade to lucene-snapshot-fa75139efea (#53150) 2020-03-05 08:47:10 +01:00
Nhat Nguyen 699b1dccac
Upgrade to Lucene 8.5.0-snapshot-c4475920b08 (#52950)
To give LUCENE-9228 more CI cycles
2020-02-28 21:25:34 -05:00
Lee Hinman f8880b4024
Mute GoogleCloudStorageBlobStoreRepositoryTests (#52926)
These intermittently fail due to an assertion triggered by a JDK bug.

Relates to #52906
2020-02-27 15:16:26 -07:00
Mark Vieira 8bb5a11e76
Fix cacheability of repository-hdfs integ tests (#52858) 2020-02-27 09:53:33 -08:00
Mark Vieira 416dc460ce
Ignore test seed in third party test system property inputs (#52849) 2020-02-26 14:29:16 -08:00
Mark Vieira 5c53cc6a83
Don't try to start hdfs fixtures when kerberos is unavailable (#52661) 2020-02-21 13:46:46 -08:00
Mark Vieira c1a1047e42
Consolidate docker availability build logic (#52548) 2020-02-21 08:11:50 -08:00
Armin Braun 556707277f
Fix GCS Test testReadLargeBlobWithRetries (#52619)
The countdown didn't work well here because it only returns `true` once the countdown reaches `0`
but can on subsequent executions return `false` again if a countdown at `0` is counted down again,
leading to more than the expected number of simulated failures.

Closes #52607
2020-02-21 09:13:30 +01:00
Zachary Tong f05b831e43
Comprehensively test supported/unsupported field type:agg combinations (#52493)
This adds a test to AggregatorTestCase that allows us to programmatically
verify that an aggregator supports or does not support a particular
field type.  It fetches the list of registered field type parsers,
creates a MappedFieldType from the parser and then attempts to run
a basic agg against the field.

A supplied list of supported VSTypes are then compared against the
output (success or exception) and suceeds or fails the test accordingly.

Co-Authored-By: Mark Tozzi <mark.tozzi@gmail.com>
* Skip fields that are not aggregatable
2020-02-20 14:08:25 -05:00
Armin Braun f5ca487fc4
Add Caching for RepositoryData in BlobStoreRepository (#52341)
Cache latest `RepositoryData` on heap when it's absolutely safe to do so (i.e. when the repository is in strictly consistent mode).

`RepositoryData` can safely be assumed to not grow to a size that would cause trouble because we often have at least two copies of it loaded at the same time when doing repository operations. Also, concurrent snapshot API status requests currently load it independently of each other and so on, making it safe to cache on heap and assume as "small" IMO.

The benefits of this move are:
* Much faster repository status API calls 
   * listing all snapshot names becomes instant
   * Other operations are sped up massively too because they mostly operate in two steps: load repository data then load multiple other blobs to get the additional data
* Additional cloud cost savings
* Better resiliency, saving another spot where an IO issue could break the snapshot
* We can simplify a number of spots in the current code that currently pass around the repository data in tricky ways to avoid loading it multiple times in follow ups.
2020-02-20 12:58:29 +01:00
markharwood cbd224d070
Upgrade Lucene 8.5 to latest snapshot (#52520)
Upgrade Lucene 8.5 to latest snapshot
2020-02-20 10:34:41 +00:00
Armin Braun c257b56a96
Add Region and Signer Algorithm Overrides to S3 Repos (#52112)
Exposes S3 SDK signing region and algorithm override settings as requested in #51861.

Closes #51861
2020-02-20 11:12:20 +01:00
Armin Braun c665cf022a
Add Blob Download Retries to GCS Repository (#52479)
* Add Blob Download Retries to GCS Repository

Exactly as #46589 (and kept as close to it as possible code wise so we can dry things up in a follow-up potentially) but for GCS.

Closes #52319
2020-02-19 16:11:51 +01:00
Ioannis Kakavas 652bcd46e9
Update BouncyCastle to 1.64 (#52185)
This commit upgrades the bouncycastle dependency from 1.61 to 1.64.
2020-02-18 12:18:31 +02:00
Armin Braun 616fc3baf9
Fix Failure to Drain Stream in GCS Repo Tests (#52431)
Same as #51933 but for the custom handler just used in this test.

Closes #52430
2020-02-18 09:59:08 +01:00
Armin Braun f06f9fa5e4
Refactor Inflexible Snapshot Repository BwC (#52365)
Transport the version to use for  a snapshot instead of whether to use shard generations in the snapshots in progress entry. This allows making upcoming repository metadata changes in a flexible manner in an analogous way to how we handle serialization BwC elsewhere.
Also, exposing the version at the repository API level will make it easier to do BwC relevant changes in derived repositories like source only or encrypted.
2020-02-17 13:07:59 +01:00
Marios Trivyzas e42c4d1b0b
[Tests] Update skip version for YAML tests (#52324)
Update skip versions upper boundary to match the release
or intended release version of the feature/fix.

Relates to #52310
2020-02-13 20:03:48 +01:00
Jay Modi a11ccb83d4
Use List convenience methods in rest actions (#52286)
This commit replaces usages of older collection utility methods with
the JDK 9 convenience method `List.of()`.

Relates #51950
2020-02-12 15:11:22 -07:00
Marios Trivyzas a8b39ed842
Add a cluster setting to disallow expensive queries (#51385)
Add a new cluster setting `search.allow_expensive_queries` which by
default is `true`. If set to `false`, certain queries that have 
usually slow performance cannot be executed and an error message
is returned.

- Queries that need to do linear scans to identify matches:
  - Script queries
- Queries that have a high up-front cost:
  - Fuzzy queries
  - Regexp queries
  - Prefix queries (without index_prefixes enabled
  - Wildcard queries
  - Range queries on text and keyword fields
- Joining queries
  - HasParent queries
  - HasChild queries
  - ParentId queries
  - Nested queries
- Queries on deprecated 6.x geo shapes (using PrefixTree implementation)
- Queries that may have a high per-document cost:
  - Script score queries
  - Percolate queries

Closes: #29050
2020-02-12 18:06:04 +01:00
Armin Braun 96359c3744
Move EC2 Discovery Tests to Mock Rest API (#50605)
Move EC2 discovery tests to using the mock REST API introduced in
https://github.com/elastic/elasticsearch/pull/50550 instead of mocking
the AWS SDK classes manually.
Move the trivial remaining AWS SDK mocks to the single test suit that
was using them.
2020-02-12 17:07:04 +01:00
Ignacio Vera 8b6e6a1639 Upgrade to lucene-8.5.0-snapshot-d62f6307658 (#52039) 2020-02-10 09:08:15 +01:00
Jay Modi 627d853f18 RestHandlers declare handled routes (#51950)
This commit changes how RestHandlers are registered with the
RestController so that a RestHandler no longer needs to register itself
with the RestController. Instead the RestHandler interface has new
methods which when called provide information about the routes
(method and path combinations) that are handled by the handler
including any deprecated and/or replaced combinations.

This change also makes the publication of RestHandlers safe since they
no longer publish a reference to themselves within their constructors.

Closes #51622

Co-authored-by: Jason Tedor <jason@tedor.me>
2020-02-09 21:35:39 -07:00
Ioannis Kakavas 043279a6ff Fix custom policy in plugins in FIPS 140 (#52046)
Our FIPS 140 testing depends on setting the appropriate java policy
in order to configure the JVM in FIPS mode. Some tests (
discovery-ec2 and ccr qa ) also needed to set a custom policy file
to grant a specific permission, which overwrote the FIPS related
policy and tests would fail. This change ensures that when a
custom policy needs to be set in these tests, the permissions that
are necessary for FIPS are also set.

Resolves: #51685, #52034
2020-02-08 11:51:03 +02:00
Julie Tibshirani e0b3ea0416
Rename MapperService#fullName to fieldType. (#52025)
The new name more accurately describes what the method returns.
2020-02-07 10:16:53 -08:00
Armin Braun 26b9cf787d
Add Trace Logging of REST Requests (#51684)
Being able to trace log all REST requests to a node would make debugging
a number of issues a lot easier.
2020-02-06 20:05:03 +01:00
Ioannis Kakavas 12b24bfa57
Test modifications for FIPS 140 mode (#51832)
- Enable SunJGSS provider for Kerberos tests
- Handle the fact that in the decrypt method in KeyStoreWrapper might
not throw immediately when the GCM cipher is from BouncyCastle FIPS
and we end up with a DataInputStream that has reached it's end.
- Disable tests, jarHell, testingConventions for ingest attachment
plugin. We don't support this plugin (and document this) in FIPS
mode.
- Don't attempt to install ingest-attachment in smoke-test-plugins
2020-02-04 19:37:38 +02:00
Maria Ralli 84dd9dc9c0
Add host address to BindTransportException message (#51269)
When bind fails, show the host address in addition to the port. This
helps debugging cases with wrong "network.host" values.

Closes #48001
2020-02-04 08:48:13 +00:00
Ioannis Kakavas ae070f41d9
Adjust jarHell and 3rd party audit exclusions (#51733)
Now that the FIPS 140 security provider is simply a test dependency
we don't need the thirdPartyAudit exceptions, but plugin-cli and
transport-netty4 do need jarHell disabled as they use the non fips
BouncyCastle security provider as a test dependency too.
2020-01-31 19:46:20 +02:00
Tim Brooks ad32c10857
Upgrade netty to 4.1.45.Final (#51689)
Upgrade netty.
2020-01-31 10:33:23 -07:00
Ioannis Kakavas a59095e58a
Mute ec2 test in FIPS 140 mode (#51686)
as it needs an extra permission, until we can figure out how to
grant the permission in FIPS 140 mode too.

See: https://github.com/elastic/elasticsearch/issues/51685
2020-01-30 17:54:43 +02:00
Mayya Sharipova 3d53c48509
Upgrade to lucene-8.5.0-snapshot-3333ce7da6d (#51327)
Remove lucene-spatial module
Keep previous behaviour of FieldHighlighter::highlightOffsetsEnums

LUCENE-9093 modified how FieldHighlighter breaks texts into passages,
which doesn't work well with elasticsearch custome BoundedBreakIteratorScanner.
This commit for now keeps previous behaviour of FieldHighlighter.
2020-01-30 10:08:48 -05:00
Armin Braun 06c5db2220
Optimize GCS Repo Uploads (#51596)
For small uploads (that can still be up to 5MB!) we needlessly
reading the `InputStream` into a BAOS which entailed allocating
the `byte[]` for the stream contents twice (because to `toByteArray` on the BAOS copies).

Also, for resumeable uploads we were needlessly wrapping the output channel and running each individual write in its own privileged context when we could just wrap the whole upload in a single privileged context.

Relates #51593
2020-01-29 15:03:13 +01:00
Armin Braun 0952c2169d
Optimize GCS Mock (#51593)
This test was still very GC heavy in Java 8 runs in particular
which seems to slow down request processing to the point of timeouts
in some runs.
This PR completely removes the large number of O(MB) `byte[]` allocations
that were happening in the mock http handler which cuts the allocation rate
by about a factor of 5 in my local testing for the GC heavy `testSnapshotWithLargeSegmentFiles`
run.

Closes #51446
Closes #50754
2020-01-29 10:04:09 +01:00
Ioannis Kakavas 5de8009093
Revert e34d7fd (#51530)
In e34d7fd we decided to use the default distribution for all tests
when running in a FIPS 140 JVM. This is strictly not necessary in
master, as the problem we originally attempted to fix is that we
set `xpack.security.ssl.diagnose.trust` when running in FIPS 140
JVMs and OSS didn't know of that setting. In master, we do not
need to set `xpack.security.ssl.diagnose.trust` so we don't need
to _always_ run with default distribution.
2020-01-29 08:15:56 +02:00
Armin Braun 89318d46ab
Fix ByteBuf Leak in Nio HTTP Tests (#51444)
It is the job of the http server transport to release the request in the handler
but the mock fails to do so since we never override `incomingRequest`.
2020-01-25 15:05:30 +01:00
Armin Braun 44d5ad9ac6
Stop Copying Bulk HTTP Requests in NIO Networking (#49819)
Same as #44564 but for NIO.
2020-01-24 09:15:44 +01:00
Mark Vieira e34d7fdaf7
Always test against default distribution when in a FIPS JVM (#51273) 2020-01-22 10:55:25 -08:00
Alan Woodward 573c7ddab1
Remove fieldMapper parameter from MetadataFieldMapper.TypeParser#getDefault() (#51219)
This addresses a very old TODO comment in MetadataFieldMapper.TypeParser; passing
in a previously constructed field mapper here was a hack in order to provide access to
prebuilt analyzers for the AllFieldType; this has now been removed, so we can remove
the parameter from this method signature.
2020-01-21 09:18:05 +00:00
Alan Woodward 3d79624843
Revert "Don't use user-supplied type when building DocumentMapper (#50960)" (#51214)
Reverts #50960

This commit has been causing test failures during upgrade tests: specifically, an upgraded
node becomes master and sends a cluster state update to a 7.x node; this node sees that the
mapping version of its .tasks index is the same as the master, so asserts that the serialized
mappings are the same; however, because the master has rewritten the mapping to use
_docinstead oftasks`, we get an assertion failure. The logical fix is for the master to
increment its mapping version when it rewrites the mapping, but there isn't a simple way to
do that currently.

This reverts commit 774bfb5e22.
2020-01-20 11:14:49 +00:00
Armin Braun f4293597fc
Add CoolDown Period to S3 Repository (#51074)
Add cool down period after snapshot finalization and delete to prevent eventually consistent AWS S3 from corrupting shard level metadata as long as the repository is using the old format metadata on the shard level.
2020-01-20 10:32:21 +01:00
Nik Everett 2762375dc4
Move test of custom sig heuristic to plugin (#50891)
This moves the testing of custom significance heuristic plugins from an
`ESIntegTestCase` to an example plugin. This is *much* more "real" and
can be used as an example for anyone that needs to actually build such a
plugin. The old test had testing concerns and the example all jumbled
together.
2020-01-15 15:06:29 -05:00
Mykhailo Havelia 12a8006a38 Change ExampleRescoreBuilder ctor visibility (#50922)
The existing package private visibility of the serialization ctor isn't enough when copying
example code to oder packages or projects when bootstrapping a new project from it.
2020-01-14 21:46:07 +01:00
Alan Woodward 774bfb5e22
Don't use user-supplied type when building DocumentMapper (#50960)
This commit begins the process of removing types from the document parsing
infrastructure. Initially, we just ignore the user-supplied type after it has been
removed from the mapping json structure, and always supply _doc as the name
of the root parser.

The production code change is very small here, and most of the changeset
consists of alterations to Mapper test code that was passing in non-standard
type names and checking serialization.

Relates to #41059
2020-01-14 15:15:19 +00:00
Alan Woodward 2ba5da2eca
Remove type parameter from CIR.mapping(type, object...) (#50739)
This commit removes the type parameter from `CreateIndexRequest.mapping(type, object...)`,
and the associated delegating method on `CreateIndexRequestBuilder`. To make migration
simpler, the method on `CreateIndexRequest` is renamed to `simpleMapping`, and
on `CreateIndexRequestBuilder` to `setMapping`; this should help the compiler catch all
necessary changes on upgrades.

Relates to #41059
2020-01-09 16:02:28 +00:00
Armin Braun 95fcee2d4a
Enforce Logging of Errors in GCS Rest RetriesTests (#50761)
It's impossible to tell why #50754 fails without this change.
We're failing to close the `exchange` somewhere and there is no
write timeout in the GCS SDK (something to look into separately)
only a read timeout on the socket so if we're failing on an assertion without
reading the full request body (at least into the read-buffer) we're locking up
waiting forever on `write0`.

This change ensure the `exchange` is closed in the tests where we could lock up
on a write and logs the failure so we can find out what broke #50754.
2020-01-09 09:43:30 +01:00
Adrien Grand de2c0c660e
Upgrade to Lucene 8.4.0. (#50518) 2020-01-08 17:10:38 +01:00
Armin Braun 88ff69be5d
Fix and Reenable SnapshotTool Minio Tests (#50736)
This solves half of the problem in #46813 by moving the S3
tests to using the shared minio fixture so we at least have
some non-3rd-party, constantly running coverage on these tests.
2020-01-08 15:07:19 +01:00
Alan Woodward a59b065091
Remove type parameter from `CreateIndexRequest.mapping(type, XContentBuilder)` (#50586)
This continues the removal of type parameters from CreateIndexRequest.mapping
methods started in #50419. Here the removed methods are almost entirely in test
code, with the exception of a change to TransformIndex in the transform plugin.

Relates to #41059
2020-01-08 09:18:31 +00:00
Armin Braun 51799dc0d8
Make EC2 Discovery Cache Empty Seed Hosts List (#50607)
Follow up to #50550. Cache empty nodes lists (`fetchDynamicNodes` will return an empty list in case of failure)
now that the plugin properly retries requests to AWS EC2 APIs.
2020-01-03 20:46:00 +01:00
Armin Braun 77fd51f30b
Remove some Dead Code from Discovery Plugins (#50592)
None of this stuff is used.
2020-01-03 13:25:28 +01:00
Armin Braun 789f7908d8
Make EC2 Discovery Plugin Retry Requests (#50550)
Use the default retry condition instead of never retrying in the discovery plugin causing hot retries upstream and add a test that verifies retrying works.

Closes #50462
2020-01-02 16:30:23 +01:00
Alexander Reelsen 0a66fefbf1
Remove accidentally added license files (#50370)
As license infos and sha files belong to the licenses/ folder, these
files seem to have been added accidentally some time ago.
2019-12-20 13:53:11 +01:00
Stuart Tettemer cd721b6386
Scripting: ScriptFactory not required by compile (#50344)
Avoid backwards incompatible changes for 8.x and 7.6 by removing type
restriction on compile and Factory.  Factories may optionally implement
ScriptFactory.  If so, then they can indicate determinism and thus
cacheability.

Relates: #49466
2019-12-19 10:14:28 -07:00
Tanguy Leroux 4fef422976
Remove snapshots left by previous tests failures (#50380)
When a third party test failed, it potentially left some snapshots 
in the repository. In case of tests running against an external 
service like Azure, the remaining snapshots can fail the future 
test executions are they are not supposed to exist.

Similarly to what has been done for S3 and GCS, this commit 
cleans up remaining snapshots before the test execution.

Closes #50304
2019-12-19 17:50:59 +01:00
Armin Braun 24a8071229
Better Logging S3 Bulk Delete Failures (#50203)
Unfortunately bulk delete exceptions don't show the individual delete
errors when a bulk delete fails when you log them outright so I added this work-around
to get the individual details to get useful logging.
2019-12-17 08:54:29 +01:00
Armin Braun abd969e5b8
Remove BlobContainer Tests against Mocks (#50194)
* Remove BlobContainer Tests against Mocks

Removing all these weird mocks as asked for by #30424.
All these tests are now part of real repository ITs and otherwise left unchanged if they had
independent tests that didn't call the `createBlobStore` method previously.
The HDFS tests also get added coverage as a side-effect because they did not have an implementation
of the abstract repository ITs.

Closes #30424
2019-12-16 10:39:26 +01:00
Ignacio Vera 8304977a53
upgrade to lucene 8.4.0-snapshot-08b8d116f8f (#50129) 2019-12-12 12:17:44 +01:00
Armin Braun 1e4d775bfc
Remove Unused Single Delete in BlobStoreRepository (#50024)
* Remove Unused Single Delete in BlobStoreRepository

There are no more production uses of the non-bulk delete or the delete that throws
on missing so this commit removes both these methods.
Only the bulk delete logic remains. Where the bulk delete was derived from single deletes,
the single delete code was inlined into the bulk delete method.
Where single delete was used in tests it was replaced by bulk deleting.
2019-12-12 10:12:03 +01:00
Armin Braun 926d142c0d
Fix GCS Mock Batch Delete Behavior (#50034)
Batch deletes get a response for every delete request, not just those that actually hit an existing blob.
The fact that we only responded for existing blobs leads to a degenerate response that throws a parse exception if a batch delete only contains non-existant blobs.
2019-12-11 16:45:44 +01:00
Adrien Grand 1329acc094
Upgrade to lucene 8.4.0-snapshot-662c455. (#50016)
Lucene 8.4 is about to be released so we should check it doesn't cause problems
with Elasticsearch.
2019-12-10 17:09:36 +01:00
Jason Tedor 87517d96f6
Enable dependent settings values to be validated (#49942)
Today settings can declare dependencies on another setting. This
declaration is implemented so that if the declared setting is not set
when the declaring setting is, settings validation fails. Yet, in some
cases we want not only that the setting is set, but that it also has a
specific value. For example, with the monitoring exporter settings, if
xpack.monitoring.exporters.my_exporter.host is set, we not only want
that xpack.monitoring.exporters.my_exporter.type is set, but that it is
also set to local. This commit extends the settings infrastructure so
that this declaration is possible. The use of this in the monitoring
exporter settings will be implemented in a follow-up.
2019-12-09 12:39:26 -05:00
Stuart Tettemer 356d1a274e
Scripting: Groundwork for caching script results (#49895)
In order to cache script results in the query shard cache, we need to
check if scripts are deterministic.  This change adds a default method
to the script factories, `isResultDeterministic() -> false` which is
used by the `QueryShardContext`.

Script results were never cached and that does not change here.  Future
changes will implement this method based on whether the results of the
scripts are deterministic or not and therefore cacheable.

Refs: #49466
2019-12-06 13:09:44 -07:00
Rafael Acevedo 2e84e83dca Update jackson-databind to 2.8.11.4 (#49347) 2019-12-06 12:38:15 -06:00
Alexander Reelsen 5ab459122f
Add tests for ingesting CBOR data attachments (#49715)
Our docs specifically mention that CBOR is supported when ingesting attachments. However this is not tested anywhere.

This adds a test, that uses specifically CBOR format in its IndexRequest and another one that behaves like CBOR in the ingest attachment unit tests.
2019-12-06 14:33:02 +01:00
Stuart Tettemer 4a078029ed
Scripting: add available languages & contexts API (#49652)
Adds `GET /_script_language` to support Kibana dynamic scripting
language selection.

Response contains whether `inline` and/or `stored` scripts are
enabled as determined by the `script.allowed_types` settings.

For each scripting language registered, such as `painless`,
`expression`, `mustache` or custom, available contexts for the language
are included as determined by the `script.allowed_contexts` setting.

Response format:
```
{
  "types_allowed": [
    "inline",
    "stored"
  ],
  "language_contexts": [
    {
      "language": "expression",
      "contexts": [
        "aggregation_selector",
        "aggs"
        ...
      ]
    },
    {
      "language": "painless",
      "contexts": [
        "aggregation_selector",
        "aggs",
        "aggs_combine",
        ...
      ]
    }
...
  ]
}
```

Fixes: #49463
2019-12-03 18:55:48 -07:00
Armin Braun 5ddf9203f1
Stop Copying Every Http Request in Message Handler (#44564)
* Copying the request is not necessary here. We can simply release it once the response has been generated and a lot of `Unpooled` allocations that way
* Relates #32228
   * I think the issue that preventet that PR  that PR from being merged was solved by #39634 that moved the bulk index marker search to ByteBuf bulk access so the composite buffer shouldn't require many additional bounds checks  (I'd argue the bounds checks we add, we save when copying the composite buffer)
* I couldn't neccessarily reproduce much of a speedup from this change, but I could reproduce a very measureable reduction in GC time with e.g. Rally's PMC (4g heap node and bulk requests of size 5k saw a reduction in young GC time by ~10% for me)
2019-12-03 22:44:20 +01:00
Armin Braun 459d8edcc0
Make BlobStoreRepository Aware of ClusterState (#49639)
This is a preliminary to #49060.

It does not introduce any substantial behavior change to how the blob store repository
operates. What it does is to add all the infrastructure changes around passing the cluster service to the blob store, associated test changes and a best effort approach to tracking the latest repository generation on all nodes from cluster state updates. This brings a slight improvement to the consistency
by which non-master nodes (or master directly after a failover) will be able to determine the latest repository generation. It does not however do any tricky checks for the situation after a repository operation
(create, delete or cleanup) that could theoretically be used to get even greater accuracy to keep this change simple.
This change does not in any way alter the behavior of the blobstore repository other than adding a better "guess" for the value of the latest repo generation and is mainly intended to isolate the actual logical change to how the
repository operates in #49060
2019-11-29 10:14:53 +01:00
Christoph Büscher c23c4ae4a4
Small fix in ICUCollationKeywordFieldMapperIT (#49656)
The test was slightly modified with #49166, the two test documents in
`testNormalization` look like they should mirror the document id in the "id"
field in order for it to work as a tie breaker.

Closes #49654
2019-11-27 21:37:30 +01:00
Jim Ferenczi c2deb287f1
Add a cluster setting to disallow loading fielddata on _id field (#49166)
This change adds a dynamic cluster setting named `indices.id_field_data.enabled`.
When set to `false` any attempt to load the fielddata for the `_id` field will fail
with an exception. The default value in this change is set to `false` in order to prevent
fielddata usage on this field for future versions but it will be set to `true` when backporting
to 7x. When the setting is set to true (manually or by default in 7x) the loading will also issue
a deprecation warning since we want to disallow fielddata entirely when https://github.com/elastic/elasticsearch/issues/26472
is implemented.

Closes #43599
2019-11-27 13:38:09 +01:00
Armin Braun f4e39cd932
Remove Redundant EsBlobStoreTestCase (#49603)
All the implementations of `EsBlobStoreTestCase` use the exact same
bootstrap code that is also used by their implementation of
`EsBlobStoreContainerTestCase`.
This means all tests might as well live under `EsBlobStoreContainerTestCase`
saving a lot of code duplication. Also, there was no HDFS implementation for
`EsBlobStoreTestCase` which is now automatically resolved by moving the tests over
since there is a HDFS implementation for the container tests.
2019-11-26 18:17:28 +01:00
Alan Woodward 563b2736a9
Annotated text type should extend TextFieldType (#49555)
The annotated text mapper has a field type that currently extends StringFieldType,
which means that all the positional-related query factory methods need to be copied
over from TextFieldType. In addition, MappedFieldType.intervals() hasn't been
overridden, so you can't use intervals queries with annotated text - a major drawback,
since one of the purposes of annotated text is to be able to run positional queries against
annotations.

This commit changes the annotated text field type to extend TextFieldType instead,
adding tests to ensure that position queries work correctly.

Closes #49289
2019-11-26 16:51:41 +00:00
Armin Braun 5f57c7efc7
Improve Stability of GCS Mock API (#49592)
Same as #49518 pretty much but for GCS.
Fixing a few more spots where input stream can get closed
without being fully drained and adding assertions to make sure
it's always drained.
Moved the no-close stream wrapper to production code utilities since
there's a number of spots in production code where it's also useful
(will reuse it there in a follow-up).
2019-11-26 15:21:46 +01:00
Ioannis Kakavas 92f1631407
Adjustments for FIPS 140 testing (#49319)
- Don't install ingest-attachment and don't run the related docs
tests, since ingest-attachment is not supported in FIPS 140 JVMs
- Move copying extra jars and extra config files earlier on in the
node configuration so that elasticsearch-keystore and
elasticsearch-plugin that run before the node starts have all files
(policy, properties, jars) available.
- BCJSSE needs a certificate to be explicitly added in a keystore 
as a trustedcerty entry, it's not enough for it to be in privatekeyentry 
for it to be trusted
- Set the value for BuildParams.inFipsJvm configuration time
2019-11-22 09:11:07 +02:00
Armin Braun ff1c2c337b
Fix Azure Mock Issues (#49377)
Fixing a few small issues found in this code:
1. We weren't reading the request headers but the response headers when checking for blob existence in the mocked single upload path
2. Error code can never be `null` removed the dead code that resulted
3. In the logging wrapper we weren't checking for `Throwable` so any failing assertions in the http mock would not show up since they
run on a thread managed by the mock http server
2019-11-20 15:38:48 +01:00
Tanguy Leroux 38de0336ed
Mute AzureBlobStoreRepositoryTests (#49364)
Relates #48978
2019-11-20 05:13:56 -05:00
Tanguy Leroux b07d1107c8
HttpHandlers should return correct list of objects (#49283)
This commit fixes the server side logic of "List Objects" operations 
of Azure and S3 fixtures. Until today, the fixtures were returning a "
flat" view of stored objects and were not correctly handling the 
delimiter parameter. This causes some objects listing to be wrongly 
interpreted by the snapshot deletion logic in Elasticsearch which 
relies on the ability to list child containers of BlobContainer (#42653) 
to correctly delete stale indices.

As a consequence, the blobs were not correctly deleted from the
 emulated storage service and stayed in heap until they got garbage 
collected, causing CI failures like #48978.

This commit fixes the server side logic of Azure and S3 fixture when 
listing objects so that it now return correct common blob prefixes as 
expected by the snapshot deletion process. It also adds an after-test 
check to ensure that tests leave the repository empty (besides the 
root index files).

Closes #48978
2019-11-19 09:55:36 -05:00
Tanguy Leroux 3e569014d1
Add docker-compose fixtures for S3 integration tests (#49107)
Similarly to what has been done for Azure (#48636) and GCS (#48762), 
this committ removes the existing Ant fixture that emulates a S3 storage 
service in favor of multiple docker-compose based fixtures.

The goals here are multiple: be able to reuse a s3-fixture outside of the 
repository-s3 plugin; allow parallel execution of integration tests; removes 
the existing AmazonS3Fixture that has evolved in a weird beast in 
dedicated, more maintainable fixtures.

The server side logic that emulates S3 mostly comes from the latest 
HttpHandler made for S3 blob store repository tests, with additional 
features extracted from the (now removed) AmazonS3Fixture: 
authentication checks, session token checks and improved response 
errors. Chunked upload request support for S3 object has been added 
too. 

The server side logic of all tests now reside in a single S3HttpHandler class.

Whereas AmazonS3Fixture contained logic for basic tests, session token 
tests, EC2 tests or ECS tests, the S3 fixtures are now dedicated to each 
kind of test. Fixtures are inheriting from each other, making things easier 
to maintain.
2019-11-18 03:50:13 -05:00
Alan Woodward c1c7fa5d9c
Remove type field from internal PutMappingRequest (#48793)
External API requests can no longer include types, so we have no need to pass this
information along in internal PutMappingClusterStateUpdateRequest objects, or on
PutMappingRequests used by the internal node client.

Relates to #41059
2019-11-14 13:20:39 +00:00
Tanguy Leroux 8e18356609
Move MinIO fixture in its own project (#48921)
This commit moves the MinIO docker-compose fixture from the 
:plugins:repository-s3 to its own :test:minio-fixture Gradle project.
2019-11-13 08:20:20 -05:00
Rory Hunter 3a3e5f6176
Apply 2-space indent to all gradle scripts (#48849)
Closes #48724. Update `.editorconfig` to make the Java settings the default
for all files, and then apply a 2-space indent to all `*.gradle` files.
Then reformat all the files.
2019-11-13 10:14:04 +00:00
Tanguy Leroux 625c00ddd6
Add docker-composed based test fixture for GCS (#48762)
Similarly to what has be done for Azure in #48636, this commit 
adds a new :test:fixtures:gcs-fixture project which provides two 
docker-compose based fixtures that emulate a Google Cloud 
Storage service.

Some code has been extracted from existing tests and placed 
into this new project so that it can be easily reused in other 
projects.
2019-11-07 11:17:06 -05:00
Armin Braun be6697f05a
Remove Blocking Connect Methods from TransportService (#48841)
We're not doing any blocking connects in production code anymore
so we can move these helpers to test code only.
Also, we were only tracking the proper closing of blockingly opened
connections on the mock transport service but didn't check those
created via the non-blocking API which is fixed here too.
2019-11-04 19:56:07 +01:00
Mark Vieira af6af346f7
Introduce type-safe and consistent pattern for handling build globals (#48778)
This commit introduces a consistent, and type-safe manner for handling
global build parameters through out our build logic. Primarily this
replaces the existing usages of extra properties with static accessors.
It also introduces and explicit API for initialization and mutation of
any such parameters, as well as better error handling for uninitialized
or eager access of parameter values.

Closes #42042
2019-11-01 09:54:22 -07:00
Tanguy Leroux 3e4791a4be
Add docker-compose based test fixture for Azure (#48636)
This commit adds a new :test:fixtures:azure-fixture project which 
provides a docker-compose based container that runs a AzureHttpFixture 
Java class that emulates an Azure Storage service.

The logic to emulate the service is extracted from existing tests and 
placed in AzureHttpHandler into the new project so that it can be 
easily reused. The :plugins:repository-azure project is an example 
of such utilization.

The AzureHttpFixture fixture is just a wrapper around AzureHttpHandler 
and is now executed within the docker container. 

The :plugins:repository-azure:qa:microsoft-azure project uses the new 
test fixture and the existing AzureStorageFixture has been removed.
2019-10-31 09:28:21 +01:00
Alan Woodward dbd33f7764
Remove type parameter from MapperService.documentMapper() (#48593)
We only have a single mapper per MapperService now anyway, so the extra
type parameter is surplus to requirements.

Relates to #41059
2019-10-30 09:50:23 +00:00
Mayya Sharipova 3514485991
Upgrade lucene to 8.4.0-snapshot-e648d601efb (#48607) 2019-10-29 05:44:29 -04:00
Tanguy Leroux 47a1fc1643
Reduce allocations when draining HTTP requests bodies in repository tests (#48541)
In repository integration tests, we drain the HTTP request body before 
returning a response. Before this change this operation was done using
Streams.readFully() which uses a 8kb buffer to read the input stream, it
 now uses a 1kb for the same operation. This should reduce the allocations 
made during the tests and speed them up a bit on CI.

Co-authored-by: Armin Braun <me@obrown.io>
2019-10-29 09:12:59 +01:00
Tim Brooks d084b93d74
Upgrade to Netty 4.1.43 (#48484)
With this update we can remove the mitigation in our custom allocator
which forces heap buffer allocations.
2019-10-25 09:36:07 -06:00
Tanguy Leroux 1998a10424
Add missing azure error code (#48520)
In #47176 we changed the internal HTTP server that emulates 
the Azure Storage service so that it includes a response body 
for injected errors. This fixed most of the issues reported in 
#47120 but sadly I missed to map one error to its Azure 
equivalent, and it triggered some CI failures today.

Closes #47120
2019-10-25 16:46:47 +02:00
Alan Woodward 750c6d8bb1
Remove Client.prepareIndex(index, type, id) method (#48443)
As types are no longer used in index requests, we can remove the type parameter
from `prepareIndex` methods in the `Client` interface. However, just changing the signature
of `prepareIndex(index, type, id)` to `prepareIndex(index, id)` risks confusion when
upgrading with the previous (now removed) `prepareIndex(index, type)` method -
just changing the dependency version of java code would end up silently changing the
semantics of the method call. Instead we should just remove this method entirely, and
replace it by calling `prepareIndex(index).setId(id)`
2019-10-25 11:09:52 +01:00
Alan Woodward 8b9bed9ea6
Remove type parameter from ESIntegTestCase sugar methods (#48451)
ESIntegTestCase has a number of sugar index methods that prepare and execute
index requests. Now that index requests no longer use types, we can remove the
type parameter from each of these.

To prevent issues when re-compiling against the test framework, the method
`index(String index, String id, Object... source)` is renamed to `indexDoc`
so that e.g. `index(index, type, id, field1, field2, field3)` does not get re-interpreted
as an index request with an id of `type`.
2019-10-25 10:29:32 +01:00
Alan Woodward e85e3a8a63
Remove type parameter from Client.prepareIndex/Delete/Update(index, type) (#48185)
Types are no longer used in IndexRequest, DeleteRequest or UpdateRequest; 
this commit removes them from the prepareX(index, type) methods on Client, as well as removing setType() and deprecated constructors on XRequestBuilder objects.

Note that Client.prepareIndex(index, type, id) is not affected by this PR and will be removed
in a followup.

Relates to #41059
2019-10-23 16:58:08 +01:00
Tanguy Leroux ed667be78c
Differentiate service account tokens in GCS tests (#48382)
This commit changes the test so that each node use a specific 
service account and private key. It also changes how unique 
request ids are generated for refresh token request using the 
token itself, so that error count will be specific per node (each 
node should execute a single refresh token request as tokens 
are valid for 1 hour).
2019-10-23 16:54:23 +02:00
Tanguy Leroux a6b8d0d1fa
Reenable azure repository tests and remove some randomization in http servers (#48283)
Relates #47948
Relates #47380
2019-10-22 11:40:24 +02:00
Tim Brooks 458de91256
Make BytesReference an interface (#48171)
BytesReference is currently an abstract class which is extended by
various implementations. This makes it very difficult to use the
delegation pattern. The implication of this is that our releasable
BytesReference is a PagedBytesReference type and cannot be used as a
generic releasable bytes reference that delegates to any reference type.
This commit makes BytesReference an interface and introduces an
AbstractBytesReference for common functionality.
2019-10-21 13:15:39 -06:00
Alan Woodward afeee4be9e
Remove type filter from GetMappings API (#47364)
This commit removes the types filter from the GetMappings API, which is no longer
useful seeing as we can only have a single mapping type per index. It also changes
the structure of GetMappingsResponse and GetIndexResponse to remove the extra
nesting of mappings below the no-longer-relevant type name, and removes the types
methods from the equivalent request classes.

Relates to #41059
2019-10-21 10:10:34 +01:00
Ignacio Vera cef9883324
upgrade to Lucene-snapshot-25968e3b75e (#48203) 2019-10-18 07:48:52 +02:00
Alan Woodward 6531369f11
Don't persist type information to translog (#47229)
We no longer need to store type information in the translog, given that an index
can only have a single type.

Relates to #41059
2019-10-15 09:05:29 +01:00
Armin Braun 58c62c56fe
Fix Bug in Azure Repo Exception Handling (#47968)
We were incorrectly handling `IOExceptions` thrown by
the `InputStream` side of the upload operation, resulting
in a `ClassCastException` as we expected to never get
`IOException` from the Azure SDK code but we do in practice.
This PR also sets an assertion on `markSupported` for the
streams used by the SDK as adding the test for this scenario
revealed that the SDK client would retry uploads for
non-mark-supporting streams on `IOException` in the `InputStream`.
2019-10-15 03:40:28 +02:00
Tim Brooks d7ae6de480
Upgrade to Netty 4.1.42 (#48015)
Upgrades the netty version.
2019-10-14 13:39:08 -06:00
Nick Knize 968632424f
Mute AzureBlobStoreRepositoryTests.testIndicesDeletedFromRepository (#47949) 2019-10-11 14:06:15 -05:00
Armin Braun c74527e4bb
Simplify some Common ActionRunnable Uses (#47799)
Especially in the snapshot code there's a lot
of logic chaining `ActionRunnables` in tricky
ways now and the code is getting hard to follow.
This change introduces two convinience methods that
make it clear that a wrapped listener is invoked with
certainty in some trickier spots and shortens the code a bit.
2019-10-09 22:16:53 +02:00
Jim Ferenczi a8dae10edb
Remove the SearchContext from the highlighter context (#47733)
Today built-in highlighter and plugins have access to the SearchContext through the
highlighter context. However most of the information exposed in the SearchContext are not needed and a QueryShardContext
would be enough to perform highlighting. This change replaces the SearchContext by the informations that are absolutely
required by highlighter: a QueryShardContext and the SearchContextHighlight. This change allows to reduce the exposure of the
complex SearchContext and remove the needs to clone it in the percolator sub phase.

Relates #47198
Relates #46523
2019-10-09 14:40:05 +02:00
Ignacio Vera 4e91caee59
upgrade to Lucene-8.3.0-snapshot-47aece66b48 (#47770) 2019-10-09 12:21:59 +02:00
Alan Woodward 7a622f024f
Remove types from BulkRequest (#46983)
This commit removes types entirely from BulkRequest, both as a global
parameter and as individual entries on update/index/delete lines.

Relates to #41059
2019-10-07 13:29:12 +01:00
Ryan Ernst d8b4556e2d
Add explanations to script score queries (#46693)
While function scores using scripts do allow explanations, they are only
creatable with an expert plugin. This commit improves the situation for
the newer script score query by adding the ability to set the
explanation from the script itself.

To set the explanation, a user would check for `explanation != null` to
indicate an explanation is needed, and then call
`explanation.set("some description")`.
2019-10-03 19:35:59 -07:00
Alpar Torok ca54b442bf
Remove eclipse conditionals (#44075)
* Remove eclipse conditionals

We used to have some meta projects with a `-test` prefix because
historically eclipse could not distinguish between test and main
source-sets and could only use a single classpath.
This is no longer the case for the past few Eclipse versions.

This PR adds the necessary configuration to correctly categorize source
folders and libraries.
With this change eclipse can import projects, and the visibility rules
are correct e.x. auto compete doesn't offer classes from test code or
`testCompile` dependencies when editing classes in `main`.

Unfortunately the cyclic dependency detection in Eclipse doesn't seem to
take the difference between test and non test source sets into account,
but since we are checking this in Gradle anyhow, it's safe to set to
`warning` in the settings. Unfortunately there is no setting to ignore
it.

This might cause problems when building since Eclipse will probably not
know the right order to build things in so more wirk might be necesarry.
2019-10-03 10:50:46 +03:00
Tanguy Leroux 4c90ec604e
Differentiate base paths in repository integration tests (#47284)
This commit change the repositories base paths used in Azure/S3/GCS 
integration tests so that they don't conflict with each other when tests 
run in parallel on real storage services.

Closes #47202
2019-09-30 16:50:50 +02:00
Henning Andersen f487495e02
Mute azure third party tests (#47205)
Muted testCreateSnapshot, testCleanup and testListChildren

Relates #47202
2019-09-27 20:44:32 +02:00
James Rodewig 0b07befb1b
[DOCS] Correct typo in ICU Analysis plugin description (#47175) 2019-09-27 10:48:00 -04:00
Henning Andersen 77fa6cf8c8
Mute Snapshot/Restore with repository-azure (#47204)
Relates #47201
2019-09-27 12:05:41 +02:00
Tanguy Leroux c5b9cdac81
Injected response errors in Azure repository tests should have a body (#47176)
The Azure SDK client expects server errors to have a body, 
something that looks like:

<?xml version="1.0" encoding="utf-8"?>  
<Error>  
  <Code>string-value</Code>  
  <Message>string-value</Message>  
</Error> 

I've forgot to add such errors in Azure tests and that triggers 
some NPE in the client like the one reported in #47120.

Closes #47120
2019-09-27 09:30:00 +02:00
Tanguy Leroux b1a03a137f
Remove unused private methods and fields (#47115)
This commit removes a bunch of unused private fields and 
unused private methods from the code base.
2019-09-26 09:35:57 +02:00
Tanguy Leroux 707ff24774
Add blob container retries tests for Azure SDK client (#47032)
Similarly to what has been done for S3 and GCS, this commit adds unit tests that verify the retry logic of the Azure SDK client implementation when the remote service returns errors.

It only tests the retry logic in case of errors and not in case of timeouts because Azure client timeout options are not exposed as settings.
2019-09-25 09:18:44 +02:00
seanmcrw 9c266cda03 Update AWS SDK for repository-s3 plugin to support IAM Roles for Service Accounts (#46969)
* Update AWS SDK for repository-s3 and discovery-ec2 plugins
2019-09-24 13:11:35 +02:00
Tanguy Leroux 60619126db
Add blob container retries tests for Google Cloud Storage (#46968)
Similarly to what has been done for S3 in #45383, this commit 
adds unit tests that verify the behavior of the SDK client and 
blob container implementation for Google Storage when the 
remote service returns errors.

The main purpose was to add an extra test to the specific retry 
logic for 410-Gone errors added in #45963.

Relates #45963
2019-09-24 08:57:39 +02:00
Alpar Torok 2afe2aa5f2
Testfixtures allow a single service only (#46780)
This PR adds some restrictions around testfixtures to make sure the same service ( as defiend in docker-compose.yml ) is not shared between multiple projects.
Sharing would break running with --parallel.

Projects can still share fixtures as long as each has it;s own service within.
This is still useful to share some of the setup and configuration code of the fixture.

Project now also have to specify a service name when calling useCluster to refer to a specific service.
If this is not the case all services will be claimed and the fixture can't be shared.
For this reason fixtures have to explicitly specify if they are using themselves ( fixture and tests in the same project ).
2019-09-23 12:48:47 +03:00
Alan Woodward 7c90801aff
Remove types from Get/MultiGet (#46587)
This commit removes types from the ShardGetService, and propagates this API change
up through the Transport and Rest actions for Get and MultiGet

Relates to #41059
2019-09-20 14:22:57 +01:00
Tanguy Leroux 35054c6222
GCS deleteBlobsIgnoringIfNotExists should catch StorageException (#46832)
GoogleCloudStorageBlobStore.deleteBlobsIgnoringIfNotExists() does 
not correctly catch StorageException thrown by batch.submit().

In the case a snapshot is deleted through BlobStoreRepository.deleteSnapshot() 
a storage exception is not caught (only IOException are) so the deletion is 
interrupted and indices cannot be cleaned up. The storage exception bubbles 
up to SnapshotService.deleteSnapshotFromRepository() but the listener that
 removes the deletion from the cluster state is not executed, leaving the 
deletion in the cluster state.

This bug has been reported in #46772 where batch.submit() threw an 
exception in the test testIndicesDeletedFromRepository and following 
tests failed because a snapshot deletion was running.

Relates #46772
2019-09-20 09:52:50 +02:00
Tanguy Leroux 20c4e45614
Move testSnapshotWithLargeSegmentFiles to ESMockAPIBasedRepositoryIntegTestCase (#46802)
This commit moves the common test testSnapshotWithLargeSegmentFiles 
to the ESMockAPIBasedRepositoryIntegTestCase base class.
2019-09-18 15:30:51 +02:00
Tanguy Leroux dccee86766
Add block support to AzureBlobStoreRepositoryTests (#46664)
This commit adds support for Put Block API to the internal HTTP server
used in Azure repository integration tests. This allows to test the
behavior of the Azure SDK client when the Azure Storage service
returns errors when uploading Blob in multiple blocks or when
downloading a blob using ranged downloads.
2019-09-18 09:42:16 +02:00
Tanguy Leroux 8861ac6e6f
Add support for Multipart upload to S3 repository integration tests (#46704)
This commit adds support for Multipart upload to the internal HTTP 
server used in S3 repository integration tests.
2019-09-18 09:39:17 +02:00
Tanguy Leroux 96abfe1ad1
Add resumable uploads support to GCS repository integration tests (#46562)
This commit adds support for resumable uploads to the internal HTTP 
server used in GoogleCloudStorageBlobStoreRepositoryTests. This 
way we can also test the behavior of the Google's client when the 
service returns server errors in response to resumable upload requests.

The BlobStore implementation for GCS has the choice between 2 
methods to upload a blob: resumable and multipart. In the current 
implementation, the client executes a resumable upload if the blob 
size is larger than LARGE_BLOB_THRESHOLD_BYTE_SIZE, 
otherwise it executes a multipart upload. This commit makes this 
logic overridable in tests, allowing to randomize the decision of 
using one method or the other.

The commit add support for single request resumable uploads 
and chunked resumable uploads (the blob is uploaded into multiple 
2Mb chunks; each chunk being a resumable upload). For this last 
case, this PR also adds a test testSnapshotWithLargeSegmentFiles 
which makes it more probable that a chunked resumable upload is 
executed.
2019-09-18 09:32:14 +02:00
Armin Braun 3f9e86b709
Retry GCS Resumable Upload on Error 410 (#45963)
A resumable upload session can fail on with a 410 error and should
be retried in that case. I added retrying twice using resetting of
the given `InputStream` as the retry mechanism since the same
approach is used by the AWS S3 SDK already as well and relied upon
by the S3 repository implementation.

Related GCS documentation:
https://cloud.google.com/storage/docs/json_api/v1/status-codes#410_Gone
2019-09-17 16:20:14 +02:00
David Turner d391446e88
Resume partial download from S3 on connection drop (#46589)
Today if the connection to S3 times out or drops after starting to download an
object then the SDK does not attempt to recover or resume the download, causing
the restore of the whole shard to fail and retry. This commit allows
Elasticsearch to detect such a mid-stream failure and to resume the download
from where it failed.
2019-09-17 13:10:55 +01:00
Armin Braun 888f203b5d
Fix Expected Azure API Status Code (#46729)
We expect a `403` and not a `401` here for failing
to perform the listing.
Closes #46710
2019-09-17 09:22:30 +02:00
Armin Braun 6059f8e8da
Ensure SAS Tokens in Test Use Minimal Permissions (#46112)
* Ensure SAS Tokens in Test Use Minimal Permissions

There were some issues with the Azure implementation requiring
permissions to list all containers ue to a container exists
check. This was caught in CI this time, but going forward we
should ensure that CI is executed using a token that does not
allow listing containers.

Relates #43288
2019-09-11 19:51:48 +02:00
Mark Vieira 184cc4d8ed
Repository plugin test cacheability fixes (#46572) 2019-09-11 08:24:32 -07:00
Luca Cavanna c512214cdc
Update http-core and http-client dependencies (#46549)
* Update http-core and http-client dependencies

Relates to #45808
Closes #45577

* update shas dependencies

* update test
2019-09-11 13:42:32 +02:00
Tanguy Leroux 62a516de88
Mutualize code in cloud-based repository integration tests (#46483)
This commit factors out some common code between the cloud-based 
repository integration tests that were recently improved.

Relates #46376
2019-09-09 15:51:24 +02:00
Tanguy Leroux 3cef830ff6
Inject random server errors in AzureBlobStoreRepositoryTests (#46371)
This commit modifies the HTTP server used in 
AzureBlobStoreRepositoryTests so that it randomly returns 
server errors for any type of request executed by the Azure client.
2019-09-09 09:59:01 +02:00
Tanguy Leroux 3d4c0c6a87
Inject random server errors in GoogleCloudStorageBlobStoreRepositoryTests (#46376)
This commit modifies the HTTP server used in 
GoogleCloudStorageBlobStoreRepositoryTests so that it randomly 
returns server errors. The test does not inject server errors for the 
following types of request: batch request, resumable upload request.
2019-09-09 09:57:43 +02:00
David Turner 23155532d8
Add support for OneZoneInfrequentAccess storage (#46436)
The `repository-s3` plugin has supported a storage class of `onezone_ia` since
the SDK upgrade in #30723, but we do not test or document this fact. This
commit adds this storage class to the docs and adds a test to ensure that the
documented storage classes are all accepted by S3 too.

Fixes #30474
2019-09-09 07:54:02 +01:00
Tanguy Leroux 0321073ae6
Fix usage of randomIntBetween() in testWriteBlobWithRetries (#46380)
This commit fixes the usage of randomIntBetween() in the test 
testWriteBlobWithRetries, when the test generates a random array  
of a single byte.
2019-09-06 09:10:06 +02:00
Tanguy Leroux 4726e1e6b3
Replace mocked client in GCSBlobStoreRepositoryTests by HTTP server (#46255)
This commit removes the usage of MockGoogleCloudStoragePlugin in 
GoogleCloudStorageBlobStoreRepositoryTests and replaces it by a 
HttpServer that emulates the Storage service. This allows the repository 
tests to use the real Google's client under the hood in tests and will allow 
us to test the behavior of the snapshot/restore feature for GCS repositories 
by simulating random server-side internal errors.

The HTTP server used to emulate the Storage service is intentionally simple 
and minimal to keep things understandable and maintainable. Testing full 
client options on the server side (like authentication, chunked encoding 
etc) remains the responsibility of the GoogleCloudStorageFixture.
2019-09-05 09:25:23 +02:00
Tanguy Leroux dfc74c096b
Add repository integration tests for Azure (#46263)
Similarly to what had been done for S3 (#46081) and GCS (#46255) 
this commit adds repository integration tests for Azure, based on an 
internal HTTP server instead of mocks.
2019-09-05 09:22:42 +02:00
Tanguy Leroux 69abc64413
Disable request throttling in S3BlobStoreRepositoryTests (#46226)
When some high values are randomly picked up - for example the number 
of indices to snapshot or the number of snapshots to create - the tests in S3BlobStoreRepositoryTests can generate a high number of requests to 
the internal S3 server.

In order to test the retry logic of the S3 client, the internal server is 
designed to randomly generate random server errors. When many
 requests are made, it is possible that the S3 client reaches its maximum 
number of successive retries capacity. Then the S3 client will stop 
retrying requests until enough retry attempts succeed, but it means 
that any request could fail before reaching the max retries count and 
make the test fail too.

Closes #46217
Closes #46218
Closes #46219
2019-09-02 16:41:18 +02:00
Henning Andersen dd487a0ab9
Mute 2 tests in S3BlobStoreRepositoryTests (#46221)
Muted testSnapshotAndRestore and testMultipleSnapshotAndRollback

Relates #46218 and #46219
2019-09-02 10:37:32 +02:00
Tanguy Leroux bf838f6608
Inject random errors in S3BlobStoreRepositoryTests (#46125)
This commit modifies the HTTP server used in S3BlobStoreRepositoryTests 
so that it randomly returns server errors for any type of request executed by
 the SDK client. It is now possible to verify that the repository tests are s
uccessfully completed even if one or more errors were returned by the S3 
service in response of a blob upload, a blob deletion or a object listing request 
etc.

Because injecting errors forces the SDK client to retry requests, the test limits
 the maximum errors to send in response for each request at 3 retries.
2019-08-30 10:00:32 +02:00
Jason Tedor 2bcfe1a2d8
Remove insecure settings (#46147)
This commit removes the oxymoron of insecure secure settings from the
code base. In particular, we remove the ability to set the access_key
and secret_key for S3 repositories inside the repository definition (in
the cluster state). Instead, these settings now must be in the
keystore. Thus, it also removes some leniency where these settings could
be placed in the elasticsearch.yml, would not be rejected there, but
would not be consumed for any purpose.
2019-08-29 21:25:20 -04:00
Tanguy Leroux 7dbf2df949
Replace MockAmazonS3 usage in S3BlobStoreRepositoryTests by a HTTP server (#46081)
This commit removes the usage of MockAmazonS3 in S3BlobStoreRepositoryTests 
and replaces it by a HttpServer that emulates the S3 service. This allows the 
repository tests to use the real Amazon's S3 client under the hood in tests and will 
allow to test the behavior of the snapshot/restore feature for S3 repositories by 
simulating random server-side internal errors.

The HTTP server used to emulate the S3 service is intentionally simple and minimal 
to keep things understandable and maintainable. Testing full client options on the 
server side (like authentication, chunked encoding etc) remains the responsibility 
of the AmazonS3Fixture.
2019-08-29 13:15:48 +02:00
Armin Braun f7fedc3090
Upgrade to Azure SDK 8.4.0 (#46094)
* Upgrading to 8.4.0 here which brings bulk deletes to be used in a follow up PR
2019-08-29 10:22:16 +02:00
Tanguy Leroux 1dcc4ed3eb
Few clean ups in ESBlobStoreRepositoryIntegTestCase (#46068) 2019-08-28 16:13:31 +02:00
Jason Tedor 268881ecc9
Remove node settings from blob store repositories (#45991)
This commit starts from the simple premise that the use of node settings
in blob store repositories is a mistake. Here we see that the node
settings are used to get default settings for store and restore throttle
rates. Yet, since there are not any node settings registered to this
effect, there can never be a default setting to fall back to there, and
so we always end up falling back to the default rate. Since this was the
only use of node settings in blob store repository, we move them. From
this, several places fall out where we were chaining settings through
only to get them to the blob store repository, so we clean these up as
well. That leaves us with the changeset in this commit.
2019-08-26 16:10:25 -04:00
Tanguy Leroux a526d9c54a
Refactor RepositoryCredentialsTests (#45919)
This commit refactors the S3 credentials tests in 
RepositoryCredentialsTests so that it now uses a single 
node (ESSingleNodeTestCase) to test how secure/insecure 
credentials are overriding each other. Using a single node 
makes it much easier to understand what each test is actually 
testing and IMO better reflect how things are initialized.

It also allows to fold into this class the test 
testInsecureRepositoryCredentials which was wrongly located 
in S3BlobStoreRepositoryTests. By moving this test away, the 
S3BlobStoreRepositoryTests class does not need the 
allow_insecure_settings option anymore and thus can be 
executed as part of the usual gradle test task.
2019-08-26 14:53:31 +02:00
Tanguy Leroux 9dc6f0d7d9
Allow partial request body reads in AWS S3 retries tests (#45847)
This commit changes the tests added in #45383 so that the fixture that 
emulates the S3 service now sometimes consumes all the request body 
before sending an error, sometimes consumes only a part of the request 
body and sometimes consumes nothing. The idea here is to beef up a bit 
the tests that writes blob because the client's retry logic relies on 
marking and resetting the blob's input stream.

This pull request also changes the testWriteBlobWithRetries() so that it 
(rarely) tests with a large blob (up to 1mb), which is more than the client's 
default read limit on input streams (131Kb).

Finally, it optimizes the ZeroInputStream so that it is a bit more effective 
(now works using an internal buffer and System.arraycopy() primitives).
2019-08-23 13:38:52 +02:00
Jason Tedor 7cb26efbb8
Remove binary file accidentally committed
🤦‍♀️
2019-08-22 17:34:38 -04:00
Jason Tedor d05101b9e5
Add node.processors setting in favor of processors (#45855)
This commit namespaces the existing processors setting under the "node"
namespace. In doing so, we deprecate the existing processors setting in
favor of node.processors.
2019-08-22 17:19:40 -04:00
Tanguy Leroux 8010dd070b
Add tests to check that requests are retried when writing/reading blobs on S3 (#45383)
This commit adds tests to verify the behavior of the S3BlobContainer and 
its underlying AWS SDK client when the remote S3 service is responding 
errors or not responding at all. The expected behavior is that requests are 
retried multiple times before the client gives up and the S3BlobContainer 
bubbles up an exception.

The test verifies the behavior of BlobContainer.writeBlob() and 
BlobContainer.readBlob(). In the case of S3 writing a blob can be executed 
as a single upload or using multipart requests; the test checks both scenario 
by writing a small then a large blob.
2019-08-22 11:27:54 +02:00
Armin Braun df01766c15
Repository Cleanup Endpoint (#43900)
* Snapshot cleanup functionality via transport/REST endpoint.
* Added all the infrastructure for this with the HLRC and node client
* Made use of it in tests and resolved relevant TODO
* Added new `Custom` CS element that tracks the cleanup logic.
Kept it similar to the delete and in progress classes and gave it
some (for now) redundant way of handling multiple cleanups but only allow one
* Use the exact same mechanism used by deletes to have the combination
of CS entry and increment in repository state ID provide some
concurrency safety (the initial approach of just an entry in the CS
was not enough, we must increment the repository state ID to be safe
against concurrent modifications, otherwise we run the risk of "cleaning up"
blobs that just got created without noticing)
* Isolated the logic to the transport action class as much as I could.
It's not ideal, but we don't need to keep any state and do the same
for other repository operations
(like getting the detailed snapshot shard status)
2019-08-21 12:02:44 +02:00
Jim Ferenczi d66a307599
Add support for inlined user dictionary in the Kuromoji plugin (#45489)
This change adds a new option called user_dictionary_rules to
Kuromoji's tokenizer. It can be used to set additional tokenization rules
to the Japanese tokenizer directly in the settings (instead of using a file).
This commit also adds a check that no rules are duplicated since this is not allowed
in the UserDictionary.

Closes #25343
2019-08-20 15:06:01 +02:00
Igor Motov 9f5611f820
Ingest Attachment: Upgrade tika to v1.22 (#45575)
Upgrades:
Apache Tika: 1.19.1 -> 1.22.
pdfbox : 2.0.12 -> 2.0.16
poi : 4.0.0 -> 4.0.1
2019-08-19 18:16:32 -04:00
Karel Minarik 9166311622 Update the schema for the REST API specification (#42346)
* Update the REST API specification

This patch updates the REST API spefication in JSON files to better encode deprecated entities,
to improve specification of URL paths, and to open up the schema for future extensions.

Notably, it changes the `paths` from a list of strings to a list of objects, where each
particular object encodes all the information for this particular path: the `parts` and the `methods`.

Among the benefits of this approach is eg. encoding the difference between using the `PUT` and `POST`
methods in the Index API, to either use a specific document ID, or let Elasticsearch generate one.

Also `documentation` becomes an object that supports an `url` and also a `description` which is a
new field.

* Adapt YAML runner to new REST API specification format

The logic for choosing the path to use when running tests has been
simplified, as a consequence of the path parts being listed under each
path in the spec. The special case for create and index has been removed.

Also the parsing code has been hardened so that errors are thrown earlier
when the structure of the spec differs from what expected, and their
error messages should be more helpful.
2019-08-15 17:15:30 +02:00
Yogesh Gaikwad b44c0281e6
Refactor cluster privileges and cluster permission (#45265)
The current implementations make it difficult for
adding new privileges (example: a cluster privilege which is
more than cluster action-based and not exposed to the security
administrator). On the high level, we would like our cluster privilege
either:
- a named cluster privilege
  This corresponds to `cluster` field from the role descriptor
- or a configurable cluster privilege
  This corresponds to the `global` field from the role-descriptor and
allows a security administrator to configure them.

Some of the responsibilities like the merging of action based cluster privileges
are now pushed at cluster permission level. How to implement the predicate
(using Automaton) is being now enforced by cluster permission.

`ClusterPermission` helps in enforcing the cluster level access either by
performing checks against cluster action and optionally against a request.
It is a collection of one or more permission checks where if any of the checks
allow access then the permission allows access to a cluster action.

Implementations of cluster privilege must be able to provide information
regarding the predicates to the cluster permission so that can be enforced.
This is enforced by making implementations of cluster privilege aware of
cluster permission builder and provide a way to specify how the permission is
to be built for a given privilege.

This commit renames `ConditionalClusterPrivilege` to `ConfigurableClusterPrivilege`.
`ConfigurableClusterPrivilege` is a renderable cluster privilege exposed
as a `global` field in role descriptor.

Other than this there is a requirement where we would want to know if a cluster
permission is implied by another cluster-permission (`has-privileges`).
This is helpful in addressing queries related to privileges for a user.
This is not just simply checking of cluster permissions since we do not
have access to runtime information (like request object).
This refactoring does not try to address those scenarios.

Relates #44048
2019-08-12 13:09:34 +10:00
Armin Braun 18f5690ce7
Remove Settings from BaseRestRequest Constructor (#45418)
* Resolving the todo, cleaning up the unused `settings` parameter
* Cleaning up some other minor dead code in affected classes
2019-08-11 21:47:21 +02:00
Armin Braun fb508dba4a
Upgrade to Netty 4.1.38 (#45132)
* A number of fixes to buffer handling in the .37 and .38 -> we should stay up to date
2019-08-09 01:58:53 +02:00
Tim Brooks e0f9d61bec
Disable netty direct buffer pooling by default (#44837)
Elasticsearch does not grant Netty reflection access to get Unsafe. The
only mechanism that currently exists to free direct buffers in a timely
manner is to use Unsafe. This leads to the occasional scenario, under
heavy network load, that direct byte buffers can slowly build up without
being freed.

This commit disables Netty direct buffer pooling and moves to a strategy
of using a single thread-local direct buffer for interfacing with sockets.
This will reduce the memory usage from networking. Elasticsearch
currently derives very little value from direct buffer usage (TLS,
compression, Lucene, Elasticsearch handling, etc all use heap bytes). So
this seems like the correct trade-off until that changes.
2019-08-08 16:54:01 -04:00
Armin Braun 5c5f782b89
Add Assertion to Ensure Retries in S3BlobContainer (#45224)
* We need a `markSupported` input stream to retry uploads
* Relates #45153
2019-08-06 11:47:13 +02:00
Yannick Welsch 245cb348d3
Add per-socket keepalive options (#44055)
Uses JDK 11's per-socket configuration of TCP keepalive (supported on Linux and Mac), see
https://bugs.openjdk.java.net/browse/JDK-8194298, and exposes these as transport settings.
By default, these options are disabled for now (i.e. fall-back to OS behavior), but we would like
to explore whether we can enable them by default, in particular to force keepalive configurations
that are better tuned for running ES.
2019-08-05 16:09:11 +02:00
Armin Braun 570e406e91
Stop Passing Around REST Request in Multiple Spots (#44949)
* Stop Passing Around REST Request in Multiple Spots

* Motivated by #44564
  * We are currently passing the REST request object around to a large number of places. This works fine since we simply copy the full request content before we handle the rest itself which is needlessly hard on GC and heap.
  * This PR removes a number of spots where the request is passed around needlessly. There are many more spots to optimize in follow-ups to this, but this one would already enable bypassing the request copying for some error paths in a follow up.
2019-08-01 20:19:25 +02:00
Mark Vieira 635b55a861
Add missing dependency on plugin bundle task (#45103) 2019-08-01 10:47:06 -07:00
Andrey Ershov 63361622e3
Snapshot tool: GCS orphaned files cleanup (#45076)
Extending snapshot-tool with GCS cleanup command.
Refactoring main/test to support both S3 and GCS.
Snapshot-tool was first introduced here #44551.
2019-08-01 15:38:26 +02:00
Andrey Ershov d3230c9239
Move thirdPartyTest from :repository-gcs to :qa:google-cloud-storage (#45056)
Currently, thirdPartyTest task for GCS lives in repository-gcs project.
However, it depends a lot on :qa:google-cloud-storage project and
should live there instead.
2019-08-01 12:07:24 +02:00
Tim Brooks f39e8e5dcf
Move nio channel initialization to event loop (#43780)
Currently in the transport-nio work we connect and bind channels on the
a thread before the channel is registered with a selector. Additionally,
it is at this point that we set all the socket options. This commit
moves these operations onto the event-loop after the channel has been
registered with a selector. It attempts to set the socket options for a
non-server channel at registration time. If that fails, it will attempt
to set the options after the channel is connected. This should fix
#41071.
2019-07-30 12:41:51 -04:00
Armin Braun 236ceed3e9
S3 3rd Party Test Goal (#44799)
* Create S3 Third Party Test Task that Covers the S3 CLI Tool
* Adjust snapshot cli test tool tests to work with real S3
  * Build adjustment
  * Clean up repo path before testing
* Dedup the logic for asserting path contents by using the correct utility method here that somehow became unused
2019-07-30 14:27:07 +02:00
Armin Braun 7ee8d150e9
Release Pooled Buffers Earlier for HTTP Requests (#44952)
* We should release the buffers right after copying and not only do so after we did all the request handling on the copy
* Relates #44564
2019-07-30 07:41:31 +02:00
Andrey Ershov 80cb5df977
Support fixture in repository-gcs:thirdPartyTest and fix GCS fixture (#44885)
It turns out that today :plugins:repository-gcs:thirdPartyTest can only
run against real GCS.
Moreover, thirdPartyTest is not a part of check, so these tests are not
running on intake build.
This commit addresses the issue and makes repository-gcs:thirdPartyTest
work with both fixture and real GCS.
To do that, except adjusting build and test itself, I had to make
changes to the fixture, because previously it was ignoring
BlobListOption.currentDirectory() in the list call.
2019-07-29 14:12:39 +02:00
Ignacio Vera b8ef6127f2
Upgrade to Lucene 8.2.0 release (#44859) 2019-07-26 05:57:02 +02:00
Ioannis Kakavas 3b7b025690
Allow parsing the value of java.version sysprop (#44017)
We often start testing with early access versions of new Java
versions and this have caused minor issues in our tests
(i.e. #43141) because the version string that the JVM reports
cannot be parsed as it ends with the string -ea.

This commit changes how we parse and compare Java versions to
allow correct parsing and comparison of the output of java.version
system property that might include an additional alphanumeric
part after the version numbers
 (see [JEP 223[(https://openjdk.java.net/jeps/223)). In short it 
handles a version number part, like before, but additionally a 
PRE part that matches ([a-zA-Z0-9]+).

It also changes a number of tests that would attempt to parse
java.specification.version in order to get the full version
of Java. java.specification.version only contains the major
version and is thus inappropriate when trying to compare against
a version that might contain a minor, patch or an early access
part. We know parse java.version that can be consistently
parsed.

Resolves #43141
2019-07-22 20:13:32 +03:00
Jason Tedor 56d47d09a0
Reomve debugging loging statements from Azure tests
This commit removes some unneeded debugging logging statements from the
Azure storage tests.

Relates #44672
2019-07-22 16:54:16 +09:00
Jason Tedor 35d4a9d9a4
Use debug logging instead for Azure tests (#44672)
These Azure tests have hard println statements which means we always see
these messages during configuration. Yet, there are unnecessary most of
the time. This commit changes them to use debug logging.
2019-07-22 00:44:46 -07:00
Jinhu Wu 6d70276af1 Add disable_chunked_encoding Setting to S3 Repo (#44052)
* Add disable_chunked_encoding setting to S3 repo plugin to support S3 implementations that don't support chunked encoding
2019-07-18 14:39:16 +02:00
maarab7 aff21c431e Fix parameter value for calling data.advanceExact (#44205)
While the code works perfectly well for a single segment, it returns the wrong values for multiple segments. E.g. If we have 500 docs in one segment and if we want to get the doc id = 280 then data.advanceExact(topDocs.scoreDocs[i].doc) works fine. If we have two segments, say, with first segment having docs 1-200 and the second segment having docs 201-500, then 280 is fetched from the second segment but is actually 480. Subtracting the docBase (280-200) takes us to the correct document which is 80 in the second segment and actually 280.
2019-07-18 10:51:27 +02:00
Yogesh Gaikwad 83912ed95a
skip repository-hdfs integTest in case of fips jvm (#44319)
The repository-hdfs runners need to be disabled it in fips mode.

Testing done for all the tasks, dynamic created and static (integTest, integTestHa, integSecureTest, integSecureHaTest)
2019-07-18 15:07:33 +10:00
Jason Tedor 7de0919b96
Introduce test issue logging (#44477)
Today we have an annotation for controlling logging levels in
tests. This annotation serves two purposes, one is to control the
logging level used in tests, when such control is needed to impact and
assert the behavior of loggers in tests. The other use is when a test is
failing and additional logging is needed. This commit separates these
two concerns into separate annotations.

The primary motivation for this is that we have a history of leaving
behind the annotation for the purpose of investigating test failures
long after the test failure is resolved. The accumulation of these stale
logging annotations has led to excessive disk consumption. Having
recently cleaned this up, we would like to avoid falling into this state
again. To do this, we are adding a link to the test failure under
investigation to the annotation when used for the purpose of
investigating test failures. We will add tooling to inspect these
annotations, in the same way that we have tooling on awaits fix
annotations. This will enable us to report on the use of these
annotations, and report when stale uses of the annotation exist.
2019-07-18 05:26:01 +09:00
Armin Braun 5cda8709b6
Remove Minio Host Hack in S3 Repository Build (#44491)
* Resolving the todo to clean this hackyness up
2019-07-17 16:36:23 +02:00
Ignacio Vera 39d0355bca
Upgrade to lucene-8.2.0-snapshot-6413aae226 (#44476) 2019-07-17 15:52:43 +02:00
Armin Braun 4b8fd4e76f
Remove blobExists Method from BlobContainer (#44472)
* We only use this method in one place in production code and can replace that with a read -> remove it to simplify the interface
   * Keep it as an implementation detail in the Azure repository
2019-07-17 09:15:22 +02:00
Tim Brooks c9607061ae
Add Cors integration tests (#44361)
This commit adds integration tests to ensure that the basic cors
functionality works for the netty and nio transports.
2019-07-16 21:27:29 -04:00
Tim Brooks b75003fd53
Isolate nio channel registered from channel active (#44388)
Registering a channel with a selector is a required operation for the
channel to be handled properly. Currently, we mix the registeration with
other setup operations (ip filtering, SSL initiation, etc). However, a
fail to register is fatal. This PR modifies how registeration occurs to
immediately close the channel if it fails.

There are still two clear loopholes for how a user can interact with a
channel even if registration fails. 1. through the exception handler.
2. through the channel accepted callback. These can perhaps be improved
in the future. For now, this PR prevents writes from proceeding if the
channel is not registered.
2019-07-16 18:46:41 -04:00
Armin Braun b8407005a5 Fix compilation S3 repository 2019-07-16 10:18:37 +02:00
Armin Braun 71186fcb9f
Cleanup S3 BlobContainer Listing Logic (#43088)
* Cleanup duplication in creating and looping over IO Requests
2019-07-16 10:06:09 +02:00
Ryan Ernst 7e87c4141b
Convert testclusters to use distro download plugin (#44253)
Test clusters currently has its own set of logic for dealing with
finding different versions of Elasticsearch, downloading them, and
extracting them. This commit converts testclusters to use the
DistributionDownloadPlugin.
2019-07-15 10:39:05 -07:00
Yogesh Gaikwad 79d46cc2bb
check if property 'inFipsJvm' exists before accessing it (#44306)
The intake build failed as it could not find the property 'inFipsJvm' which is set only if it is in that mode.
2019-07-13 10:45:47 +10:00
Yogesh Gaikwad f7486037e8
Disable repository-hdfs tests in FIPS jvm (#44283)
Due to https://github.com/elastic/elasticsearch/issues/40079,
we need to disable repository-hdfs tests in FIPS jvm.
2019-07-13 10:07:40 +10:00
Yannick Welsch c40b77b771
Simplify port usage in transport tests (#44157)
Simplifies AbstractSimpleTransportTestCase to use JVM-local ports  and also adds an assertion so
that cases like #44134 can be more easily debugged. The likely reason for that one is that a test,
which was repeated again and again while always spawning a fresh Gradle worker (due to Gradle
daemon) kept increasing Gradle worker IDs, causing an overflow at some point.
2019-07-11 12:11:39 +02:00
Nick Knize be0df44b1b
Upgrade to lucene-8.2.0-snapshot-860e0be5378 (#44171)
Upgrade to lucene-8.2.0-snapshot-860e0be5378
2019-07-10 13:05:51 -05:00
Yogesh Gaikwad 8d87ab7573
fix and enable repository-hdfs secure tests (#44044)
Due to recent changes are done for converting `repository-hdfs` to test
clusters (#41252), the `integTestSecure*` tasks did not depend on
`secureHdfsFixture` which when running would fail as the fixture
would not be available. This commit adds the dependency of the fixture
to the task.

The `secureHdfsFixture` is a `AntFixture` which is spawned a process.
Internally it waits for 30 seconds for the resources to be made available.
For my local machine, it took almost 45 seconds to be available so I have
added the wait time as an input to the `AntFixture` defaults to 30 seconds
 and set it to 60 seconds in case of secure hdfs fixture.

The integ test for secure hdfs was disabled for a long time and so
the changes done in #42090 to fix the tests are also done in this commit.
2019-07-10 11:19:40 +10:00
Alpar Torok 75f597f9d5
Test fixtures improovements (#43956)
* Test fixtures improovements

Don't disable some of the precommit tasks on fixtures.
This no longer makes sense now that a project can both produce and use a
fixture.

In order for this to be possible, had to add an additional configuration
to make JarHell class accessible to the task even if it's not a
dependency of the project and fix some of the third party audit fallout
from  #43671 which wasn't detected at the time due to the issue being
fixed here.

Closes #43918
2019-07-09 10:04:03 +03:00
Alpar Torok 65cbe51c39
Make sure the clean task doesn't break test fixtures (#43641)
Use a dedicated fixture dir.
2019-07-08 17:49:33 +03:00
Armin Braun d6e23e9bd5
Provide an Option to Use Path-Style-Access with S3 Repo (#41966)
* Provide an Option to Use Path-Style-Access with S3 Repo

* As discussed, added the option to use path style access back again and
deprecated it.
* Defaulted to `false`
* Added warning to docs

* Closes #41816
2019-07-04 17:37:47 +02:00
Alan Woodward 60b460d38a
Add name() method to TokenizerFactory (#43909)
This brings TokenizerFactory into line with CharFilterFactory and TokenFilterFactory,
and removes the need to pass around tokenizer names when building custom analyzers.

As this means that TokenizerFactory is no longer a functional interface, the commit also
adds a factory method to TokenizerFactory to make construction simpler.
2019-07-04 11:23:27 +01:00
Tim Brooks 120db54580
Move CORS Config into :server package (#43779)
This commit moves the config that stores Cors options into the server
package. Currently both nio and netty modules must have a copy of this
config. Moving it into server allows one copy and the tests to be in a
common location.
2019-07-03 09:06:23 -04:00
Mark Vieira bfd8754c4a
Enable caching of rest tests which use integ-test distribution (#43782) 2019-07-02 17:23:44 -07:00
Armin Braun 525f9c0d87
Optimize Azure Directory Delete (#43341)
* Follow up to #43281:
* Optimizing the Azure directory delete operation:
   * Same as with GCS and S3 we can simply flat list a prefix and then delete as we iterate instead of listing the directories recursively. This should require fewer actual list RPC calls and the logic becomes simpler
2019-07-01 15:02:37 +02:00
Armin Braun 6db8104d22
Remove Unused AWS KMS Dependency (#43671)
* We don't make use of KMS at the moment, no need to have this dependency here
2019-06-27 10:49:26 +02:00
Jack Conradson ab7ca7fa0f
Add annotations to Painless whitelist (#43239)
* Start to parse annotations in the whitelist

* Finish parsing annotations

* Finish annotation parsing

* Add docs

* Parser changes.

* Add annotation parser.

* Add annotation tests for Painless core.

* Add example annotation to Painless example extension.

* Response to PR comments.
2019-06-24 09:00:44 -07:00
Tim Brooks 893785a758
Move nio ip filter rule to be a channel handler (#43507)
Currently nio implements ip filtering at the channel context level. This
is kind of a hack as the application logic should be implemented at the
handler level. This commit moves the ip filtering into a channel
handler. This requires adding an indicator to the channel handler to
show when a channel should be closed.
2019-06-24 11:35:46 -04:00
Armin Braun 0545a006da
Recursively Delete Unreferenced Index Directories (#42189)
* Use ability to list child "folders" in the blob store to implement recursive delete on all stale index folders when cleaning up instead of using the diff between two `RepositoryData` instances to cover aborted deletes
* Runs after ever delete operation
* Relates  #13159 (fixing most of this issues caused by unreferenced indices, leaving some meta files to be cleaned up only)
2019-06-21 16:38:34 +02:00
Andrey Ershov 680d6edc0b
Get snapshots support for multiple repositories (#42090)
This commit adds multiple repositories support to get snapshots
request.
If some repository throws an exception this method does not fail fast
instead, it returns results for all repositories.
This PR is opened in favour of #41799, because we decided to change
the response format in a non-BwC manner. It makes sense to read a
discussion of the aforementioned PR.
This is the continuation of work done here #15151.
2019-06-19 16:04:13 +03:00
Armin Braun 9a4ffa3d7e
Recursive Delete on BlobContainer (#43281)
This is a prerequisite of #42189:

* Add directory delete method to blob container specific to each implementation:
  * Some notes on the implementations:
       * AWS + GCS: We can simply exploit the fact that both AWS and GCS return blobs lexicographically ordered which allows us to simply delete in the same order that we receive the blobs from the listing request. For AWS this simply required listing without the delimiter setting (so we get a deep listing) and for GCS the same behavior is achieved by not using the directory mode on the listing invocation. The nice thing about this is, that even for very large numbers of blobs the memory requirements are now capped nicely since we go page by page when deleting.
       * For Azure I extended the parallelization to the listing calls as well and made it work recursively. I verified that this works with thread count `1` since we only block once in the initial thread and then fan out to a "graph" of child listeners that never block. 
       * HDFS and FS are trivial since we have directory delete methods available for them
* Enhances third party tests to ensure the new functionality works (I manually ran them for all cloud providers)
2019-06-18 13:28:22 +02:00
Armin Braun 72bd785cdd
Remove Azure Container Exists Check (#43288)
* This check is redundant, if the container doesn't exist subsequent operations will fail anyway. Since we are not running this exists check during verification I don't think there's much point to having it in snapshot initialization.
* This PR is mainly motivated by the fact that this forces more permissions to be available in shared environments
2019-06-18 09:38:08 +02:00
Armin Braun ee9a0ecfb8
Upgrade GCS Repository Dependencies (#43142)
* Upgrade to latest GCS SDK and transitive dependencies (I chose the later version here on conflict)
* Remove now unnecessary hack for custom endpoints (the linked bugs were both resolved in the SDK)
2019-06-14 17:30:13 +02:00
Yogesh Gaikwad 4757870708
Enable krb5kdc-fixture, kerberos tests mount urandom for kdc container (#41710)
Infra has fixed #10462 by installing `haveged` on CI workers.
This commit enables the disabled fixture and tests, and mounts
`/dev/urandom` for the container so there is enough
entropy required for kdc.
Note: hdfs-repository tests have been disabled, will raise a separate issue for it.

Closes #40624 Closes #40678
2019-06-13 10:38:45 +10:00
Martijn Laarman 61c34bbd92
Introduce stability description to the REST API specification (#38413)
* introduce state to the REST API specification

* change state over to stability

* CCR is no GA updated to stable

* SQL is now GA so marked as stable

* Introduce `internal` as state for API's, marks stable in terms of lifetime but unstable in terms of guarantees on its output format since it exposes internal representations

* make setting a wrong stability value, or not setting it at all an error that causes the YAML test suite to fail

* update spec files to be explicit about their stability state

* Document the fact that stability needs to be defined

Otherwise the YAML test runner will fail (with a nice exception message)

* address check style violations

* update rest spec unit tests to include stability

* found one more test spec file not declaring stability, made sure stability appears after documentation everywhere

* cluster.state is stable, mark response in some way to denote its a key value format that can be changed during minors

* mark data frame API's as beta

* remove internal and private as states for an API

* removed the wrong enum values in the Stability Enum in the previous commit
2019-06-12 20:54:51 +02:00
Simon Willnauer 62620f2866
Remove usage of FileSwitchDirectory (#42937)
We are still using `FileSwitchDirectory` in the case a user configures file based pre-load of mmaps. This is trappy for multiple reasons if the both directories used by `FileSwitchDirectory` point to the same filesystem directory. One issue is LUCENE-8835 that cause issues like #37111 - unless LUCENE-8835 isn't fixed we should not use it in elasticsearch. Instead we use a similar trick as we use for HybridFS and subclass mmap directory directly.
2019-06-12 17:42:08 +02:00
Christoph Büscher 508496e2d1
Fix suggestions for empty indices (#42927)
Currently suggesters return null values on empty shards. Usually this gets replaced
by results from other non-epmty shards, but if the index is completely epmty (e.g. after
creation) the search responses "suggest" is also "null" and we don't render a corresponding
output in the REST response. This is an irritating edge case that requires special handling on
the user side (see #42473) and should be fixed.

This change makes sure every suggester type (completion, terms, phrase) returns at least an
empty skeleton suggestion output, even for empty shards. This way, even if we don't find
any suggestions anywhere, we still return and output the empty suggestion.

Closes #42473
2019-06-12 15:41:41 +02:00
Armin Braun 38d1caf928
Ensure Test Cluster in Azure Discovery Tests Closes (#43057)
* Use `internalCluster().close()` to force all nodes (and not just the datanodes) to shut down even if one fails to shut down in time
* Force closing httpServer to get cleaner logs if nodes still hang on shut down
* Relates #43048
2019-06-12 10:43:40 +02:00
Armin Braun faffaa9b28
Add SAS Token Authentication Support to Azure Repo Plugin (#42982)
* Added setting for SAS token
* Added support for the token in tests
* Relates #42117
2019-06-11 15:50:05 +02:00
Martijn Laarman f5fde1d084
remove path from rest-api-spec (#41452) 2019-06-11 10:20:55 +02:00
Armin Braun dde3614595
Upgrade AWS SDK to Latest Version (#42708)
* Just staying up to data on the SDK version
* Use `AbstractAmazonEC2` to shorten code
2019-06-11 09:19:32 +02:00
Henning Andersen f2672ca286
Mute AzureDiscoveryClusterFormationTests (#43049)
Relates #43048
2019-06-10 17:39:01 +02:00
Armin Braun 255ab8965f
Fix GCS Blob Repository 3rd Party Tests (#43030)
* We have to strip the trailing slash from child names here like we do for AWS
* closes #43029
2019-06-10 15:25:07 +02:00
Alpar Torok 4586f2928c
Clean up configuration when docker isn't available (#42745)
We initially added `requireDocker` for a way for tasks to say that they
absolutely must have it, like the  build docker image tasks.
Projects using the test fixtures plugin are not in this both, as the
intent with these is that they will be skipped if docker and docker-compose
is not available.

Before this change we were lenient, the docker image build would succeed
but produce nothing. The implementation was also confusing as it was not
immediately obvious this was the case due to all the indirection in the
code.

The reason we have this leniency is that when we added the docker image
build, docker was a fairly new requirement for us, and we didn't have
it deployed in CI widely enough nor had CI configured to prefer workers
with docker when possible. We are in a much better position now.
The other reason was other stack teams running `./gradlew assemble`
in their respective CI and the possibility of breaking them if docker is
not installed. We have been advocating for building specific distros for
some time now and I will also send out an additional notice

The PR also removes the use of `requireDocker` from tests that actually
use test fixtures and are ok without it, and fixes a bug in test
fixtures that would cause incorrect configuration and allow some tasks
to run when docker was not available and they shouldn't have.

Closes  #42680 and #42829  see also #42719
2019-06-10 13:39:39 +03:00
Mayya Sharipova 2eef9707cc
Improve documentation for smart_cn analyzer (#42822) 2019-06-10 06:26:56 -04:00
Armin a3cec0d580 Fix Azure Plugin Compilation Issue 2019-06-05 17:19:17 +02:00
Armin Braun 2f637d42f1
Add Ability to List Child Containers to BlobContainer (#42653)
* Add Ability to List Child Containers to BlobContainer
* This is a prerequisite of #42189
2019-06-05 17:03:14 +02:00
Colin Goodheart-Smithe 795fa816d9
Removes type from TermVectors APIs (#42198) 2019-06-05 09:32:48 +01:00
Armin Braun 8b41126efb
Enable Parallel Deletes in Azure Repository (#42783)
* Parallel deletes via private thread pool
2019-06-05 09:59:35 +02:00
Jason Tedor ed1d3d7a33
Fix version parsing in various tests (#42871)
This commit fixes the version parsing in various tests. The issue here is that
the parsing was relying on java.version. However, java.version can contain
additional characters such as -ea for early access builds. See JEP 233:

Name                            Syntax
------------------------------  --------------
java.version                    $VNUM(\-$PRE)?
java.runtime.version            $VSTR
java.vm.version                 $VSTR
java.specification.version      $VNUM
java.vm.specification.version   $VNUM

Instead, we want java.specification.version.
2019-06-04 18:21:20 -04:00
Mark Vieira 12d583dbf6
Remove unnecessary usage of Gradle dependency substitution rules (#42773) 2019-06-03 16:18:45 -07:00
Christoph Büscher f51db164fa
[Docs] Add example to reimplement stempel analyzer (#42676)
Adding an example of how to re-implement the polish stempel analyzer
in case a user want to modify or extend it. In order for the analyzer to be
able to use polish stopwords, also registering a polish_stop filter for the
stempel plugin.

Closes #13150
2019-06-03 13:22:10 +02:00
Ryan Ernst e917390e99
Remove client jar support from build (#42640)
The client jars were a way for modules and plugins to produce an
additional jar that contained classes for use by the transport client.
This commit removes that configuration as the transport client is being
removed.

relates #42638
2019-05-30 13:21:48 -07:00
Jason Tedor c9fb1ee0db
Remove Log4j 1.2 API as a dependency (#42702)
We had this as a dependency for legacy dependencies that still needed
the Log4j 1.2 API. This appears to no longer be necessary, so this
commit removes this artifact as a dependency.

To remove this dependency, we had to fix a few places where we were
accidentally relying on Log4j 1.2 instead of Log4j 2 (easy to do, since
both APIs were on the compile-time classpath).

Finally, we can remove our custom Netty logger factory. This was needed
when we were on Log4j 1.2 and handled logging in our own unique
way. When we migrated to Log4j 2 we could have dropped this
dependency. However, even then Netty would still pick up Log4j 1.2 since
it was on the classpath, thus the advantage to removing this as a
dependency now.
2019-05-30 16:06:11 -04:00
Colin Goodheart-Smithe 3f10cea87a
Removes types from SearchRequest and QueryShardContext (#42112) 2019-05-29 08:50:30 +01:00
Armin Braun 349d2ce153
Add Infrastructure to Run 3rd Party Repository Tests (#42586)
* Add Infrastructure to Run 3rd Party Repository Tests

* Add infrastructure to run third party repository tests using our standard JUnit infrastructure
* This is a prerequisite of #42189
2019-05-27 22:40:23 +02:00
Armin Braun 074da02f44
Dry up BlobStoreRepository#basePath Implementations (#42578)
* This method is just a getter in every implementation => moved the field and concrete getter to the base class to simplify implementations
2019-05-27 19:29:51 +02:00
Armin Braun f95071d0af
Upgrade to Netty 4.1.36 (#42543) 2019-05-25 08:53:50 +02:00
Mark Vieira d5281fc96f
Ignore JAR manifests when snapshotting runtime classpaths (#42548) 2019-05-24 18:08:51 -07:00
Mark Vieira eda3da31da
Improve build configuration time (#41392)
This commit moves the expensive configuration-time calculation of Java runtime version information
to runtime instead and also makes that work cacheable. This roughly equates to about a 50% 
reduction in project configuration time.
2019-05-24 12:10:32 -07:00
Ryan Ernst 1b6dc17838
Remove transport client from tests (#42457)
This commit removes testing infrastructure for using the transport
client.
2019-05-24 10:30:06 -07:00
Yannick Welsch 43848fc40e
Wipe repositories more often (#42511)
Fixes an issue where repositories are unintentionally shared among tests (given that the repo contents is captured in a static variable on the test class, to allow "sharing" among nodes) and two tests randomly chose the same snapshot name, leading to a conflict.

Closes #42519
2019-05-24 17:18:53 +02:00
Simon Willnauer 4b21100178
Remove IndexStore and DirectoryService (#42446)
Both of these classes are basically a bloated wrapper around a simple
construct that can simply be a DirectoryFactory interface. This change
removes both classes and replaces them with a simple stateless interface
that creates a new `Directory` per shard. The concept of `index.store` is preserved
since it makes sense from a configuration perspective.
2019-05-24 10:44:59 +02:00
Ryan Ernst 4520e88b22
Remove transport client from xpack (#42202)
This commit removes support for the transport client from xpack.
2019-05-23 10:16:48 -07:00
Jim Ferenczi 4e999d7514
Upgrade to Lucene 8.1.0 (#42214)
This commit upgrades to the GA release of Lucene 8.1.0
2019-05-23 11:41:05 +02:00
Armin Braun be412ca83f
Remove Dead Code from Azure Repo Plugin (#42178)
* None of this stuff is used
2019-05-21 19:49:53 +02:00
Alan Woodward 6d95386f0d
Simplify handling of keyword field normalizers (#42002)
We have a number of places in analysis-handling code where we check
if a field type is a keyword field, and if so then extract the normalizer rather
than pulling the index-time analyzer. However, a keyword normalizer is
really just a special case of an analyzer, so we should be able to simplify this
by setting the normalizer as the index-time analyzer at construction time.
2019-05-10 14:38:10 +01:00
Armin Braun 70eb812f83
Remove Delete Method from BlobStore (#41619)
* Remove Delete Method from BlobStore

* The delete method on the blob store was used almost nowhere and just duplicates the delete method on the blob containers
  * The fact that it provided for some recursive delete logic (that did not behave the same way on all implementations) was not used and not properly tested either
2019-05-09 17:12:34 +02:00
Alpar Torok fa98c5ec60
Testclusters: support for security and convert example plugins (#41864)
testclusters detect from settings that security is enabled
if a user is not specified using the DSL introduced in this PR, a default one is created
the appropriate wait conditions are used authenticating with the first user defined in the DSL ( or the default user ).
an example DSL to create a user is user username:"test_user" password:"x-pack-test-password" role: "superuser" all keys are optional and default to the values shown in this example
2019-05-08 14:00:11 +03:00
Yannick Welsch 89d31de535
Upgrade SDK and test discovery-ec2 credential providers (#41732)
Upgrades the AWS SDK to the same version that we're using for the repository-s3 plugin, providing
testing capabilities to override certain SDK endpoints in order to point them to localhost for testing.
Adds tests for the various credential providers.
2019-05-08 09:26:37 +02:00
Ryan Ernst 8af01dfa3c
Cleanup versioned deprecations in analysis (#41560)
This commit removes versioned logic in analyzer creation that is no
longer relevant for 8.0.
2019-05-07 19:06:08 -04:00
Alan Woodward f7f6c44d66
Correct spelling of MockLogAppender.PatternSeenEventExpectation (#41893)
The class was called PatternSeenEventExcpectation. This commit
is a straight class rename to correct the spelling.
2019-05-07 19:06:03 -04:00
Jay Modi 96bf049ef3
Update TLS ciphers and protocols for JDK 11 (#41808)
* Update TLS ciphers and protocols for JDK 11 (#41385)

This commit updates the default ciphers and TLS protocols that are used
after the minimum supported JDK is JDK 11. The conditionals around
TLSv1.3 and 256-bit cipher support have been removed. JDK 11 no longer
requires an unlimited JCE policy file for 256 bit cipher support and
TLSv1.3 is supported in JDK 11+. New cipher support has been introduced
in the newer JDK versions as well. The ciphers are ordered with PFS
ciphers being most preferred, then AEAD ciphers, and finally those with
mainstream hardware support.

* Fixes for TLSv1.3 on JDK11

* fix for JDK-8212885
2019-05-07 19:05:58 -04:00
Nikita Glashenko e6019b4107 Reject port ranges in `discovery.seed_hosts` (#41404)
Today Elasticsearch accepts, but silently ignores, port ranges in the
`discovery.seed_hosts` setting:

```
discovery.seed_hosts: 10.1.2.3:9300-9400
```

Silently ignoring part of a setting like this is trappy. With this change we
reject seed host addresses of this form.

Closes #40786
2019-05-07 16:45:56 +01:00
Jason Tedor 354118fac6
Replace more uses of immutable map builder (#41823)
This commit replaces more uses of a custom immutable map builder in
favor of convenience collection factory methods available since JDK 9.
2019-05-06 19:58:48 -04:00
Armin Braun 59eeaa02c0
Cleanup Bulk Delete Exception Logging (#41693)
* Cleanup Bulk Delete Exception Logging

* Follow up to #41368
* Collect all failed blob deletes and add them to the exception message
* Remove logging of blob name list from caller exception logging
2019-05-06 16:59:47 +02:00
Tim Brooks 697c9908c1
Fix http read timeout test by releasing response (#41801)
This fixes #41794. Currently the read timeout test queues up responses
in the netty pipeline. These responses are immediately returned in the
write call, but they are not released. This commit releases the
responses. This will cause the leak detector to quit throwing
exceptions.
2019-05-03 13:43:48 -06:00
Henning Andersen aed3db378c Mute HttpReadWriteHandlerTests.testReadTimeout
This seems to cause the failure in #41794
2019-05-03 16:14:35 +02:00
Tim Brooks cb2bd0bb6b
Read multiple TLS packets in one read call (#41725)
This is related to #27260. Currently we have a single read buffer that
is no larger than a single TLS packet. This prevents us from reading
multiple TLS packets in a single socket read call. This commit modifies
our TLS work to support reading similar to the plaintext case. The data
will be copied to a (potentially) recycled TLS packet-sized buffer for
interaction with the SSLEngine.
2019-05-02 14:44:22 -06:00
Tim Brooks 5309c6cd3e
Support http read timeouts for transport-nio (#41466)
This is related to #27260. Currently there is a setting
http.read_timeout that allows users to define a read timeout for the
http transport. This commit implements support for this functionality
with the transport-nio plugin. The behavior here is that a repeating
task will be scheduled for the interval defined. If there have been
no requests received since the last run and there are no inflight
requests, the channel will be closed.
2019-05-01 09:39:11 -06:00
Armin Braun b633182094
Implement Bulk Deletes for GCS Repository (#41368)
* Implement Bulk Deletes for GCS Repository

* Just like #40322 for AWS
* We already had a bulk delete API but weren't using it from the blob container implementation, now we are using it
  * Made the bulk delete API also compliant with our interface that only suppresses errors about non existent blobs by stating failed deletes (I didn't use any bulk stat action here since having to stat here should be the exception anyway and it would make error handling a lot more complex)
* Fixed bulk delete API to limit its batch size to 100 in line with GCS recommendations
2019-04-30 12:38:22 +02:00
Armin Braun 8a16b9195e
Upgrade to Netty 4.1.35 (#41499)
* Some fixes and possible performance fixes in the last 3 versions ->
upgrading
2019-04-29 19:42:56 +02:00
Jason Tedor 545e56d1d1
Remove some usages of MapBuilder#immutableMap (#41593)
This method can be replaced by some convenience collection factory
methods available in the JDK now. This commit does not attempt to
replace all usages, only enough that the size of the commit is kept to a
reasonable size.
2019-04-28 19:55:17 -04:00
Jason Tedor f48ddd53fd
Use Java 11 collections conveniences everywhere (#41399)
This commit replaces all applicable uses with Java 11 collections
convenience methods.
2019-04-26 12:32:48 -04:00
Alpar Torok 14af0b4ba8 Testclsuters: convert plugins qa projects (#41496)
Add testclusters support for files in keystore and convert qa subprojects within plugins.
2019-04-26 08:34:03 -07:00
Tim Brooks 0ca375ed42
Remove dedicated SSL network write buffer (#41283)
This is related to #27260. Currently for the SSLDriver we allocate a
dedicated network write buffer and encrypt the data into that buffer one
buffer at a time. This requires constantly switching between encrypting
and flushing. This commit adds a dedicated outbound buffer for SSL
operations that will internally allocate new packet sized buffers as
they are need (for writing encrypted data). This allows us to totally
encrypt an operation before writing it to the network. Eventually it can
be hooked up to buffer recycling.
2019-04-25 14:30:16 -06:00
Armin Braun 180deaa48e
Remove Exists Check from S3 Repository Deletes (#40931)
* The check doesn't add much if anything practically, since the S3 repository is eventually consistent and we only log the non-existence of a blob anyway
  * We don't do the check on writes for this very reason and documented it as such
  * Removing the check saves one API call per single delete speeding up the deletion process and lowering costs
2019-04-25 16:18:02 +02:00
Armin Braun a8b68110fc
Fix Repository Base Path Matching in Azure ITs (#41457)
* Added quotes so that "regexy" base paths like `7.0` that we use on CI
don't break matching
* closes #41405
2019-04-24 10:12:48 +02:00
clement-tourriere 8fe7568f73 Add ignore_above in ICUCollationKeywordFieldMapper (#40414)
Add the possibility to use ignore_above parameter in ICUCollationKeywordFieldMapper.

Close #40413
2019-04-19 13:17:00 -07:00
Alpar Torok b1f9884a8d
Convert repository-hdfs to testclusters (#41252)
* Convert repository-hdfs to testclusters

Relates #40862
2019-04-19 09:34:23 +03:00
Nhat Nguyen 8b0a74f11c
Clean up outdated skip statements in yaml tests (#41165)
These skip statements become no-ops in 8.0 for we don't support
a mixed cluster between 6.x and 8.0.

Relates #41164
2019-04-18 14:19:31 -04:00
Henning Andersen 97fd2ed757
Remove pending deletions workaround (#41245)
The recent upgrade to lucene 8.1.0 included the fix for LUCENE-8735
(pending deletions did not delegate). Removed the temporary workaround
that was previously added for this issue.

Follow up to #40345
2019-04-17 07:40:40 +02:00
Jim Ferenczi 01ab82f866
Upgrade to lucene 8.1.0-snapshot-e460356abe (#40952) 2019-04-16 09:29:22 +02:00
Mark Vieira 323f312bbc
Replace usages RandomizedTestingTask with built-in Gradle Test (#40978)
This commit replaces the existing RandomizedTestingTask and supporting code with Gradle's built-in JUnit support via the Test task type. Additionally, the previous workaround to disable all tasks named "test" and create new unit testing tasks named "unitTest" has been removed such that the "test" task now runs unit tests as per the normal Gradle Java plugin conventions.
2019-04-08 14:13:59 -07:00
Jason Tedor 8deadfb2d1
Bump the minimum Java version to Java 11 (#40754)
With the 8.0.0 release of Elasticsearch we will bump the minimum
required Java to Java 11. This commit puts this into effect on the
master branch.
2019-04-07 16:16:23 -04:00
Jay Modi f486cffe28
Update apache httpclient to version 4.5.8 (#40875)
This change updates our version of httpclient to version 4.5.8, which
contains the fix for HTTPCLIENT-1968, which is a bug where the client
started re-writing paths that contained encoded reserved characters
with their unreserved form.
2019-04-05 12:06:06 -06:00
Armin Braun 8a07522ed5
Async Snapshot Repository Deletes (#40144)
Motivated by slow snapshot deletes reported in e.g. #39656 and the fact that these likely are a contributing factor to repositories accumulating stale files over time when deletes fail to finish in time and are interrupted before they can complete. 

* Makes snapshot deletion async and parallelizes some steps of the delete process that can be safely run concurrently via the snapshot thread poll
   * I did not take the biggest potential speedup step here and parallelize the shard file deletion because that's probably better handled by moving to bulk deletes where possible (and can still be parallelized via the snapshot pool where it isn't). Also, I wanted to keep the size of the PR manageable. 
* See https://github.com/elastic/elasticsearch/pull/39656#issuecomment-470492106
* Also, as a side effect this gives the `SnapshotResiliencyTests` a little more coverage for master failover scenarios (since parallel access to a blob store repository during deletes is now possible since a delete isn't a single task anymore).
* By adding a `ThreadPool` reference to the repository this also lays the groundwork to parallelizing shard snapshot uploads to improve the situation reported in #39657
2019-04-05 06:56:46 +02:00
Mark Vieira b439127be5
Revert "Replace usages RandomizedTestingTask with built-in Gradle Test (#40564)"
This reverts commit 2b2a3f50
2019-04-04 21:52:47 -07:00
Mark Vieira 2b2a3f5086
Replace usages RandomizedTestingTask with built-in Gradle Test (#40564)
This commit replaces the existing RandomizedTestingTask and supporting code with Gradle's built-in JUnit support via the Test task type. Additionally, the previous workaround to disable all tasks named "test" and create new unit testing tasks named "unitTest" has been removed such that the "test" task now runs unit tests as per the normal Gradle Java plugin conventions
2019-04-04 19:51:13 -07:00
Martijn van Groningen f3650b45c6
Remove -Xlint exclusions in all plugins. (#40721)
The xlint exclusions of the following plugins were removed:
* ingest-attachment.
* mapper-size.
* transport-nio. Removing the -try exclusion required some work, because
  the NettyAdaptor implements AutoCloseable and NettyAdaptor#close() method
  could throw an InterruptedException (ChannelFuture#await() and a generic
  Exception is re-thrown, which maybe an ChannelFuture). The easiest way
  around this to me seemed that NettyAdaptor should not implement AutoCloseable,
  because it is not directly used in a try-with-resources statement.

Relates to #40366
2019-04-04 08:29:42 +02:00
Armin Braun 8e3dabcac4
Remove Dead Code in Transport Package (#39885)
* None of this stuff is used
2019-04-04 07:04:16 +02:00
Christoph Büscher efe47cebe7
Small refactorings to analysis components (#40745)
This change add the following internal refactorings:

* wraps input analyzers into an unmodifiable map in IndexAnalyzers ctor
* removes duplicated indexSetting in IndexAnalyzers
* removes references to IndexAnalyzers from DocumentMapperParser and TypeParser.ParserContext.
   It can always be retrieve it from MapperService directly in those cases
2019-04-03 14:15:40 +02:00
Armin Braun b1e2cec55b
Add Bulk Delete Api to BlobStore (#40322)
* Adds Bulk delete API to blob container
* Implement bulk delete API for S3
* Adjust S3Fixture to accept both path styles for bulk deletes since the S3 SDK uses both during our ITs
* Closes #40250
2019-04-02 22:46:19 +02:00
Armin Braun 15dad8bca9
Simplify BlobStoreRepository Constructor (#40653)
* Thanks to #39346 we can simplify the logic here some more, now that compress is a `final` field
2019-04-01 20:51:55 +02:00
Alpar Torok c8205494cc Fix repository-hdfs when no docker and unnecesary fixture
The hdfs-fixture is actually executed in plugin/repository-hdfs as a
dependency. The fixture is not needed and actually causes a failure
because we have two copies now and both use the same ports.
2019-03-29 16:52:02 +02:00
Alpar Torok 80b88cff3e
Fix 3rd pary S3 tests (#40588)
* Fix 3rd pary S3 tests

This is allready excluded on line 186, by doing this again here, the
other exclusion from arround that line are removed causing the tests to
fail.

* Fix blacklisting with the fixture
2019-03-29 08:01:06 +02:00
Alpar Torok 65e031742d
Test fixtures krb5 (#40297)
Replaces the vagrant based kerberos fixtures with docker based test fixtures plugin.
The configuration is now entirely static on the docker side and no longer driven by Gradle,
also two different services are being configured since there are two different consumers of the fixture that can run in parallel and require different configurations.
2019-03-28 17:23:40 +02:00
Andy Bristol 6bba9fc83b
search as you type fieldmapper (#35600)
Adds the search_as_you_type field type that acts like a text field optimized
for as-you-type search completion. It creates a couple subfields that analyze
the indexed terms as shingles, against which full terms are queried, and a
prefix subfield that analyze terms as the largest shingle size used and
edge-ngrams, against which partial terms are queried

Adds a match_bool_prefix query type that creates a boolean clause of a term
query for each term except the last, for which a boolean clause with a prefix
query is created.

The match_bool_prefix query is the recommended way of querying a search as you
type field, which will boil down to term queries for each shingle of the input
text on the appropriate shingle field, and the final (possibly partial) term
as a term query on the prefix field. This field type also supports phrase and
phrase prefix queries however
2019-03-27 10:03:30 -07:00
Alpar Torok eded9ca757
Testclusters: convert plugin repository-s3 (#40399)
* Add support for setting and keystore settings
* system properties and env var config
* use testclusters for repository-s3
* Some cleanup of the build.gradle file for plugin-s3
* add runner {} to rest integ test task
2019-03-27 08:37:04 +02:00
Tim Brooks 8d532b5ad7
Add InboundHandler for inbound message handling (#40430)
This commit adds an InboundHandler to handle inbound message processing.
With this commit, this code is moved out of the TcpTransport.
Additionally, finer grained unit tests are added to ensure that the
inbound processing works as expected
2019-03-26 09:32:53 -06:00
Henning Andersen cca77c1268
Store Pending Deletions Fix (#40345)
FilterDirectory.getPendingDeletions does not delegate, fixed
temporarily by overriding in StoreDirectory.

This in turn caused duplicate file name use after a trimUnsafeCommits
had been done, since a new IndexWriter would not consider the pending
deletes in IndexFileDeleter. This should only happen on windows (AFAIK).

Reenabled doing index updates for all tests using
IndexShardTests.indexOnReplicaWithGaps (which could fail due to above
when using mocked WindowsFS).

Added getPendingDeletions delegation to all elasticsearch
FilterDirectory subclasses that were not trivial test-only overrides to
minimize the risk of hitting this issue in another case.
2019-03-26 15:11:51 +01:00
Tim Brooks 9e11dfc7f0
Move outbound message handling to OutboundHandler (#40336)
Currently there are some components of message serializer and sending
that still occur in TcpTransport. This commit makes it possible to
send a message without the TcpTransport by moving all of the remaining
application logic to the OutboundHandler. Additionally, it adds unit
tests to ensure that this logic works as expected.
2019-03-22 13:58:30 -06:00
Armin Braun 69975de964
Use Netty ByteBuf Bulk Operations for Faster Deserialization (#40158)
* Use bulk methods to read numbers faster from byte buffers
2019-03-21 21:08:57 +01:00
Yannick Welsch 6b03b131be
Remove note about Azure ARM plugin (#40219)
Relates to #22679
2019-03-20 16:31:03 +01:00
Tim Brooks 9026c91a84
Remove transport name from tcp channel (#40074)
Currently, we maintain a transport name ("mock-nio", "nio", "netty")
that is passed to a `TcpTransportChannel` when a request is received.
The value of this name is to associate with the task when we register a
task with the task manager. However, it is only possible to run ES with
one transport, so having an implementation specific name is unnecessary.
This commit removes the name and replaces it with the generic
"transport".
2019-03-15 11:47:29 -06:00
Ryan Ernst 7d5ff03b82
Add no-jdk distributions (#39882)
This commit adds a variant for every official distribution that omits
the bundled jdk. The "no-jdk" naming is conveyed through the package
classifier, alongside the platform. Package tests are also added for
each new distribution.
2019-03-15 00:55:15 -07:00
Jason Tedor 2c8560141f
Upgrade the bouncycastle dependency to 1.61 (#40017)
This commit upgrades the bouncycastle dependency from 1.59 to 1.61.
2019-03-14 08:54:14 -04:00
Jim Ferenczi ab55ac2dea
Upgrade to Lucene release 8.0.0 (#39992)
This commit upgrades to the GA release of Lucene 8

Closes #39640
2019-03-13 15:56:32 +01:00
Jay Modi 1f0741ce73
Add client jar for transport-nio (#39860)
This change marks the transport-nio plugin as having a client jar. The
nio transport can be used from a transport client and the
x-pack-transport artifact depends on the transport-nio jar but this jar
is not published. This change marks the transport-nio project as having
a client jar so that the jar may be published in the same way that we
publish the netty4 transport artifact.

The change to actually publish the jar will be handled separately as an
update to the release manager.
2019-03-12 09:03:41 -06:00
David Emanuel Buchmann dc2d7077fb plugins/repository-gcs: Update google-cloud-storage/core to 1.59.0 (#39748)
* plugins/repository-gcs: Update google-cloud-storage /
google-cloud-core to 1.59.0

* plugins: Update sha1 for google-cloud-core & google-cloud-storage
2019-03-10 11:03:16 -04:00
Alpar Torok 22ab741df5
Testclusters: start using it for testing some plugins (#39693)
* enable testclusters for some plugins
2019-03-07 17:48:49 +02:00
markharwood a1fcb8a7e6
Bug fix for AnnotatedTextHighlighter - port of 39525 (#39747)
Bug fix for AnnotatedTextHighlighter - port of 39525
Relates to #39395
2019-03-06 17:10:36 +00:00
Armin Braun 0619e6e9a2
Optimize Bulk Message Parsing and Message Length Parsing (#39634)
* Optimize Bulk Message Parsing and Message Length Parsing

* findNextMarker took almost 1ms per invocation during the PMC rally track
  * Fixed to be about an order of magnitude faster by using Netty's bulk `ByteBuf` search
* It is unnecessary to instantiate an object (the input stream wrapper) and throw it away, just to read the `int` length from the message bytes
  * Fixed by adding bulk `int` read to BytesReference
2019-03-05 17:45:41 +01:00
Pedro Silva 518f5ffd0b Add Support for S3 Intelligent Tiering (#39376)
* Add support for S3 intelligent tiering
* Closes #38836
2019-03-04 07:58:54 +01:00
Alpar Torok 41a29a74a2
Un-mute and fix BuildExamplePluginsIT (#38899)
* Un-mute and fix BuildExamplePluginsIT

There doesn't seem to be anything wrong with the test iteself.
I think the failure were CI performance related, but while it was muted,
some failures managed to sneak in.

Closes #38784

* PR review
2019-03-04 08:37:43 +02:00
Henning Andersen ac7ec99bea
Unify blob store compress setting (#39346)
Blob store compression was all implemented generally, except reading the
setting for it. Moved the setting to BlobStoreRepository to unify this.
Also removed deprecated env setting 'repositories.fs.compress'.

This is a follow up on #39073
2019-02-28 12:34:13 +01:00
Alan Woodward 68c57adadf
Upgrade to lucene 8.0.0-snapshot-ff9509a8df (#39350)
Contains the following:

* LUCENE-8635: Move terms dictionary off-heap for non-primary-key fields in `MMapDirectory`
* LUCENE-8292: `TermsEnum` is fully abstract
* LUCENE-8679: Return WITHIN in `EdgeTree#relateTriangle` only when polygon and triangle 
share one edge
* LUCENE-8676: Nori tokenizer deals correctly with large buffers
* LUCENE-8697: `GraphTokenStreamFiniteStrings` better handles side paths with gaps
* LUCENE-8664: Add `equals` and `hashCode` to `TotalHits`
* LUCENE-8660: `TopDocsCollector` returns accurate hit counts if the total equals the threshold
* LUCENE-8654: `Polygon2D#relateTriangle` fix for when the polygon is inside the triangle
* LUCENE-8645: `Intervals#fixField` can merge intervals from different fields
* LUCENE-8585: Create jump-tables for DocValues at index time
2019-02-27 14:35:44 +00:00
Jason Tedor bab89ed638
Bump jackson-databind version for AWS SDK (#39183)
This commit bumps the jackson-databind version for discovery-ec2 and
repository-s3 to 2.8.11.3.
2019-02-20 13:03:27 -05:00
Henning Andersen f5fc163228
Blob store compression fix (#39073)
Blob store compression was not enabled for some of the files in
snapshots due to constructor accessing sub-class fields. Fixed to
instead accept compress field as constructor param. Also fixed chunk
size validation to work.

Deprecated repositories.fs.compress setting as well to be able to unify
in a future commit.
2019-02-20 08:27:07 +01:00
Alan Woodward 38d29354ff
Avoid double term construction in DfsPhase (#38716)
DfsPhase captures terms used for scoring a query in order to build global term statistics across
multiple shards for more accurate scoring. It currently does this by building the query's `Weight`
and calling `extractTerms` on it to collect terms, and then calling `IndexSearcher.termStatistics()`
for each collected term. This duplicates work, however, as the various `Weight` implementations 
will already have collected these statistics at construction time.

This commit replaces this round-about way of collecting stats, instead using a delegating
IndexSearcher that collects the term contexts and statistics when `IndexSearcher.termStatistics()`
is called from the Weight.

It also fixes a bug when using rescorers, where a `QueryRescorer` would calculate distributed term
statistics, but ignore field statistics.  `Rescorer.extractTerms` has been removed, and replaced with
a new method on `RescoreContext` that returns any queries used by the rescore implementation.
The delegating IndexSearcher then collects term contexts and statistics in the same way described
above for each Query.
2019-02-15 15:42:04 +00:00
Tanguy Leroux 510829f9f7
TransportVerifyShardBeforeCloseAction should force a flush (#38401)
This commit changes the `TransportVerifyShardBeforeCloseAction` so that it 
always forces the flush of the shard. It seems that #37961 is not sufficient to 
ensure that the translog and the Lucene commit share the exact same max 
seq no and global checkpoint information in case of one or more noop 
operations have been made.

The `BulkWithUpdatesIT.testThatMissingIndexDoesNotAbortFullBulkRequest` 
and `FrozenIndexTests.testFreezeEmptyIndexWithTranslogOps` test this trivial 
situation and they both fail 1 on 10 executions.

Relates to #33888
2019-02-06 13:22:54 +01:00
David Turner 5a3c452480
Align docs etc with new discovery setting names (#38492)
In #38333 and #38350 we moved away from the `discovery.zen` settings namespace
since these settings have an effect even though Zen Discovery itself is being
phased out. This change aligns the documentation and the names of related
classes and methods with the newly-introduced naming conventions.
2019-02-06 11:34:38 +00:00