Commit Graph

37612 Commits

Author SHA1 Message Date
Armin Braun b4a06770c9
Release memory for cancelled tasks earlier in TaskExecutor (#13609)
We can save some memory in failure scenarios here (and a tiny bit in
every case) by moving our started flag to the `FutureTask` and using the
callable outright. First of all, we save the wrapper callable, but that
also allows us to just `set(null)` on cancellation instead of waiting
for the task to run to set the `null`.
In case we have longer running tasks executing and it would take a while
to get to the cancelled tasks, this saves some memory and allows us to
return from the method earlier.
2024-08-21 21:25:09 +02:00
Michael Sokolov c52ddd83bf
import definition of default parameter values from o.a.l.util.HnswGraphBuilder (#13674) 2024-08-21 14:06:45 -04:00
Adrien Grand 2971ce1b7f
Display frame types when analyzing top frames. (#13670)
This helps understand if a given frame is interpreted, compiled or inlined for instance.
2024-08-20 23:36:51 +02:00
Ignacio Vera 4404aa3fe9
Convert BKDConfig to a record (#13668) 2024-08-20 11:44:28 +02:00
mrhbj 0533effe48
Modernize switch statements in ArrayUtil (#13669) 2024-08-19 14:23:35 -07:00
Benjamin Trent 1c9bd6bdb4
Only attempt to connect components when entry point is valid (#13660)
* Only attempt to connect components when entry point is valid

* iter
2024-08-19 08:36:52 -04:00
Adrien Grand 299d7f6721
Speed up prefix sums when decoding doc IDs. (#13658)
This updates file formats to compute prefix sums by summing up 8 deltas per
long at the same time if the number of bits per value is 4 or less, and 4
deltas per long at the same time if the number of bits per value is between 5
included and 11 included. Otherwise, we keep summing up 2 deltas per long like
today.

The `PostingDecodingUtil` was slightly modified due to the fact that more
numbers of bits per value now need to apply different shifts to the input data.
E.g. now that we store integers that require 5 bits per value as 16-bit
integers under the hood rather than 8, we extract the first values by shifting
by 16-5=11, 16-2*5=6 and 16-3*5=1 and then decode tail values from the
remaining bit per 16-bit integer.
2024-08-16 21:27:32 +02:00
mrhbj 29eda04e23
Simplify FSTCompiler loop (#13663) 2024-08-16 10:40:55 -07:00
Dawid Weiss f99deb58b7
Upgrade spotless to 6.9.1, google java format to 1.23.0. (#13661) 2024-08-16 09:28:44 +02:00
Dawid Weiss af22fe922d Revert "Update checksums after tidy/ regenerate."
This reverts commit f96caeeb92.
2024-08-15 22:30:57 +02:00
Dawid Weiss f96caeeb92 Update checksums after tidy/ regenerate. 2024-08-15 22:29:23 +02:00
Dawid Weiss 8b25c4dd0b Fix icu's regeneration script: instead of getVersion we can just pick the version from the catalog. 2024-08-15 22:28:49 +02:00
panguixin 7cd2eb20cf
Compare the missing value with the top value even after the hit queue is full (#13644) 2024-08-14 15:33:56 -07:00
Dawid Weiss 1cfa697c06
Fix eclipse ide settings generation (#13649)
* Only run the ide configuration block for eclipse when explicitly invoked. fix property access ordering here and there.

* Correct dependsOn task name.

* Correct crlf/encoding after versionCatalogFormatDeps finishes.

* Change java-library to java-base in the plugin applied within the eclipse task.

* use ant.fixcrlf to correct line endings.

* Changes entry.

* Simplify fixcrlf

---------

Co-authored-by: Uwe Schindler <uschindler@apache.org>
2024-08-14 23:50:06 +02:00
Greg Miller 97e30fa487
Revert changes to IndexSearcher brought in by GH#13568 (#13656)
Note that this results in some silly code duplication so this is meant to be a more temporary fix while we better understand the root cause of the regression.
2024-08-14 10:08:08 -07:00
Michael Sokolov 2b0c6cdcbc
Call HnswGraphBuilder.getCompletedGraph() in 94/95 back-compat writers (#13654) 2024-08-14 08:55:21 -04:00
Adrien Grand a40bb39195
Optimize decoding blocks of postings using the vector API. (#13636)
Our postings use a layout that helps take advantage of Java's
auto-vectorization to be reasonably fast to decode. But we can make it a bit
faster by vectorizing directly from the MemorySegment instead of first
copying data into a long[].

This approach only works when the `Directory` uses `MemorySegmentIndexInput`
under the hood, ie. `MMapDirectory` on JDK 21+.

Co-authored-by: Uwe Schindler <uschindler@apache.org>
2024-08-13 21:49:10 +02:00
Greg Miller beea877775 Move CHANGES entry for GH#13568 2024-08-12 07:30:36 -07:00
Egor Potemkin 304d4e7855
Sandbox: Compute facets while collecting (#13568)
This adds a new, ground-up implementation of faceting that computes aggregations while collecting. This has the following advantages over the current faceting module:
1. Allows for flexible aggregation logic instead of just "counts" in a general way (essentially makes what's available in today's "association faceting" available beyond taxonomy-based fields).
2. When aggregating beyond "counts," association value computation can be expensive. This implementation allows values to be computed only once when used across different aggregations.
3. Reduces latency by leveraging concurrency during collection (but potentially with increased overall cost).

This work has been done in the sandbox module for now since it is not yet complete (the current faceting module covers use-cases this doesn't yet) and it needs time to bake to work out API and implementation rough edges.

---------

Co-authored-by: Egor Potemkin <epotyom@amazon.com>
Co-authored-by: Shradha Shankar <shrdsha@amazon.com>
Co-authored-by: Greg Miller <gsmiller@gmail.com>
2024-08-12 07:26:59 -07:00
mrhbj 9b481f76f7
Mark some fields final in Lucene99SkipWriter (#13639) 2024-08-12 07:06:48 -07:00
Michael Sokolov f0558ae263
Two fixes for recently-added HnswGraphBuilder.connectComponents: (#13642)
1. properly set frozen flag to avoid re-duplicative work
2. don't try to join a node to itself
2024-08-10 16:59:38 -04:00
Ankit Jain 5aa1aa98ea
Minor offset tracking tweak in PointRangeQuery #matches and #relate (#13599) 2024-08-09 13:50:47 -07:00
Michael Froh 4d04cc26a9
Get better cost estimate on MultiTermQuery over few terms (#13201)
---------
Co-authored-by: Greg Miller <gsmiller@gmail.com>
2024-08-09 09:16:15 -07:00
Christine Poerschke ea562f6ef2
Knn(Float-->Byte)VectorField javadocs update in KnnByteVectorQuery (#13637) 2024-08-09 09:44:12 +01:00
Michael Sokolov 843273e20b fix TestHnswUtil when top level is disconnected; add CHANGES entry 2024-08-08 19:56:45 -04:00
Michael Sokolov 217828736c
gh-12627: HnswGraphBuilder connects disconnected HNSW graph components (#13566)
* gh-12627: HnswGraphBuilder connects disconnected HNSW graph components
2024-08-08 14:41:52 -04:00
Benjamin Trent d26b152117
Fix race condition on flush for DWPT seqNo generation (#13627)
There is a tricky race condition with DWPT threads. It is possible that a flush starts by advancing the deleteQueue (in charge of creating seqNo). Thus, the referenced deleteQueue, there should be a cap on the number of actions left. 

However, it is possible after the advance, but before the DWPT are actually marked for flush, the DWPT gets freed and taken again to be used.

To replicate this extreme behavior, see: https://github.com/apache/lucene/compare/main...benwtrent:lucene:test-replicate-and-debug-13127?expand=1

This commit will prevent DWPT from being added back to the free list if their queue has been advanced. This is because the `maxSeqNo` for that queue was created accounting only for the current number of active threads. If the thread gets passed out again and still references the already advanced queue, it is possible that seqNo actually advances past the set `maxSeqNo`. 


closes: https://github.com/apache/lucene/issues/13127
closes: https://github.com/apache/lucene/issues/13571
2024-08-07 13:31:00 -04:00
bjacobowitz 926d8f4ce6
Make CandidateMatcher functions public (#13632)
A number of functions in CandidateMatcher are protected or package-protected,
meaning that client code can't use them, which makes it difficult to build custom 
wrapper matchers.  This commit makes these functions public
2024-08-07 15:28:06 +01:00
Benjamin Trent 9e831ee809
Add float|byte vector support to memory index (#13633)
* Add float|byte vector support to memory index

* adding changes
2024-08-07 08:38:41 -04:00
Adrien Grand 82210189ee Add missing test for Lucene912PostingsFormat. 2024-08-06 14:30:03 +02:00
Kaival Parikh e0e5d81df8
Add timeout support to AbstractVectorSimilarityQuery (#13285)
Co-authored-by: Kaival Parikh <kaivalnp@amazon.com>
2024-08-05 17:12:19 -07:00
Benjamin Trent 43c80117dd
Fix ScalarQuantization when used with COSINE similarity (#13615)
When quantizing vectors in a COSINE vector space, we normalize them. However, there is a bug when building the quantizer quantiles and we didn't always use the normalized vectors. Consequently, we would end up with poorly configured quantiles and recall will drop significantly (especially in sensitive cases like int4).

closes: #13614
2024-08-05 12:29:14 -04:00
Mayya Sharipova 26b46ced07
KMeans clustering algorithm (#13604)
Implement Kmeans clustering algorithm for vectors.
Knn algorithms that further reduce memory usage of vectors (such as Product Quantization,
 RaBitQ etc) require clustering of vectors. This implements KMeans clustering algorithm.

Co-authored-by: Jim Ferenczi jim.ferenczi@elastic.co
2024-08-02 11:59:16 -04:00
zhouhui cb8bc75750
Rename prefix to prefixLength, suffix to suffixLength. (#13629) 2024-08-02 08:12:34 -07:00
Jakub Slowinski 1ce1156de4
Fix failing unit test - TestTopDocsCollector#testResultsOrder (#13621) 2024-08-02 14:03:09 +02:00
Zhang Chao ad2f02c013
Fix testAddDocumentOnDiskFull to handle IllegalStateException from IndexWriter#close (#13558) 2024-08-02 15:28:03 +08:00
Greg Miller 35a5d7323b CHANGES entry for GH#13625 2024-08-01 19:19:20 -07:00
Greg Miller 99f35e3f8b
Remove some BitSet#nextSetBit code duplication (#13625) 2024-08-01 19:16:39 -07:00
Benjamin Trent 836c8e76ad
Revert cosine deprecation (#13613)
Opening for more pointed discussion. See latest discussion here: #13281

I was hoping to have a full answer for folks who use byte models by Lucene 10, but I just don't have that.

I still want to remove the internal cosine optimized methods. We can do this if we store magnitudes along side the raw vectors. This way we can remove all the internal optimized cosine code as its complicated.
2024-08-01 15:05:05 -04:00
Michael Sokolov 2f297b7735 Add CHANGES entry for GH-13581 2024-08-01 10:30:31 -04:00
Adrien Grand 44a9133824 Fix lazy decoding of freqs. (#13585) 2024-08-01 16:25:45 +02:00
Michael Sokolov f14eb2b2c5
HnswLock: access locks via hash and only use for concurrent indexing (#13581)
hnswlock: hash locks and only use for concurrent indexing
2024-08-01 10:22:56 -04:00
Greg Miller 3ee85a46af Move CHANGES entry for GH#13559 from 10.0 to 9.12 2024-08-01 07:15:35 -07:00
Egor Potemkin e8eba4d455
SparseFixedBitSet#firstDoc: reduce number of `indices` iterations for a bit set that is not fully built yet. (#13559) 2024-08-01 07:11:58 -07:00
Adrien Grand 0a24769850 Don't clone an IndexInput if postings are inlined in the terms dict (#13585). 2024-08-01 12:55:06 +02:00
Armin Braun 47650a4314
Deduplicate min and max term in single-term FieldReader (#13618)
I noticed that single-term readers are an edge case but not that
uncommon in Elasticsearch heap dumps. It seems quite common to have a
constant value for some field across a complete segment (e.g. a version
value that is repeated endlessly in logs).
Seems simple enough to deduplicate here to save a couple MB of heap.
2024-07-31 20:38:21 +02:00
Armin Braun ca098e63b9
Deduplicate bytes for `FieldReader#rootCode` (#13610)
Looking at how these instances are serialized to disk it appears
that the empty output in the FST metadata is always the same as the
rootCode bytes.
Without changing the serialization we could at least deduplicate here,
saving hundreds of MB in some high-segment count use cases I observed in
ES.
2024-07-31 20:31:13 +02:00
Jakub Slowinski 255a2fcf9c
Fix comments containing 'the this' (#13624) 2024-07-31 11:00:34 -07:00
Armin Braun a1816e3f65
Wrap Executor in TaskExecutor to never reject (#13622)
Make it so rejected tasks are execute right away on the caller thread.
Users of the API shouldn't have to worry about rejections when we don't
expose any upper limit to the task count that we put on the executor that
would help in sizing a queue for the executor.
2024-07-31 19:34:35 +02:00
Adrien Grand b4a8810b7a
Inline skip data into postings lists (#13585)
This updates the postings format in order to inline skip data into postings. This format is generally similar to the current `Lucene99PostingsFormat`, e.g. it shares the same block encoding logic, but it has a few differences:
 - Skip data is inlined into postings to make the access pattern more sequential.
 - There are only 2 levels of skip data: on every block (128 docs) and every 32 blocks (4,096 docs).

In general, I found that the fact that skip data is inlined may slow down a bit queries that don't need skip data at all (e.g. `CountOrXXX` tasks that never advance of consult impacts) and speed up a bit queries that advance by small intervals. The fact that the greatest level only allows skipping 4096 docs at once means that we're slower at advancing by large intervals, but data suggests that it doesn't significantly hurt performance.
2024-07-31 17:18:28 +02:00