Commit Graph

38787 Commits

Author SHA1 Message Date
Costin Leau f7bed219f3 SQL: improve conversion of Date types (elastic/x-pack-elasticsearch#4382)
When dealing with dates, the conversion now returns a proper DateTime
instance instead of a long

Relates elastic/x-pack-elasticsearch#4331

Original commit: elastic/x-pack-elasticsearch@bba9f2c79f
2018-04-16 19:58:32 +03:00
Alexander Reelsen 25895e0a3c Tests: Check watcher state before starting/stopping (elastic/x-pack-elasticsearch#4362)
This changes the behaviour of AbstractWatcherIntegrationTestCase and its
startWatcher/stopWatcher methods. Instead of checking for the target
state and just starting or stopping if it does not match, the methods
now wait for certain states to be reached before starting or stopping.

This will fix test failures where a failure is started instead of
stopped or vice versa.

Original commit: elastic/x-pack-elasticsearch@f0b0954803
2018-04-16 18:53:04 +02:00
Costin Leau fd7b3e4d0b SQL: add conversion to same and NULL data type (elastic/x-pack-elasticsearch#4378)
Add trivial data type conversions to same (identity) and NULL type

Original commit: elastic/x-pack-elasticsearch@dc825443d5
2018-04-16 19:48:22 +03:00
Costin Leau 7266042546 SQL: Add folding to Math functions (elastic/x-pack-elasticsearch#4377)
Math functions now support folding

Original commit: elastic/x-pack-elasticsearch@4af7a22b32
2018-04-16 19:48:10 +03:00
Costin Leau e69f820423 SQL: Expand SYS TABLES behavior to support ODBC spec (elastic/x-pack-elasticsearch#4375)
Add behavior for enumerating catalogs, table types, etc when the main
param is SQL_ALL_* while all the rest are empty strings

Fix elastic/x-pack-elasticsearch#4334

Original commit: elastic/x-pack-elasticsearch@28e7b15904
2018-04-16 19:47:38 +03:00
Costin Leau bf5f7e1847 SQL: Enable some date agg tests (elastic/x-pack-elasticsearch#4374)
Now that composite aggs return dates as long (instead of Strings) enable
relevant tests

Relates https://github.com/elastic/elasticsearch/pull/29370

Original commit: elastic/x-pack-elasticsearch@6653db6d0f
2018-04-16 19:47:08 +03:00
Costin Leau e113d5dda1 SQL: Fix bug in transforming Expression properties (elastic/x-pack-elasticsearch#4373)
Fix bug in checking whether the expression properties has been  
modified or not.

Change test to move from SIN to SQRT (as the former seem to return
different values (extra digit) across JDK versions - 8 vs 10)

Fix elastic/x-pack-elasticsearch#4335

Original commit: elastic/x-pack-elasticsearch@8f672c455d
2018-04-16 19:46:33 +03:00
Igor Motov e334baf6fc
Fix overflow error in parsing of long geohashes (#29418)
Fixes a possible overflow error that geohashes longer than 12 characters
can cause during parsing.

Fixes #24616
2018-04-16 12:37:38 -04:00
jaymode 13d08f9c42 Test: don't reset node in ClusterPrivilegeTests
In the ClusterPrivilegeTests class, the code was resetting the node
after each test and failures were seen in CI that were HTTP 401 when
a 403 was expected. This commit removes the resetting of the node
between tests as this was not necessary.

Additionally, there is an issue in the SecuritySingleNodeTestCase where
the rest client was not torn down afterstopping a node and starting a
new node. This means the client used in other tests would not be
connected to the right cluster. This change resolves this by tearing
down the rest client after the old node is torn down.

relates elastic/x-pack-elasticsearch#4383

Original commit: elastic/x-pack-elasticsearch@2f81a4b2e2
2018-04-16 10:31:13 -06:00
Lisa Cawley da6ff8fddd [DOCS] Clarified xpack.monitoring.enabled setting (elastic/x-pack-elasticsearch#4384)
Original commit: elastic/x-pack-elasticsearch@e713aee367
2018-04-16 09:16:29 -07:00
David Turner 34ec403a2e
Remove unused index.ttl.disable_purge setting (#29527)
This setting does nothing, and is deprecated in the 6.x series by #29526. This 
change removes it entirely in 7.0.
2018-04-16 17:10:55 +01:00
Boaz Leskes 8f91743768 FullClusterRestartIT.testRecovery should wait for all initializing shards
Shards that are not fully bake may not execute the flush call, causing
subsequent unexpected translog recoveries which fails the test.

Closes #27817
2018-04-16 17:51:08 +02:00
Nik Everett 69aabb7e40
Build: Fail if any libs depend on non-core libs (#29336)
Fails the build if any subprojects of `:libs` have dependencies in `:libs`
except for `:libs:elasticsearch-core`.

Since we now have three places where we resolve project substitutions
I've added `dependencyToProject` to `project.ext` in all projects. It
resolves both `project` style dependencies and "external" style (like
"org.elasticsearch:elasticsearch-core:${version}") dependencies to
`Project`s using the `projectSubstitutions`. I use this new function all
three places where resovle project substitutions.

Finally this pulls `apply plugin: 'elasticsearch.build'` out of
`libs/*/build.gradle` and into a subprojects clause in
`libs/build.gradle`. I do this entirely so that I can call
`tasks.precommit.dependsOn checkDependencies` without waiting for the
subprojects to be evaluated or worrying about whether or not they have
`precommit` set up in a normal way.
2018-04-16 11:49:27 -04:00
javanna 719bad0cc3 Mute ClusterPrivilegeTests#testThatSnapshotAndRestore
See elastic/x-pack-elasticsearch#4383

Original commit: elastic/x-pack-elasticsearch@95d57374bc
2018-04-16 17:38:44 +02:00
Luca Cavanna 62e33eeef3
[TEST] REST client request without leading '/' (#29471)
The following is the current behaviour, tested now through a specific
test.

The low-level REST client doesn't add a leading wildcard when not
provided, unless a `pathPrefix` is configured in which case a trailing
slash will be automatically added when concatenating the prefix and the
provided uri.

Also when configuring a pathPrefix, if it doesn't start with a '/' it
will be modified by adding the missing leading '/'.
2018-04-16 15:06:57 +02:00
Ke Li 0bfb59dcf2 Using ObjectParser in UpdateRequest (#29293)
CRUD: Parsing changes for UpdateRequest (#29293)

Use `ObjectParser` to parse `UpdateRequest` so we reject unknown fields
and drop support for the `_fields` parameter because it was deprecated
in 5.x.
2018-04-16 08:39:35 -04:00
Dimitris Athanasiou 5bd467eec8 [ML] Respect max_result_window setting in result APIs (elastic/x-pack-elasticsearch#4380)
Currently there is a hardcoded check against 10000, which
is the default value of the max_result_window setting. This
is a relic of the past. Removing this hardcoded validation
means we respect the setting so that a user may alter it
when appropriate.

relates elastic/x-pack-elasticsearch#3672

Original commit: elastic/x-pack-elasticsearch@9c9c5bab89
2018-04-16 13:12:24 +01:00
Christoph Büscher a004a33803
Prevent accidental changes of default values (#29528)
The default percentiles values and the default highlighter per- and
post-tags are currently publicly accessible and can be altered any time.
This change prevents this by restricting field access.
2018-04-16 13:41:42 +02:00
Bolarinwa Saheed Olayemi 7931cf87f0 [Docs] Add definitions to glossary (#29127)
Definitions for "filter" and "query" are added to the glossary of terms.

Closes #29127
2018-04-16 10:49:54 +02:00
Yogesh Gaikwad 1701934dd4 SAML: Support multiple decryption keys for SP (elastic/x-pack-elasticsearch#4289)
- Changes in build SAML SP metadata to support multiple
  encryption keys.
- Changes in Saml metadata command to support the use of
   protected keystores.
- Changes to export and set proper usage type in key
   descriptors of SP saml metadata XML.
- Changes in SAML realm to create chaining key info
   credential resolver backed by Collection of encryption
   keys as per SP configuration.
- Unit tests and test enhancements

relates elastic/x-pack-elasticsearch#3980,elastic/x-pack-elasticsearch#4293

Original commit: elastic/x-pack-elasticsearch@e02ebcc9e6
2018-04-16 17:17:39 +10:00
Jason Tedor 00fd73acc4
Avoid self-deadlock in the translog (#29520)
Today when reading an operation from the current generation fails
tragically we attempt to close the translog. However, by invoking close
before releasing the read lock we end up in self-deadlock because
closing tries to acquire the write lock and the read lock can not be
upgraded to a write lock. To avoid this, we move the close invocation
outside of the try-with-resources that acquired the read lock. As an
extra guard against this, we document the problem and add an assertion
that we are not trying to invoke close while holding the read lock.
2018-04-15 16:26:09 -04:00
Jason Tedor 9125684d86 Minor cleanup in NodeInfo.groovy
This commit is a minor cleanup of a code block in NodeInfo.groovy. We
remove an unused variable, make the formatting of the code consistent,
and cast a property that is typed as an Object to a String to avoid an
annoying IDE warning.
2018-04-14 20:48:48 -04:00
Jason Tedor 0e89f07c3f Lazy configure build tasks that require older JDKs (elastic/x-pack-elasticsearch#4376)
Some build tasks require older JDKs. For example, the BWC build tasks
for older versions of Elasticsearch require older JDKs. It is onerous to
require these be configured when merely compiling Elasticsearch, the
requirement that they be strictly set to appropriate values should only
be enforced if these tasks are going to be executed. To address this, we
lazy configure these tasks.

Original commit: elastic/x-pack-elasticsearch@804a11c243
2018-04-14 15:45:01 -04:00
Jason Tedor b883e1217f
Lazy configure build tasks that require older JDKs (#29519)
Some build tasks require older JDKs. For example, the BWC build tasks
for older versions of Elasticsearch require older JDKs. It is onerous to
require these be configured when merely compiling Elasticsearch, the
requirement that they be strictly set to appropriate values should only
be enforced if these tasks are going to be executed. To address this, we
lazy configure these tasks.
2018-04-14 15:44:43 -04:00
Jason Tedor efa823bd79 Simplify snapshot check in root build file
Rather than checking a substring match, now that
VersionProperties#elasticsearch is a strongly-typed instance of Version,
we can use the Version#isSnapshot convenience method. This commit
switches the root build file to do this.
2018-04-13 17:11:37 -04:00
Jason Tedor 85ac541ab3
Make NodeInfo#nodeVersion strongly-typed as Version (#29515)
Today we have a nodeVersion property on the NodeInfo class that we use
to carry around information about a standalone node that we will start
during tests. This property is a String which we usually end up parsing
to a Version anyway to do various checks on it. This can end up
happening a lot during configuration so it would be more efficient and
safer to have this already be strongly-typed as a Version and parsed
from a String only once for each instance of NodeInfo. Therefore, this
commit makes NodeInfo#nodeVersion strongly-typed as a Version.
2018-04-13 16:57:59 -04:00
Jason Tedor 82a753dcc7
Enable license header exclusions (#29379)
There are some scenarios where the license on a source file is one that
is compatible with our projects yet we do not want to add the license to
the list of approved license headers (to keep the number of files with
that compatible license contained). This commit adds the ability to
exclude a file from the license check.
2018-04-13 15:59:33 -04:00
lcawley 614d28cee7 [DOCS] Fixed xpack.monitoring.elasticsearch.ssl.ca setting
Original commit: elastic/x-pack-elasticsearch@ce453e1a0c
2018-04-13 11:27:31 -07:00
Jason Tedor 2b201d8f4a Use proper Java version for BWC builds (elastic/x-pack-elasticsearch#4365)
This commit sets the BWC builds to use the version of the JDK that is
appropriate for the indvidual version of Elasticsearch under test.

Original commit: elastic/x-pack-elasticsearch@967a497a20
2018-04-13 12:41:32 -04:00
Jason Tedor 27fafa24f5
Use proper Java version for BWC builds (#29493)
Today we have JAVA_HOME for the compiler Java home and RUNTIME_JAVA_HOME
for the test Java home. However, when we compile BWC nodes and run them,
neither of these Java homes might be the version that was suitable for
that BWC node (e.g., 5.6 requires JDK 8 to compile and to run). This
commit adds support for the environment variables JAVA\d+_HOME and uses
the appropriate Java home based on the version of the node being
started. We even do this for reindex-from-old which requires JDK 7 for
these very old nodes. Note that these environment variables are not
required if not running BWC tests, and they are strictly required if
running BWC tests.
2018-04-13 12:41:18 -04:00
Costin Leau 177121fa05 SQL: fix bug in mutate method
Make sure mutateInstance() returns a different instance

Original commit: elastic/x-pack-elasticsearch@4d403473d0
2018-04-13 19:11:18 +03:00
Costin Leau 4252b3094c SQL: Fix incorrect field type returned by SYS TYPE (elastic/x-pack-elasticsearch#4358)
SYS TYPE returns an integer instead of a boolean (the bug was caused
by reading the ODBC spec which refers to the wire representation instead
of the JDBC one which uses primitives)

Original commit: elastic/x-pack-elasticsearch@f9fe64ab0d
2018-04-13 18:22:53 +03:00
Costin Leau fc5e1631f1 SQL: generalize the use of ? for STRING (elastic/x-pack-elasticsearch#4359)
Improve grammar to allow use of ? as an alternative to STRING
through-out all commands
Add various parsing tests checking the ? usage for SYS commands

Original commit: elastic/x-pack-elasticsearch@d0d1feeb4c
2018-04-13 18:16:47 +03:00
javanna 485d5d19bc Mute TranslogTests#testFatalIOExceptionsWhileWritingConcurrently
This test has been failing quite a few times with a suite timeout,
opened #29509 for it.
2018-04-13 17:03:09 +02:00
Jason Tedor 03ce3dd4a4 Enable skipping fetching latest for BWC builds (#29497)
The BWC builds always fetch the latest from the elastic/elasticsearch
repository for the BWC branches. Yet, there are use-cases for using the
local checkout without fetching the latest. This commit enables these
use-cases by adding a tests.bwc.git.fetch.latest property to skip the
fetches.
2018-04-13 09:31:06 -04:00
Simon Willnauer 694e2a9970
Add remote cluster client (#29495)
This change adds a client that is connected to a remote cluster.
This allows plugins and internal structures to invoke actions on
remote clusters just like a if it's a local cluster. The remote
cluster must be configured via the cross cluster search infrastructure.
2018-04-13 15:23:44 +02:00
Simon Willnauer eab530ce11 Ensure flush happens on shard idle
This adds 2 testcases that test if a shard goes idle
pending (uncommitted) segments are committed and unreferenced
files will be freed.

Relates to #29482
2018-04-13 15:06:51 +02:00
Chandan83 782517b452 Adds SpanGapQueryBuilder in the query DSL (#28636)
This change adds the support for a `span_gap` query inside the span query DSL.
2018-04-13 14:51:03 +02:00
Jay Modi 0d83edbca5 Test: speed up IndexPrivilegeTests (elastic/x-pack-elasticsearch#4348)
The IndexPrivilegeTests have been notoriously slow for years.
@polyfractal identified the primary issue, which is that these tests
were running against an internal cluster with 1 or 2 data nodes and had
the number of replicas set to 1 for indices by default and the methods
in the test would perform a wait for green. This wait for green would
take the full thirty seconds when there was a single data node as the
index could never reach green health due to an unassigned replica. This
could have been caught earlier by asserting the request did not timeout
but this assertion was not present.

This change does a few things to address the issues above. The first is
that these tests now extend SecuritySingleNodeTestCase, which is a new
class that extends ESSingleNodeTestCase and contains the necessary
logic for the setup and teardown of security; much of which is based
off of SecurityIntegTestCase. This means that these tests always run
against a single node cluster and have a much simpler setup. The
default index template for these tests applies settings so that indices
are created with a single shard and no replicas.

Assertions have been added to ensure the health checks with a wait for
green status have not timed out. A handcoded wait for snapshots to
finish has been replaced with an assertBusy call. Finally, the BadApple
annotation has been removed from the test.

Relates elastic/x-pack-elasticsearch#324

Original commit: elastic/x-pack-elasticsearch@572919273d
2018-04-13 06:30:40 -06:00
Mayya Sharipova 5dcfdb09cb
Control max size and count of warning headers (#28427)
Control max size and count of warning headers

Add a static persistent cluster level setting
"http.max_warning_header_count" to control the maximum number of
warning headers in client HTTP responses.
Defaults to unbounded.

Add a static persistent cluster level setting
"http.max_warning_header_size" to control the maximum total size of
warning headers in client HTTP responses.
Defaults to unbounded.

With every warning header that exceeds these limits,
a message will be logged in the main ES log,
and any more warning headers for this response will be
ignored.
2018-04-13 05:55:33 -04:00
Adrien Grand 553c718d66
Make index APIs work without types. (#29479)
Unlike the `indices.create`, `indices.get_mapping` and `indices.put_mapping`
APIs, the index APIs do not need the `include_type_name` option, they can work
work with and without types withouth knowing whether types are being used.

Internally, `_doc` is used as a type if no type is provided, like for the
`indices.put_mapping` API.
2018-04-13 09:08:45 +02:00
Adrien Grand ebd6b5b7ba
Deprecate filtering on `_type`. (#29468)
As indices are only allowed to have one type now, and types are going away in
the future, we should deprecate filtering by `_type`.

Relates #15613
2018-04-13 09:07:51 +02:00
Jason Tedor d44bbb7602
Fix auto-generated ID example format (#29461)
This commit fixes the format of an example auto-generated ID in the docs
where the format misleadingly looked like a UUID rather than a base64
ID.
2018-04-12 22:33:38 -04:00
Sachin Frayne 183ba9a7e5 Fix typo in max number of threads check docs (#29469)
Historically, the bootstrap checks used 2048 as the minimum limit for
the maximum number of threads. This limit was guided by the fact that
the number of processors was artificially capped at 32. This limit was
removed in 6.0.0 and the minimum limit was raised to 4096 to accommodate
this. However, the docs were not updated and this commit addresses that
miss.
2018-04-12 21:16:37 -04:00
lcawley c09c9e13d7 [DOCS] Removes redundant role examples
Original commit: elastic/x-pack-elasticsearch@ac17cbbdfd
2018-04-12 16:47:45 -07:00
Nik Everett 76c764b379 SQL: Prepare JDBC for release (elastic/x-pack-elasticsearch#4341)
This changes JDBC so it can be released. It bundles the
`sql-shared-client` and `sql-proto` jars into the jar for the jdbc client.
It also Generates a pom for the jdbc driver when you run `gradle assemble`
on it. This will allow us to release the jdbc driver.

It also adds a zip distribution of the jdbc driver with all of its
dependencies bundled in the zip. It'd be nice to bundle all of the jdbc
driver's dependencies in the jar but we can't quite do that yet. So, for
now, to help folks using BI tools use the JDBC driver, we build a zip.

Original commit: elastic/x-pack-elasticsearch@9c668231d4
2018-04-12 15:43:35 -04:00
Nhat Nguyen f96e00badf
Add primary term to translog header (#29227)
This change adds the current primary term to the header of the current
translog file. Having a term in a translog header is a prerequisite step
that allows us to trim translog operations given the max valid seq# for
that term.

This commit also updates tests to conform the primary term invariant 
which guarantees that all translog operations in a translog file have
its terms at most the term stored in the translog header.
2018-04-12 13:57:59 -04:00
Lee Hinman d72d3f996e
Add a helper method to get a random java.util.TimeZone (#29487)
* Add a helper method to get a random java.util.TimeZone

This adds a helper method to ESTestCase that returns a randomized
`java.util.TimeZone`. This can be used when transitioning code from Joda to the
JDK's time classes.
2018-04-12 11:56:42 -06:00
Lisa Cawley e521bb55ff [DOCS] Removed X-Pack installation terminology (elastic/x-pack-elasticsearch#4339)
Original commit: elastic/x-pack-elasticsearch@4987e15148
2018-04-12 10:23:07 -07:00
Costin Leau e5d18ad45c SQL: GROUP BY use composite instead of terms aggregation (elastic/x-pack-elasticsearch#4282)
Rewrote the GROUP BY to use composite aggregation instead of terms 
(and everything that comes with it) but instead rely on composite aggregation

This not only works better but simplifies the code complexity since
composite is a straight, two-level tree:

1. root/group-by/composite-keys
2. (metric) aggregations

This removes a lot of complexity from all stages that involve creating,
assembling and especially parsing the results.
By moving to composite agg, the aggregation/GROUP BY are now pageable
so the consumer/listener had to be extended to include a dedicated
cursor and specific (bucket) extractors inline with the scroll requests.

While at it, also improved the support for implicit GROUP BY by
formalizing it (previously it supported only counts and no other
agg).

In addition:
Fixed a JDBC bug that caused incorrect timeout to be passed
Improved the returned RowSet a bit and add better naming
Pick up @Nullable move from core
Make sure to specify the TimeZone for DateTimeHistogram extraction
Add missing javadoc
To avoid delegating NamedWriteableRegistry (NWR) and to keep the scope
clean, SQL writeables now handle their own serialization, keeping the
boundary between the Elasticsearch's NWR in place.
Pass NamedWriteableRegistry only when looking at the next page
To keep in line with the existing patter and simplify the code
bureaucracy, the deserialization happens directly.
Since the SearchSourceBuilder deserialization happens explicitly (and
it's otherwise opaque), the declarative invocation isn't necessary
anymore.
Add a bit more randomization in tests

Original commit: elastic/x-pack-elasticsearch@f5af046386
2018-04-12 20:20:10 +03:00