summaryrefslogtreecommitdiff
path: root/core/src/main/java/org
AgeCommit message (Collapse)Author
2017-06-22Initialize max unsafe auto ID timestamp on shrinkJason Tedor
When shrinking an index we initialize its max unsafe auto ID timestamp to the maximum of the max unsafe auto ID timestamps on the source shards. Relates #25356
2017-06-22Enable a long translog retention policy by default (#25294)Boaz Leskes
#25147 added the translog deletion policy but didn't enable it by default. This PR enables a default retention of 512MB (same maximum size of the current translog) and an age of 12 hours (i.e., after 12 hours all translog files will be deleted). This increases to chance to have an ops based recovery, even if the primary flushed or the replica was offline for a few hours. In order to see which parts of the translog are committed into lucene the translog stats are extended to include information about uncommitted operations. Views now include all translog ops and guarantee, as before, that those will not go away. Snapshotting a view allows to filter out generations that are not relevant based on a specific sequence number. Relates to #10708
2017-06-22Get short path name for native controllersJason Tedor
Due to limitations with CreateProcessW on Windows (ultimately used by ProcessBuilder) with respect to maximum path lengths, we need to get the short path name for any native controllers before trying to start them in case the absolute path exceeds the maximum path length. This commit uses JNA to invoke the necessary Windows API for this to start the native controller using the short path. To be precise about the limitation here, the MSDN docs for CreateProcessW say for the command line parameter: >The command line to be executed. The maximum length of this string is >32,768 characters, including the Unicode terminating null character. If >lpApplicationName is NULL, the module name portionof lpCommandLine is >limited to MAX_PATH characters. This is exactly how the Windows implementation of Process in the JDK invokes CreateProcessW: with the executable name (lpApplicationName) set to NULL. Relates #25344
2017-06-22Live primary-replica resync (no rollback) (#24841)Yannick Welsch
Adds a replication task that streams all operations from the primary's global checkpoint to all replicas.
2017-06-22Upgrade to lucene-7.0.0-snapshot-ad2cb77. (#25349)Adrien Grand
Most notable changes: - better update concurrency: LUCENE-7868 - TopDocs.totalHits is now a long: LUCENE-7872 - QueryBuilder does not remove the boolean query around multi-term synonyms: LUCENE-7878 - removal of Fields: LUCENE-7500 For the `TopDocs.totalHits` change, this PR relies on the fact that the encoding of vInts and vLongs are compatible: you can write and read with any of them as long as the value can be represented by a positive int.
2017-06-21Initialize sequence numbers on a shrunken indexJason Tedor
Bringing together shards in a shrunken index means that we need to address the start of history for the shrunken index. The problem here is that sequence numbers before the maximum of the maximum sequence numbers on the source shards can collide in the target shards in the shrunken index. To address this, we set the maximum sequence number and the local checkpoint on the target shards to this maximum of the maximum sequence numbers. This enables correct document-level semantics for documents indexed before the shrink, and history on the shrunken index will effectively start from here. Relates #25321
2017-06-21Javadoc: ThreadPool doesn't reject while shutdown (#23678)Nik Everett
It caught me offguard yesterday that our executors won't always reject when the ThreadPool is shutdown.
2017-06-21Add version v5.4.2 after releaseTanguy Leroux
2017-06-21IndexMetaData: Add internal format index setting (#25292)Alexander Reelsen
This setting is supposed to ease index upgrades as it allows you to check for a new setting called `index.internal.version` which can be used to check before upgrading indices.
2017-06-21Ensure we never read from a closed MockSecureSettings object (#25322)Simon Willnauer
If secure settings are closed after the node has been constructed no key-store access is permitted. We should also try to be as close as possible to the real behavior if we mock secure settings. This change also adds the same behavior as bootstrap has to InternalTestCluster to ensure we fail if we try to read from secure settings after the node has been constructed.
2017-06-21Fix settings serialization to not serialize secure settings or not take the ↵Simon Willnauer
total size into account (#25323)
2017-06-20Initialize primary term for shrunk indicesJason Tedor
Today when an index is shrunk, the primary terms for its shards start from one. Yet, this is a problem as the index will already contain assigned sequence numbers across primary terms. To ensure document-level sequence number semantics, the primary terms of the target shards must start from the maximum of all the shards in the source index. This commit causes this to be the case. Relates #25307
2017-06-20Parse synonyms with the same analysis chain (#8049)Jun Ohtani
* [Analysis] Parse synonyms with the same analysis chain Synonym Token Filter / Synonym Graph Filter tokenize synonyms with whatever tokenizer and token filters appear before it in the chain. Close #7199
2017-06-19Tweak reindex cancel logic and add many debug logs (#25256)Nik Everett
I'm still trying to hunt down rare failures in the cancelation tests for reindex and friends. Here is the latest: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+5.x+multijob-unix-compatibility/os=ubuntu/876/console It doesn't show much, other than that one of the tasks didn't kill itself when asked to cancel. So I'm going a bit crazy with debug logging so that the next time this comes up I can trace exactly what happened. Additionally, this tweaks the logic around how rethrottles were performed around cancel. Previously we set the `requestsPerSecond` to `0` when we cancelled the task. That was the "old way" to set them to inifity which was the intent. This switches that from `0` to `Float.MAX_VALUE` which is the "new way" to set the `requestsPerSecond` to infinity. I don't know that this is much better, but it feels better.
2017-06-19Keystore CLI should use the AddFileKeyStoreCommand for files (#25298)Jay Modi
This commit fixes a typo in the KeyStoreCli class. The add-file command was incorrectly set to use the AddStringKeyStoreCommand instead of the AddFileKeyStoreCommand.
2017-06-19Simplify IndexShard indexing and deletion methods (#25249)Yannick Welsch
Indexing or deleting documents through the IndexShard interface is quite complex and error-prone. It requires multiple calls, e.g. first prepareIndexOnPrimary, then do some checks if mapping updates have occurred, then do the actual indexing using index(...) etc. Currently each consumer of the interface (local recovery, peer recovery, replication) has additional custom checks built around it to deal with mapping updates, some of which are even inconsistent. This commit aims at reducing the complexity by exposing a simpler interface on IndexShard. There are no more prepare*** methods and the mapping complexity is also hidden, but still giving callers a possibility to implement custom logic to deal with mapping updates.
2017-06-19Initialise empty lists in BaseTaskResponse constructor (#25290)David Kyle
* Initialise empty lists in BaseTaskResponse constructor * Remove little used default constructor which leaves uninitialised members
2017-06-19Remove (deprecated) support for '+' in index expressions (#25274)Luca Cavanna
Relates to #24515
2017-06-19[Test] Extend parsing checks for DocWriteResponses (#25257)Tanguy Leroux
This commit changes the parsing logic of DocWriteResponse, ReplicationResponse and GetResult so that it skips any unknown additional fields (for forward compatibility reasons). This affects the IndexResponse, UpdateResponse,DeleteResponse and GetResponse objects.
2017-06-19Simplify connection closing and cleanups in TcpTransport (#25250)Simon Willnauer
Today we maintain a map of open connections in order to close them when a low level channel gets closed or handles a failure. We also spawn a thread due to some tricky concurrency issues especially with respect to netty since they listener might be called on a transport / boss thread. Executions on those threads must not be blocking since otherwise we will likely deadlock the event processing which adds to the complexity of the concurrency model in this class. This change associates the connection with the close callback that every channel invokes once it's closed which allows us to remove the connections map. A relaxed non-blocking concurrency model in the connection close listener allows cleaning up connected nodes without blocking on any lock.
2017-06-17[Tests] Check that parsing aggregations works in a forward compatible way ↵Christoph Büscher
(#25219) This change adds tests for the aggregation parsing that try to simulate that we can parse existing aggregations in a forward compatible way in the future, ignoring potential newly added fields or substructures to the xContent response.
2017-06-16Move TransportStats accounting into TcpTransport (#25251)Simon Willnauer
Today TcpTransport is the de-facto base-class for transport implementations. The need for all the callbacks we have in TransportServiceAdaptor are not necessary anymore since we can simply have the logic inside the base class itself. This change moves the stats metrics directly into TcpTransport removing the need for low level bytes send / received callbacks.
2017-06-16Move pre-configured "keyword" tokenizer to the analysis-common module (#24863)Nik Everett
Moves the keyword tokenizer to the analysis-common module. The keyword tokenizer is special because it is used by CustomNormalizerProvider so I pulled it out into its own PR. To get the move to work I've reworked the lookup from static to one using the AnalysisRegistry. This seems safe enough. Part of #23658.
2017-06-16Delete index API to work only against concrete indices (#25268)Luca Cavanna
With #23997 we have introduced a new internal index option that allows to resolve index expressions only against concrete indices while ignoring aliases. Such index option was applied to IndicesAliasesRequest, so that the index part of alias actions would only be resolved against concrete indices. Same is done in this commit with delete index request. Deleting aliases has always been confusing as some users expect it to only remove the alias from the index (which has its own specific API). Even worse, in case of filtered aliases, deleting an alias may leave users with the expectation that only the documents that match the filter are deleted, which was never the case. To address all this confusion, delete index api works now only against concrete indices. WIldcard expressions will be only resolved against concrete index, as if aliases didn't exist. If one tries to delete against an alias, an IndexNotFoundException will be thrown regardless of whether the alias exists or not, as a concrete index with such a name doesn't exist. Closes #2318
2017-06-16Introduce translog size and age based retention policies (#25147)Boaz Leskes
This PR extends the TranslogDeletionPolicy to allow keeping the translog files longer than what is needed for recovery from lucene. Specifically, we allow specifying the total size of the files and their maximum age (i.e., keep up to 512MB but no longer than 12 hours). This will allow making ops based recoveries more common. Note that the default size and age still set to 0, maintaining current behavior. This is needed as the other components in the system are not yet ready for a longer translog retention. I will adapt those in follow up PRs. Relates to #10708
2017-06-15Improves snapshot logging and snapshoth deletion error handling (#25264)Ali Beyad
This commit does two things: 1. Adds logging at the DEBUG level for when the index-N blob is updated. 2. When attempting to delete a snapshot, if the snapshot was not found in the repository data, an exception is now thrown instead of silently ignoring the lack of presence of the snapshot in the repository data.
2017-06-15Deprecate tribe serviceGuillaume Le Floch
This commit deprecates the tribe service so that deprecation log messages are delivered if a tribe node is configured. Relates #24598
2017-06-15Moved more token filters to analysis-common module.Martijn van Groningen
The following token filters were moved: `edge_ngram`, `ngram`, `uppercase`, `lowercase`, `length`, `flatten_graph` and `unique`. Relates to #23658
2017-06-15test: Ported more OldIndexBackwardsCompatibilityIT tests to full cluster ↵Martijn van Groningen
restart qa tests. (#25173) Relates to #24939
2017-06-15Allow reader wrappers to have different live docs but the same cache key.Adrien Grand
Relates to #19856
2017-06-15Use SPI in High Level Rest Client to load XContent parsers (#25098)Tanguy Leroux
This commit adds a NamedXContentProvider interface that can be implemented by plugins or modules using Java's SPI feature in order to provide additional NamedXContent parsers to external applications like the Java High Level Rest Client.
2017-06-15Speed up PK lookups at index time. (#19856)Adrien Grand
At index time Elasticsearch needs to look up the version associated with the `_id` of the document that is being indexed, which is often the bottleneck for indexing. While reviewing the output of the `jfr` telemetry from a Rally benchmark, I saw that significant time was spent in `ConcurrentHashMap#get` and `ThreadLocal#get`. The reason is that we cache lookup objects per thread and segment, and for every indexed document, we first need to look up the cache associated with this segment (`ConcurrentHashMap#get`) and then get a state that is local to the current thread (`ThreadLocal#get`). So if you are indexing N documents per second and have S segments, both these methods will be called N*S times per second. This commit changes version lookup to use a cache per index reader rather than per segment. While this makes cache entries live for less long, we now only need to do one call to `ConcurrentHashMap#get` and `ThreadLocal#get` per indexed document.
2017-06-15Upgrade to lucene-7.0.0-snapshot-92b1783. (#25222)Adrien Grand
This snapshot has faster range queries on range fields (LUCENE-7828), more accurate norms (LUCENE-7730) and the ability to use fake term frequencies (LUCENE-7854).
2017-06-14Scripting: Rename SearchScript.needsScores to needs_score (#25235)Ryan Ernst
This commit renames the needsScores method so as to make it automatically generatable, based on the name of the `_score` variable which is available in search scripts. It also adds documentation to ScriptContext to explain the naming and signature of such methods.
2017-06-15FastVectorHighlighter should not cache the field query globally (#25197)Jim Ferenczi
This commit removes the global caching of the field query and replaces it with a caching per field. Each field can use a different `highlight_query` and the rewriting of some queries (prefix, automaton, ...) depends on the targeted field so the query used for highlighting must be unique per field. There might be a small performance penalty when highlighting multiple fields since the query needs to be rewritten once per highlighted field with this change. Fixes #25171
2017-06-14Remove QUERY_AND_FETCH BWC for pre-5.3.0 nodes (#25223)Lee Hinman
* Remove QUERY_AND_FETCH BWC for pre-5.3.0 nodes This was a BWC layer where we expicitly set the `search_type` to "query_and_fetch" when a single node is queried on pre-5.3 nodes. Since 6.0 no longer needs to be compatible with 5.3 nodes, this can be removed. * Fix indentation * Remove unused QUERY_FETCH_ACTION_NAME constant
2017-06-14Add more missing AggregationBuilder getters (#25198)Zachary Tong
* Add more missing AggregationBuilder getters - getMetadata for all aggs - various getters on TermsAggBuilder (without "get" prefix to maintain convention) - Also makes InternalSum's ctor public, to follow suit of other metrics (min/max/avg/etc)
2017-06-14Refactor TransportShardBulkAction.executeUpdateRequest and add testsLee Hinman
This splits `executeUpdateRequest` into separate parts and adds some unit tests for the behavior in it. The actual behavior has not been changed.
2017-06-14Make sure range queries are correctly profiled. (#25108)Adrien Grand
We introduced a new API for ranges in order to be able to decide whether points or doc values would be more appropriate to execute a query, but since `ProfileWeight` does not implement this API, the optimization is disabled when profiling is enabled.
2017-06-14Remove PrefixAnalyzer, because it is no longer used.Martijn van Groningen
2017-06-13Internal: Remove Strings.cleanPath (#25209)Ryan Ernst
This commit removes the cleanPath method, in favor of using java's Path.normalize().
2017-06-13Add Cross Cluster Search support for scroll searches (#25094)Simon Willnauer
To complete the cross cluster search capabilities for all search types and function this change adds cross cluster search support for scroll searches.
2017-06-13Rollover max docs should only count primaries (#24977)Sergey Galkin
max_doc condition for index rollover should use document count only from primary shards Fixes #24217
2017-06-13Add remote cluster infrastructure to fetch discovery nodes. (#25123)Simon Willnauer
In order to add scroll support for cross cluster search we need to resolve the nodes encoded in the scroll ID to send requests to the corresponding nodes. This change adds the low level connection infrastructure that also ensures that connections are re-established if the cluster is disconnected due to a network failure or restarts. Relates to #25094
2017-06-13Ensure pending transport handlers are invoked for all channel failures (#25150)Simon Willnauer
Today if a channel gets closed due to a disconnect we notify the response handler that the connection is closed and the node is disconnected. Unfortunately this is not a complete solution since it only works for published connections. Connections that are unpublished ie. for discovery can indefinitely hang since we never invoke their handers when we get a failure while a user is waiting for the response. This change adds connection tracking to TcpTransport that ensures we are notifying the corresponding connection if there is a failure on a channel.
2017-06-12Tweak AggregatorBase.addRequestCircuitBreakerBytesLee Hinman
This modifies a method Mark added to the AggregatorBase that allows aggregations to add additional memory tracking for datastructures used during execution. If an aggregation would like to reclaim circuit breaker reserved bytes by adding a negative number, `addWithoutBreaking` should be used instead of `addEstimateBytesAndMaybeBreak`. Resolves #24511
2017-06-12Explicitly reject duplicate data pathsJason Tedor
Duplicate data paths already fail to work because we would attempt to take out a node lock on the directory a second time which will fail after the first lock attempt succeeds. However, how this failure manifests is not apparent at all and is quite difficult to debug. Instead, we should explicitly reject duplicate data paths to make the failure cause more obvious. Relates #25178
2017-06-12Do not swallow node lock failed exceptionJason Tedor
When attempting to obtain the node lock, if an exception is thrown it is not logged. This makes debugging difficult. This commit causes such an exception to be logged. Relates #25176
2017-06-12Aggregations bug: Significant_text fails on arrays of text. (#25030)markharwood
* Aggregations bug: Significant_text fails on arrays of text. The set of previously-seen tokens in a doc was allocated per-JSON-field string value rather than once per JSON document meaning the number of docs containing a term could be over-counted leading to exceptions from the checks in significance heuristics. Added unit test for this scenario Closes #25029
2017-06-12Speed up sorted scroll when the index sort matches the search sort (#25138)Jim Ferenczi
Sorted scroll search can use early termination when the index sort matches the scroll search sort. The optimization can be done after the first query (which still needs to collect all documents) by applying a query that only matches documents that are greater than the last doc retrieved in the previous request. Since the index is sorted, retrieving the list of documents that are greater than the last doc only requires a binary search on each segment. This change introduces this new query called `SortedSearchAfterDocQuery` and apply it when possible. Scrolls with this optimization will search all documents on the first request and then will early terminate each segment after $size doc for any subsequent requests. Relates #6720