summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch
AgeCommit message (Collapse)Author
2017-07-03[Test] Use a common testing class for all XContent filtering tests (#25491)Tanguy Leroux
We have two ways to filter XContent: - The first method is to parse the XContent as a map and use XContentMapValues.filter(). This method filters the content of the map using an automaton. It is used for source filtering, both at search and indexing time. It performs well but can generate a lot of objects and garbage collections when large XContent are filtered. It also returns empty objects (see f2710c16ebd918f646be9d0ab64b4871c25be4c2) when all the sub fields have been filtered out and handle dots in field names as if they were sub fields. - The second method is to parse the XContent and copy the XContentParser structure to a XContentBuilder initialized with includes/excludes filters. This method uses the Jackson streaming filter feature. It is used by the Response Filtering ('filter_path') feature. It does not generate a lot of objects, and does not return empty objects and also does not handle dots in field names explicitely. Both methods have similar goals but different tests. This commit changes the current XContentBuilder test class so that it becomes a more generic testing class and we can now ensure that filtering methods generate the same results. It also removes some tests from the XContentMapValuesTests class that should be in XContentParserTests.
2017-07-03Tests fix - Significant terms/text aggs (#25499)markharwood
The significance aggs return Lucene index-level statistics that when merged are assumed to be from different shards. The Aggregator unit tests assume segments can be treated as shards and thus break the significance stats and introduce double-counting of background doc frequencies. This change addresses this problem by ensuring test indexes have only one shard. Closes #25429
2017-07-02[TEST] Expect nodes getting disconnected quicklySimon Willnauer
If all nodes get disconnected before we can send the request we might try to reconnect and that will fail with an ISE instead of the a transport exception. Closes #25301
2017-07-02testPrimaryFailureIncreasesTerm should use assertBusy to wait for yellowBoaz Leskes
ensureYellow ensures at least yellow. Also, since we only have 1 replica, we don't need to index for it to know about the primary term promotion Closes #25287
2017-07-02Cleanup network / transport related settings (#25489)Simon Willnauer
This commit makes the use of the global network settings explicit instead of implicit within NetworkService. It cleans up several places where we fall back to the global settings while we should have used tcp or http ones. In addition this change also removes unnecessary settings classes
2017-07-01Remove allocation id from replica replication response (#25488)Yannick Welsch
The replica replication response object has an extra allocationId field that contains the allocation id of the replica on which the request was executed. As we are sending the allocation id with the actual replica replication request, and check when executing the replica replication action that the allocation id of the replica shard is what we expect, there is no need to communicate back the allocation id as part of the response object.
2017-06-30Adjust status on bad allocation explain requestsJason Tedor
When a user requests a cluster allocation explain in a situation where it does not make sense (for example, there are no unassigned shards), we should consider this a bad request instead of a server error. Yet, today by throwing an illegal state exception, these are treated as server errors. This commit adjusts these so that they throw illegal argument exceptions and are treated as bad requests. Relates #25503
2017-06-30Add additional test for sequence-number recoveryJason Tedor
This commit adds a test for a scenario where a replica receives an extra document that the promoted replica does not receive, misses the primary/replica re-sync, and the recovers from the newly-promoted primary. Relates #25493
2017-06-30WrapperQueryBuilder should also rewrite the parsed query.Martijn van Groningen
Failing to do so can cause other errors later on during query execution. For example if `WrapperQueryBuilder` wraps a `GeoShapeQueryBuilder` that fetches the shape from an index then it will skip the shape fetching and fail later with the error that no shapes have been fetched.
2017-06-29Use LRU set to reduce repeat deprecation messagesJason Tedor
This commit adds an LRU set to used to determine if a keyed deprecation message should be written to the deprecation logs, or only added to the response headers on the thread context. Relates #25474
2017-06-29Fix Java 9 compilation issueChristoph Büscher
My IDE ate a cast that seems required to make Java 9 happy.
2017-06-29Remove QueryParseContext from parsing QueryBuilders (#25448)Christoph Büscher
Currently QueryParseContext is only a thin wrapper around an XContentParser that adds little functionality of its own. I provides helpers for long deprecated field names which can be removed and two helper methods that can be made static and moved to other classes. This is a first step in helping to remove QueryParseContext entirely.
2017-06-29Promote replica on the highest version node (#25277)Lee Hinman
* Promote replica on the highest version node This changes the replica selection to prefer to return replicas on the highest version when choosing a replacement to promote when the primary shard fails. Consider this situation: - A replica on a 5.6 node - Another replica on a 6.0 node - The primary on a 6.0 node The primary shard is sending sequence numbers to the replica on the 6.0 node and skipping sending them for the 5.6 node. Now assume that the primary shard fails and (prior to this change) the replica on 5.6 node gets promoted to primary, it now has no knowledge of sequence numbers and the replica on the 6.0 node will be expecting sequence numbers but will never receive them. Relates to #10708 * Switch from map of node to version to retrieving the version from the node * Remove uneeded null check * You can pretend you're a functional language Java, but you're not fooling me. * Randomize node versions * Add test with random cluster state with multiple versions that fails shards * Re-add comment and remove extra import * Remove unneeded stuff, randomly start replicas a few more times * Move test into FailedNodeRoutingTests * Make assertions actually test replica version promotion * Rewrite test, taking Yannick's feedback into account
2017-06-29Unify the result interfaces from get and search in Java client (#25361)olcbean
As GetField and SearchHitField have the same members, they have been unified into DocumentField. Closes #16440
2017-06-28Emit settings deprecation logging at most onceJason Tedor
When a setting is deprecated, if that setting is used repeatedly we currently emit a deprecation warning every time the setting is used. In cases like hitting settings endpoints over and over against a node with a lot of deprecated settings, this can lead to excessive deprecation warnings which can crush a node. This commit ensures that a given setting only sees deprecation logging at most once. Relates #25457
2017-06-28Fix race condition in RemoteClusterConnection node supplier (#25432)Jay Modi
This commit fixes a race condition in the node supplier used by the RemoteClusterConnection. The node supplier stores an iterator over a set backed by a ConcurrentHashMap, but the get operation of the supplier uses multiple methods of the iterator and is suceptible to a race between the calls to hasNext() and next(). The test in this commit fails under the old implementation with a NoSuchElementException. This commit adds a wrapper object over a set and a iterator, with all methods being synchronized to avoid races. Modifications to the set result in the iterator being set to null and the next retrieval creates a new iterator.
2017-06-28_nodes/stats should not fail due to concurrent AlreadyClosedException (#25016)Chris Earle
This catches `AlreadyClosedException` during `stats` calls to avoid failing a `_nodes/stats` request because of the ignorable, concurrent index closure.
2017-06-28Use a single method to update shard stateYannick Welsch
This commit refactors index shard to provide a single method for updating the shard state on an incoming cluster state update. Relates #25431
2017-06-28Disallow multiple concurrent recovery attempts for same target shard (#25428)Yannick Welsch
The primary shard uses the GlobalCheckPointTracker to track local checkpoint information of recovering and started replicas in order to calculate the global checkpoint. As the tracker is updated through recoveries as well, it is easier to reason about the tracker if we can ensure that there are no concurrent recovery attempts for the same target shard (which can happen in case of network disconnects).
2017-06-28Update global checkpoint when increasing primary term on replica (#25422)Yannick Welsch
When a replica shard increases its primary term under the mandate of a new primary, it should also update its global checkpoint; this gives us the guarantee that its global checkpoint is at least as high as the new primary and gives a starting point for the primary/replica resync. Relates to #25355, #10708
2017-06-27Add missing newline at end of SetsTests.javaJason Tedor
This commit adds a missing newline to the end of SetsTests.java after the closing curly brace.
2017-06-27correct expected thrown exception in mappingMetaData to ↵Tal Levy
ElasticsearchParseException (#25410)
2017-06-27Add Javadocs and tests for set difference methodsJason Tedor
This commit adds Javadocs and tests for some set difference utility methods in core.
2017-06-27Tests: Add parsing test for AggregationsTests (#25396)Christoph Büscher
We already have these tests in InternalAggregationTestCase to check random insertions into the response xContent so that we don't fail on future changes in the response format. This change adds the same to AggregationsTests and runs on a whole aggregations tree. Unfortunately we need to exclude many places in the xContent from random insertion, but I added a long comment trying to explaine those.
2017-06-27Mute SignificantTermsAggregatorTests#testSignificance()Daniel Mitterdorfer
Relates #25429
2017-06-27Mute FullRollingRestartIT#testFullRollingRestart()Daniel Mitterdorfer
Relates #25420
2017-06-27Mute IndexShardTests#testRelocatedShardCanNotBeRevivedConcurrentlyDaniel Mitterdorfer
2017-06-26Mark shutdown non-master nodes test as awaits fixJason Tedor
This commit marks a failing test as awaits fix. The test is failing due to a primary shard not knowing its own local checkpoint in the global checkpoint tracker after recovery. If such a shard becomes primary after promotion, and is then subsequently relocated, it can lead to a violation of an assertion that when the primary context is transferred the knowledge of all in-sync local checkpoints is consistent with the global checkpoint on the relocation target. Relates #25415
2017-06-26Remove default path settingsJason Tedor
This commit removes the default path settings for data and logs. With this change, we now ship the packages with these settings set in the elasticsearch.yml configuration file rather than going through the default.path.data and default.path.logs dance that we went through in the past. Relates #25408
2017-06-26Make plugin loading stricterJason Tedor
Today we load plugins reflectively, looking for constructors that conform to specific signatures. This commit tightens the reflective operations here, not allowing plugins to have ambiguous constructors. Relates #25405
2017-06-26Remove path.conf settingJason Tedor
This commit removes path.conf as a valid setting and replaces it with a command-line flag for specifying a non-default path for configuration. Relates #25392
2017-06-26Fix primary context sealing testJason Tedor
This commit updates some assertions in the primary context sealing test after the restriction on updating allocation IDs from master and updating global checkpoint on replica while sealed were removed.
2017-06-26Introduce primary context (#25122)Jason Tedor
* Introduce primary context The target of a primary relocation is not aware of the state of the replication group. In particular, it is not tracking in-sync and initializing shards and their checkpoints. This means that after the target shard is started, its knowledge of the replication group could differ from that of the relocation source. In particular, this differing view can lead to it computing a global checkpoint that moves backwards after it becomes aware of the state of the entire replication group. This commit addresses this issue by transferring a primary context during relocation handoff. * Fix test * Add assertion messages * Javadocs * Barrier between marking a shard in sync and relocating * Fix misplaced call * Paranoia * Better latch countdown * Catch any exception * Fix comment * Fix wait for cluster state relocation test * Update knowledge via upate local checkpoint API * toString * Visibility * Refactor permit * Push down * Imports * Docs * Fix compilation * Remove assertion * Fix compilation * Remove context wrapper * Move PrimaryContext to new package * Piping for cluster state version This commit adds piping for the cluster state version to the global checkpoint tracker. We do not use it yet. * Remove unused import * Implement versioning in tracker * Fix test * Unneeded public * Imports * Promote on our own * Add tests * Import * Newline * Update comment * Serialization * Assertion message * Update stale comment * Remove newline * Less verbose * Remove redundant assertion * Tracking -> in-sync * Assertions * Just say no Friends do not let friends block the cluster state update thread on network operations. * Extra newline * Add allocation ID to assertion * Rename method * Another rename * Introduce sealing * Sealing tests * One more assertion * Fix imports * Safer sealing * Remove check * Remove another sealed check
2017-06-26Tests: Fix array out of bounds exception in TemplateUpgradeServiceITIgor Motov
2017-06-26Move more token filters to analysis-common moduleMartijn van Groningen
The following token filters were moved: stemmer, stemmer_override, kstem, dictionary_decompounder, hyphenation_decompounder, reverse, elision and truncate. Relates to #23658
2017-06-25Remove remaining `index.mapper.single_type` setting usage from tests (#25388)Simon Willnauer
This change removes the remaining explicitly specified `index.mapper.single_type` settings from tests in order to allow the removal of the setting. This is the already approved part of #25375 broken out to simplfiy reviews on
2017-06-23Tests: Improve stability and logging of TemplateUpgradeServiceIT tests (#25386)Igor Motov
Relates to #25382
2017-06-23Added unit test coverage for SignificantTerms (#24904)markharwood
Added unit test coverage for GlobalOrdinalsSignificantTermsAggregator, GlobalOrdinalsSignificantTermsAggregator.WithHash, SignificantLongTermsAggregator and SignificantStringTermsAggregator. Removed integration test. Relates #22278
2017-06-23testCreateShrinkIndex: removed left over debugging log line that violated ↵Boaz Leskes
linting
2017-06-23testCreateShrinkIndex should make sure to use the right source stats when ↵Boaz Leskes
testing shrunk target
2017-06-23[Test] Add unit test for XContentParserUtilsTests.parseStoredFieldsValue ↵Tanguy Leroux
(#25288)
2017-06-23Remove remaining `index.mapping.single_type=false` (#25369)Simon Willnauer
This change cleans up remaining tests to not use index.mapping.single_type=false but instead where applicable use a single type or markt the index as created with a pre 6.x version. Yet, there is still on leftover in the client tests that needs special attention. See `org.elasticsearch.client.SearchIT` Relates to #24961
2017-06-23test: Replace OldIndexBackwardsCompatibilityIT#testOldClusterStates with a ↵Martijn van Groningen
full cluster restart qa test OldIndexBackwardsCompatibilityIT#testOldClusterStates tested whether global and index metadata could be read from data directory, this can also be tested in full cluster qa test that checks cluster state via api. Relates to #24939
2017-06-22ESIndexLevelReplicationTestCase.ReplicationAction#execute should send ↵Boaz Leskes
exceptions to it's listener rather than bubble them up This is how TRA works as well.
2017-06-22testRecoveryAfterPrimaryPromotion shouldn't flush the replica with extra ↵Boaz Leskes
operations We don't yet have lucene rollbacks, so we can't bake those in
2017-06-22Ensure `InternalEngineTests.testConcurrentWritesAndCommits` doesn't pile up ↵Simon Willnauer
commits (#25367) `InternalEngineTests.testConcurrentWritesAndCommits` can be very heavy on disks if threads are slow and the main thread keeps on pulling commit points holding on to many many segments. This commit adds some quadratic backoff to not pile up too many commits and to make sure indexing threads can make progress. This also now doesn't do busy waiting but waits on a latch with a timeout. Closes #25110
2017-06-22[TEST] Add debug logging if an unexpected exception is thrownSimon Willnauer
2017-06-22TemplateUpgraders should be called during rolling restart (#25263)Igor Motov
In #24379 we added ability to upgrade templates on full cluster startup. This PR invokes the same update procedure also when a new node first joins the cluster allowing to update templates on a rolling cluster restart as well. Closes #24680
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