Commit Graph

23257 Commits

Author SHA1 Message Date
Simon Willnauer cbbc8790a5 Remove redundant modifier 2016-07-05 08:39:08 +02:00
Simon Willnauer 44ccf67e33 Simplify TcpTransport interface by reducing send code to a single send method (#19223)
Due to some optimization on the netty layer we had quite some code / cruft
added to the TcpTransport to allow for those optimizations. After cleaning
up BytesReference we can now move this optimization into TcpTransport and
have a simple send method on the implementation layer instead. This commit
adds a CompositeBytesReference that also allows message headers to be written
separately which simplify the header code as well since no skips are needed
anymore.
2016-07-05 08:33:19 +02:00
Jason Tedor a00a54ebda Fix style violation in InstallPluginCommand.java
This commit fixes a checkstyle violation in InstallPluginCommand.java
added after renaming UserError to UserException in
f9d55be1ed.
2016-07-04 19:45:46 -04:00
Jason Tedor f9d55be1ed Rename UserError
The top-level class Throwable represents all errors and exceptions in
Java. This hierarchy is divided into Error and Exception, the former
being serious problems that applications should not try to catch and the
latter representing exceptional conditions that an application might
want to catch and handle. This commit renames
org.elasticsearch.cli.UserError to org.elasticsearch.UserException to
make its name consistent with where it falls in this hierarchy.

Relates #19254
2016-07-04 19:22:29 -04:00
Jason Tedor 36b887ee7c Throw translog corrupted exception on malformed op
Today when reading a malformed operation from the translog, we throw an
assertion error that is immediately caught and wrapped into a translog
corrupted exception. This commit replaces this by electing to directly
throw a translog corrupted exception instead.

Additionally, this cleanup also addressed a double-wrapped translog
corrupted exception. Namely, verifying the checksum can throw a translog
corrupted exception which the existing code would catch and wrap again
in a translog corrupted exception.

Relates #19256
2016-07-04 19:22:12 -04:00
Ali Beyad f5b07e438f Fixes getting snapshot status checks for preventing duplicate entries
from both current snapshots (cluster state) and repository snapshots
(on storage).
2016-07-04 17:40:44 -04:00
Boaz Leskes 37c8c0fa03 Improve logging for batched cluster state updates (#19255)
We've been slowly improving batch support in `ClusterService` so service won't need to implement this tricky logic themselves. These good changes are blessed but our logging infra didn't catch up and we now log things like:

```
[2016-07-04 21:51:22,318][DEBUG][cluster.service          ] [node_sm0] processing [put-mapping [type1],put-mapping [type1]]:
```

Depending on the `source` string this can get quite ugly (mostly in the ZenDiscovery area). 

This PR adds some infra to improve logging, keeping the non-batched task the same. As result the above line looks like:

```
[2016-07-04 21:44:45,047][DEBUG][cluster.service          ] [node_s0] processing [put-mapping[type0, type0, type0]]: execute
```

ZenDiscovery waiting on join moved from:

```
[2016-07-04 17:09:45,111][DEBUG][cluster.service          ] [node_t0] processing [elected_as_master, [1] nodes joined),elected_as_master, [1] nodes joined)]: execute
```

To

```
[2016-07-04 22:03:30,142][DEBUG][cluster.service          ] [node_t3] processing [elected_as_master ([3] nodes joined)[{node_t2}{R3hu3uoSQee0B6bkuw8pjw}{p9n28HDJQdiDMdh3tjxA5g}{127.0.0.1}{127.0.0.1:30107}, {node_t1}{ynYQfk7uR8qR5wKIysFlQg}{wa_OKuJHSl-Oyl9Gis-GXg}{127.0.0.1}{127.0.0.1:30106}, {node_t0}{pweq-2T4TlKPrEVAVW6bJw}{NPBSLXSTTguT1So0JsZY8g}{127.0.0.1}{127.0.0.1:30105}]]: execute
```

As a bonus, I removed all `zen-disco` prefixes to sources from that area.
2016-07-04 22:54:43 +02:00
Boaz Leskes 6861d3571e Persistent Node Ids (#19140)
Node IDs are currently randomly generated during node startup. That means they change every time the node is restarted. While this doesn't matter for ES proper, it makes it hard for external services to track nodes. Another, more minor, side effect is that indexing the output of, say, the node stats API results in creating new fields due to node ID being used as keys.

The first approach I considered was to use the node's published address as the base for the id. We already [treat nodes with the same address as the same](https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/discovery/zen/NodeJoinController.java#L387) so this is a simple change (see [here](https://github.com/elastic/elasticsearch/compare/master...bleskes:node_persistent_id_based_on_address)). While this is simple and it works for probably most cases, it is not perfect. For example, if after a node restart, the node is not able to bind to the same port (because it's not yet freed by the OS), it will cause the node to still change identity. Also in environments where the host IP can change due to a host restart, identity will not be the same. 

Due to those limitation, I opted to go with a different approach where the node id will be persisted in the node's data folder. This has the upside of connecting the id to the nodes data. It also means that the host can be adapted in any way (replace network cards, attach storage to a new VM). I

It does however also have downsides - we now run the risk of two nodes having the same id, if someone copies clones a data folder from one node to another. To mitigate this I changed the semantics of the protection against multiple nodes with the same address to be stricter - it will now reject the incoming join if a node exists with the same id but a different address. Note that if the existing node doesn't respond to pings (i.e., it's not alive) it will be removed and the new node will be accepted when it tries another join.

Last, and most importantly, this change requires that *all* nodes persist data to disk. This is a change from current behavior where only data & master nodes store local files. This is the main reason for marking this PR as breaking.

Other less important notes:
- DummyTransportAddress is removed as we need a unique network address per node. Use `LocalTransportAddress.buildUnique()` instead.
- I renamed `node.add_lid_to_custom_path` to `node.add_lock_id_to_custom_path` to avoid confusion with the node ID which is now part of the `NodeEnvironment` logic.
- I removed the `version` paramater from `MetaDataStateFormat#write` , it wasn't really used and was just in the way :)
- TribeNodes are special in the sense that they do start multiple sub-nodes (previously known as client nodes). Those sub-nodes do not store local files but derive their ID from the parent node id, so they are generated consistently.
2016-07-04 21:09:25 +02:00
Tanguy Leroux ed444cd276 Fix CompletionTokenStream modifier redundancy 2016-07-04 16:29:26 +02:00
Tanguy Leroux d72134b46e Fix CompletionSuggestSearchIT and CompletionSuggestSearch2xIT 2016-07-04 15:58:27 +02:00
Tanguy Leroux 0e7faf1005 Enable Checkstyle RedundantModifier 2016-07-04 15:22:12 +02:00
Nik Everett a728c4bb5c Migrate global, filter, and filters aggs to NamedWriteable
Once all of these are migrated we'll be able to remove aggregation's
custom "streams" which function that same as NamedWriteable. It also
allows us to make most of the fields on aggregations final which is
rather nice.

Also starts to migrate MultiBucketAggregation.Bucket to Writeable,
allowing the buckets to have immutable parts.
2016-07-04 08:53:02 -04:00
Nik Everett c02de9227c Migrate remaining calc aggs to NamedWriteable
Once all of these are migrated we'll be able to remove aggregation's
custom "streams" which function that same as NamedWriteable. It also
allows us to make most of the fields on aggregations final which is
rather nice.
2016-07-04 08:46:00 -04:00
Jason Tedor 3343ceeae4 Do not catch throwable
Today throughout the codebase, catch throwable is used with reckless
abandon. This is dangerous because the throwable could be a fatal
virtual machine error resulting from an internal error in the JVM, or an
out of memory error or a stack overflow error that leaves the virtual
machine in an unstable and unpredictable state. This commit removes
catch throwable from the codebase and removes the temptation to use it
by modifying listener APIs to receive instances of Exception instead of
the top-level Throwable.

Relates #19231
2016-07-04 08:41:06 -04:00
Boaz Leskes 86d2e88362 re-introduce: Inline reroute with process of node join/master election (#18938) 2016-07-04 13:06:56 +02:00
Jim Ferenczi 1924b46dbb Fix typo in rest test 2016-07-04 12:33:44 +02:00
Clinton Gormley f572f8cc17 Bad asciidoc link 2016-07-04 11:02:06 +02:00
Jim Ferenczi afe99fcdcd Restore reverted change now that alpha4 is out:
Rename `fields` to `stored_fields` and add `docvalue_fields`

`stored_fields` parameter will no longer try to retrieve fields from the _source but will only return stored fields.
`fields` will throw an exception if the user uses it.
Add `docvalue_fields` as an adjunct to `fielddata_fields` which is deprecated. `docvalue_fields` will try to load the value from the docvalue and fallback to fielddata cache if docvalues are not enabled on that field.

Closes #18943
2016-07-04 10:39:49 +02:00
Daniel Mitterdorfer 25881c265b Improve error checking and reporting in CBSIT 2016-07-04 10:24:15 +02:00
Daniel Mitterdorfer 4131476db1 Propagate canTripCircuitBreaker for all broadcasted actions
With this commit we also propagate the `canTripCircuitBreaker`
setting for the main action in TransportBroadcastByNodeAction.

Previously, we set it only on the additional action added by
this handler.
2016-07-04 10:24:15 +02:00
Tanguy Leroux c8a9b28d1b Rename Search Template REST tests 2016-07-04 10:07:45 +02:00
Ryan Ernst 5cf7583bde Internal: Remove unused methods and classes
This change removes a handful of classes and methods that were simply
unused. Some of the classes were intermediate abstract classes that
added nothing to the base class they extended.
2016-07-02 11:33:16 -07:00
Yannick Welsch 3e199b1dff Make testAllOperationsInvoked properly clean up after itself 2016-07-02 11:54:52 +02:00
Yannick Welsch 3221c9d970 Match exception message more exactly in test assertion 2016-07-02 10:07:57 +02:00
Yannick Welsch b4064ce43f Make primary relocation handoff non-blocking (#19013)
Primary relocation and indexing concurrently can currently lead to a deadlock situation as indexing operations are blocked on a (bounded) thread pool during the hand-off phase between old and new primary. This change replaces blocking of indexing operations by putting operations that cannot be executed during relocation hand-off in a queue to be executed once relocation completes.

Closes #18553.
2016-07-02 09:35:54 +02:00
Yannick Welsch 50b97ba5f5 Fix test assertion matching exception message
Newer versions of the URL class in JDK 9 use a different exception message when throwing a MalformedURLException due to an
unknown protocol.
2016-07-02 09:27:07 +02:00
Ryan Ernst 5a66c08ae9 Merge branch 'master' into ingest_plugin_api 2016-07-01 16:27:52 -07:00
Ryan Ernst c7b9489be8 Merge pull request #19225 from rjernst/we_dont_need_generics
Internal: Remove generics from LifecycleComponent
2016-07-01 16:25:34 -07:00
Ryan Ernst 822c995367 Internal: Remove generics from LifecycleComponent
The only reason for LifecycleComponent taking a generic type was so that
it could return that type on its start and stop methods. However, this
chaining has no practical necessity. Instead, start and stop can be
void, and a whole bunch of confusing generics disappear.
2016-07-01 16:17:42 -07:00
Ali Beyad 05998224d8 Adding repository index generational files
Before, a repository would maintain an index file (named 'index') per
repository, that contained the current snapshots in the repository.
This file was not atomically written, so repositories had to depend on
listing the blobs in the repository to determine what the current
snapshots are, and only rely on the index file if the repository does
not support the listBlobs operation.  This could cause an incorrect view
of the current snapshots in the repository if any prior snapshot delete
operations failed to delete snapshot metadata files.

This commit introduces the atomic writing of the index file, and because
atomic writes are not guaranteed if the file already exists, we write to
a generational index file (index-N, where N is the current generation).
We also maintain an index-latest file that contains the current
generation, for those repositories that cannot list blobs.

Closes #19002
Relates #18156
2016-07-01 17:52:57 -04:00
Ryan Ernst e707f0ea6e Simplify ingest useragent construction 2016-07-01 14:21:41 -07:00
Ryan Ernst 10261a615b Update ingest useragent plugin to use new ingest plugin 2016-07-01 14:16:09 -07:00
Ryan Ernst 40e1fe7d9e Remove unused ClusterService member of NodeService 2016-07-01 13:17:12 -07:00
Ryan Ernst f9eed91f33 Fix test oops 2016-07-01 13:00:33 -07:00
Ryan Ernst 2f12d1cb45 Merge branch 'master' into ingest_plugin_api 2016-07-01 12:58:11 -07:00
Ryan Ernst 62397c0c3d Fix node service to still work when http is disabled 2016-07-01 12:55:41 -07:00
Ryan Ernst 6110dcc710 Fix unit tests for http server that no longer need node service 2016-07-01 12:45:43 -07:00
Ryan Ernst f6491047a0 Fix line lengths for ingest config utils 2016-07-01 12:36:44 -07:00
Ryan Ernst e5caadc4f3 Merge branch 'master' into ingest_plugin_api 2016-07-01 12:35:26 -07:00
Ryan Ernst a200292211 Merge pull request #19218 from rjernst/http_server_without_node_service
Internal: Remove cyclic dependency between HttpServer and NodeService
2016-07-01 12:32:52 -07:00
Nik Everett de71a9abb3 Migrate value_count, percentiles, and percentile_ranks aggregations to NamedWriteable
These are the first aggregations with multiple `InternalAggregation`s
backing the same `AggregationBuilder`. This required a change in the
register method's signature.
2016-07-01 14:48:08 -04:00
Nik Everett f30a70c51f Fix comment
I forgot a word....
2016-07-01 14:48:08 -04:00
Ali Beyad cb20776439 Includes the index UUID in the _cat/indices API and adds tests
for the _cat/indices functionality.

Closes #19204
Closes #19132
2016-07-01 14:45:55 -04:00
Nik Everett ff42d7cfc6 Add embedded stash key support to rest tests
This allowes embedding stash keys in string like `t${key}est`. This
allows simple string concatenation like acitons.

The test for this is in `ObjectPathTests` because `Stash` doesn't seem
to have a test on its own and it is simple enough to test embedded
stashes this way. And this is a way I expect them to be used eventually.
2016-07-01 14:11:11 -04:00
Ryan Ernst a206c7a149 Remove unnecessary transport level bwc 2016-07-01 10:16:56 -07:00
Ryan Ernst dbbfadeefa Internal: Remove cyclic dependency between HttpServer and NodeService
NodeService has an "service attributes" map, which is only
set by HttpServer on start/stop. But the only thing it puts in this map
is already available as part of the HttpServer info which is added to
node info requests. This change removes the attributes map and removes
the dependency in HttpServer on NodeService.
2016-07-01 09:50:54 -07:00
Ryan Ernst 76ba10bab6 Remove unnecessary optional injection of ScriptService into NodeService 2016-07-01 09:31:41 -07:00
Ryan Ernst 65c9b0b588 Merge branch 'master' into ingest_plugin_api 2016-07-01 09:26:17 -07:00
Tal Levy 01d7020ee3 Skip the execution of an empty pipeline (#19200)
main optimization: `sourceToMap` is not called, therefore avoiding creation of Map of Maps
Closes #19192.
2016-07-01 09:15:05 -07:00
Nik Everett b66fc308fc Add ingest-useragent to vagrant tests 2016-07-01 11:29:48 -04:00