Commit Graph

29733 Commits

Author SHA1 Message Date
Nhat Nguyen 6629f4ab0d
Rollback primary before recovering from translog (#27804)
Today we always recover a primary from the last commit point. However 
with a new deletion policy, we keep multiple commit points in the
existing store, thus we have chance to find a good starting commit
point. With a good starting commit point, we may be able to throw away
stale operations. This PR rollbacks a primary to a starting commit then
recovering from translog.

Relates #10708
2017-12-22 18:25:36 -05:00
Boaz Leskes adb49efe17
Non-peer recovery should set the global checkpoint (#27965)
Non-Peer recoveries should restore the global checkpoint rather than wait for the activation of the primary. This brings us a step closer to a universe where a recovered shard always has a valid global checkpoint. Concretely:

1) Recovery from store can read the checkpoint from the translog
2) Recovery from local shards and snapshots can set the global checkpoint to the local checkpoint as this is the only copy of the shard.
3) Recovery of an empty shard can set it to `NO_OPS_PERFORMED`

Peer recoveries will follow but require more work and thus will have their own PR.

I also used the moment to clean up `IndexShard`'s api around starting the engine and doing recovery from the translog. The current naming are a relic of the past and don't align with the current naming schemes in the engine.
2017-12-22 21:39:12 +01:00
Nhat Nguyen 6435928c4f Remove no existing commits assertion in onInit()
This assertion does not hold if a shard is recovered from an empty store
but failed then retries. Moreover, if the openMode is CREATE_INDEX_*, we
pass CREATE mode to the IndexWriterConfig to create a new index and
overwrite the existing one.

Closes #27960
2017-12-22 15:04:16 -05:00
Ryan Ernst 0375d887f2
Plugins: Add validation to plugin descriptor parsing (#27951)
This commit checks there are no leftover unparsed elements when parsing
a plugin descriptor.
2017-12-22 10:02:11 -08:00
Jason Tedor 0423155fc6
Also skip Javadoc task for client JARs on JDK 10
We disabled the Javadoc task on JDK 10 due to an apparent bug in Javadoc
generation on JDK 10. However, the client JAR task sets up its own
Javadoc task for client JARs (because it merely copies the non-client
Javadoc JAR). This commit diables that task too, since the Javadocs for
the non-client JAR will not exist.

Relates #27962
2017-12-22 07:34:00 -05:00
Tanguy Leroux bd9daf422e
Do not start snapshots that are deleted during initialization (#27931)
When a new snapshot is created it is added to the cluster state as a
snapshot-in-progress in INIT state, and the initialization is kicked
off in a new runnable task by SnapshotService.beginSnapshot(). The
initialization writes multiple files before updating the cluster state
to change the snapshot-in-progress to STARTED state. This leaves a
short window in which the snapshot could be deleted (let's say, because
the snapshot is stuck in INIT or because it takes too much time to
upload all the initialization files for all snapshotted indices). If
the INIT snapshot is deleted, the snapshot-in-progress becomes ABORTED
but once the initialization in SnapshotService.beginSnapshot() finished
it is change back to STARTED state again.

This commit avoids an ABORTED snapshot to be started if it has been
deleted during initialization. It also adds a test that would have failed
with the previous behavior, and changes few method names here and there.
2017-12-22 12:59:36 +01:00
Alexander Reelsen 012ea03f54
Tests: Fix packaging tests after attachment plugin upgrade (#27959)
The tests explicitely check for the version of some java dependencies
and thus needed to be fixed.

Relates #27824

Closes #27916
2017-12-22 12:16:17 +01:00
Tanguy Leroux 098f82f086
[Test] Do not rely on MockZenPing for Azure tests (#27945)
This commit changes some Azure tests so that they do not rely on
MockZenPing and TestZenDiscovery anymore, but instead use a mocked
AzureComputeService that exposes internal test cluster nodes as if
they were real Azure nodes.

Related to #27859

Closes #27917, #11533
2017-12-22 09:58:02 +01:00
Jason Tedor d4f914be2a
Disable Javadocs on JDK 10
There appears to be a bug in JDK 10 for generating Javadocs with some
nested anonymous classes. This commit disables these on JDK 10 until the
upstream issue is resolved.

Relates #27952
2017-12-21 17:26:20 -05:00
Ryan Ernst da703a7383
Tests: Update plugin info unit tests to use expectThrows (#27953) 2017-12-21 14:23:40 -08:00
Nhat Nguyen 7e3dc122fd Revert "Mute testRetentionPolicyChangeDuringRecovery"
This test is fixed by https://github.com/elastic/elasticsearch/pull/27947
This reverts commit cba80f3972d76f655a1a048aab1121b56f2b3a56.
2017-12-21 16:58:07 -05:00
Nhat Nguyen c831442352
Persist global checkpoint when finalizing peer recovery (#27947)
Today we don't persist the global checkpoint when finishing a peer 
recovery even though we advance an in memory value. This commit persists
the global checkpoint in RecoveryTarget#finalizeRecovery.

Closes #27861
2017-12-21 16:51:30 -05:00
Jim Ferenczi e5f0852d5f
Remove unused search plugin extension (#27943)
Search response listeners should not be exposed in search plugin.
Support was added but reverted right after (not present in any release).
Though the SearchPlugin still contains a default definition for search response listeners
due to a broken revert. This change removes this extension point that is basically no-op.
2017-12-21 22:15:55 +01:00
olcbean 7f2f59eb85 delete `operation_threading` from the rest specs (#27940) 2017-12-21 13:09:11 -08:00
Martijn van Groningen a54798354b
simplify methods 2017-12-21 19:42:32 +01:00
Martijn van Groningen 791c5ddd7e
aggs: Add a method that is invoked before the `getLeafCollector(...)` of children aggregators is invoked.
In the case of nested aggregator this allows it to push down buffered child docs down to children aggregator.
Before this was done as part of the `NestedAggregator#getLeafCollector(...)`, but by then the children aggregators
have already moved on to the next segment and this causes incorrect results to be produced.

Closes #27912
2017-12-21 19:28:28 +01:00
Mayya Sharipova cbd271e497
Limit the analyzed text for highlighting (#27934)
* Limit the analyzed text for highlighting

- Introduce index level settings to control the max number of character
to be analyzed for highlighting
- Throw an error if analysis is required on a larger text

Closes #27517
2017-12-21 10:19:58 -05:00
Colin Goodheart-Smithe d63b1efb14
Splits nio project into two for eclipse build only (#27939)
* Splits nio project into two for eclipse build only

https://github.com/elastic/elasticsearch/pull/27801 introduced a new gradle project `:libs:elasticsearch-nio` which creates cyclical project dependencies when importingthe projects into Eclipse.

This change applies the same trick as we have for the core project where, and building for Eclipse, splits the `:libs:elasticsearch-nio` project into `:libs:elasticsearch-nio` which points to `src/main` and `:libs:elasticsearch-nio-tests` which points to `src/test`. This prevents cyclical project dependencies in Eclipse arising from the fact that eclipse does not separate compile/runtime dependencies from test dependencies.

* Removes integTest bits since there are none
2017-12-21 14:34:15 +00:00
Jim Ferenczi c753b82ca8 Adapt scroll rest test after backport. relates #27842 2017-12-21 09:31:56 +01:00
Jim Ferenczi 5ac5fd95ae
Move early termination based on index sort to TopDocs collector (#27666)
Lucene TopDocs collector are now able to early terminate the collection
based on the index sort. This change plugs this new functionality directly in the
query phase instead of relying on a dedicated early terminating collector.
2017-12-21 08:57:06 +01:00
Adrien Grand 7d88851766
Upgrade beats templates that we use for bwc testing. (#27929)
These templates were generated with 5.0. We need those generated with 6.0 since
we do not guarantee compatibility with previous versions of the template anyway.

I removed the winlogbeat template which is a bit harder to generate as it requires
Windows, since we do not aim to be exhaustive.
2017-12-21 08:50:14 +01:00
Martijn van Groningen 90ee35930a
ingest: upgraded ingest geoip's geoip2's dependencies. 2017-12-21 08:43:02 +01:00
Andy Bristol 863432668b [TEST] logging for update by query test #27820 2017-12-20 18:27:16 -05:00
Tim Brooks 06b313025c
Add elasticsearch-nio jar for base nio classes (#27801)
This is related to #27802. This commit adds a jar called
elasticsearch-nio that contains the base nio classes that will be used
for the tcp nio transport and eventually the http nio transport.

The jar does not depend on elasticsearch:core, so all references to core
have been removed.
2017-12-20 16:29:16 -06:00
Jason Tedor 8bd7a19d61
Use full profile on JDK 10 builds
JDK 10 has gone fully-modular. This means that:
 - when targeting JDK 8 with a JDK 10 compiler, we have to use the full
   profile
 - when targeting JDK 10 with a JDK 10 compiler, we have to use
   -add-modules java.base

Today we only target JDK 8 (our minimum compatibility version) so we
need to change the compiler flags conditional on using a JDK 10
compiler. This commit does that.

Relates #27884
2017-12-20 16:22:21 -05:00
Jason Tedor c8371fa0b4
Require Gradle 4.3
This commit sets the minimum Gradle version to version 4.3. This the
minimum Gradle version that understands JDK 10 in code.

Relates #27885
2017-12-20 16:14:19 -05:00
Sian Lerk Lau 47eefbe889 Enable grok processor to support long, double and boolean (#27896) 2017-12-20 11:19:49 -08:00
Maxime Gréau d9fff6d8f2 Add unreleased v6.1.2 version 2017-12-20 19:51:29 +01:00
Nhat Nguyen 3c865d6d04 TEST: reduce blob size #testExecuteMultipartUpload
If a large blob size and small buffer size are picked, this test causes out of memory.

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+intake/1061/
2017-12-20 12:43:05 -05:00
Nhat Nguyen 54b6885844
Check index under the store metadata lock (#27768)
Today when we get a metadata snapshot directly from a store directory, 
we acquire a metadata lock, then acquire an IndexWriter lock. However,
we create a CheckIndex in IndexShard without acquiring the metadata lock 
first. This causes a recovery failed because the IndexWriter lock can be
still held by method snapshotStoreMetadata. This commit makes sure to
create a CheckIndex under the metadata lock.

Closes #24481
Closes #27731
Relates #24787
2017-12-20 11:26:06 -05:00
Colin Goodheart-Smithe 4cbbe3ed93
Fixes DocStats to not report index size < -1 (#27863)
Previously to this change when DocStats are added together (for example when adding the index size of all primary shards for an index)  we naively added the `totalSizeInBytes` together. This worked most of the time but not when the index size on one or multiple shards was reported to be `-1` (no value).

This change improves the logic by considering if the current value or the value to be added is `-1`:
* If the current and new value are both `-1` the value remains at `-1`
* If the current value is `-1` and the new value is not `-1`, current value is changed to be equal to the new value
* If the current value is not `-1` and the new value is `-1` the new value is ignored and the current value is not changed
* If both the current and new values are not `-1` the current value is changed to be equal to the sum of the current and new values.

The change also re-enables the failing rollover YAML test that was failing due to this bug.
2017-12-20 14:45:09 +00:00
Martijn van Groningen dd0cb11d53
Fixed test to be up to date with the new database files. 2017-12-20 14:41:41 +01:00
Adrien Grand 77711508b0
Upgrade to Lucene 7.2.0. (#27910) 2017-12-20 14:17:40 +01:00
Boaz Leskes 0ca141880f Disable TestZenDiscovery in cloud providers integrations test
TestZenDiscovery is used to allow discovery based on in memory structures. This isn't a relevant for the cloud providers tests (but isn't a problem at the moment either)
2017-12-20 14:02:55 +01:00
Simon Willnauer 5b229c31d6
Use `_refresh` to shrink the version map on inactivity (#27918)
We used to shrink the version map under an external lock. This is
quite ambigious and instead we can simply issue an empty refresh to
shrink it.

Closes #27852
2017-12-20 13:53:41 +01:00
Simon Willnauer c4fae375b0
Make KeyedLock reentrant (#27920)
Today we prevent that the same thread acquires the same lock more than once.
This restriction is a relict form the early days of this concurrency construct
and can be removed.
2017-12-20 13:53:03 +01:00
Martijn van Groningen 4585cc8312
ingest: Upgraded the geolite2 databases. 2017-12-20 10:42:46 +01:00
Tanguy Leroux 0f80e7c5f6
[Test] Fix IndicesClientDocumentationIT (#27899)
The last operation executed in IndicesClientDocumentationIT.testCreate()
 is an asynchronous index creation. Because nothing waits for its
 completion, on slow machines the index can sometimes be created after
 the testCreate() test is finished, and it can fail the following test.

 Closes #27754
2017-12-20 09:31:10 +01:00
Simon Willnauer 0779af6dd2
Move uid lock into LiveVersionMap (#27905)
While the LiveVersionMap is an internal class that belongs to the engine we do
rely on some external locking to enforce the desired semantics.  Yet, in tests
we mimic the outer locking but we don't have any way to enforce or assert on
that the lock is actually hold.  This change moves the KeyedLock inside the
LiveVersionMap that allows the engine to access it as before but enables
assertions in the LiveVersionMap to ensure the lock for the modifying or
reading key is actually hold.
2017-12-20 08:34:58 +01:00
Jason Tedor 8b2eee39f0 Increase Gradle heap space to 1536m
This commit increases the heap space for the Gradle processes to
1536m. Note that the default is 1024m.
2017-12-19 21:45:43 -05:00
Stuart Cam e458c6b762
timestamp and ttl in index requests (#27888)
timestamp and ttl are not accepted anymore as parameters of index/update requests.
2017-12-20 10:43:21 +11:00
Christoph Büscher 05aa1a6033 [Tests] Remove redudant rest test added in #27900
The removed rest test doesn't really test the the issue
reported in #27841 and adds nothing on top of the unit test.
2017-12-19 20:04:37 +01:00
Christoph Büscher fb2fd4e8ee
Fix preserving FiltersAggregationBuilder#keyed field on rewrite (#27900)
Currently FiltersAggregationBuilder#doRewrite creates a new FiltersAggregationBuilder which doesn't correctly copy the original "keyed" field if a non-keyed filter gets rewritten.
This can cause rendering bugs of the output aggregations like the one reported in #27841.

Closes #27841
2017-12-19 19:56:12 +01:00
Tim Brooks 41677b0b9e
Default to no http read timeout (#27879)
Elasticsearch offers a number of http requests that can take a while to
execute. In #27713 we introduced an http read timeout that defaulted to
30 seconds. This means that if no reads happened for 30 seconds (even
after a request is received), the connection would be closed due to
timeout.

This commit disables the read timeout by default to allow us to evaluate
the impact of read timeouts and to avoid introducing distruptive
behavior.
2017-12-19 11:44:48 -07:00
David Pilato 3ca39186d1
Fix missing comma in examples (#27904) 2017-12-19 18:28:39 +01:00
Nhat Nguyen 0c1ac2e700 Revert "testCorruptTranslogTruncation: add logging"
We can reduce logging for this test as it's fixed in https://github.com/elastic/elasticsearch/pull/27887
This reverts commit e0e698bc26.
2017-12-19 12:13:23 -05:00
Nhat Nguyen 6b0d90b9d4
TEST: Corrupt some translog files used in recovery (#27887)
Currently, method corruptTranslogFiles corrupts some translog files
whose translog_gen are at least the min_required_translog_gen from the
translog checkpoint. However this condition is not enough for
recoverFromTranslog to be always failed.  If we corrupt only translog
operations from only translog files whose translog_gen are smaller than
the min_translog_gen of a recovering index commit, recoverFromTranslog
will be ok as we won't read translog operations from those files.

This commit makes sure corruptTranslogFiles to corrupt some translog 
files that will be used in recoverFromTranslog.

Closes #27538
2017-12-19 12:01:49 -05:00
Nhat Nguyen 25b0a7b20f Revert "Add @AwaitsFix for #27890"
This test was fixed in e9a3932dbc.

This reverts commit 1383cab267.
2017-12-19 11:27:03 -05:00
Nhat Nguyen e9a3932dbc Fix incorrectly assign local checkpoint from max_seqno
Relates #27837
2017-12-19 11:18:36 -05:00
Andrew Banchich 3b58582059 [Docs] Grammatical fix in important-settings.asciidoc (#27654) 2017-12-19 17:08:08 +01:00