* Reducing duplication in plugins around ref-counted releasable classes
Both AmazonEc2Reference and AmazonS3Reference duplicate the same logic - a subclass of AbstractRefCounted that also implements Releasable. This change centralizes this paradigm into a AbstractRefCountedReleasable class and supports both clients via generics. It also updates all fetching implementations to use the get() method instead of client()
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* Introduce Reference classes for the Closeable and AutoCloseable interfaces
These classes allow you to wrap a reference instance with an onClose runnable that is executed when close() is invoked. Two separate classes are needed because the close() signatures for the two interfaces are different. This change takes the first step to have implementing classes extend from these generic superclasses, before attempting to remove the subclasses entirely. The get() method is also replaced throughout the code base.
Note that there is also a separate Releasable interface that has a similar access pattern, but is implemented separately. This is used in AbstractRefCountedReleasable introduced in a prior commit
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* More improvements and refactoring
* Functionality around one-way gating is now moved to a dedicated class - OneWayGate. This replaces duplicate functionality throughout the code.
* The two *Reference classes have been renamed to Gated* since that better represents their functionality
* The AbstractRefCountedReleasable has been improved to no longer be abstract by accepting the shutdown hook. This removes the need for the inner class in ReleasableBytesReference, and further simplifies the plugin subclasses (these could probably be removed entirely).
* Finally, unit tests have been added for some classes
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* Added tests for GatedCloseable
Also updated the license information in GatedAutoCloseableTests
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* Fixing license information in new files
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* Added unit tests for RefCountedReleasable
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
* [Remove] TrimUnsafeCommit logic for legacy 6.x indexes
Multiple txlog commits was introduced in legacy 7.x. Legacy 6.x indexes could
therefore not have a safe commit. Since OpenSearch 2.0 is no longer compatible
with legacy 6.x indexes, the logic to trim these unsafe commits is safely
removed.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* fix assertion typo
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* rebase and incorporate pr feedback
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* MapperService has to be passed in as null for EnginePlugins CodecService constructor
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Addressing code review comments
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Delayed CodecService instantiation up to the shard initialization
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Added logger (associated with shard) to CodecServiceConfig
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Refactored the EngineConfigFactory / IndexShard instantiation of the CodecService
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Removes include_type_name from the high level reset client along with relevant
deprecated methods in IndicesClient. All tests are updated to remove the
parameter from the rest requests along with various toXContent methods that are
no longer required.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* Replace the exclusionary word whitelist with allowlist, and blacklist with denylist, in code commet and internal variable/method/class/package name.
Signed-off-by: Andreas <apre@gmx.at>
* Add '_name' field support to score functions and provide it back in explanation response
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Address code review comments
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Removes the deprecated types based get, getMapping, getAsync, and
getMappingAsync methods from IndicesClient. It also removes extra nesting of
mappings belong the deprecated type named object and removes the types based
methods from the affected request classes.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* Reintroduce negative epoch_millis #1991
Fixes a regression introduced with Elasticsearch 7 regarding the date
field type that removed support for negative timestamps with sub-second
granularity.
Thanks to Ryan Kophs (https://github.com/rkophs) for allowing me to use
his previous work.
Signed-off-by: Breno Faria <breno.faria@intrafind.de>
* applying spotless fix
Signed-off-by: Breno Faria <breno.faria@intrafind.de>
* more conservative implementation of isSupportedBy
Signed-off-by: Breno Faria <breno.faria@intrafind.de>
* adding braces to control flow statement
Signed-off-by: Breno Faria <breno.faria@intrafind.de>
* spotless fix...
Signed-off-by: Breno Faria <breno.faria@intrafind.de>
Co-authored-by: Breno Faria <breno.faria@intrafind.de>
Removes the type parameter from Client.prepare(Index,Delete,Update) and
everywhere it's used throughout the codebase except for prepareIndex(index,
type, id) which is removed in a follow up.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Removes type support from DocWrite Request and Response, all derived classes,
and all places used.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* [Remove] types from SearchHit and Explain API
Removes type support from SearchHit and Explain API.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* fix failing tests
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* move TYPES_DEPRECATION_MESSAGE from RestExplainAction to FullClusterRestartIT
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* fix FullClusterRestartIT
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* fix failing tests
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* fix testSoftDelete
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
With soft deletes no longer optional, peer recovery is switched to always use the
lucene index instead of replaying operations from the translog.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* Remove type param from yml and integ test files
Signed-off-by: Suraj Singh <surajrider@gmail.com>
* Remove type mapping specific update API
Signed-off-by: Suraj Singh <surajrider@gmail.com>
Removes type support from the get and mget transport and rest actions along
with removal from ShardGetService.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Default mappings were deprecated in Legacy version 6x and cannot be added to
indexes created in legacy 7+ or any version of OpenSearch. All support for
default mappings are removed for OpenSearch 2+.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
With types deprecation the type support is removed from internal search API
(SearchRequest and QueryShardContext).
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* Support unordered non-overlapping intervals
This commit exposes Intervals.unorderedNoOverlaps (LUCENE-8828).
Signed-off-by: Matt Weber <matt@mattweber.org>
* Replace ordered and overlap flags with enum.
- add IntervalMode enum
- deprecate ordered
- bwc between IntervalMode and ordered flag
- update tests
- update rest tests
Signed-off-by: Matt Weber <matt@mattweber.org>
* fix annotated text plugin test
Signed-off-by: Matt Weber <matt@mattweber.org>
* bwc to 2x only
Signed-off-by: Matt Weber <matt@mattweber.org>
* BWC rest tests for ordered flag
Signed-off-by: Matt Weber <matt@mattweber.org>
* Bump com.diffplug.spotless from 5.6.1 to 6.2.0
Bumps com.diffplug.spotless from 5.6.1 to 6.2.0.
---
updated-dependencies:
- dependency-name: com.diffplug.spotless
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* spotlessApply
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Walter Knize <nknize@apache.org>
* Remove doc type specific indexing APIs and relevant changes
Signed-off-by: Suraj Singh <surajrider@gmail.com>
* Remove type param from yml and integ test files
Signed-off-by: Suraj Singh <surajrider@gmail.com>
* [Refactor] MapperService to QueryShardContext in valueFetcher
QueryShardContext encapsulates MapperService along with other mechanisms useful
for analyzers, highlighters, and readers. This commit refactors the valueFetcher
to use the QueryShardContext as a parameter instead of direct access to the
MapperService. This is an API change. Behavior of the method is unaffected.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* change unnecessary Optional usage
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* spotlessApply
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
* Add regexp interval source
Add a regexp interval source provider so people can use regular
expressions inside of intervals queries.
Signed-off-by: Matt Weber <matt@mattweber.org>
* Fixes
- register regexp interval in SearchModule
- use fully-qualified name for lucene RegExp
- get rid of unnecessary variable
Signed-off-by: Matt Weber <matt@mattweber.org>
Lucene 9 changes from BigEndian to LittleEndian in DataInput and DataOutput.
The use of Lucene's Data IO classes are refactored in this commit to use
StreamInput which maintains the same method calls while preserving the byte
order of the data.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Lucene 9 removed CodecReader#ramBytesUsed and all file formats that no longer
consume large amounts of memory. As a result RAM estimation for segments is no
longer possible and is removed by this commit. backwards compatibility is retained
for the tranport layer.
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>