Commit Graph

6354 Commits

Author SHA1 Message Date
Yannick Welsch bf5d425ab9 Fix wrong logger usages
These misusages were found by the logger usage checker that was re-enabled in the previous commit.
2016-09-21 14:45:28 +02:00
Simon Willnauer 0151974500 `_flush` should block by default (#20597)
This commit changes the default behavior of `_flush` to block if other flushes are ongoing.
This also removes the use of `FlushNotAllowedException` and instead simply return immediately
by skipping the flush. Users should be aware if they set this option that the flush might or might
not flush everything to disk ie. no transactional behavior of some sort.

Closes #20569
2016-09-21 14:20:24 +02:00
Simon Willnauer 6dc03ecb10 Remove unused Translog#read method (#20598)
Translog#read is a left-over from realtime-get that allows to read
from an arbitrary location in the transaction log. This method is unused
and can be replaced with snapshots in tests.
2016-09-21 14:19:49 +02:00
Boaz Leskes b3e5e6a0ba `index.routing.allocation.initial_recovery` limits replica allocation (#20589)
`index.routing.allocation.initial_recovery` is used with index shrinking to make sure the new index's primary is assigned to the node that holds a copy of each of the source index shards. Sadly with the introduction of `RecoverySource` a regression was introduced that limits the allocation of replicas of the new index.
2016-09-21 12:40:37 +02:00
Nik Everett 92417c6ae3 Better explain Plugin (#20573)
Adds some javadoc with more explanation on how to extend Plugin and
why we have all these `@Deprecated public final` `onModule` methods.

Closes #20564
2016-09-20 11:20:13 -04:00
Jason Tedor 12234c067a Ensure logging is initialized in CLI tools
Today when CLI tools are executed, logging statements can intentionally
or unintentionally be executed when logging is not configured. This
leads to log messages that the status logger is not configured. This
commit reworks logging configuration for CLI tools so that logging is
always configured.

Relates #20575
2016-09-20 08:28:27 -04:00
Tanguy Leroux 7645abaad9 Remove duplicate methods in ByteSizeValue (#20560)
This commit removes `ByteSizeValue`'s methods that are duplicated (ex: `mbFrac()` and `getMbFrac()`) in order to only keep the `getN` form.
    
It also renames `mb()` -> `getMb()`, `kb()` -> `getKB()` in order to be more coherent with the `ByteSizeUnit` method names.
2016-09-20 14:07:23 +02:00
Alexander Lin d31a8e6558 Provides a cat api endpoint for templates. (#20545)
Adds a cat api endpoint: /_cat/templates and its more specific version, /_cat/templates/{name}.

It looks something like:

$ curl "localhost:9200/_cat/templates?v"
name                  template     order version
sushi_california_roll *avocado*    1     1
pizza_hawaiian        *pineapples* 1
pizza_pepperoni       *pepperoni*  1

The specified version (only allows * globs) looks like:

$ curl "localhost:9200/_cat/templates/pizza*"
name            template     order version
pizza_hawaiian  *pineapples* 1
pizza_pepperoni *pepperoni*  1

Partially specified columns:

$ curl "localhost:9200/_cat/templates/pizza*?v=true&h=name,template"
name            template
pizza_hawaiian  *pineapples*
pizza_pepperoni *pepperoni*

The help text:

$ curl "localhost:9200/_cat/templates/pizza*?help"
name     | n | template name
template | t | template pattern string
order    | o | template application order number
version  | v | version

Closes #20467
2016-09-20 10:40:23 +02:00
Tanguy Leroux 38dce6384f Improve TribeIT tests
This commit adds a new test TribeIT#testClusterStateNodes() to verify that the tribe node correctly reflects the nodes of the remote clusters it is connected to.

It also changes the existing tests so that they really use two remote clusters now.
2016-09-20 10:31:32 +02:00
Luca Cavanna b7314c8721 fix IndexResponse#toString to print out shards info (#20562)
IndexResponse#toString method outputs an error caused by the shards object needing to be wrapped into another object. It is fixed by calling a different variant of Strings.toString(XContent) which accepts a second boolean argument that makes sure that a new object is created before outputting ShardInfo. I didn't change ShardInfo#toString directly as whether it needs a new object or not very much depends on where it is printed out. IndexResponse seemed a specific case as the rest of the info were not json, hence the shards object was the first one, but it is usually not the case.
2016-09-20 08:57:49 +02:00
Ryan Ernst b77c16086c Convert old download links to unified release urls (#20574)
With the unified release process across the elastic stack, download
links for all products are changing. This change updates docs referring
to the old download and packages urls.

Note that this change also updates the plugin installation command as
the url for downloads is being changed to be consistent with that for
packages (both plural).
2016-09-19 18:10:45 -07:00
Jason Tedor 05b4e0c0e3 Add serial collector bootstrap check
The serial collector is not suitable for running with a server
application like Elasticsearch and can decimate performance and lead to
cluster instability. This commit adds a bootstrap check to prevent usage
of the serial collector when Elasticsearch is running in production
mode.

Relates #20558
2016-09-19 20:25:50 -04:00
Jason Tedor aa510159c2 Avoid unnecessary creation of prefix loggers
Today when acquiring a prefix logger for a logger info stream, we obtain
a new prefix logger per invocation. This can lead to contention on the
markers lock in the constructor of PrefixLogger. Usually this is not a
problem (because the vast majority of callers hold on to the logger they
obtain). Unfortunately, under heavy indexing with multiple threads, the
contention on the lock can be devastating. This commit modifies
LoggerInfoStream to hold on to the loggers it obtains to avoid
contending over the lock there.

Relates #20571
2016-09-19 20:22:07 -04:00
Ryan Ernst 85b8f29415 Build: Remove old maven deploy support (#20403)
* Build: Remove old maven deploy support

This change removes the old maven deploy that we have in parallel to
maven-publish, and makes maven-publish fully work with publishing to
maven local. Using `gradle publishToMavenLocal` should be used to
publish to .m2.

Note that there is an unfortunate hack that means for
zip artifacts we must first create/publish a dummy pom file, and then
follow that with the real pom file. It would be nice to have the pom
file contains packaging=zip, but maven central then requires sources and
javadocs. But our zips are really just attached artifacts, so we already
set the packaging type to pom for our zip files. This change just works
around a limitation of the underlying maven publishing library which
silently skips attached artifacts when the packaging type is set to pom.

relates #20164
closes #20375

* Remove unnecessary extra spacing
2016-09-19 15:10:41 -07:00
Simon Willnauer ee8d14798f Unguice Transport and friends (#20526)
This change removes all guice interaction from Transport, HttpServerTransport,
HttpServer and TransportService. All these classes as well as their subclasses
or extended version configured via plugins are now created by using plain old
bloody java constructors. YAY!
2016-09-19 22:10:47 +02:00
Simon Willnauer bd93b3dce6 Call onNewEngine before the engine is actually published 2016-09-19 17:00:17 +02:00
Simon Willnauer 817d55cf93 Take refresh IOExceptions into account when catching ACE in InternalEngine (#20546)
Since #19975 we are aggressively failing with AssertionError when we catch an ACE
inside the InternalEngine. We treat everything that is neither a tragic even on
the IndexWriter or the Translog as a bug and throw an AssertionError. Yet, if the
engine hits an IOException on refresh of some sort and the IW doesn't realize it since
it's not fully under it's control we fail he engine but neither IW nor Translog are marked
as failed by tragic event while they are already closed.
This change takes the `failedEngine` exception into account and if it's set we know
that the engine failed by some other even than a tragic one and can continue.

This change also uses the `ReferenceManager#RefreshListener` interface in the engine rather
than it's concrete implementation.

Relates to #19975
2016-09-19 15:15:51 +02:00
Jason Tedor 7874463db0 Merge pull request #20553 from jasontedor/node-attributes
Node attributes and REST API spec README
2016-09-19 08:31:09 -04:00
Boaz Leskes 2ee9ab25d9 Remove `RoutingAllocation.Result` (#20538)
Currently all the reroute-like methods of `AllocationService` return a result object of type `RoutingAllocation.Result`. The result object contains the new `RoutingTable` and `MetaData` plus an indication whether those were changed. The caller is then responsible of updating a cluster state with these. These means that things can easily go wrong and one can take one of these but not the other causing inconsistencies. We already have a utility method on the `ClusterState` builder that does but no one forces you to do so. Also 99% of the callers do the same thing: i.e., check if the result was changed and if so update the very same cluster state that was passed to `AllocationService`.  This PR folds this pattern into `AllocationService` and changes almost all it's methods to return a new cluster state (potentially the original one).  This saves some 500 lines of code.

The one exception here is the reroute API which executes allocation commands and potentially returns an explanation as well (next to the routing table and metadata). That API now returns a `CommandsResult` object which encapsulate a cluster state and the explanation.
2016-09-19 13:54:35 +02:00
Jason Tedor b456823434 Fix leftover node attributes usage
Previously node attributes could be set via node.* but this now requires
using node.attr.*. This commit fixes some leftover usages of the old
way.
2016-09-19 07:45:31 -04:00
javanna 7097f4943c [TEST] delete specific index boost serialization test, already covered by testSerialization
indexBoost is already randomly set, we don't need a specific test for it in SearchSourceBuilderTests
2016-09-16 21:03:27 +02:00
javanna 20badcdbab [TEST] set back the visibility of our search ext plugin in FetchSubPhasePluginIT to private
This plugin is not used in other tests anymore, it should be private to make sure its usage doesn't spread again
2016-09-16 21:03:27 +02:00
javanna 4c726311e2 [TEST] introduce test plugin to inject random search ext elements in search request tests
A few of our unit tests generate a random search request body nd run tests against it. The source can optionally contain ext elements under the ext sections, which can be parsed by plugins. With this commit we introduce a plugin so that the tests don't use the one from FetchSubPhasePluginIT anymore. They rather generate multiple search ext elements. The plugin can parse and deal with all those. This extends the test coverage as we may have multiple elements with random names.

Took the chance to introduce a common test base class for search requests, called AbstractSearchTestCase, given that the setup phase is the same for all three tests around search source. Then we can have the setup isolated to the base class and the subclasses relying on it.

Closes #17685
2016-09-16 21:03:27 +02:00
Luca Cavanna 629e2b2aff Throw error if query element doesn't end with END_OBJECT (#20528)
* Throw error if query element doesn't end with END_OBJECT

Followup to #20515 where we added validation that after we parse a query within a query element, we should not get a field name. Truth is that the only token allowed at that point is END_OBJECT, as our DSL allows only one single query within the query object:

```
{
  "query" : {
    "term" : { "field" : "value" }
  }
}
```

We can then check that after parsing of the query we have an end_object that closes the query itself (which we already do). Following that we can check that the query object is immediately closed, as there are no other tokens that can be present in that position.

Relates to #20515
2016-09-16 21:02:12 +02:00
Nik Everett 697adfb3c4 Fix up tasks integ test
I'd made some mistakes that hadn't caused the test to fail but did
slow it down and partially invalidate some of the assertions. This
fixes those mistakes.
2016-09-16 12:18:41 -04:00
Jim Ferenczi d0f4bc16ca Fix FieldStats deserialization of `ip` field (#20522)
* Fix FieldStats deserialization of `ip` field

Add missing readBytes in `ip` field deserialization
Add (de)serialization tests for all types
This change also removes the ability to set FieldStats.minValue or FieldStats.maxValue to null.
This is not required anymore since the stats are built on fields with values only.

Fixes #20516
2016-09-16 16:15:46 +02:00
Nicholas Knize 01a6b7c408 [TEST] Refactor Geo test names to follow naming and style convention
This commit closes a stale issue where GeoJson parsing tests used a combination of underscore and camel case.

closes #8998
2016-09-16 09:13:38 -05:00
Simon Willnauer 3aabda6752 Ensure elasticsearch doesn't start with unuspported indices (#20514)
If an index was created with pre 2.0 we should not treat it as supported
even if all segments have been upgraded to a supported lucene version.

Closes #20512
2016-09-16 16:11:53 +02:00
Simon Willnauer f5daa165f1 Remove ability to plug-in TransportService (#20505)
TransportService is such a central part of the core server, replacing
it's implementation is risky and can cause serious issues. This change removes the ability to
plug in TransportService but allows registering a TransportInterceptor that enables
plugins to intercept requests on both the sender and the receiver ends. This is a commonly used
and overwritten functionality but encapsulates the custom code in a contained manner.
2016-09-16 09:47:53 +02:00
Boaz Leskes 577dcb3237 Add current cluster state version to zen pings and use them in master election (#20384)
During a networking partition, cluster states updates (like mapping changes or shard assignments)
are committed if a majority of the masters node received the update correctly. This means that the current master has access to enough nodes in the cluster to continue to operate correctly. When the network partition heals, the isolated nodes catch up with the current state and get the changes they couldn't receive before. However, if a second partition happens while the cluster
is still recovering from the previous one *and* the old master is put in the minority side, it may be that a new master is elected which did not yet catch up. If that happens, cluster state updates can be lost.

This commit fixed 95% of this rare problem by adding the current cluster state version to `PingResponse` and use them when deciding which master to join (and thus casting the node's vote). 

Note: this doesn't fully mitigate the problem as a cluster state update which is issued concurrently with a network partition can be lost if the partition prevents the commit message (part of the two phased commit of cluster state updates) from reaching any single node in the majority side *and* the partition does allow for the master to acknowledge the change. We are working on a more comprehensive fix but that requires considerate work  and is targeted at 6.0.
2016-09-15 23:39:11 +02:00
Simon Willnauer 1e2ef192c9 [TEST] Reduce the number of docs per indexRandom in FieldSortIT#testIssue6614 2016-09-15 22:56:26 +02:00
Areek Zillur 8c12b7c3b6 Merge pull request #20515 from areek/fix/query_validation
Fix silently accepting malformed queries
2016-09-15 16:53:17 -04:00
Areek Zillur bdad62a2f8 Fix silently accepting malformed queries
Currently, we silently accept malformed query where more
than one key is defined at the top-level for query object.
If all the keys have a valid query body, only the last query
is executed, besides throwing off parsing for additional suggest,
aggregation or highlighting defined in the search request.

This commit throws a parsing exception when we encounter a query
with multiple keys.

closes #20500
2016-09-15 16:32:28 -04:00
Boaz Leskes 2233d48235 add a reduced TCP_CONNECT_TIMEOUT setting to DiscoveryWithServiceDisruptionsIT
The default of 30s causes some tests to timeout when running ensureGreen and similar. This is because network delays simulation blocks connect until either the connect timeout expires or the disruption configured time stops. We do *not* immediately connect when the disruption is stopped.
2016-09-15 21:50:24 +02:00
Areek Zillur 16ed2fb423 [TEST] ensure context filtering with valid utf-8 characters work with completion suggester 2016-09-15 14:38:52 -04:00
Luca Cavanna 37489c3274 Add clusterUUID to RestMainAction output (#20503)
Add clusterUUID to RestMainAction output

GET / now returns the clusterUUID as well as part of its output for monitoring purposes
2016-09-15 16:25:17 +02:00
gfyoung b03c807368 Rename service.bat to elasticsearch-service.bat (#20496)
Closes gh-17528.
2016-09-15 15:53:44 +02:00
Jason Tedor 7132fcd7ac Give useful error message if log config is missing
Today when starting Elasticsearch without a Log4j 2 configuration file,
we end up throwing an array index out of bounds exception. This is
because we are passing no configuration files to Log4j. Instead, we
should throw a useful error message to the user. This commit modifies
the Log4j configuration setup to throw a user exception if no Log4j
configuration files are present in the config directory.

Relates #20493
2016-09-15 07:44:05 -04:00
Boaz Leskes a5f03b4bc5 testCanNotPublishWithoutMinMastNodes could time out if disruption hit just before cluster was fully formed
The test uses a NetworkDelay that drops requests and slows down connecting. Next to that it disable node fault detection to make sure nodes are not removed before we check our publishing. Sadly that can lead to huge slow downs if the disruption hits while a node is still pinging (and tries to connect, which is slowed down). Instead we can start the disruption on the cluster state thread, making sure the result of fault detection won't be processed before we publish
2016-09-15 08:50:58 +02:00
Lee Hinman d9f83a6d74 Change 'norelease' in MappedFieldType to 'TODO'
This should not block any sort of release, it is only to be more
protective towards fields not having any settings changed.
2016-09-14 14:37:02 -06:00
Lee Hinman 1e39a12fb0 Merge remote-tracking branch 'dakrone/remove-idx-shard-count-norelease' 2016-09-14 14:10:49 -06:00
Lee Hinman e462edc6d6 Validate index settings differently when registering index template
This was actually a byproduct of trying to remove a //norelease for
index shard setting validation in MetaDataIndexService. This //norelease
is now removed. Previously this check was *only* used by the template
service, so we validated twice, once in the Settings infrastructure and
once when actually creating the index. We now instead use the Settings
infrastructure to validate the settings for shard count.
2016-09-14 13:25:34 -06:00
Simon Willnauer 17ddee7011 Remove TransportService#registerRequestHandler leniency (#20469)
`TransportService#registerRequestHandler` allowed to register
handlers more than once and issues an annoying warn log message when
this happens. This change simple throws an exception to prevent regsitering
the same handler more than once. This commit also removes the ability
to remove request handlers.

Relates to #20468
2016-09-14 20:32:29 +02:00
javanna e7e27d9ffa [TEST] remove unused currentTypes variable from SearchSourceBuilderTests 2016-09-14 19:33:23 +02:00
Simon Willnauer bb6e7eeb7a [TEST] Don't use transport client if we are blocking internal actions we might run into disconnects 2016-09-14 17:50:14 +02:00
Simon Willnauer b35f7446ce Remove unused imports 2016-09-14 17:44:45 +02:00
Simon Willnauer d402ca0dd7 Remove poor-mans compression in InternalSearchHit and friends (#20472)
We still use some crazy poor mans compression in InternalSearchHit that
uses a thread local and an unordered map as a lookup table if requested.
Stuff like this should be handled by compression on the transport layer
rather than in-line in the serialization code. This code is complex enough.
2016-09-14 15:25:25 +02:00
Simon Willnauer c1e84618a6 Only try to read new segments info if we really flushed the index (#20474)
There is no reason to read the current segments info unless we flushed
/ committed the lucene index.
2016-09-14 15:23:17 +02:00
Boaz Leskes 74fc074e5e fix styling 2016-09-14 10:52:10 +02:00
Simon Willnauer a1cd6be777 Don't register SearchTransportService handlers more than once (#20468)
This utility class is used in 3 places while we only need to register
the handlers once per node. Otherwise we will see nasty `WARN` logs like:
`registered two transport handlers for action indices:data/read/search[phase/fetch/id/scroll]...`

This change will only register handlers inside the main TransportSearchAction.
2016-09-14 10:34:40 +02:00