Commit Graph

20 Commits

Author SHA1 Message Date
Ryan Ernst 19257125b1
Move transport version constants to TransportVersions (#97990)
Constants for TransportVersion currently live alongeside the class
definition. This has been fine since there was only one set of
constants. However, to support serverless, some constants will need to
be defined elsewhere.

This commit moves the existing constants to a new holder class,
TransportVersions. It is almost entirely mechanical, using IntelliJ move
members. The only non mechanical part was slightly shifting how CURRENT
is found, defining a LATEST in TransportVersions that is automatically
calculated (since we already have it, no need to manually define it).
2023-09-06 15:14:41 -04:00
David Turner 1e9c7f1d95
Align collection de/serialization API naming (#99150)
The `StreamOutput` and `StreamInput` APIs are designed so that code
which serializes objects to the transport protocol aligns closely with
the corresponding deserialization code. However today
`StreamOutput#writeCollection` pairs up with a variety of methods on
`StreamInput`, including `readList`, `readSet`, and so on. These methods
are not obviously compatible with `writeCollection` unless you look at
the implementation, and that makes verifying transport protocol code
harder than it needs to be.

This commit renames these methods to `readCollectionAsList`,
`readCollectionAsSet`, and so on, to clarify that they are compatible
with `writeCollection`.

Relates
https://github.com/elastic/elasticsearch/pull/98971#issuecomment-1697289815
2023-09-04 06:46:54 -04:00
Armin Braun e4de4021fc
Remove redundant writeList from StreamOutput (#98971)
Noticed this when benchmarking FieldCaps transport messages.
The `writeList` alias just adds more lines to the code and makes
profiling more annoying to read, lets remove it.
2023-08-29 16:00:59 +02:00
Michael Peterson 42fbe0b1dc
Skipping the new stall_time_seconds test in error_query yaml test before version 8.10 (#98182) 2023-08-03 19:30:58 -04:00
Michael Peterson 1d593b168b
Add stall_time_seconds to the error_query DSL testing query (#98114)
This allows simulating long running queries (particularly useful for CCS testing).

In addition a "NONE" exception type was added for cases where you want the stall time
greater than 0 but to not throw an Exception.

Most of the runtime logic for the Query was moved out of the ErrorQueryBuilder
and into a new ErrorQuery class (extending the Lucene Query class), so that this can be
tested in conjunction with search timeout flag to induce query timeouts and allow
testing of that feature as well.
2023-08-03 11:36:45 -04:00
Simon Cooper c513b2bcc6
Migrate VersionedWriteable & NamedDiff to TransportVersion take 2 (#93242)
Re-apply "Migrate VersionedWriteable & NamedDiff to TransportVersion (#93076)"

This reverts commit 48f96090dc.
2023-01-26 09:49:08 +00:00
Simon Cooper 48f96090dc Revert "Migrate VersionedWriteable & NamedDiff to TransportVersion (#93076)"
This reverts commit bef85c66e7.
2023-01-25 16:16:10 +00:00
Simon Cooper bef85c66e7
Migrate VersionedWriteable & NamedDiff to TransportVersion (#93076)
InferenceConfig is kept on Version, as that existed before VersionedNamedWriteable came along
2023-01-25 16:03:38 +00:00
Ignacio Vera dd1bd83234
Don't index geo_shape field in AbstractBuilderTestCase (#88437)
This commit stops adding the geo_shape field mapper by default and adds the mapper only when it is needed.
2022-07-12 06:52:14 +02:00
Alan Woodward 26019f2a15
Remove default-value parameters from non-core queries (#87813)
This slims down the representations of all remaining queries not in the core

* percolate
* function_score
* script_score
* pinned

Relates to #76515
2022-06-20 12:43:41 +01:00
Christoph Büscher 5536884936
Add getMinimalSupportedVersion to QueryBuilders (#83208)
Supporting #81809, we changed query builders to implement 'VersionedNamedWriteable' to be able to detect
when new query builders under the search enpoint are introduced and also to force new implementations to overwrite
'getMinimalSupportedVersion' with a current release version.
This change removes the default implementation in the QueryBuilder interface and replaces it with individual
implementations in the currently existing query builders. For builders that have been around for longer than 7.0 (the
earliest verison constant we currently have around) we use Version.V_EMPTY which sorts always before any other declared version.
2022-02-03 11:22:07 +01:00
Keith Massey 08df1cb623
Changing HeaderWarning to always use 299 as the warning code (#80304)
This commit changes the deprecation logger so that all messages (critical or warning) are written
out with "299" as the level at the beginning of the header in order to be compliant with
https://www.rfc-editor.org/rfc/rfc7234.html#section-5.5.7. In #79107 we mistakenly began logging
warning-level messages with the 300 code, which is not valid in the RFC.
2021-11-08 09:47:25 -06:00
Keith Massey 88250c216c
Exposing the ability to log deprecated settings at non-critical level (#79107)
A recent change for the deprecation logs provided the capability to emit deprecation's at critical vs. warning levels, #77482.
However deprecated settings always log at critical level without the ability to express that the setting deprecation is only a
warning.

This commit exposes the ability to set the deprecation level when deprecating a setting.
Closes #78781
2021-10-19 07:51:05 -05:00
Chris Hegarty 20c9f756d2
Fix split package org.elasticsearch.common.xcontent (#78831)
Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.
2021-10-08 17:14:26 +01:00
Ryan Ernst eb147abd5d
Fix split packages in external test modules (#78136)
The external test modules are plugins which provide extra test
functionality in snapshot builds. These are independent Elasticsearch
plugins added as modules. They currently share package names with
server. This commit moves them each into their own java package name.
2021-09-21 13:00:52 -07:00
Rory Hunter a5d2251064
Order imports when reformatting (#74059)
Change the formatter config to sort / order imports, and reformat the
codebase. We already had a config file for Eclipse users, so Spotless now
uses that.

The "Eclipse Code Formatter" plugin ought to be able to use this file as
well for import ordering, but in my experiments the results were poor.
Instead, use IntelliJ's `.editorconfig` support to configure import
ordering.

I've also added a config file for the formatter plugin.

Other changes:
   * I've quietly enabled the `toggleOnOff` option for Spotless. It was
     already possible to disable formatting for sections using the markers
     for docs snippets, so enabling this option just accepts this reality
     and makes it possible via `formatter:off` and `formatter:on` without
     the restrictions around line length. It should still only be used as
     a very last resort and with good reason.
   * I've removed mention of the `paddedCell` option from the contributing
     guide, since I haven't had to use that option for a very long time. I
     moved the docs to the spotless config.
2021-06-16 09:22:22 +01:00
Ryan Ernst ab1a2e4a84
Add precommit task for detecting split packages (#73784)
Modularization of the JDK has been ongoing for several years. Recently
in Java 16 the JDK began enforcing module boundaries by default. While
Elasticsearch does not yet use the module system directly, there are
some side effects even for those projects not modularized (eg #73517).
Before we can even begin to think about how to modularize, we must
Prepare The Way by enforcing packages only exist in a single jar file,
since the module system does not allow packages to coexist in multiple
modules.

This commit adds a precommit check to the build which detects split
packages. The expectation is that we will add the existing split
packages to the ignore list so that any new classes will not exacerbate
the problem, and the work to cleanup these split packages can be
parallelized.

relates #73525
2021-06-08 15:04:23 -07:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Jim Ferenczi eb8d7e2aaf
Add a test module to simulate errors and warnings in search requests (#71674)
This change adds a test module called `error-query` that exposes a
query builder to simulate errors and warnings on shard search request.
The query accepts a list of indices and shard ids where errors or warnings
should be reported:
```
POST test*/_search
{
    "query": {
        "error_query": {
            "indices": [
                {
                    "name": "test_exception",
                    "shard_ids": [1],
                    "error_type": "exception",
                    "message": "boom"
                },
                {
                    "name": "test_warn*",
                    "error_type": "warning",
                    "message": "Watch out!"
                }
            ]
        }
    }
}
```

The `error_type` can be set to `exception` or `warning` and the `name` accepts
simple patterns, aliases and fully qualified index name if the search targets remote shards.

This module is published only within snapshots like the other test modules.

Relates #70784
2021-05-06 09:42:08 +02:00