Commit Graph

5306 Commits

Author SHA1 Message Date
Yannick Welsch 58a103aca2 Remove custom iterators from RoutingNodes (#18615)
Contains a number of cleanups related to recent changes in RoutingNodes:

- PR #17821 (Immutable ShardRouting) changed RoutingNode to use a map indexed by ShardId to manage ShardRouting elements. This means that we can directly select the right ShardRouting without iterating over all elements. This lets us get rid of RoutingNodeIterator and all kind of iterations all over the place.
- Second cleanup is an extension of #18390 (Expose cluster state before reroute in RoutingAllocation instead of RoutingNodes). We should not reexpose RoutingTable in RoutingNodes and only use it in the constructor. This makes it clear that the RoutingTable is only used to construct the RoutingNodes and can diverge from it afterwards (only RoutingNodes is mutable).
- Remove AllocationService.applyNewNodes() (that is already done as part of construction of RoutingNodes)
2016-05-31 16:37:58 +02:00
Simon Willnauer 82645563bf Estimate shard size for shrinked indices (#18659)
When we shrink an index we can estimate the shards size for the primary
from the source index. This is important for allocation decisions since we
should try out best to ensure we have enough space on the node we shrink the
index.
2016-05-31 16:33:38 +02:00
Christoph Büscher 740bdc8d99 Treat zero token in `common` terms query as MatchNoDocsQuery
Currently we return `null` when the query in a common terms query has
zero tokens after analysis. It would be better if query builders
`toQuery()` would never return null and return a meaningful lucene
query instead. Since an ExtendedCommonTermsQuery with no terms gets
rewritten to a MatchNoDocsQuery later, it is enough to leave out the
check for zero tokens.
2016-05-31 16:28:03 +02:00
Michael McCandless 8f0109c2a5 Merge pull request #18651 from mikemccand/remove_iw_max_memory_stat
Remove index_writer_max_memory stat from segment stats
2016-05-31 09:58:55 -04:00
Robert Muir 2d1eb89aef improve date api for expressions/painless fields 2016-05-31 09:32:33 -04:00
Adrien Grand adf4712164 Make ip fields backward-compatible at query time. #18593
The fact that ip fields used a different doc values representation in 2.x causes
issues when querying 2.x and 5.0 indices in the same request. This changes 2.x
doc values on ip fields/2.x to be hidden behind binary doc values that use the
same encoding as 5.0. This way the coordinating node will be able to merge shard
responses that have different major versions.

One known issue is that this makes sorting/aggregating slower on ip fields for
indices that have been generated with elasticsearch 2.x.
2016-05-31 14:50:00 +02:00
Mike McCandless 5c525e6606 Remove index_writer_max_memory stat from segment stats 2016-05-31 06:29:29 -04:00
Simon Willnauer 867d35c084 Never trip circuit breaker in liveness request (#18627)
We don't want transport clients to disconnect due to circuit breakers
preventing the liveness request from executing.

Relates to #17951
2016-05-31 11:31:52 +02:00
Simon Willnauer 502a775a7c Add primitive to shrink an index into a single shard (#18270)
This adds a low level primitive operations to shrink an existing
index into a new index with a single shard. This primitive expects
all shards of the source index to allocated on a single node. Once the target index is initializing on the shrink node it takes a snapshot of the source index shards and copies all files into the target indices data folder. An [optimization](https://issues.apache.org/jira/browse/LUCENE-7300) coming in Lucene 6.1 will also allow for optional constant time copy if hard-links are supported by the filesystem. All mappings are merged into the new indexes metadata once the snapshots have been taken on the merge node.

To shrink an existing index all shards must be moved to a single node (one instance of each shard) and the index must be read-only:

```BASH
$ curl -XPUT 'http://localhost:9200/logs/_settings' -d '{
    "settings" : {
        "index.routing.allocation.require._name" : "shrink_node_name",
        "index.blocks.write" : true 
    }
}
```
once all shards are started on the shrink node. the new index can be created via:

```BASH
$ curl -XPUT 'http://localhost:9200/logs/_shrink/logs_single_shard' -d '{
    "settings" : {
        "index.codec" : "best_compression",
        "index.number_of_replicas" : 1
    }
}'
```

This API will perform all needed check before the new index is created and selects the shrink node based on the allocation of the source index. This call returns immediately, to monitor shrink progress the recovery API should be used since all copy operations are reflected in the recovery API with byte copy progress etc.

The shrink operation does not modify the source index, if a shrink operation should
be canceled or if the shrink failed, the target index can simply be deleted and
all resources are released.
2016-05-31 10:41:44 +02:00
Ryan Ernst c911f4d951 Merge pull request #18646 from rjernst/jarhell_evil_tests
Tests: Remove unnecessary evil jarhell tests
2016-05-31 00:08:36 -07:00
Adrien Grand 9570feaf8d Process dynamic templates in order. #18638
When calling `findTemplateBuilder(context, currentFieldName, "text", null)`,
elasticsearch ignores all templates that have a `match_mapping_type` set since
no dynamic type is provided (the last parameter, which is null in that case).
So this should only be called _last_. Otherwise, if a path-based template
matches, it will have precedence over all type-based templates.

Closes #18625
2016-05-31 09:00:10 +02:00
Ryan Ernst 454de6a8f2 Tests: Remove unnecessary evil jarhell tests
We have 3 evil tests for jarhell. They have been failing in java 9
because of how evil they are. The first checks the leniency we add for
jarhell in the jdk itself. This is unecessary, since if the leniency
wasn't there, we would already be failing all jarhell checks. The second
is checking the compile version is compatible with the jdk. This is
simpler since we don't need to fake the java version: we know 1.7 should
be compatibile with both java 8 and 9, so we can use that as a constant.
Finally the last test checks if the java version system property is
broken. This is simply something we should not check, we have to trust
that java specifies it correctly, and again, if it was broken, all
jarhell checks would be broken.
2016-05-30 21:39:56 -07:00
Boaz Leskes 38bee27b11 testCorruptionOnNetworkLayerFinalizingRecovery should keep on trying to assign replicas
In rare cases it can reach the limit set by index.allocation.max_retries
2016-05-30 21:37:34 +02:00
Simon Willnauer f74a78940c Improve phrase suggest test speed (#18633)
There is no reason to read the entire marvel hero file to test the features,
it might take several seconds to do so which is unnecessary.
This commit also splits SearchSuggestTests into core and modules/mustache 
also add @Nighlty to forbidden API to make sure we don't use it since they won't run in CI these days.
2016-05-30 17:22:03 +02:00
Jason Tedor 04cae88ff4 Do not use Lucene SuppressForbidden
Lucene SuppressForbidden is marked lucene.internal and should not be
used outside of Lucene. This commit removes the uses of this class
within Elasticsearch. Instead,
org.elasticsearch.common.SuppressForbidden should be used, which was
already the case in most places.
2016-05-30 10:57:33 -04:00
Boaz Leskes a1c4086a17 No need to inject the ClusterService into IndicesService (#18639)
It's already available where it's needed.
2016-05-30 16:55:44 +02:00
Britta Weber fc1696822f Fix filtering of node ids for TransportNodesAction (#18634)
* Fix filtering of node ids for TransportNodesAction

Don't mix up member variables  with local variables
in constructor.

closes #18618
2016-05-30 15:26:20 +02:00
Yannick Welsch 148fd3f891 [TEST] mute testDeleteIndexStore test
Issue: https://github.com/elastic/elasticsearch/issues/18558
2016-05-30 11:57:42 +02:00
Simon Willnauer 32e9a879b4 Use at least 2 docs to see deleted docs
Closes #18623
2016-05-28 08:14:49 +02:00
Jason Tedor df7b3c6e82 Fix translog replay multiple operations same doc
Modifying the translog replay to not replay again into the translog
introduced a bug for the case of multiple operations for the same
doc. Namely, since we were no longer updating the version map for each
operation, the second operation for a doc would be treated as a creation
instead of as an update. This commit fixes this bug by placing these
operations into version map. This commit includes a failing test case.

Relates #18611
2016-05-27 09:43:19 -04:00
Christoph Büscher f0020caf7c Merge pull request #18589: Improve TimeUnitRounding for edge cases and DST transitions 2016-05-27 15:37:20 +02:00
Simon Willnauer 98fd45dc02 Move DocStats under Engine to get more accurate numbers (#18587)
Today we pull doc stats from an index reader which might not reflect reality.
IndexWriter might have merged all deletes away but due to a missing refresh
the stats are completely off. This change pulls doc stats from the IndexWriter
directly instead of relying on refreshes to run regularly. Note: Buffered deletes
are still not visible until the segments are flushed to disk.
2016-05-27 15:31:40 +02:00
Yannick Welsch 2b47a2643c Only fail relocation target shard if failing source shard is a primary (#18574)
If the relocation source fails during the relocation of a shard from one node to another, the
relocation target is currently failed as well. For replica shards this is not necessary,
however, as the actual shard recovery of the relocation target is done via the primary shard.
2016-05-27 15:28:57 +02:00
Christoph Büscher 29c970958c Adding tests for derivatives on date histogram aggregation with time zones 2016-05-27 15:18:11 +02:00
Christoph Büscher 4439a86cb8 Improve TimeUnitRounding for edge cases and DST transitions
Our current testing for TimeUnitRoundings rounding() and nextRoundingValue()
methods that are used especially for date histograms lacked proper randomization
for time zones. We only did randomized tests for fixed offset time zones
(e.g. +01:00, -05:00) but didn't account for real world time zones with
DST transitions.

Adding those tests revealed a couple of problems with our current rounding logic.
In some cases, usually happening around those transitions, rounding a value down
could land on a value that itself is not a proper rounded value. Also sometimes
the nextRoundingValue would not line up properly with the rounded value of all
dates in the next unit interval.

This change improves the current rounding logic in TimeUnitRounding in two ways:
it makes sure that calling round(date) always returns a date that when rounded
again won't change (making round() idempotent) by handling special cases happening
during dst transitions by performing a second rounding. It also changes the
nextRoundingValue() method to itself rely on the round method to make sure we
always return rounded values for the unit interval boundaries.

Also adding tests for randomized TimeUnitRounding that assert important basic
properties the rounding values should have. For better understanding and readability
a few of the pathological edge cases are also added as a special test case.
2016-05-27 15:18:11 +02:00
Jason Tedor 41710f1028 Upgrade joda-time to 2.9.4
This commit upgrades joda-time to version 2.9.4 to integrate a bug fix
there into Elasticsearch.

Relates #18609
2016-05-27 08:51:19 -04:00
Martijn van Groningen 0e9f3addd2 Nested inner hits shouldn't use relative paths
Like on other places in the query dsl the full field name should be used.
Before this change this wasn't the case for nested inner hits when source filtering was used.
Highlighting has a workaround, which is now removed as the source of nested inner hits can only be refered by the full name.

Closes #16653
2016-05-27 13:41:45 +02:00
Jason Tedor cebbf0de41 Do not replay into translog on local recovery
When performing a local recovery, the engine replays operations
recovered from the translog into the translog again. These duplicated
operations are eventually cleared after successful recovery on flush,
but there is no need to play these operations into the translog at
all. This commit modifies the local recovery process so as to not replay
these operations into the translog.

Relates #18547
2016-05-27 06:04:11 -04:00
Boaz Leskes 318a4e3ef6 Introduce dedicated master nodes in testing infrastructure (#18514)
This PR changes the InternalTestCluster to support dedicated master nodes. The creation of dedicated master nodes can be controlled using a new `supportsMasterNodes` parameter to the ClusterScope annotation. If set to true (the default), dedicated master nodes will randomly be used. If set to false,  no master nodes will be created and data nodes will also be allowed to become masters. If active, test runs will either have 1 or 3 masternodes
2016-05-27 08:44:20 +02:00
Igor Motov fb763c1e8e Add ability to store results for long running tasks
The results of the tasks are stored in a special index .results
2016-05-26 19:49:13 -04:00
Robert Muir 3f06d9f3b8 Merge pull request #18600 from rmuir/new_script_exception
replace ScriptException with a better one
2016-05-26 17:51:34 -04:00
Robert Muir 76ca4af561 move instanceof to catch block 2016-05-26 15:03:13 -04:00
Jason Tedor d23db39445 Merge pull request #18594 from jasontedor/plugins-cleanup
Plugins cleanup
2016-05-26 14:46:09 -04:00
Jason Tedor f16f65741e Fix when plugins directory is symlink
This commit fixes an issue with the plugins directory being a symbolic
link. Namely, the install plugins command attempts to always create the
plugins directory just in case it does not exist. The JDK method used
here guarantees that the directory is created, and an exception is not
thrown if the directory could not be created because it already
exists. The problem is that this JDK method does not respect symlinks so
its internal existence checks fails, it proceeds to attempt to create
the directory, but the directory creation fails because the symlink
exists. This is documented as being not an issue. We work around this by
checking if there is a symlink where we expect the plugins directory to
be, and only attempt to create if not. We add a unit test that plugin
installation to a symlinked plugins directory works as expected.
2016-05-26 14:10:32 -04:00
Yannick Welsch f98ca5310c Fix ReplicaShardAllocatorTests when unassigned reason is ALLOCATION_FAILED
When mocking unassigned shards which have failed with reason ALLOCATION_FAILED we
have to ensure that the failed allocation counter is strictly positive.
2016-05-26 19:01:43 +02:00
Ryan Ernst a8a38c282a Remove extra mostly duplicate readme file
It looks like the readme was duplicated when plugins were merged back
into the repo. We removed all these extra files from the plugins, this
removes the remaining duplicate from core.

closes #18597
2016-05-26 08:54:35 -07:00
Robert Muir f037807117 replace ScriptException with a better one 2016-05-26 11:43:29 -04:00
Jason Tedor d29844e597 Remove custom plugins path
This commit removes the ability to specify a custom plugins
path. Instead, the plugins path will always be a subdirectory called
"plugins" off of the home directory.
2016-05-26 10:16:25 -04:00
Jason Tedor 0f529e10a8 Fix plugin command name in remove plugin command
This commit fixes the name of the plugin command that is output when a
user attempts to remove a plugin that does not exist.
2016-05-26 10:14:39 -04:00
Yannick Welsch 31b0777c91 Simplify delayed shard allocation (#18351)
This commit simplifies the delayed shard allocation implementation by assigning clear responsibilities to the various components that are affected by delayed shard allocation:

- UnassignedInfo gets a boolean flag delayed which determines whether assignment of the shard should be delayed. The flag gets persisted in the cluster state and is thus available across nodes, i.e. each node knows whether a shard was delayed-unassigned in a specific cluster state. Before, nodes other than the current master were unaware of that information.
- This flag is initially set as true if the shard becomes unassigned due to a node leaving and the index setting index.unassigned.node_left.delayed_timeout being strictly positive. From then on, unassigned shards can only transition from delayed to non-delayed, never in the other direction.
- The reroute step is in charge of removing the delay marker (comparing timestamp when node left to current timestamp).
- A dedicated service DelayedAllocationService, reacting to cluster change events, has the responsibility to schedule reroutes to remove the delay marker.

Closes #18293
2016-05-26 13:39:55 +02:00
Ryan Ernst 16d029aff7 Merge branch 'master' into staging_plugins 2016-05-25 14:47:12 -07:00
Ryan Ernst 9c15e0c56d Merge pull request #18583 from rjernst/official_plugins
Use resource files for list of modules and plugins
2016-05-25 14:42:24 -07:00
Ryan Ernst 45adab0cb8 Add test that x-pack is in official plugins list 2016-05-25 14:23:57 -07:00
Jason Tedor 9d39b05845 Remove deprecation suppression
Failing the build on deprecation warnings was removed in
19b3ec88af. This commit removes the
suppressed deprecation warnings so that their use is surfaced in the
build now.

Relates #18582
2016-05-25 17:15:36 -04:00
Ryan Ernst a9e7bdc54c Plugins: use resource files for list of modules and plugins
This adds modules.txt and plugins.txt to the core jar resource files,
which the install plugin command statically loads, in place of the
previously hardcoded lists (which have often gone out of date).
2016-05-25 13:42:24 -07:00
Ryan Ernst 478877edf7 Plugins: Changing staging property to be the hash instead of a boolean
With the unified release, we will have staged releases based on a
unified hash (hash of all the hashes), so using the elasticsearch hash
for plugins staging will no longer work. This change makes the
`es.plugins.staging` property take the staging hash it should use.
2016-05-25 12:36:31 -07:00
Jim Ferenczi 6d62f33702 Make doc_values accessible for _type
`doc_values` for _type field are created but any attempt to load them throws an IAE.

This PR re-enables `doc_values` loading for _type, it also enables `fielddata` loading for indices created between 2.0 and 2.1 since doc_values were disabled during that period.

It also restores the old docs that gives example on how to sort or aggregate on _type field.
2016-05-25 18:56:13 +02:00
Yannick Welsch 1c59c7e349 Log warning if minimum_master_nodes is set to less than a quorum of master-eligible nodes (#15625)
The setting minimum_master_nodes is crucial to avoid split brains in a cluster. In order to avoid data loss, it should always be configured to at least a quorum (majority) of master-eligible nodes.

This commit adds a warning to the logs on the master node if the value is set to less than quorum of master-eligible nodes.
2016-05-25 16:49:08 +02:00
Tanguy Leroux bdee8c2632 Disable XContent auto closing of object and arrays 2016-05-25 16:46:09 +02:00
Chris Earle de6b4f35b1 Remove inaccurate Javadoc on Setting constructor
The 'Setting' constructor has some outdated Javadoc that suggested that it would automatically apply 'Property.NodeScope' if no scope is supplied, but no scope is added in that case.
2016-05-25 09:28:34 -05:00
Simon Willnauer eab3113204 Drop 1.x BWC and cut over to Writeable for Translog.Operation (#18565)
We still maintain BWC for the translog operations back to 1.1 which is not
supported in the current version anyway. This commit drops the bwc and moves
the operations to the Writeable interface enforcing immutability.
2016-05-25 11:51:28 +02:00
Britta Weber 6862c48791 Merge pull request #18495 from brwe/geo-query-highlight-II
skip all geo point queries in plain highlighter
2016-05-25 11:35:59 +02:00
Yannick Welsch dee34c916c Expand wildcards to closed indices in /_cat/indices (#18545)
Closed indices are already displayed when no indices are explicitly selected. This commit ensures that closed indices are also shown when wildcard filtering is used. It also addresses another issue that is caused by the fact that the cat action is based internally on 3 different cluster states (one when we query the cluster state to get all indices, one when we query cluster health, and one when we query indices stats). We currently fail the cat request when the user specifies a concrete index as parameter that does not exist. The implementation works as intended in that regard. It checks this not only for the first cluster state request, but also the subsequent indices stats one. This means that if the index is deleted before the cat action has queried the indices stats, it rightfully fails. In case the user provides wildcards (or no parameter at all), however, we fail the indices stats as we pass the resolved concrete indices to the indices stats request and fail to distinguish whether these indices have been resolved by wildcards or explicitly requested by the user. This means that if an index has been deleted before the indices stats request gets to execute, we fail the overall cat request. The fix is to let the indices stats request do the resolving again and not pass the concrete indices.

Closes #16419
Closes #17395
2016-05-25 10:02:14 +02:00
Tal Levy 0fa67e1538 Expose underlying processor to blame for thrown exception within CompoundProcessor (#18342)
Fixes #17823
2016-05-24 14:25:40 -07:00
Jason Tedor 568c26a76c Log OS and JVM on startup
This commit adds the OS and JVM to the initial logline on startup.

Relates #18557
2016-05-24 16:55:55 -04:00
Ali Beyad 105aee08b3 Removes multiple toXContent entry points for SnapshotInfo
SnapshotInfo had a toXContent and an externalToXContent, the former for
writing snapshot info to the snapshot blob and the latter for writing the
snapshot info to the APIs. This commit unifies writing x-content to one
method, toXContent, which distinguishes which format to write the
snapshot info in based on the Params parameter.  In addition, it makes
use of the already existing snapshot specific params found in the
BlobStoreFormat.

Closes #18494
2016-05-24 15:44:22 -04:00
Britta Weber b3a8c54928 Test for deadlock when relocating and indexing concurrently
see #18553

Reproduces with

gradle :core:integTest -Dtests.class=org.elasticsearch.recovery.RelocationIT -Dtests.method="testIndexAndRelocateConcurrently"  -Dtests.iters=20 -Dtests.failfast=true -Dtests.logger.level=DEBUG -Dtests.seed=9BE7064B819064FA:C44B70F31707D081 -Dtests.timeoutSuite=60000!
2016-05-24 20:06:21 +02:00
Nik Everett a93f578bf6 Move parsing of allocation commands into REST
Port them to the ObjectParser.

Don't let plugins register custom allocation commands
2016-05-24 11:59:05 -04:00
Jason Tedor f210605af8 Add test for parsing fractional seconds
This commit adds a test that ensures that strings containing a
fractional number of seconds are correctly parsed into milliseconds.

Relates #18548
2016-05-24 11:26:36 -04:00
Clinton Gormley 9c9bea9258 Set version to 5.0.0-alpha3 (#18550)
* Set version to 5.0.0-alpha3

* Updated version in qa/backwards tests too
2016-05-24 16:46:05 +02:00
Tanguy Leroux 1f011f9dea Remove Delete-By-Query plugin
closes #18469
2016-05-24 13:28:20 +02:00
Martijn van Groningen 27cc2fe4dc Moved the percolator from core to its own module
Significant changes:
* AbstractQueryTestCase has moved to the test framework module, in order for query builder tests in modules and plugins
* Added support to AbstractQueryTestCase to register plugins
* Lift the restriction that only one percolator could be added per index. This validation existed in MapperService, but because the percolator moved to a module it could no longer exist there. Instead of bringing it back it was removed. This validation existed since the percolator cache only supported one percolator query per document, since the percolator cache has been removed this restriction could removed as well.
* While moving percolator tests to the new module, also removed a couple of tests for the deprecated percolate and mpercolate api. These APIs are now sugar  APIs for bwc and rediect to the searvh and msearvh APIs. Some tests were still testing as if percolate and mpercolate API did the percolation, but this no longer the case and these tests could be removed.
2016-05-24 11:01:57 +02:00
Ryan Ernst ef435d0099 Remove unnecessary boxing and use of deprecated Double ctors 2016-05-23 13:44:59 -07:00
Lee Hinman bfce901edf Merge remote-tracking branch 'dakrone/explain-add-fetch-in-progress' 2016-05-23 09:43:16 -06:00
Lee Hinman 8040ed0c16 Add whether the shard state fetch is pending to the allocation explain API
If the shard state fetch is still pending, this will now return a
message like:

```json
{
  "shard" : {
    "index" : "i",
    "index_uuid" : "de1W1374T4qgvUP4a9Ieaw",
    "id" : 0,
    "primary" : false
  },
  "assigned" : false,
  "shard_state_fetch_pending": true,
  "unassigned_info" : {
    "reason" : "INDEX_CREATED",
    "at" : "2016-04-26T16:34:53.227Z"
  },
  "allocation_delay_ms" : 0,
  "remaining_delay_ms" : 0,
  "nodes" : {
    "z-CbkiELT-SoWT91HIszLA" : {
      "node_name" : "Brain Cell",
      "node_attributes" : {
        "testattr" : "test"
      },
      "store" : {
        "shard_copy" : "NONE"
      },
      "final_decision" : "NO",
      "final_explanation" : "the shard state fetch is pending",
      "weight" : 5.0,
      "decisions" : [ ]
    }
  }
}
```

Adds the `shard_state_fetch_pending` field and uses the state to
influence the final decision and final explanation.

Relates to #17372
2016-05-23 09:42:57 -06:00
Adrien Grand 31e4c16ec3 Merge pull request #18509 from terradatum/epoch
Support full range of Java Long for epoch DateTime
2016-05-23 12:27:38 +02:00
Adrien Grand 459916f5dd Remove custom Base64 implementation. #18413
This replaces o.e.common.Base64 with java.util.Base64.
2016-05-23 11:32:42 +02:00
Tanguy Leroux e7eb664c78 Change BlobPath.buildAsString() method 2016-05-23 10:50:40 +02:00
Adrien Grand c5a9edf1c7 Add `Character.MODIFIER_SYMBOL` to the list of symbol categories. #18402
Closes #18388
2016-05-23 10:11:35 +02:00
Jim Ferenczi 238d390637 Fixes for _only_nodes preferences:
* Handle multiple attributes/name (coma separated).
  * Shuffle the nodes that match the preferences.

Fix #12546
Fix #12700
2016-05-23 09:44:52 +02:00
Adrien Grand cb2cfdd9c0 Speed up named queries. #18470
Named queries have a performance bug when they are used with expensive queries
that need to perform a lot of work up-front like fuzzy or range queries
(including with points). The reason is that they currently re-create the weight
and scorer for every hit. Instead we should create weights exactly once and
use a single Scorer for all documents that are on the same segment.
2016-05-23 08:56:40 +02:00
Martijn van Groningen c1a0929123 percolator: Add support dor MatchNoDocsQuery in query terms extract service
Before the query extraction would have been aborted and the percolator query would be marked as unknown.
This resulted in a situation that these queries always need to be evaluated by the memory index at search time.
By adding support for this query many more percolator query candidate hits can skip the expensive memory index verification step. For example the `match` query parser returns a MatchNoDocsQuery if the query terms are removed by text analysis (lets query text only contained stop words).
2016-05-22 22:42:19 +02:00
G. Richard Bellamy cf54903580 Support full range of Java Long for epoch DateTime
Remove the arbitrary limit on epoch_millis and epoch_seconds of 13 and 10
characters, respectively. Instead allow any character combination that can
be converted to a Java Long.

Update the docs to reflect this change.
2016-05-22 13:08:20 -07:00
Ryan Ernst 37d36f2f4c Merge branch 'master' into java9 2016-05-21 14:19:58 -07:00
Ryan Ernst f01f15d3b8 Document the hack 2016-05-21 14:14:12 -07:00
Jason Tedor ba14aca218 Refactor property placeholder use of env. vars
This commit is a slight refactoring of the use of environment variables
in replacing property placeholders. In commit
115f983827 the constructor for
Settings.Builder was made package visible to provide a hook for tests to
mock obtaining environment variables. But we do not need to go that far
and can instead provide a small hook for this for tests without opening
up the constructor. Thus, in this commit we refactor
Settings.Builder#replacePropertyPlaceholders to a package-visible method
that accepts a function providing environment variables by names. The
public-visible method just delegates to this method passing in
System::getenv and tests can use the package-visible method to mock the
behavior they need without relying on external environment variables.
2016-05-21 17:06:56 -04:00
Ryan Ernst 41a5c0cfa1 Force java9 log4j hack in testing 2016-05-21 13:41:38 -07:00
Ryan Ernst b26f5711d6 Fix log4j buggy java version detection 2016-05-21 13:18:12 -07:00
Ryan Ernst 1d40c4bbc1 Make java9 work again
This change makes ES compile with java9 again, build 118.
* There are a handful of changes due to failure to determine types during compile.
* The attachment plugins which use tika needed to have tika upgraded in order to pickup fixes there for java 9.
* azure discovery and s3 repository indirectly depend on jaxb, which is no longer in the default modules. They now add a jaxb dependency externally, and make JarHell allow for this package.
2016-05-21 09:41:51 -07:00
Lee Hinman 1d8441b681 Merge remote-tracking branch 'dakrone/remove-script-mode' 2016-05-20 15:22:14 -06:00
Jason Tedor 115f983827 Fix env. var placeholder test so it's reproducible
This commit modifies the settings test for environment variables
placeholders so that it is reproducible. The underlying issue is that
the set of environment variables from system to system can vary, and
this means that's we can never be sure that a failing test will be
reproducible. This commit simplifies this test to not rely on external
forces that could influence reproducibility.

Relates #18501
2016-05-20 17:11:37 -04:00
Lee Hinman fdfd2a2f18 Remove ScriptMode class in favor of boolean true/false
This removes the ScriptMode class entirely, which was an enum with two
options (ON and OFF) which essentially boiled down to true and false.
Now the boolean values are used instead.
2016-05-20 15:01:30 -06:00
Jason Tedor 4c7993ea71 Netty request/response tracer should wait for send
We write to Netty channels in an async fashion, but notify listeners via
a transport service adapter before we are certain that the channel write
succeeded. In particular, the tracer logs are implemented via a
transport service adapter and this means that we can write tracer logs
before a write was successful and in some cases the write might fail
leading to misleading logs. This commit attaches the transport service
adapters to channel writes as a listener so that the notification occurs
only after a successful write.

Relates #18500
2016-05-20 16:26:46 -04:00
Ali Beyad 923d90d434 Remove use of a Fields class in snapshot responses that contains
x-content keys, in favor of declaring/using the keys directly.

Closes #18497
2016-05-20 15:07:41 -04:00
Simon Willnauer 35e705877b Limit retries of failed allocations per index (#18467)
Today if a shard fails during initialization phase due to misconfiguration, broken disks,
missing analyzers, not installed plugins etc. elasticsaerch keeps on trying to initialize
or rather allocate that shard. Yet, in the worst case scenario this ends in an endless
allocation loop. To prevent this loop and all it's sideeffects like spamming log files over
and over again this commit adds an allocation decider that stops allocating a shard that
failed more than N times in a row to allocate. The number or retries can be configured via
`index.allocation.max_retry` and it's default is set to `5`. Once the setting is updated
shards with less failures than the number set per index will be allowed to allocate again.

Internally we maintain a counter on the UnassignedInfo that is reset to `0` once the shards
has been started.

Relates to #18417
2016-05-20 20:37:45 +02:00
Britta Weber b493f0defe skip all geo point queries in plain highlighter
Geo queries and plain highlighter do not seem to work well
together (https://issues.apache.org/jira/browse/LUCENE-7293)
so we need to skip all geo related queries when we highlight.

closes #17537
2016-05-20 20:07:10 +02:00
Jason Tedor 61f40156d3 Do not decode path when sending error
Today when sending a REST error to a client, we send the decoded
path. But decoding that path can already be the cause of the error in
which case decoding it again will just throw an exception leading to us
never sending an error back to the client. It would be better to send
the entire raw path to the client and that is what we do in this commit.

Relates #18477
2016-05-20 12:15:30 -04:00
Igor Motov ce88d7f9ab Fix race condition in snapshot initialization
When a snapshot initialization fails, the create snapshot method may return before the snapshot metadata in the cluster state is removed. This can cause follow up snapshot-API related calls to fail due to a snapshot still running. This is causing CI failures when we try to delete indices that were participating in failed snapshot to a read-only repository.

Closes #18121
2016-05-20 10:52:08 -04:00
Daniel Mitterdorfer 8b962bb234 Increase log level for NettyHttpRequestSizeLimitIT
This test fails spuriosly in CI and is not reproducible locally.

With this commit we temporarily increase the log level in a few
packages that are suspected to reveal the cause.
2016-05-20 15:12:52 +02:00
Jason Tedor 140f9dfe5f Fix scaling thread pool test bug
This commit fixes a test bug in the scaling thread pool configuration
test. In particular, the test randomization could select min and max for
a thread pool configuration where both are equal to zero. This is a
violation of the requirements of the ThreadPoolExecutor. With this
commit, we now ensure that the max is bounded below by one.
2016-05-20 08:58:08 -04:00
Martijn van Groningen 80fee8666f percolator: Removed percolator cache
Before 5.0 for it was required that the percolator queries were cached in jvm heap as Lucene queries for two reasons:
1) Performance. The percolator evaluated all percolator queries all the time. There was no pre-selecting queries that are likely to match like we have today.
2) Updates made to percolator queries were visible in realtime, Today these changes are visible in near realtime. So updating no longer requires the percolator to have the queries in jvm heap.

So having the percolator queries in jvm heap via the percolator cache is now less attractive. Especially when there are many percolator queries then these queries can consume many GBs of jvm heap.
Removing the percolator cache does make the percolate query slower compared to how the execution time in 5.0.0-alpha1 and alpha2, but it is still faster compared to 2.x and before.
2016-05-20 14:52:16 +02:00
Christoph Büscher d3fe22c990 Improve adding clauses to `span_near` and `span_or` query
Currently the query builders expose the clauses of the span
query as a modifiable list. Instead we should make the that
getter return an unmodifiable list. Also renaming the method
used to add a clause from `clause(spanQuery)` to
`addClause(spanQuery)`.
2016-05-20 13:36:55 +02:00
Boaz Leskes 34ef5306d2 Snapshotting and sync could cause a dead lock TranslogWriter (#18481)
#18360 introduced an extra lock in order to allow writes while syncing the translog. This caused a potential deadlock with snapshotting code where we first acquire the instance lock, followed by a sync (which acquires the syncLock). However, the sync logic acquires the syncLock first, followed by the instance lock.

I considered solving this by not syncing the translog on snapshot - I think we can get away with just flushing it. That however will create subtleties around snapshoting and whether operations in them are persisted. I opted instead to have slightly uglier code with nest synchronized, where the scope of the change is contained to the TranslogWriter class alone.
2016-05-20 12:56:24 +02:00
Jason Tedor c257e2c51f Remove settings and system properties entanglement
Today when parsing settings during bootstrap, we add a system property
for every Elasticsearch setting. Additionally, settings can be set via
system properties. This commit simplifies this situation.
 - settings are no longer propogated to system properties
 - system properties can not be used to set settings
 - the "es." prefix on settings is no longer required (nor permitted)
 - test logging has a dedicated system property (tests.logger.level)

Relates #18198
2016-05-19 14:08:08 -04:00
Clinton Gormley dc33a83231 Remove the preserve_original option from the FingerprintAnalyzer (#18471)
The preserve_original option to the ASCIIFoldingFilter doesn't
play well with the FingerprintFilter, as it ends up producing
fingerprints like:

    "and consistent godel gödel is said sentence this yes"

The goal of the OpenRefine algorithm is to product a small normalized
ASCII fingerprint. There's no need to expose preserve_original.
2016-05-19 19:37:13 +02:00
Christoph Büscher d2515727d0 Improve random DateTimeZone creation in tests
We often require a random joda DateTimeZone in our tests. Currently
there are a few options for generating such a random DateTimeZone
from the set of available ids. Currently most random picks are not
really reproducable across different jvms because they rely on order
in the ids set implementation. The helper in DateProcessorFactoryTests
thus performs a sort on the set of ids before random picking from
the result, so I moved this to ESTestCase to make it publicly
available and changed all other tests to use that method.
2016-05-19 18:12:48 +02:00
Boaz Leskes 4d6887075f Log IndexShard.refresh logs under trace (#18435)
We log them every second...
2016-05-19 17:12:37 +02:00
Christoph Büscher 757ccf00b2 Enforce MatchQueryBuilder#maxExpansions() to be strictly positive 2016-05-19 16:59:37 +02:00
Jeff Evans 3cf4214255 Add better error message when analyzer created without tokenizer or analyzer type (#18455)
Closes #15492
2016-05-19 15:47:07 +02:00
Ali Beyad fc6df23fea Rename AggregatorBuilder and all of its subclasses to
AggregationBuilder, in keeping consistent with the Java APIs.

Closes #18377
Closes #18367
2016-05-19 09:25:29 -04:00