Commit Graph

6100 Commits

Author SHA1 Message Date
Lee Hinman 3fbfb3e7e7 Fix propagating the default value for script settings
Fixes an issue where the value for the `script.engine.<lang>.inline`
settings would be _set_ properly, but would not accurately be reflected
in the `include_defaults` output. Adds a test to ensure the default raw
setting is now correct.

Resolves #20159
2016-08-26 13:03:32 -06:00
Jason Tedor 287cb00474 Avoid prematurely triggering logger initialization
The class Setting holds a static reference to a deprecation logger
instance. When the class initializer for Setting runs, it starts
triggering log4j initialization. There is a chain of initializations
from InternalSettingsPreparer to Environment to Setting that triggers
this initialization before log4j configuration has occurred. This commit
modifies this initialization so that initialization is not done eagerly.

Relates #20170
2016-08-26 05:07:05 -04:00
Adrien Grand 3ed0da5a58 GET operations should not extract fields from `_source`. #20158
This makes GET operations more consistent with `_search` operations which expect
`(stored_)fields` to work on stored fields and source filtering to work on the
`_source` field. This is now possible thanks to the fact that GET operations
do not read from the translog anymore (#20102) and also allows to get rid of
`FieldMapper#isGenerated`.

The `_termvectors` API (and thus more_like_this too) was relying on the fact
that GET operations would extract fields from either stored fields or the source
so the logic to do this that used to exist in `ShardGetService` has been moved
to `TermVectorsService`. It would be nice that term vectors do not rely on this,
but this does not seem to be a low hanging fruit.
2016-08-26 10:35:23 +02:00
Yannick Welsch 6fe9ae29ea Mark shard as stale on non-replicated write, not on node shutdown (#20023)
Non-stale shard copies are currently tracked using their allocation ids in the cluster state. When a node leaves the cluster, shard copies of that node are marked as stale by removing their allocation ids from the active set in the cluster. For full cluster restarts, this can have the unwanted effect that only the last node holding a copy of the shard will be seen as non-stale. The other shard copies are not really stale though as long as no writes have happened on this shard copy. Shard copies should thus only be marked as stale (by the master in the cluster state) if other active shards have received writes.

This commit implements the above logic and also renames the persistent structure used to track non-stale shard copies from "active_allocations" to "in_sync_allocations" as we now also support tracking non-stale shard copies that have no active routing entries in the cluster state.
2016-08-26 10:09:57 +02:00
Adrien Grand c5f8e1b64d Do not parse numbers as both strings and numbers when not included in `_all`. #20167
We need to get the string representation of numbers in order to include in
`_all`. However this has a cost and disabling `_all` is rather common so we
should look into skipping it.
2016-08-26 10:00:36 +02:00
Jason Tedor bc136a90d5 Add network types to cluster stats
The network types in use on a cluster can be useful information to have,
so this commit adds aggregate metrics for the network types in use in a
cluster to the cluster stats.

Relates #20144
2016-08-25 21:08:05 -04:00
Chris Earle 1cf694b63e Use StringBuilder in favor of StringBuffer
This removes all instances of StringBuffer that are removeable.

Uncontended synchronization in Java is pretty cheap, but it's unnecessary.
2016-08-25 16:20:03 -04:00
Chris Earle b41508a344 Make MapOfLists Generic
This moves the Writer interface from StreamOutput into Writeable, as a peer of its inner Reader interface. This should hopefully help to avoid random functional interfaces being created for the same purpose.

It also makes use of the moved class by updating writeMapOfLists and readMapOfLists.
2016-08-25 16:10:48 -04:00
Colin Goodheart-Smithe f5fbb3eb8b Fix agg profiling when using breadth_first collect mode
Previous to this change the nesting of aggregation profiling results
would be incorrect when the request contains a terms aggregation and the
collect mode is (implicitly or explicitly) set to `breadth_first`. This
was because the aggregation profiling has to make the assumption that
the `preCollection()` method of children aggregations is always called in
the `preCollection()` method of their parent aggregation. When the collect
mode is `breadth_first` the `preCollection` of the children aggregations
was delayed until the documents were replayed.

This change moves the `preCollection()` of deferred aggregations to run
during the `preCollection()` of the parent aggregation. This should have
no adverse impact on the breadth_first mode as there is no allocation of
memory in any of the aggregations.

We also apply the same logic to the diversified sampler aggregation as
we did to the terms aggregation to move the `preCollection()` of the
child aggregations method to be called during the `preCollection()` of
the parent aggregation.

This commit also includes a fix so that the `ProfilingLeafBucketCollector`
propagates the scorer to its delegate so the diversified sampler agg works
when profiling is enabled.
2016-08-25 14:57:52 +01:00
Adrien Grand b521638f52 Revert "Revert "Save one utf8 conversion in KeywordFieldMapper. #19867""
This reverts commit d805266d94.
2016-08-25 13:37:14 +02:00
Adrien Grand f93ce94afe The root object mapper should support updating `numeric_detection`, `date_detection` and `dynamic_date_formats`. #20119
If they are specified by a mapping update, these properties are currently
ignored. This commit also fixes the handling of `dynamic_templates` so that it
is possible to remove templates (and so that it works more similarly to all
other mapping properties).

Closes #20111
2016-08-25 12:39:38 +02:00
Mike McCandless 7a14cd4b1d Pass baseSimilarity to super (PerFieldSimilarityWrapper) 2016-08-25 04:43:56 -04:00
Mike McCandless 5eb66e3378 Mark Scandinavian analysis components as multi term aware 2016-08-24 19:50:25 -04:00
Mike McCandless 7492300544 Remove now unused Store.renameFile, and obsolete commented out code 2016-08-24 18:20:30 -04:00
Mike McCandless 0ccfe69789 Upgrade to Lucene 6.2.0 2016-08-24 17:26:28 -04:00
Nicholas Knize 9eb63fb885 Refactor GeoPointFieldMapperLegacy and Legacy BBox query helpers
This is a house cleaning commit that refactors GeoPointFieldMapperLegacy to LegacyGeoPointFieldMapper for consistency with Legacy Numerics and IP field mappers.

IndexedGeoBoundingBoxQuery and InMemoryGeoBoundingBoxQuery are also deprecated and refactored as Legacy classes.
2016-08-24 14:40:25 -05:00
Jim Ferenczi 4682fc34ae Add the ability to disable the retrieval of the stored fields entirely
This change adds a special field named _none_ that allows to disable the retrieval of the stored fields in a search request or in a TopHitsAggregation.

To completely disable stored fields retrieval (including disabling metadata fields retrieval such as _id or _type) use _none_ like this:

````
POST _search
{
   "stored_fields": "_none_"
}
````
2016-08-24 16:40:08 +02:00
Simon Willnauer c499427166 Use _refresh instead of reading from Translog in the RT GET case (#20102)
Today we do a lot of accounting inside the engine to maintain locations
of documents inside the transaction log. This is only needed to ensure
we can return the documents source from the engine if it hasn't been refreshed.
Aside of the added complexity to be able to read from the currently writing translog,
maintainance of pointers into the translog this also caused inconsistencies like different values
of the `_ttl` field if it was read from the tlog or not. TermVectors are totally different if
the document is fetched from the tranlog since copy fields are ignored etc.

This chance will simply call `refresh` if the documents latest version is not in the index. This
streamlines the semantics of the `_get` API and allows for more optimizations inside the engine
and on the transaction log. Note: `_refresh` is only called iff the requested document is not refreshed
yet but has recently been updated or added.

#Relates to #19787
2016-08-24 15:30:08 +02:00
Simon Willnauer 1b1a1acad8 Don't index the `_version` field (#20132)
The `_version` field doesn't allow to be searched anyway since it's
set `IndexOptions#NONE` for it instead.
2016-08-24 10:04:27 +02:00
Adrien Grand 5d6c9b0745 Fix RAM usage estimation of LiveVersionMap. #20123
I was writing tests for RAM usage estimation of LiveVersionMap and found a
couple issues:
 - The BytesRef objects used as uids were oversized since they were created
   via `new BytesRef(CharSequence)` which creates a `byte[]` whose size is 3x
   the length of the provided char sequence. Given that our uids are most of
   times ASCII sequences, this is a waste of memory.
 - `VersionValue` was using `translogLocation.size` instead of
   `translogLocation.ramBytesUsed()` for RAM estimation, which is completely
   unrelated to the memory footprint of the `Translog.Location` object.

In particular, the latter issue could cause RAM usage estimation to be
significantly overestimated, especially on large documents.

I also added tests for ram accounting.
2016-08-24 09:54:06 +02:00
Lee Hinman 3298a4ed38 Revert "Merge remote-tracking branch 'dakrone/exclude-numerics-from-all'"
This reverts commit 514585290c, reversing
changes made to 8563c8d897.
2016-08-23 09:24:33 -06:00
Nicholas Knize 8234fad9ca Deprecate geohash parameters for geo_point parser
This commit deprecates all geohash parameters in the geo_point field parser.
2016-08-23 09:19:21 -05:00
Nicholas Knize 28ed0e7abf Deprecate optimize_bbox on geodistance queries
Deprecates the optimize_bbox parameter on geodistance queries. This has no longer been needed since version 2.2 because lucene geo distance queries (postings and LatLonPoint) already optimize by bounding box.
2016-08-23 09:14:54 -05:00
Michael McCandless 668dac722a Don't suppress AlreadyClosedException (#19975)
Catching and suppressing AlreadyClosedException from Lucene is dangerous because it can mean there is a bug in ES since ES should normally guard against invoking Lucene classes after they were closed.

I reviewed the cases where we catch AlreadyClosedException from Lucene and removed the ones that I believe are not needed, or improved comments explaining why ACE is OK in that case.

I think (@s1monw can you confirm?) that holding the engine's readLock means IW will not be closed, except if disaster strikes (failEngine) at which point I think it's fine to see the original ACE in the logs?

Closes #19861
2016-08-23 12:37:38 +02:00
Masaru Hasegawa f3cddef61e Merge pull request #20046 from masaruh/same_shard_host_setting
Move cluster.routing.allocation.same_shard.host setting to new settings infrastructure
2016-08-23 11:34:59 +09:00
Jack Conradson 131e370a16 Make Painless the default scripting language.
Closes #20017
2016-08-22 17:38:02 -07:00
Lee Hinman 514585290c Merge remote-tracking branch 'dakrone/exclude-numerics-from-all' 2016-08-22 12:36:25 -06:00
Thiago Souza 8563c8d897 Merge pull request #20042 from tsouza/fix/issue-19364
Use internal from/to when creating InternalDateRange.Bucket
2016-08-22 14:38:13 -03:00
Simon Willnauer 29336b231b Add ref-counting to SearchContext to prevent accessing already closed readers (#20095)
When a SearchContext is closed it's reader / searcher reference is closed too.
If this happens while a search is accessing it's reader reference it can lead
to an unexpected `AlreadyClosedException` or worst case, an already closed MMapDirectory
is access causing a `SIGSEV` like in #20008 (even though the window for this is very small).

SearchContext can be closed concurrently if:
 * an index is deleted / removed from the node
 * a search context is idle for too long and is cleaned by the reaper
 * an explicit freeContext message is received

This change adds reference counting to the SearchContext base class and it's used
inside SearchService each time the context is accessed.

Closes #20008
2016-08-22 15:41:05 +02:00
Masaru Hasegawa c7e36536f6 Move cluster.routing.allocation.same_shard.host setting to new settings infrastructure
Fixes #20045
2016-08-22 11:07:42 +09:00
Ryan Ernst e7393529b1 Merge branch 'master' into remove_index_template_filter 2016-08-19 21:14:12 -07:00
Ryan Ernst 1a7a9d3c62 Merge pull request #20071 from rjernst/pull_shards_allocator
Plugins: Switch custom ShardsAllocators to pull based model
2016-08-19 20:55:31 -07:00
Ryan Ernst 3a9055b55d Merge pull request #20073 from rjernst/deguice_indices_service
Deguice IndicesService
2016-08-19 20:47:07 -07:00
Lee Hinman d7e516c0b4 Default `include_in_all` for numeric-like types to false
This includes:

- All regular numeric types such as int, long, scaled-float, double, etc
- IP addresses
- Dates
- Geopoints and Geoshapes

Relates to #19784
2016-08-19 15:50:38 -06:00
Jason Tedor 6cda12871c Merge pull request #20083 from jasontedor/improve-startup-exception
Improve startup exception
2016-08-19 16:44:41 -04:00
Ali Beyad 1c9b64e09a Adds ignoreUnavailable option to the snapshot status API (#20066)
Adds ignoreUnavailable to the snapshot status API to be consistent
with the get snapshots API which has a similar parameter. If
ignoreUnavailable is set to true, then the snapshot status request
will ignore any snapshots that were not found in the repository,
instead of throwing a SnapshotMissingException.

Closes #18522
2016-08-19 16:19:56 -04:00
Jason Tedor c3849d9e7d Add print stack trace override to StartupException
StartupException overrides Throwable#printStackTrace(PrintStream) but
not Throwable#printStackTrace(PrintWriter). The former override is used
when the JVM terminates with an exception, but the latter override can
be used in some logging frameworks when rendering an exception (e.g.,
log4j). This commit adds an override for the latter, with the behavior
for the two overrides being the same.
2016-08-19 15:10:54 -04:00
Jason Tedor 3a6f7eb07a Rename StartupError to StartupException
This commit renames StartupError to StartupException. This rename is due
to the fact that this class inherits from Exception not Error in the
Throwable class hierarchy.
2016-08-19 14:53:08 -04:00
Ali Beyad cf32f8de34 Fixes tests so allocation ids in IndexMetaData is in sync with
what is in the RoutingTable
2016-08-19 14:42:02 -04:00
Jason Tedor 069fc22696 Remove minimum master nodes bootstrap check
This commit removes the minimum master nodes bootstrap check. The
motivation for this check was to raise awareness of the minimum master
nodes setting but this check gives a false sense of security because
it's too easy to set the setting to one when first standing up a cluster
and never update it when adding master-eligible nodes, or have it out of
sync on various nodes and still pass this check. Since this check does
not have the security that other bootstrap checks provide, it should be
removed in favor of a stronger guarantee in the future. We do log a
warning if an election occurs with minimum master nodes less than a
quorum of master-eligible nodes that participated in an election and
this is the best that we can do right now.

Relates #20082
2016-08-19 14:21:17 -04:00
Thiago Souza 9ea3f4ace3 Use supported random methods instead of DateTime.now() 2016-08-19 14:09:15 -03:00
Thiago Souza 2ba508a761 Use a better name for unit test method 2016-08-19 13:53:15 -03:00
Yannick Welsch 57c3dcb7d7 Merge pull request #20075 from ywelsch/fix/update-cs-with-routingresult
Some time ago, AllocationService.reroute was changed to not only return updates to the routing table but also to the metadata (which contain primary terms and in-sync allocation ids). A lot of test code still only updates the routing table though, which is fixed by this PR.
2016-08-19 18:18:30 +02:00
Yannick Welsch 771668f380 Use routingResult method to update cluster state after reroute
This ensures that the routing table as well as the metadata (with the primary terms and in-sync allocation ids) is updated.
2016-08-19 17:15:02 +02:00
Adrien Grand b586465a4c Make generics explicit to please ECJ. 2016-08-19 15:55:24 +02:00
Yannick Welsch a74f77b632 Check that all active shards have their allocation id in the in-sync set 2016-08-19 10:41:11 +02:00
Ryan Ernst 59636a0844 Internal: Deguice IndicesService
Almost all the dependencies of indices service are already created outside of
guice. This change deguices MetaStateService, and then IndicesService.
2016-08-19 00:27:37 -07:00
Adrien Grand a4ea7e7223 Switch indices.exists_type from `{index}/{type}` to `{index}/_mapping/{type}`. #20055
This will help remove types as we will need `{index}/{id}` to tell whether a
document exists.

Relates #15613
2016-08-19 09:18:24 +02:00
Ryan Ernst 207d3a60e7 Fix staging url for official plugins
This was incorrectly setup in #19996, without the version in the staging
build id.
2016-08-18 23:06:14 -07:00
Ryan Ernst 00c123b59f Plugins: Remove IndexTemplateFilter
How index templates match is currently controlled by the
IndexTemplateFilter interface. It is pluggable, to add additional
filter implementations to the default glob matcher.

This change removes the IndexTemplateFilter interface completely. This
is a very esoteric extension point, and not worth maintaining. Instead,
any improvements should be made to all of our glob matching.
2016-08-18 22:41:25 -07:00