Commit Graph

24867 Commits

Author SHA1 Message Date
Nik Everett 1bbd3c5400 Fix painless's out of bounds assertions in java 9
Java 9's exception message when lists have an out of bounds index
is much better than java 8 but the painless code asserted on the
java 8 message. Now it'll accept either.

I'm tempted to weaken the assertion but I like asserting that the
message is readable.
2016-10-29 22:21:57 -04:00
Nik Everett 3a7a218e8f Support negative array ofsets in painless
Adds support for indexing into lists and arrays with negative
indexes meaning "counting from the back". So for if
`x = ["cat", "dog", "chicken"]` then `x[-1] == "chicken"`.

This adds an extra branch to every array and list access but
some performance testing makes it look like the branch predictor
successfully predicts the branch every time so there isn't a
in execution time for this feature when the index is positive.
When the index is negative performance testing showed the runtime
is the same as writing `x[x.length - 1]`, again, presumably thanks
to the branch predictor.

Those performance metrics were calculated for lists and arrays but
`def`s get roughly the same treatment though instead of inlining
the test they need to make a invoke dynamic so we don't screw up
maps.

Closes #20870
2016-10-29 16:12:40 -04:00
Igor Motov d731a330aa Tests: Add addtional logging to SearchCancellationIT tests 2016-10-28 11:29:49 -10:00
Nik Everett f11a217546 Rewrite vagrant upgrade test's dependency resolution
This is cleaner and it doesn't fail in Jenkins. I'm not sure
why the old way failed in jenkins but not locally, but computers
are basically magic so I take what I can get. Here is a jenkins
failure:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+packaging-tests/238/consoleFull
2016-10-28 17:02:24 -04:00
Boaz Leskes b9691d15ae IndexWithShadowReplicasIT.testReplicaToPrimaryPromotion should wait for node leave to be processed 2016-10-28 20:22:24 +02:00
Nik Everett 267a7b427b Fix the package upgrade tests for 5.0.0 (#21178)
5.0+'s deb and rpm packages aren't pushed to maven cnertral so
instead we have to download them from artifacts.elastic.org.
2016-10-28 14:00:43 -04:00
Boaz Leskes 75ee2bb61d Update resiliency page for the release of v5 (#21177) 2016-10-28 18:46:54 +02:00
Nik Everett 9e3eacec35 Fix generation of versions to upgrade from
Vagrant tests use a static list of dependencies to upgrade from
and we weren't including 5.0.0 deps in that list. Also when the
list was incorrect we weren't sorting the "current" list so it
was difficult to read.

Also adds 2.4.1 to the list but *doesn't* add 5.0.0 because we
still can't resolve it yet. We still only print an error when
the list is wrong but don't abort the build. We'll abort the build
once we've fixed resolution for 5.0.0 and we can re-add it.
2016-10-28 10:45:36 -04:00
Simon Willnauer 9598616dfe Fallback to '/' info call to fetch cluster version
The `_cat/nodes` API might not be available in all clusters for instance
if they have authorization enabled. This change falls back to the previously
used method of using the '/' endpoint to fetch the nodes version, this is best
effort and will emit a warning.
2016-10-28 16:22:53 +02:00
Simon Willnauer 36c86c2b00 Fix `_cat/store` sort test to use a reliable sort value
using the store size is not reliable since it's cached and might
be stale depending on the timing when the cache entry was generated.
2016-10-28 16:04:33 +02:00
Nik Everett bce34e4f1e Disable out of date versions exception
We are upgrading from out of date versions in our tests right now and we
can't fix that because the current versions to upgrade from aren't in
maven central. We'll resolve the resolution issue soon, but for now
let's get the build green.
2016-10-28 09:47:47 -04:00
Ali Beyad 733d74229b Revert "Updates vagrant tests upgrade version number" (#21171) 2016-10-28 09:40:04 -04:00
Simon Willnauer 326a665509 [TEST] Only set 0s state timeout if we have more than one node 2016-10-28 15:22:02 +02:00
Adrien Grand bafedc93fa Fix Lucene version in the docs. 2016-10-28 14:50:46 +02:00
Adrien Grand b3cc54cf0d Upgrade to lucene-6.3.0-snapshot-ed102d6 (#21150)
Lucene 6.3 is expected to be released in the next weeks so it'd be good to give
it some integration testing. I had to upgrade randomized-testing too so that
both Lucene and Elasticsearch are on the same version.
2016-10-28 14:47:15 +02:00
Simon Willnauer 43dbf9c7b6 Use all available hosts in REST tests and allow for real master election (#21161)
Today we only use a single node to send requests to when we run REST tests.
In some cases we have more than one node (ie. in the BWC case) where we should
send requests to all nodes in a round-robin fashion. This change passes all
available node endpoints to the rest test.

Additionally, this change adds the setting of `discovery.zen.minimum_master_nodes`
to the cluster formation forcing the nodes to wait for all other nodes until the cluster
is formed. This allows for a more realistic master election and allows all master eligable
nodes to become master while before always the first node in the cluster became the master.

This also adds logging to each test run to log the master nodes version and the minimum node
version in the cluster to help debugging BWC test failures.
2016-10-28 12:18:47 +02:00
Adrien Grand 9cbbddb6dc Add support for `quote_field_suffix` to `simple_query_string`. (#21060)
Closes #18641
2016-10-28 09:11:57 +02:00
Ali Beyad 557506ba6e Updates the versions the vagrant tests can upgrade from to 5.0.0 (#21151) 2016-10-27 16:44:04 -04:00
Simon Willnauer 97cc426a89 Fix bwc cluster formation in order to run BWC tests against a mixed version cluster (#21145)
This fixes our cluster formation task to run REST tests against a mixed version cluster.
Yet, due to some limitations in our test framework `indices.rollover` tests are currently
disabled for the BWC case since they select the current master as the merge node which
happens to be a BWC node and we can't relocate all shards to it since the primaries are on
a higher version node. This will be fixed in a followup.

Closes #21142

Note: This has been cherry-picked from 5.0 and fixes several rest tests
as well as a BWC break in `OsStats.java`
2016-10-27 17:03:53 +02:00
markharwood 9944a594b1 Aggregations fix: scripted heuristics for scoring significant_terms aggs were not thread safe when running local to the coordinating node. New code spawns an object for each shard search execution rather than sharing a common instance which is not thread safe.
Closes #18120
2016-10-27 13:56:48 +01:00
Yannick Welsch f3e578f942 Stop delaying existing requests after network delay rule is cleared (#21129)
The network disruption type "network delay" continues delaying existing requests even after the disruption has been cleared. This commit ensures that the requests get to execute right after the delay rule is cleared.
2016-10-27 13:48:17 +02:00
Yannick Welsch 952097b1c0 [TEST] Fix testDelayShards to wait for master to remove stopped node
This test failed when the node that was shutting down was not yet removed from the cluster state on the master.
The cluster allocation explain API will not see any unassigned shards until the node shutting down is removed from the
cluster state.
2016-10-27 12:02:00 +02:00
Yannick Welsch 118913b553 [TEST] Fix testRolloverConditionsNotMet to expect correct rollover index name
PR #21138 changed the target index name even if _rollover conditions are not met but missed to adapt this test.
2016-10-27 11:00:44 +02:00
Jun Ohtani a66c76eb44 Merge pull request #20704 from johtani/remove_request_params_in_analyze_api
Removing request parameters in _analyze API
2016-10-27 17:43:18 +09:00
Colin Goodheart-Smithe c1a9833445 Correct similarity default for 5.0 (#21144) 2016-10-27 09:33:21 +01:00
Simon Willnauer e745015325 Return target index name even if _rollover conditions are not met (#21138)
Today we return the old index name as the target / new index name.
This change passes the correct rollover index name to the response.
2016-10-27 09:20:46 +02:00
Jack Conradson 7a7d6ea8e6 Merge pull request #21136 from jdconrad/stype
Refactor ScriptType to be a top-level class.
2016-10-26 12:45:50 -07:00
Jack Conradson 512a77a633 Refactor ScriptType to be a top-level class. 2016-10-26 10:21:22 -07:00
Ali Beyad c88452dc80 Abort snapshots on a node that leaves the cluster (#21084)
Previously, if a node left the cluster (for example, due to a long GC),
during a snapshot, the master node would mark the snapshot as failed, but
the node itself could continue snapshotting the data on its shards to the
repository. If the node rejoins the cluster, the master may assign it to
hold the replica shard (where it held the primary before getting kicked off
the cluster). The initialization of the replica shard would repeatedly fail
with a ShardLockObtainFailedException until the snapshot thread finally
finishes and relinquishes the lock on the Store.

This commit resolves the situation by ensuring that when a shard is removed
from a node (such as when a node rejoins the cluster and realizes it no longer
holds the active shard copy), any snapshotting of the removed shards is aborted.
In the scenario above, when the node rejoins the cluster, it will see in the cluster 
state that the node no longer holds the primary shard, so IndicesClusterStateService
will remove the shard, thereby causing any snapshots of that shard to be aborted.

Closes #20876
2016-10-26 10:04:50 -04:00
Christoph Büscher aaf3477327 Remove checkstyle LineLenght check suppression from 23 more classes 2016-10-26 15:24:21 +02:00
Yannick Welsch e82a1f5cca Only allow the master to update the list of nodes in the cluster state (#21092)
The cluster state on a node is updated either
- by incoming cluster states that are received from the active master or
- by the node itself when it notices that the master has gone.

In the second case, the node adds the NO_MASTER_BLOCK and removes the current master as active master from its cluster state. In one particular case, it would also update the list of nodes, removing the master node that just failed. In the future, we want a clear separation between actions that can be executed by a master publishing a cluster state and a node locally updating its cluster state when no active master is around.
2016-10-26 09:24:03 +02:00
Igor Motov e6dda02c66 Tests: silence cancelling scroll search tests
Investigating it locally
2016-10-25 20:06:05 -10:00
Igor Motov 6fe3bd817b Tests: make sure that 2 segments are created in SearchCancellationTests
Otherwise, the test fails if forced merge kicks in.
2016-10-25 20:05:49 -10:00
Jason Tedor 9c3e4d6e22 Add correct Content-Length on HEAD requests
This commit fixes responses to HEAD requests so that the value of the
Content-Length is correct per the HTTP spec. Namely, the value of this
header should be equal to the Content-Length if the request were not a
HEAD request.

This commit also fixes a memory leak on HEAD requests to the main action
that arose from the bytes on a builder not being released due to them
being dropped on the floor to ensure that the response to the main
action did not have a body.

Relates #21123
2016-10-25 23:08:19 -04:00
Igor Motov 17ad88d539 Makes search action cancelable by task management API
Long running searches now can be cancelled using standard task cancellation mechanism.
2016-10-25 12:27:34 -10:00
Greg Marzouka c3761b8e4d Merge pull request #21099 from gmarz/rest-allow-no-indices
Remove allow_no_indices from indices.upgrade
2016-10-25 12:31:09 -04:00
Britta Weber 7945894ede Remove unused interface InitialStateDiscoveryListener (#21115) 2016-10-25 18:29:23 +02:00
Nik Everett 44c3b04bef Convert more docs to // CONSOLE
Converts docs for `_cat/segments`, `_cat/plugins` and `_cat/repositories`
from `curl` to `// CONSOLE` so they are tested as part of the build and
are cleaner to use in Console. They should work fine with `curl` with
the `COPY AS CURL` link.

Also swaps the `source` type of the response from `js` to `txt` because
that is more correct. The syntax highlighter doesn't care. It looks at
the text to figure out the language. So it looks a little funny for `_cat`
responses regardless.

Relates to #18160
2016-10-25 11:17:24 -04:00
Jason Tedor 1bc08ff1e5 Fix empty <p> tag warning in o/e/m/o/OsProbe.java
This commit fixes an empty <p> tag warning in o/e/m/o/OsProbe.java.
2016-10-25 08:33:15 -04:00
Jason Tedor b89c5aff51 Add preformatted tags to Javadoc in OsProbe
This commit adds preformatted tags to the Javadoc for
OsProbe#readSysFsCgroupCpuAcctCpuStat to render the form of the cpu.stat
file in a fixed-width font.
2016-10-25 08:19:10 -04:00
Jason Tedor 9a6c81c9f1 Mock areCgroupStatsAvailable in OsProbeTests
When acquiring cgroup stats, we check if such stats are available by
invoking a method areCgroupStatsAvailable. This method checks
availability by looking for existence of some virtual files in
/proc/self/cgroup and /sys/fs/cgroups. If these stats are not available,
the getCgroup method returns null. The OsProbeTests#testCgroupProbe did
not account for this. On some systems where tests run, the cgroup stats
might not be available yet this test method was expecting them to be (we
mock the relevant virtual file reads). This commit handles the execution
of this test on such systems by overriding the behavior of
OsProbe#areCgroupStatsAvailable. We test both the possibility of this
method returning true as well as false.
2016-10-24 19:59:48 -04:00
Jason Tedor de241f441d Remove unused import from o/e/m/o/OsProbe.java
This commit removes an unused import from o/e/m/o/OsProbe.java.
2016-10-24 16:40:41 -04:00
Jason Tedor 900ee0536e Strengthen handling of unavailable cgroup stats
On some systems, cgroups will be available but not configured. And in
some cases, cgroups will be configured, but not for the subsystems that
we are expecting (e.g., cpu and cpuacct). This commit strengthens the
handling of cgroup stats on such systems.

Relates #21094
2016-10-24 16:36:51 -04:00
Greg Marzouka ab22307cf2 Remove allow_no_indices from indices.upgrade 2016-10-24 15:06:17 -04:00
Christoph Büscher e8a3225719 Tests: Fix compile issue with type inference on java 9 build 2016-10-24 19:59:08 +02:00
Christoph Büscher a43f70522c Tests: fix issue with SliceBuilderTests creation of mutated test objects 2016-10-24 18:48:18 +02:00
Li Weinan d4e42b77a5 .es_temp_file remains after system crash, causing it not to start again #21007
When system starts, it creates a temporary file named .es_temp_file to ensure the data directories are writable.

If system crashes after creating the .es_temp_file but before deleting this file, next time the system will not be able to start because the Files.createFile(resolve) will throw an exception if the file already exists.
2016-10-24 16:41:36 +02:00
Christoph Büscher f6f129b21f Consolidate code for equals/hashCode testing in central utility class
Currently test that check that equals() and hashCode() are working as expected
for classes implementing them are quiet similar. This change moves common
assertions in this method to a common utility class. In addition, another common
utility function in most of these test classes that creates copies of input
object by running them through a StreamOutput and reading them back in, is moved
to ESTestCase so it can be shared across all these classes.

Closes #20629
2016-10-24 15:50:40 +02:00
Praveen Shukla 2e18f2e818 [DOCS] clarifies master nodes to be master eligible nodes 2016-10-24 08:58:44 -04:00
Jason Tedor 3d642ab0eb Add basic cgroup CPU metrics
This commit adds basic cgroup CPU metrics to the node stats API.

Relates #21029
2016-10-24 08:26:56 -04:00