Commit Graph

30334 Commits

Author SHA1 Message Date
David Kyle cb9d10f971
Protect against NPE in RestNodesAction (#29059)
* Protect against NPE in RestNodesAction
2018-03-14 15:47:18 +00:00
David Roberts 5bf92ca3b3
Enforce that java.io.tmpdir exists on startup (#28217)
If the default java.io.tmpdir is used then the startup script creates
it, but if a custom java.io.tmpdir is used then the user must ensure it
exists before running Elasticsearch. If they forget then it can cause
errors that are hard to understand, so this change adds an explicit
check early in the bootstrap and reports a clear error if java.io.tmpdir
is not an accessible directory.
2018-03-14 15:43:53 +00:00
Nik Everett 3e0e6444cf Mark field_data as deprecated in /_cache/clear
It was deprecated in #28943.
2018-03-14 11:39:35 -04:00
Jack Conradson 42fe66162e
Fix Parsing Bug with Update By Query for Stored Scripts (#29039)
This changes the parsing logic for stored scripts in update by query to match the parsing logic for scripts in general Elasticsearch.

Closes #28002
2018-03-14 07:12:15 -07:00
Christoph Büscher 90469123b3
Fix eclipse compile issues (#29056)
Eclipse Oxygen doesn't seem to be able to infer the correct type
arguments for Arrays::asList in the given test context. Adding cast to
make this more explicit.
2018-03-14 13:44:12 +01:00
Jason Tedor d3d7c04524 Fix description of die with dignity plugin
This commit adjusts the description of the die with dignity plugin which
was leftover from a previous iteration on this work.
2018-03-14 07:45:32 -04:00
Martijn van Groningen 34a264c375
added docs for `wrapper` query.
Closes #11591
2018-03-14 11:51:22 +01:00
Jason Tedor 24d10adaab
Main response should not have status 503 when okay (#29045)
The REST status 503 means "I can not handle the request that you sent
me." However today we respond to a main request with a 503 when there
are certain cluster blocks despite still responding with an actual main
response. This is broken, we should respond with a 200 status. This
commit removes this silliness.
2018-03-14 06:36:37 -04:00
Jason Tedor 647d0a1e95
Do not swallow fail to convert exceptions (#29043)
When converting the source for an indexing request to JSON, the
conversion can throw an I/O exception which we swallow and proceed with
logging to the slow log. The cause of the I/O exception is lost. This
commit changes this behavior and chooses to drop the entry from the slow
logs and instead lets an exception percolate up to the indexing
operation listener loop. Here, the exception will be caught and logged
at the warn level.
2018-03-13 23:42:16 -04:00
Jason Tedor 46fcd07153
Add total hits to the search slow log (#29034)
This commit adds the total hits to the search slow log.
2018-03-13 20:40:47 -04:00
Nik Everett 8f0da37c5e Revert "REST tests: Increase version to skip to include 6.3"
This reverts commit 9f2c4df94d which isn't
needed now that the backport is complete.
2018-03-13 20:22:32 -04:00
Alexander Reelsen 9f2c4df94d REST tests: Increase version to skip to include 6.3
In order to fix the tests, the correct version needs to be skipped until
the backport is done.

Relates #28943
2018-03-13 17:00:01 -07:00
Chun On Lee 4ec179b2ba Update "_doc" to "account" type for bulk example (#28786)
* Change 'account' to '_doc' as types are deprecated
2018-03-13 15:51:59 -07:00
Jason Tedor bddf9df8b4
Add search slowlog level to docs (#29040)
This commit adds an indication how to set the search slowlog level to
the docs.
2018-03-13 18:27:14 -04:00
Jason Tedor 4faf3cf02c
Add docs for error file configuration (#29032)
This commit adds docs for configuring the error file setting for where
the JVM writes fatal error logs.
2018-03-13 18:18:01 -04:00
Jason Tedor 4dc3adad51
Archive unknown or invalid settings on updates (#28888)
Today we can end up in a situation where the cluster state contains
unknown or invalid settings. This can happen easily during a rolling
upgrade. For example, consider two nodes that are on a version that
considers the setting foo.bar to be known and valid. Assume one of these
nodes is restarted on a higher version that considers foo.bar to now be
either unknown or invalid, and then the second node is restarted
too. Now, both nodes will be on a version that consider foo.bar to be
unknown or invalid yet this setting will still be contained in the
cluster state. This means that if a cluster settings update is applied
and we validate the settings update with the existing settings then
validation will fail. In such a state, the offending setting can not
even be removed. This commit helps out with this situation by archiving
any settings that are unknown or invalid at the time that a settings
update is applied. This allows the setting update to go through, and the
archived settings can be removed at a later time.
2018-03-13 17:32:18 -04:00
Jason Tedor 98ad2596d8
Put JVM crash logs in the default log directory (#29028)
This commit adds a JVM flag to ensure that the JVM fatal error logs land
in the default log directory. Users that wish to use an alternative
location should change the path configured here.
2018-03-13 16:32:16 -04:00
Jason Tedor c8e71327ab
Log template creation and deletion (#29027)
These can be seen at the debug level via cluster state update logging
but really they should be more visible like index creation and
deletion. This commit adds info-level logging for template puts and
deletes.
2018-03-13 16:31:19 -04:00
Jason Tedor 697b9f8b82
Remove interning from prefix logger (#29031)
This interning is completely unnecessary because we look up the marker
by the prefix (value, not identity) anyway. This means that regardless
of the identity of the prefix, we end up with the same marker. That is
all that we really care about here.
2018-03-13 16:30:13 -04:00
Robin Neatherway 6dadce4761 Painless: Correct ClassToName string conversion (#28997)
A typo of 'dimensions' rather than 'dimension' caused an infinite loop.
2018-03-13 13:16:48 -07:00
Paul Sanwald 6dae955b6a
Document and test date_range "missing" support (#28983)
* Add a REST integration test that documents date_range support

Add a test case that exercises date_range aggregations using the missing
option.

Addresses #17597

* Test cleanup and correction

Adding a document with a null date to exercise `missing` option, update
test name to something reasonable.

* Update documentation to explain how the "missing" parameter works for
date_range aggregations.

* Wrap lines at 80 chars in docs.

* Change format of test to YAML for readability.
2018-03-13 12:58:30 -07:00
Mayya Sharipova fb5b2dff57
Correct the way to reference params in painless 2018-03-13 12:33:37 -07:00
olcbean edc57f6f34 REST: deprecate `field_data` in Clear Cache API (#28943)
We call it `fielddata` everywhere else in the code and API so we may as
well be consistent.
2018-03-13 15:16:27 -04:00
Jason Tedor 5904d936fa
Copy Lucene IOUtils (#29012)
As we have factored Elasticsearch into smaller libraries, we have ended
up in a situation that some of the dependencies of Elasticsearch are not
available to code that depends on these smaller libraries but not server
Elasticsearch. This is a good thing, this was one of the goals of
separating Elasticsearch into smaller libraries, to shed some of the
dependencies from other components of the system. However, this now
means that simple utility methods from Lucene that we rely on are no
longer available everywhere. This commit copies IOUtils (with some small
formatting changes for our codebase) into the fold so that other
components of the system can rely on these methods where they no longer
depend on Lucene.
2018-03-13 12:49:33 -04:00
Jason Tedor 46e16b68fe Fix packaging scripts references to /etc/elasticsearch
We no longer source the environment file in the packaging scripts yet we
had leftover references to variables defined by those environment
files. This commit cleans these up.
2018-03-13 10:07:02 -04:00
olcbean 3cf599be4c REST api specs : remove unsupported `wait_for_merge` param (#28959) 2018-03-13 12:12:52 +01:00
Joost Rothweiler 02a611663a Indices PUT Mapping API docs: Remove mapping type user and rephrase first sentence (#28998)
The current docs on [Indices APIs: PUT Mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html) suggests that a having number of different mapping types per index is still possible in elasticsearch versions > 6.0.0 although they have been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html). The console code has already been updated accordingly but notes (2) and (3) on the console code still name the `user` mapping type.

This PR updates the list with notes after the console code, as well as the first sentence of the docs
to avoid confusion. Also, I have removed the second command from the console code as it no
longer holds any value if the docs are solely on the `_doc` mapping.
2018-03-13 09:58:47 +01:00
Daniel Mitterdorfer b2557b9c11
Skip GeoIpProcessorFactoryTests on Windows (#29005)
With this commit we skip all GeoIpProcessorFactoryTests on Windows.
These tests use a MappedByteBuffer which will keep its file mappings
until it is garbage-collected. As a consequence, the corresponding
file appears to be still in use, Windows cannot delete it and the test
will fail in teardown.

Closes #29001
2018-03-13 09:10:40 +01:00
Jason Tedor 8b6fbe2c11
Add test for dying with dignity (#28987)
I have long wanted an actual test that dying with dignity works. It is
tricky because if dying with dignity works, it means the test JVM dies
which is usually an abnormal condition. And anyway, how does one force a
fatal error to be thrown. I was motivated to investigate this again by
the fact that I missed a backport to one branch leading to an issue
where Elasticsearch would not successfully die with dignity. And now we
have a solution: we install a plugin that throws an out of memory error
when it receives a request. We hack the standalone test infrastructure
to prevent this from failing the test. To do this, we bypass the
security manager and remove the PID file for the node; this tricks the
test infrastructure into thinking that it does not need to stop the
node. We also bypass seccomp so that we can fork jps to make sure that
Elasticsearch really died. And to be extra paranoid, we parse the logs
of the dead Elasticsearch process to make sure it died with
dignity. Never forget.
2018-03-12 23:20:07 -04:00
Jason Tedor 6088af5887 Fix comment regarding removal of requiresKeystore
The requiresKeystore flag was removed from PluginInfo in 6.3.0. This
commit fixes a pair of code comments that incorrectly refer to this
version as 7.0.0.
2018-03-12 14:20:02 -04:00
Jason Tedor f0164cc954
Stop sourcing scripts during installation/removal (#28918)
Previously we allowed a lot of customization of Elasticsearch during
package installation (e.g., the username and group). This customization
was achieved by sourcing the env script (e.g.,
/etc/sysconfig/elasticsearch) during installation. Since we no longer
allow such flexibility, we do not need to source these env scripts
during package installation and removal.
2018-03-12 13:44:47 -04:00
Jason Tedor b8e165a994 Fix BWC versions on plugin info
This commit fixes the BWC versions on the plugin info serialization
which was changed to remove the requiresKeystore flag.
2018-03-12 13:05:48 -04:00
Tanguy Leroux 5a65db153e
[Test] GoogleCloudStorageFixture command line is too long on Windows (#28991)
Windows has some strong limitations on command line arguments,
specially when it's too long. In the googlecloudstoragefixture anttask
the classpath argument is very long and the command fails. This commit
removes the classpath as an argument and uses the CLASSPATH
environment variable instead.
2018-03-12 18:02:30 +01:00
Jason Tedor 6331bcaf76
Create keystore on package install (#28928)
This commit removes the ability to specify that a plugin requires the
keystore and instead creates the keystore on package installation or
when Elasticsearch is started for the first time. The reason that we opt
to create the keystore on package installation is to ensure that the
keystore has the correct permissions (the package installation scripts
run as root as opposed to Elasticsearch running as the elasticsearch
user) and to enable removing the keystore on package removal if the
keystore is not modified.
2018-03-12 12:48:00 -04:00
Mika⠙ a7b53fd3b7 Add check when trying to reroute a shard to a non-data discovery node (#28886)
While trying to reroute a shard to or from a non-data node (a node with ``node.data=false``), I encountered a null pointer exception. Though an exception is to be expected, the NPE was occurring because ``allocation.routingNodes()`` would not contain any non-data nodes, so when you attempt to do ``allocation.routingNodes.node(non-data-node)`` it would not find it, and thus error. This occurred regardless of whether I was rerouting to or from a non-data node.

This PR adds a check (as well as a test for these use cases) to return a legible, useful exception if the discovery node you are rerouting to or from is not a data node.
2018-03-12 16:48:51 +01:00
Shane O'Grady 7dcd48a0b5 [discovery-gce] Align code examples and documentation (#28876)
The docs state that `_gce_` is recommended but the code sample states
that `_gce:hostname_` is recommended. This aligns the code sample with
the documentation. Also replace `type` with `zen.hosts_provider` as 
discovery.type was removed in #25080.
2018-03-12 15:37:11 +01:00
Jason Tedor b1b469e30f
Avoid class cast exception from index writer (#28989)
When an index writer encounters a tragic exception, it could be a
Throwable and not an Exception. Yet we blindly cast the tragic exception
to an Exception which can encounter a ClassCastException. This commit
addresses this by checking if the tragic exception is an Exception and
otherwise wrapping the Throwable in a RuntimeException if it is not. We
choose to wrap the Throwable instead of passing it around because
passing it around leads to changing a lot of places where we handle
Exception to handle Throwable instead. In general, we have tried to
avoid handling Throwable and instead let those bubble up to the uncaught
exception handler.
2018-03-12 08:42:02 -04:00
Yannick Welsch be7f5dde24
Disallow logger methods with Object parameter (#28969)
Log4j2 provides a wide range of logging methods. Our code typically only uses a subset of them. In particular, uses of the methods trace|debug|info|warn|error|fatal(Object) or trace|debug|info|warn|error|fatal(Object, Throwable) have all been wrong, leading to not properly logging the provided message. To prevent these issues in the future, the corresponding Logger methods have been blacklisted.
2018-03-12 03:05:24 -07:00
Jim Ferenczi 7afe5ad943
Restore tiebreaker for cross fields query (#28935)
This commit restores the handling of tiebreaker for multi_match
cross fields query. This functionality was lost during a refactoring
of the multi_match query (#25115).

Fixes #28933
2018-03-12 09:58:20 +01:00
Daniel Mitterdorfer 0d78a5890e
Reduce heap-memory usage of ingest-geoip plugin (#28963)
With this commit we reduce heap usage of the ingest-geoip plugin by
memory-mapping the database files. Previously, we have stored these
files gzip-compressed but this has resulted that data are loaded on the
heap.

Closes #28782
2018-03-12 08:07:33 +01:00
Daniel Mitterdorfer aeaebddf4a
Honor RUNTIME_JAVA_HOME for benchmarks (#28962)
With this commit we configure our microbenchmarks project to use the
configured RUNTIME_JAVA_HOME and to fallback on JAVA_HOME so this
behavior is consistent  with the rest of the Elasticsearch build.

Closes #28961
2018-03-12 07:58:07 +01:00
Ryan Ernst 4216fc9f64
Plugins: Allow modules to spawn controllers (#28968)
This commit makes the controller spawner also look under modules. It
also fixes a bug in module security policy loading where the module is a
meta plugin.
2018-03-11 09:01:27 -07:00
Nhat Nguyen 4f644d04a3 TEST: Use non-zero number for #testCompareUnits
In `ByteSizeValueTests#testCompareUnits`, we expect non-zero for the
variable `number` however `randomNonNegativeLong` can return zero.

CI: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.2+oracle-java10-periodic/147/console
2018-03-10 22:56:22 -05:00
Jason Tedor 4ba80a7952
Maybe die before failing engine (#28973)
Today we check for a few cases where we should maybe die before failing
the engine (e.g., when a merge fails). However, there are still other
cases where a fatal error can be hidden from us (for example, a failed
index writer commit). This commit modifies the mechanism for failing the
engine to always check for a fatal error before failing the engine.
2018-03-10 07:41:51 -05:00
Jason Tedor 950c4363bf
Remove special handling for _all in nodes info
Today when requesting _all we return all nodes regardless of what other
node qualifiers are in the request. This is contrary to how the
remainder of the API behaves which acts as additive and subtractive
based on the qualifiers and their ordering. It is also contrary to how
the wildcard * behaves. This commit removes the special handling for
_all so that it behaves identical to the wildcard *.

Relates #28971
2018-03-09 18:23:16 -05:00
Lee Hinman 97b513e925
Remove Booleans use from XContent and ToXContent (#28768)
* Remove Booleans use from XContent and ToXContent

This removes the use of the `common.Boolean` class from two of the XContent
classes, so they can be decoupled from the ES code as much as possible.

Related to #28754, #28504
2018-03-09 14:58:54 -07:00
Paul Sanwald 9f7cd14f15
Update Gradle Testing Docs (#28970)
Attempting to run the REST tests, I noticed the testing instructions
  in the `TESTING.asciidoc` were outdated, so I fixed the paths.
  Steps I took to test:

  * Ran `./gradlew :distribution:packages:rpm:assemble` and make sure
  RPM is created in `./distribution/packages/rpm/build/distributions/`

  * Ran testing commands and verified the REST tests ran.
2018-03-09 11:54:59 -08:00
Nhat Nguyen 4973887a10
Make primary-replica resync failures less lenient (#28534)
Today, failures from the primary-replica resync are ignored as the best 
effort to not mark shards as stale during the cluster restart. However
this can be problematic if replicas failed to execute resync operations
but just fine in the subsequent write operations. When this happens,
replica will miss some operations from the new primary. There are some
implications if the local checkpoint on replica can't advance because of
the missing operations.

1. The global checkpoint won't advance - this causes both primary and 
replicas keep many index commits

2. Engine on replica won't flush periodically because uncommitted stats
is calculated based on the local checkpoint

3. Replica can use a large number of bitsets to keep track operations seqno

However we can prevent this issue but still reserve the best-effort by 
failing replicas which fail to execute resync operations but not mark
them as stale. We have prepared to the required infrastructure in #28049
and #28054 for this change.

Relates #24841
2018-03-09 09:55:45 -08:00
Tanguy Leroux d9cc6b9270 Remove temporary file 10_basic.yml~ 2018-03-09 17:44:10 +01:00
Martijn van Groningen b32e999960 Use different pipeline id in test.
(pipelines do not get removed between tests extending from ESIntegTestCase)
2018-03-09 14:29:42 +01:00