Commit Graph

7291 Commits

Author SHA1 Message Date
Simon Willnauer f30b1f82ee Remove HttpServer and HttpServerAdapter in favor of a simple dispatch method (#22636)
Today we have quite some abstractions that are essentially providing a simple
dispatch method to the plugins defining a `HttpServerTransport`. This commit
removes `HttpServer` and `HttpServerAdaptor` and introduces a simple `Dispatcher` functional
interface that delegate to `RestController` by default.

Relates to #18482
2017-01-16 21:06:08 +01:00
Boaz Leskes f88ab76067 Revert "Add a deprecation notice to shadow replicas (#22025)"
This reverts commit 0da190234c.
2017-01-16 16:15:41 +01:00
Boaz Leskes b887681550 Revert "Don'y use `INDEX_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE_SETTING` directly as it triggers (many) deprecation logging"
This reverts commit e976aa09bb.
2017-01-16 16:15:32 +01:00
Boaz Leskes e976aa09bb Don'y use `INDEX_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE_SETTING` directly as it triggers (many) deprecation logging
#22025 deprecated this setting (pending it's removal) but it's frequent usage will spam the deprecation logs and also fails test. As temporary work around we should not use the setting object directly.
2017-01-16 16:11:59 +01:00
Boaz Leskes 0da190234c Add a deprecation notice to shadow replicas (#22025)
Also adds deprecation logging.

See #22024
2017-01-16 15:40:05 +01:00
Christoph Büscher 59a48ffc41 ProfileResult and CollectorResult should print machine readable timing information (#22561)
Currently both ProfileResult and CollectorResult print the time field in a human readable string format
 (e.g. "time": "55.20315000ms"). When trying to parse this back to a long value, for example to use in 
the planned high level java rest client, we can lose precision because of conversion and rounding issues. 
This change adds a new additional field (`time_in_nanos`) to the profile response to be able to get the 
original time value in nanoseconds back. 

The old `time` field is only printed when the `?`human=true` flag in the url is set. This follow the behaviour for 
all other stats-related apis. Also the format of the `time` field is slightly changed. Instead of always formatting 
the output as a 10-digit ms value, by using the `XContentBuilder#timeValueField()` method we now print 
the largest time unit present is used (e.g. "s", "ms", "micros").
2017-01-16 14:27:55 +01:00
Jason Tedor e6dc74f2bf Add replica ops with version conflict to translog
An operation that completed successfully on a primary can result in a
version conflict on a replica due to the asynchronous nature of
operations. When a replica operation results in a version conflict, the
operation is not added to the translog. This leads to gaps in the
translog which is problematic as it can lead to situations where a
replica shard can never advance its local checkpoint. As such operations
are just normal course of business for a replica shard, these operations
should be treated as if they completed successfully. This commit adds
these operations to the translog.

Relates #22626
2017-01-16 08:08:52 -05:00
javanna 8e3f1dd689 Replace custom Functional interface in ElasticsearchException with CheckedFunction 2017-01-16 13:57:58 +01:00
javanna 9a910d3c9d Make RestChannelConsumer extend CheckedConsumer<RestChannel, Exception> 2017-01-16 13:57:58 +01:00
javanna ab144c418e replace ShardSearchRequest.FilterParser functional interface with CheckedFunction 2017-01-16 13:57:58 +01:00
javanna bc22afcb2f [TEST] replace SizeFunction with Function<Integer, Integer> 2017-01-16 13:57:58 +01:00
javanna 884302dcaa Expose CheckedFunction 2017-01-16 13:57:58 +01:00
Jason Tedor fc3280b3cf Expose logs base path
For certain situations, end-users need the base path for Elasticsearch
logs. Exposing this as a property is better than hard-coding the path
into the logging configuration file as otherwise the logging
configuration file could easily diverge from the Elasticsearch
configuration file. Additionally, Elasticsearch will only have
permissions to write to the log directory configured in the
Elasticsearch configuration file. This commit adds a property that
exposes this base path.

One use-case for this is configuring a rollover strategy to retain logs
for a certain period of time. As such, we add an example of this to the
documentation.

Additionally, we expose the property es.logs.cluster_name as this is
used as the name of the log files in the default configuration.

Finally, we expose es.logs.node_name in cases where node.name is
explicitly set in case users want to include the node name as part of
the name of the log files.

Relates #22625
2017-01-16 07:39:37 -05:00
Jason Tedor 9ae5410ea6 Do not configure a logger named level
When logger.level is set, we end up configuring a logger named "level"
because we look for all settings of the form "logger\..+" as configuring
a logger. Yet, logger.level is special and is meant to only configure
the default logging level. This commit causes is to avoid not
configuring a logger named level.

Relates #22624
2017-01-16 07:30:21 -05:00
Alexander Reelsen f6ee6e420b Indexing: Add shard id to indexing operation listener (#22606)
The IndexingOperationListener interface did not provide any
information about the shard id when a document was indexed.

This commit adds the shard id as the first parameter to all methods
in the IndexingOperationListener.
2017-01-16 09:08:16 +01:00
Jason Tedor 526cf6182d Cleanup handling of cgroup stats
This commit is a simple cleanup of the code related to cgroup stats:
 - reduce visibility of a method
 - remove an unneeded logger guard
 - cleanup the formatting of comments
2017-01-15 12:18:16 -05:00
Simon Willnauer 5f0344a918 Pass ThreadContext to transport interceptors to allow header modification (#22618)
TransportInterceptors are commonly used to enrich requests with headers etc.
which requires access the the thread context. This is not always easily possible
since threadpools are hard to access for instance if the interceptor is used on a transport client.

This commit passes on the thread context to all the interceptors for further consumption.

Closes #22585
2017-01-15 13:35:39 +01:00
Jason Tedor bed719de0a Log deleting indices at info level
Deleting indices is an important event in a cluster and as such should
be logged at the info level. This commit changes the logging level on
index deletion to the info level.

Relates #22627
2017-01-14 23:13:40 -05:00
Jason Tedor d67514606e Fix out-of-date Javadocs on Security.java
We have made the security manager non-optional, but the Javadocs for
Security.java imply that it still is. This commit fixes this issue.

Relates #16176
2017-01-13 17:20:45 -05:00
Ali Beyad 0c7fc229b8 [TEST] No longer randomly block on the index-N files in the
MockRepository, because the getRepositoryData() call depends on it,
which is used in non-synchronized actions such as getting
snapshot status.
2017-01-13 15:57:37 -05:00
Lee Hinman cd236c4de4 Merge remote-tracking branch 'zareek/enhancement/use_shard_bulk_for_single_ops' 2017-01-13 10:09:18 -07:00
Simon Willnauer 4c1ee018f6 Remove setLocalNode from ClusterService and TransportService (#22608)
ClusterService and TransportService expect the local discovery node to be set
before they are started but this requires manual interaction and is error prone since
to work absolutely correct they should share the same instance (same ephemeral ID).

TransportService also has 2 modes of operation, mainly realted to transport client vs. internal
to a node. This change removes the mode where we don't maintain a local node and uses a dummy local
node in the transport client since we don't bind to any port in such a case.

Local discovery node instances are now managed by the node itself and only suppliers and factories that allow
creation only once are passed to TransportService and ClusterService.
2017-01-13 16:12:27 +01:00
Simon Willnauer d5fa84f869 Harder close and remove reference concurrency in MockTcpTransport (#22613)
There was still small race in MockTcpTransport where channesl that are concurrently
closing are not yet removed from the reference tracking causing tests to fail. Compared to
the other races before this is a rather small windown and requires very very short test durations.
2017-01-13 16:04:05 +01:00
Matt Weber beceb4bf8a Analyze API Position Length Support (#22574)
Expose the position length attribute if a token has a non-standard position length greater than 1.
2017-01-13 09:12:49 -05:00
David Pilato 815c4ac4c8 Update after review and add a test 2017-01-13 12:51:35 +01:00
David Pilato 726c05b7c5 NPE when no setting name passed to elasticsearch-keystore
```h
$ bin/elasticsearch-keystore create
Created elasticsearch keystore in /Users/dpilato/Documents/Elasticsearch/apps/elasticsearch/elasticsearch-6.0.0-alpha1/config
$ bin/elasticsearch-keystore add
Enter value for null: xyz
Exception in thread "main" java.lang.NullPointerException: invalid null input
	at java.security.KeyStore.setEntry(KeyStore.java:1552)
	at org.elasticsearch.common.settings.KeyStoreWrapper.setString(KeyStoreWrapper.java:264)
	at org.elasticsearch.common.settings.AddStringKeyStoreCommand.execute(AddStringKeyStoreCommand.java:83)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.Command.main(Command.java:88)
	at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:39)
```
2017-01-13 12:20:20 +01:00
Jim Ferenczi f18d5f22ce Fix NPE in TermsAggregatorTests when global ordinals are needed 2017-01-13 09:16:24 +01:00
Tanguy Leroux 3a3ce61186 Update Jackson to 2.8.6 (#22596)
closes #22266
2017-01-13 09:05:48 +01:00
Michael McCandless 568e655fdb Source filtering: only accept array items if the previous include pattern matches (#22593)
Source filtering was always accepting array items even if the include pattern did not match.

Closes #22557
2017-01-12 19:00:39 -05:00
Nik Everett baed02bbe2 Whitelist some ScriptDocValues in painless (#22600)
Without this whitelist painless can't use ip or binary doc values.

Closes #22584
2017-01-12 15:26:09 -05:00
Lee Hinman 58daf5fb6d Bump version to 5.1.3 (#22597)
* Bump version to 5.1.3

Bumps version and adds the BWC indices
2017-01-12 12:37:26 -07:00
Simon Willnauer acf2d2f86f Ensure new connections won't be opened if transport is closed or closing (#22589)
Today there are several races / holes in TcpTransport and MockTcpTransport
that can allow connections to be opened and remain unclosed while the actual
transport implementation is closed. A recently added assertions in #22554 exposes
these problems. This commit fixes several issues related to missed locks or channel
creations outside of a lock not checking if the resource is still open.
2017-01-12 20:27:09 +01:00
Lee Hinman 2db01b6127 Merge remote-tracking branch 'dakrone/disable-all-by-default' 2017-01-12 10:17:51 -07:00
javanna 8e8ac5f239 Remove ParseFieldMatcher and ParseFieldMatcherSupplier
Closes #19552
2017-01-12 14:43:35 +01:00
javanna def8125e51 Remove ParseFieldMatcher usages from BaseRestHandler 2017-01-12 14:43:35 +01:00
javanna 9e680e8e51 Remove ParseFieldMatcher usages from TransportAction 2017-01-12 14:43:35 +01:00
javanna 64c3212fdb Remove ParseFieldMatcher usages from IndexSettings 2017-01-12 14:43:35 +01:00
javanna 4449eb181b Remove ParseFieldMatcher usages from QueryRewriteContext 2017-01-12 14:43:35 +01:00
javanna 8072f168a3 Remove ParseFieldMatcher usages from QueryParseContext 2017-01-12 14:43:35 +01:00
javanna 83a3f0e42c fix compile error
ExtendedBounds cannot yet have its ParseFieldMatcher usage removed, reverted that bit.
2017-01-12 10:21:47 +01:00
Luca Cavanna 0f7d52df68 Remove some more ParseFieldMatcher usages (#22571) 2017-01-12 10:04:10 +01:00
Lee Hinman 7a18bb50fc Disable _all by default
This change disables the _all meta field by default.

Now that we have the "all-fields" method of query execution, we can save both
indexing time and disk space by disabling it.

_all can no longer be configured for indices created after 6.0.

Relates to #20925 and #21341
Resolves #19784
2017-01-11 16:47:13 -07:00
Simon Willnauer 8a0393f718 Move assertion for open channels under TcpTransport lock
TcpTransport has an actual mechanism to stop resources in subclasses.
Instead of overriding `doStop` subclasses should override `stopInternal`
that is executed under the connection lock guaranteeing that there is no
concurrency etc.

Relates to #22554
2017-01-11 23:37:12 +01:00
Luca Cavanna ec73cfe937 Remove unused *XContentGenerator constructors (#22558) 2017-01-11 20:51:23 +01:00
Ryan Ernst 8015fbbf25 Make s3 repository sensitive settings use secure settings (#22479)
* Settings: Make s3 repository sensitive settings use secure settings

This change converts repository-s3 to use the new secure settings. In
order to support the multiple ways we allow aws creds to be configured,
it also moves the main methods for the keystore wrapper into a
SecureSettings interface, in order to allow settings prefixing to work.
2017-01-11 11:19:46 -08:00
Matt Weber 609d2aab15 QueryString and SimpleQueryString Graph Support (#22541)
Add support for graph token streams to "query_String" and
"simple_query_string" queries.
2017-01-11 18:59:43 +01:00
Lee Hinman e93fdb8460 Merge branch 'master' into enhancement/use_shard_bulk_for_single_ops 2017-01-11 10:08:46 -07:00
Lee Hinman fed2a1a822 Fix Translog.Delete serialization for sequence numbers (#22543)
* Fix Translog.Delete serialization for sequence numbers

Translog.Delete used `.writeVLong` instead of `.writeLong` for the sequence
number and primary term (and their respective "read" variants). This could lead
to issues where a 5.x node sent a translog operation with a negative sequence
number (-2 for unassigned seq no) that tripped an assertion serializing a
negative number and causing ES to exit.

Adds a unit test for serialization and a mixed-cluster REST test, since that was
how this was originally caught.

* Use more realistic values for random seqNum and primary term

* Add comment with TODO for removal in 7.0

* Change comment into an assert
2017-01-11 10:08:04 -07:00
Ali Beyad 389ffc93d8 Adds debugging information for invalid repository data x-content 2017-01-11 11:27:25 -05:00
Simon Willnauer 6810125a8b Prevent open channel leaks if handshake times out or is interrupted (#22554)
The low level TCP handshake can cause channel / connection leaks if it's interrupted
since the caller doesn't close the channel / connection if the handshake was not successful.
This commit fixes the channel leak and adds general test infrastructure to detect channel leaks
in the future.
2017-01-11 17:02:36 +01:00