Commit Graph

23798 Commits

Author SHA1 Message Date
Nik Everett e249ad8dfe Fix loggerUsageCheck after clean
The `loggerUsageCheck` can only run on directories that exist. It was
checking whether or not the directories exists before they were built
built and then deciding to do no work. But only if you are building in
a cleaned environment which CI does, but people rarely do locally.
2016-08-03 15:36:11 -04:00
Jason Tedor eb6da69e9f Explicitly tell Netty to not use unsafe
With the security permissions that we grant to Netty, Netty can not
access unsafe (because it relies on having the runtime permission
accessDeclaredMembers and the reflect permission
suppressAccessChecks). Instead, we should just explicitly tell Netty to
not use unsafe. This commit adds a flag to the default jvm.options to
tell Netty to not look for unsafe.

Relates #19786
2016-08-03 15:23:34 -04:00
Ryan Ernst c3a5e4fa48 Merge pull request #19765 from rjernst/metadata_mapper_dup
Mappings: Fix detection of metadata fields in documents
2016-08-03 11:58:24 -07:00
Ryan Ernst ef425f4b7c Merge pull request #19770 from rjernst/script_service_component
Add ScriptService to dependencies available for plugin components
2016-08-03 11:57:58 -07:00
Jason Tedor b12608a6db Merge pull request #19767 from jaymode/netty4
Enable Netty 4 extensions
2016-08-03 14:10:43 -04:00
Luca Cavanna c5a9427293 Merge pull request #19750 from javanna/fix/npe_parse_field_array
Throw ParsingException if a query is wrapped in an array
2016-08-03 18:21:39 +02:00
Mary fa3420c2a5 Update term-level-queries.asciidoc
Typo fix
2016-08-03 10:18:13 -06:00
javanna 4805250ecf Throw ParsingException if a query is wrapped in an array
Our parsing code accepted up until now queries in the following form (note that the query starts with `[`:

```
{
    "bool" : [
        {
          "must" : []
        }
    ]
}
```

This would lead to a null pointer exception as most parsers assume that the field name ("must" in this example) is the first thing that can be found in a query if its json is valid, hence always non null while parsing. Truth is that the additional array layer doesn't make the json invalid, hence the following code fragment would cause NPE within ParseField, because null gets passed to `parseContext.isDeprecatedSetting`:

```
if (token == XContentParser.Token.FIELD_NAME) {
    currentFieldName = parser.currentName();
} else if (parseContext.isDeprecatedSetting(currentFieldName)) {
    // skip
} else if (token == XContentParser.Token.START_OBJECT) {
```

We could add null checks in each of our parsers in lots of places, but we rely on `currentFieldName` being non null in all of our parsers, and we should consider it a bug when these unexpected situations are not caught explicitly. It would be best to find a way to prevent such queries altogether without changing all of our parsers.

The reason why such a query goes through is that we've been allowing a query to start with either `[` or `{`. The only reason I found is that we accept `match_all : []`. This seems like an undocumented corner case that we could drop support for. Then we can be stricter and accept only `{` as start token of a query. That way the only next token that the parser can encounter if the json is valid (otherwise the json parser would barf earlier) is actually a field_name, hence the assumption that all our parser makes hold.

The downside of this is simply dropping support for `match_all : []`

Relates to #12887
2016-08-03 17:05:14 +02:00
Nik Everett ca8f666c66 Add line number to yaml test failures
Old:
```
   > Throwable #1: java.lang.AssertionError: expected [2xx] status code but api [reindex] returned [400 Bad Request] [{"error":{"root_cause":[{"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25}],"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25,"caused_by":{"type":"illegal_argument_exception","reason":"[dest] unknown field [asdfadf], parser not found"}},"status":400}]
   >    at __randomizedtesting.SeedInfo.seed([9325F8C5C6F227DD:1B71C71F680E4A25]:0)
   >    at org.elasticsearch.test.rest.yaml.section.DoSection.execute(DoSection.java:119)
   >    at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.test(ESClientYamlSuiteTestCase.java:309)
   >    at java.lang.Thread.run(Thread.java:745)
```

New:
```
   > Throwable #1: java.lang.AssertionError: Failure at [reindex/10_basic:12]: expected [2xx] status code but api [reindex] returned [400 Bad Request] [{"error":{"root_cause":[{"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25}],"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25,"caused_by":{"type":"illegal_argument_exception","reason":"[dest] unknown field [asdfadf], parser not found"}},"status":400}]
   >    at __randomizedtesting.SeedInfo.seed([444DEEAF47322306:CC19D175E9CE4EFE]:0)
   >    at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:329)
   >    at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.test(ESClientYamlSuiteTestCase.java:309)
   >    at java.lang.Thread.run(Thread.java:745)
   > Caused by: java.lang.AssertionError: expected [2xx] status code but api [reindex] returned [400 Bad Request] [{"error":{"root_cause":[{"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25}],"type":"parsing_exception","reason":"[reindex] failed to parse field [dest]","line":1,"col":25,"caused_by":{"type":"illegal_argument_exception","reason":"[dest] unknown field [asdfadf], parser not found"}},"status":400}]
   >    at org.elasticsearch.test.rest.yaml.section.DoSection.execute(DoSection.java:119)
   >    at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:325)
   >    ... 37 more
```

Sorry for the longer stack trace, but I wanted to be sure I didn't throw
anything away by accident.
2016-08-03 10:59:57 -04:00
javanna 51bbe2c5c4 [TEST] fix log statement in ESIndexLevelReplicationTestCase 2016-08-03 16:56:19 +02:00
Nik Everett f97b1a94b8 Add 2.3.5 to packaging tests list
This should make the packaging tests happy again.
2016-08-03 10:49:49 -04:00
Ali Beyad 4f70ee521f Migration Guide changes for BlobContainer (#19731)
Adds a notice in the migration guide for removing
two deleteBlobs and one writeBlob method from the
BlobContainer interface.
2016-08-03 10:41:25 -04:00
Clinton Gormley 39081af9d6 Added version 2.3.5 with bwc indices 2016-08-03 15:50:47 +02:00
Britta Weber 5b38282fcb fix bwc index tool for versions before 5.0 (#19626)
* fix bwc index tool for versions before 5.0
2016-08-03 15:37:38 +02:00
Jason Tedor e74d02138f Merge branch 'master' into netty4
* master:
  Fix REST test documentation
  [Test] move methods from bwc test to test package for use in plugins (#19738)
  package-info.java should be in src/main only.
  Split regular histograms from date histograms. #19551
  Tighten up concurrent store metadata listing and engine writes (#19684)
  Plugins: Make NamedWriteableRegistry immutable and add extenion point for named writeables
  Add documentation for the 'elasticsearch-translog' tool
  [TEST] Increase time waiting for all shards to move off/on to a node
  Fixes the active shard count check in the case of (#19760)
  Fixes cat tasks operation in detailed mode
  ignore some docker craziness in scccomp environment checks
2016-08-03 09:16:18 -04:00
David Pilato 358ee7c272 Fix REST test documentation
To run the tests we have to use now `*Yaml*IT` instead of `RestIT`:

```sh
gradle :distribution:integ-test-zip:integTest  -Dtests.class=org.elasticsearch.test.rest.*Yaml*IT
```
2016-08-03 13:50:45 +02:00
Isabel Drost-Fromm ac3f2421b1 Merge branch 'origin/feature/rank-eval' into feature/rank-eval_index_type_to_id 2016-08-03 13:50:13 +02:00
Robert Muir ef5debc6ce Merge pull request #19754 from rmuir/docker_seccomp
ignore some docker craziness in seccomp environment checks
2016-08-03 05:50:25 -04:00
Britta Weber abcb4c8a97 [Test] move methods from bwc test to test package for use in plugins (#19738)
* [Test] move methods from bwc test to test package for use in other plugins
2016-08-03 11:41:46 +02:00
Adrien Grand 0e64117512 package-info.java should be in src/main only. 2016-08-03 11:11:25 +02:00
Ryan Ernst 18f242b069 Merge pull request #19764 from rjernst/writeable_registry
Make NamedWriteableRegistry immutable and add extension point for named writeables
2016-08-03 01:36:38 -07:00
Ryan Ernst fe823c857b Plugins: Add ScriptService to dependencies available for plugin components 2016-08-03 00:43:04 -07:00
Adrien Grand a0818d3b87 Split regular histograms from date histograms. #19551
Currently both aggregations really share the same implementation. This commit
splits the implementations so that regular histograms can support decimal
intervals/offsets and compute correct buckets for negative decimal values.

However the response API is still the same. So for intance both regular
histograms and date histograms will produce an
`org.elasticsearch.search.aggregations.bucket.histogram.Histogram`
aggregation.

The optimization to compute an identifier of the rounded value and the
rounded value itself has been removed since it was only used by regular
histograms, which now do the rounding themselves instead of relying on the
Rounding abstraction.

Closes #8082
Closes #4847
2016-08-03 08:39:48 +02:00
Boaz Leskes f6aeb35ce8 Tighten up concurrent store metadata listing and engine writes (#19684)
In several places in our code we need to get a consistent list of files + metadata of the current index. We currently have a couple of ways to do in the `Store` class, which also does the right things and tries to verify the integrity of the smaller files. Sadly, those methods can run into trouble if anyone writes into the folder while they are busy. Most notably, the index shard's engine decides to commit half way and remove a `segment_N` file before the store got to checksum (but did already list it). This race condition typically doesn't happen as almost all of the places where we list files also happen to be places where the relevant shard doesn't yet have an engine. There  is however an exception (of course :)) which is the API to list shard stores, used by the master when it is looking for shard copies to assign to.

I already took one shot at fixing this in #19416 , but it turns out not to be enough - see for example https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-os-compatibility/os=sles/822.

The first inclination to fix this was to add more locking to the different Store methods and acquire the `IndexWriter` lock, thus preventing any engine for accessing if if the a shard is offline and use the current index commit snapshotting logic already existing in `IndexShard` for when the engine is started. That turned out to be a bad idea as we create more subtleties where, for example, a store listing can prevent a shard from starting up (the writer lock doesn't wait if it can't get access, but fails immediately, which is good). Another example is running on a shared directory where some other engine may actually hold the lock.

Instead I decided to take another approach:
1) Remove all the various methods on store and keep one, which accepts an index commit (which can be null) and also clearly communicates that the *caller* is responsible for concurrent access. This also tightens up the API which is a plus.
2) Add a `snapshotStore` method to IndexShard that takes care of all the concurrency aspects with the engine, which is now possible because it's all in the same place. It's still a bit ugly but at least it's all in one place and we can evaluate how to improve on this later on. I also renamed the  `snapshotIndex` method to `acquireIndexCommit` to avoid confusion and I think it communicates better what it does.
2016-08-03 08:34:09 +02:00
Ryan Ernst 7bfe1bd628 Check inner field with metadata field name is ok 2016-08-02 17:03:21 -07:00
Ryan Ernst 4e48154130 Mappings: Fix detection of metadata fields in documents
In 2.0, the ability to specify metadata fields like _routing and _ttl
inside a document was removed. However, the ability to break through
this restriction has lingered, and the check that enforced it is
completely broken.

This change fixes the check, and adds a parsing test.
2016-08-02 16:54:44 -07:00
Ryan Ernst df8dc64e9b Plugins: Make NamedWriteableRegistry immutable and add extenion point for named writeables
Currently any code that wants to added NamedWriteables to the
NamedWriteableRegistry can do so via guice injection of the registry,
and registering at construction time. However, this makes the registry
complex: it has both get and register methods synchronized, and there is
likely contention on the read side from multiple threads.  The
registration has mostly already been contained to guice modules at node
construction time.

This change makes the registry immutable, taking all of the
NamedWriteable readers at construction time. It also allows plugins to
added arbitrary named writables that it may use in its own transport
actions.
2016-08-02 15:56:25 -07:00
Lee Hinman 046abdc281 Merge remote-tracking branch 'dakrone/document-translog-tool' 2016-08-02 16:27:02 -06:00
Lee Hinman 0ade5a207d Add documentation for the 'elasticsearch-translog' tool
This adds documentation to the translog page for the CLI truncation
tool.
2016-08-02 16:26:28 -06:00
Lee Hinman a9b2e172fa [TEST] Increase time waiting for all shards to move off/on to a node 2016-08-02 16:18:39 -06:00
Ali Beyad c28eee77df Fixes the active shard count check in the case of (#19760)
ActiveShardCount.ALL by checking for active shards,
not just started shards, as a shard could be active
but in the relocating state (i.e. not in the started
state).
2016-08-02 18:00:39 -04:00
Jason Tedor 0461e12663 Simplify Netty 4 transport implementations
The Netty 4 transport implementations have an unnecessary dependency on
SocketChannels, and can instead just use plain Channels.
2016-08-02 17:07:30 -04:00
Igor Motov 22e63b4783 Fixes cat tasks operation in detailed mode
Currently the cat tasks operation fails in the detailed mode.

Closes #19755
2016-08-02 15:21:31 -04:00
jaymode 6def10c5d9 make netty4 http request public 2016-08-02 14:46:44 -04:00
Jason Tedor 669daccfbb Allow for Netty 4 HTTP extensions
This commit enables the Netty 4 HTTP server implementation to allow for
extensions.
2016-08-02 14:10:40 -04:00
jaymode 00ca6c417e add javadocs 2016-08-02 14:06:29 -04:00
jaymode 8498470781 update transport to allow for extensions 2016-08-02 13:45:41 -04:00
Robert Muir f77e8a512c ignore some docker craziness in scccomp environment checks 2016-08-02 12:19:38 -04:00
Jason Tedor 227463c356 Default transport and HTTP to Netty 4
This commit sets the default transport and HTTP implementation to use
transport-netty4.

Relates #19563
2016-08-02 12:19:19 -04:00
Ali Beyad c4ae23f5d8 Enables implementations of the BlobContainer interface to (#19749)
conform with the requirements of the writeBlob method by
throwing a FileAlreadyExistsException if attempting to write
to a blob that already exists. This change means implementations
of BlobContainer should never overwrite blobs - to overwrite a
blob, it must first be deleted and then can be written again.

Closes #15579
2016-08-02 09:48:21 -04:00
Luca Cavanna c0b71d26cf Merge pull request #19687 from javanna/docs/java_api_version
[DOCS] replace {es.version} in maven coordinates with current version
2016-08-02 15:31:08 +02:00
Nik Everett 42fe2f0aca Add docs for a few packages
This'll make javadocs slightly more useful....
2016-08-02 09:30:30 -04:00
Ali Beyad 456ea56527 Cleans up the BlobContainer interface by removing the (#19727)
writeBlob method takes a BytesReference in favor of just
the writeBlob method that takes an InputStream.

Closes #18528
2016-08-02 09:21:43 -04:00
javanna 772c16702e [DOCS] replace {es.version} in maven coordinates with current version 2016-08-02 15:17:21 +02:00
Ali Beyad a21dd80f1b Documentation changes for wait_for_active_shards (#19581)
Documentation changes and migration doc changes for introducing 
wait_for_active_shards and removing write consistency level.

Closes #19581
2016-08-02 09:15:01 -04:00
Ali Beyad 3d2a105825 Merge pull request #19454 from abeyad/remove-write-consistency-level
Removes write consistency level across replication action APIs in favor of wait_for_active_shards
2016-08-02 09:01:11 -04:00
Daniel Mitterdorfer b99a482992 Improve client benchmark (#19736)
* Allow to run client benchmark as an uberjar
* Busy wait to avoid accidental skew on low target throughput rates
* Trigger and wait for full GC to happen between trials
* Add missing SuppressForbidden to allow System.gc in client benchmark
2016-08-02 14:17:51 +02:00
Daniel Mitterdorfer 88cbfbaabd Ban dangerous methods of java.lang.Thread (#19677)
Ban dangerous methods of java.lang.Thread

With this commit we disallow usage of the method Thread.stop().
2016-08-02 14:11:42 +02:00
Isabel Drost-Fromm 0fb7dd9054 Merge pull request #19623 from MaineC/feature/rank-eval
Add parsing of type information
2016-08-02 13:50:16 +02:00
Christoph Büscher 0188363a40 Merge branch 'master' into feature/rank-eval 2016-08-02 12:05:44 +02:00