Commit Graph

36731 Commits

Author SHA1 Message Date
Luca Cavanna 2106bf5172
Create a task executor when executor is not provided (#12606)
As we introduce more places where we add concurrency (there are
currently three) there is a common pattern around checking whether there
is an executor provided, and then going sequential on the caller thread
or parallel relying on the executor.

That can be improved by internally creating a TaskExecutor that relies
on an executor that executes tasks on the caller thread, which ensures
that the task executor is never null, hence the common conditional is no
longer needed, as the concurrent path that uses the task executor would
be the default and only choice for operations that can be parallelized.
2023-10-03 09:13:45 +02:00
Luca Cavanna 1dd05c89b0
Add missing create github release step to release wizard (#12607)
The "create github release" step was missing from the release wizard. We have forgotten about it a few times recently.

While at it, I also expanded the instructions around closing the current milestone and moved them after removing opened issues / PRs from the current milestone.
2023-10-02 19:59:23 +02:00
Luca Cavanna e93cdd1270
Simplify TaskExecutor API (#12603)
We recently made TaskExecutor public. It currently exposes two methods:
one to create tasks given a collection of callables, and one to execute
all tasks created at step 1. We can rather expose a single public method
that takes a collection of callables which internally creates the
appropriate tasks. This simplifies the API, and stops us from leaking
the internal Task abstraction which can be kept private.

Note that this is backwards compatible as we have not released yet a
version where the TaskExecutor was made public. It is marked
experimental anyways.
2023-10-02 11:07:06 +02:00
elliotzlin 4cff584a48
LUCENE-10520 / #11556 HTMLStripCharFilter bugfix (#11724)
Add generated HTMLStripCharFilter and update tests to reflect correct char filter behavior
2023-10-02 08:50:04 +02:00
Uwe Schindler 6930b57ff5
Upgrade forbiddenapis to 3.6 and ASM for APIJAR extraction to 9.6 (#12612) 2023-10-01 16:29:14 +02:00
gf2121 3cb71436a7
Sort update terms with stable radix sorter (#12591) 2023-09-29 20:11:29 -05:00
Patrick Zhai fbce75e50c Add back-compat indices for 9.8.0 2023-09-29 14:32:09 -07:00
Patrick Zhai f658b83566 Sync CHANGES for 9.8.0 2023-09-29 14:01:17 -07:00
Christine Poerschke 411b7fd518
SuggestIndexSearcher.suggest catches any CollectionTerminatedException (theoretically) thrown by getLeafCollector (#12609) 2023-09-29 12:14:50 +01:00
Christine Poerschke e02f1b1d29
IndexingChain.validateMaxVectorDimension: add missing space in IllegalArgumentException wording (#12605) 2023-09-29 12:14:29 +01:00
Patrick Zhai f01f3679bb DOAP changes for release 9.8.0 2023-09-28 11:34:29 -07:00
Ignacio Vera 6d764c3397
Add length method to RandomAccessInput (#12594)
Add RandomAccessInput#length method to the RandomAccessInput interface. In addition it deprecates
  ByteBuffersDataInput#size in favour of this new method.
2023-09-27 13:00:50 +02:00
Luca Cavanna f559cac755
Shared executor for LuceneTestCase#newSearcher callers (#12588)
Until now, LuceneTestCase#newSearcher randomly associates the returned
IndexSearcher instance with an executor that is ad-hoc created, which
gets shut down when the index reader is closed.

This has made us catch a couple of cases where we were not properly
closing readers in tests. Most recently, we have been seeing test
failures (OOM - unable to create thread) due to too many executor
instances created as part of the same test. This is to be attributed to
creating too many searcher instance, each one getting its separate
executor, which all get shutdown at the end of the entire suite. The
main offender for this is QueryUtils which creates a new searcher for
each leaf reader, and the top-level reader gets closed in the
AfterClass, hence all the executors will stay around for the entire
duration of the test suite that relies on QueryUtils.

This commit eagerly creates an executor in an additional before class
method for LuceneTestCase, and associates that with each searcher that
is supposed to get a non null executor.

Note that the executor is shutdown in the after class to ensure that
no threads leak in tests.

This has the additional advantage that it removes the need to close the
executor as part of an index reader close listener, which also requires
the reader to have an associated reader cache helper.
2023-09-25 17:00:59 +02:00
Adrien Grand ce464c7d6d Fix test failure. 2023-09-25 13:54:08 +02:00
Adrien Grand 483d28853a Move CHANGES entry to correct version. 2023-09-25 13:38:53 +02:00
Adrien Grand f2bd0bbcdd
Run top-level conjunctions of term queries with a specialized BulkScorer. (#12382)
This implements a specialized `BlockMaxConjunctionBulkScorer`, which is really
the same as `BlockMaxConjunctionScorer`, but as a `BulkScorer` instead of a
`Scorer`. Also it doesn't support two-phase iterators in order to focus on the
common case when queries, such as term queries, do not have two-phase
iterators. If a clause has a two-phase iterator, it will keep running as a
`BlockMaxConjunctionScorer` wrapped in a `DefaultBulkScorer`.
2023-09-25 13:36:44 +02:00
Ignacio Vera d48913a957
Allow reading / writing binary stored fields as DataInput (#12581)
This commit adds the possibility to read / write binary stored values using a DataInput and the number of bytes. By default the implementations will allocate those bytes in a newly created byte array and call the already existing method.
2023-09-25 11:09:32 +02:00
gf2121 8b84f6c096
Use radix sort to speed up the sorting of deleted terms (#12573) 2023-09-22 13:33:01 +08:00
Shubham Chaudhary fb1f4dd412
Make TermStates#build concurrent (#12183) 2023-09-21 17:17:36 +02:00
Luca Cavanna 3deead0ed3
Remove deprecated IndexSearcher#getExecutor method (#12580)
Use getTaskExecutor instead. This is important to enforce tracking of
tasks that run in each thread.

Relates to #12578
2023-09-21 12:30:32 +02:00
Tyler Bertrand e43bea4fa4
Resolve CompileJava task cache miss (#12577)
Resolve CompileJava task cache miss. Implement CommandLineArgumentProvider to give relative path sensitivity to apiJar file
2023-09-21 10:42:20 +02:00
Luca Cavanna 1cb0d81b40
Make TaskExecutor public (#12574)
TaskExecutor is currently package private. We have scenarios where we
want to parallelize the execution and reuse it outside of its package,
hence this commit makes it public (and experimental).

Note that its constructor remains package private as it is supposed to
be created by the index searcher, and later retrieved from it via the
appropriate getter, which is also made public as part of this commit.

Co-authored-by: gf2121 <52390227+gf2121@users.noreply.github.com>
2023-09-20 15:27:56 +02:00
Luca Cavanna 24207096c0 Move change entry for #12569 from 9.8 to 9.9 2023-09-20 12:21:47 +02:00
Luca Cavanna 937ebd4296
Prevent concurrent tasks from parallelizing further (#12569)
Concurrent search is currently applied once per search call, either when
search is called, or when concurrent query rewrite happens. They
generally don't happen within one another. There are situations in which
we are going to introduce parallelism in places where there could be
multiple inner levels of parallelism requested as each task could try to
parallelize further. In these cases, with certain executor
implementations, like ThreadPoolExecutor, we may deadlock as we are
waiting for all tasks to complete but they are waiting for threads to
free up to complete their execution.

This commit introduces a simple safeguard that makes sure that we only
parallelize via the executor at the top-level invokeAll call. When each
task tries to parallelize further, we just execute them directly instead
of submitting them to the executor.

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2023-09-20 12:00:13 +02:00
Patrick Zhai 51ade888f3 Update wrong PR number in CHANGES.txt 2023-09-19 23:37:36 -07:00
Patrick Zhai ac62c58d46 Update wrong PR number in CHANGES.txt 2023-09-19 23:29:53 -07:00
Patrick Zhai f5d5dc289e Update wrong PR number in CHANGES.txt 2023-09-19 23:24:17 -07:00
Patrick Zhai 94b879a593 Add next minor version 9.9.0 2023-09-19 22:54:14 -07:00
Tony-X ca69ae6d98
Make FSTPostingsFormat load FSTs off-heap (#12552)
* Make FSTPostingsFormat load FSTs off-heap
2023-09-19 16:29:23 -04:00
Benjamin Trent fe348de619
Fix HNSW graph reading with excessive connections (#12571)
When re-using the HNSW graph during segment merges, it is possible that more than the configured M*2 connections could be made per vector.

In those instances, we should allow the graph to still be read from the codec and searchable.
2023-09-19 15:38:23 -04:00
Adrien Grand 1d0edd76a5 Fix compilation under Java 11. 2023-09-19 12:15:38 +02:00
Adrien Grand 36432fa672
Fix issues with BP tests and the security manager. (#12568)
The default ForkJoinPool implementation uses a thread factory that removes all
permissions on threads, so we need to create our own to avoid tests failing
with FS-based directories.
2023-09-19 08:55:48 +02:00
Dawid Weiss ebfbc831ab
Omit -Ptests.haltonfailure=false in failed test repro line #12565 (#12566) 2023-09-18 14:30:53 +02:00
Dawid Weiss cba2d19efa
TestPassageSelector.randomizedSanityCheck can fail when the random input is unfortunately clashing with an assertion #12562 (#12567) 2023-09-18 12:30:01 +02:00
Egor Potemkin d633c9b7d4
Fix: Lucene90DocValuesProducer.TermsDict.seekCeil doesn't always position bytes correctly (#12555) 2023-09-16 16:48:45 -07:00
Greg Miller 43c0d72b94 Add more detailed documentation related to GH#12560 2023-09-16 14:51:53 -07:00
Greg Miller 58a50bf44d
Defer #advanceExact on expression dependencies until their values are needed (#12560) 2023-09-15 16:26:14 -07:00
Adrien Grand 780e684340 CHANGES for #12489. 2023-09-14 18:58:52 +02:00
Adrien Grand 39f3777886
Add support for recursive graph bisection. (#12489)
Recursive graph bisection is an extremely effective algorithm to reorder doc
IDs in a way that improves both storage and query efficiency by clustering
similar documents together. It usually performs better than other techniques
that try to achieve a similar goal such as sorting the index in natural order
(e.g. by URL) or by a min-hash, though it comes at a higher index-time cost.

The [original paper](https://arxiv.org/pdf/1602.08820.pdf) is good but I found
this [reproducibility study](http://engineering.nyu.edu/~suel/papers/bp-ecir19.pdf)
to describe the algorithm in more practical ways.
2023-09-14 18:20:45 +02:00
Gokul Manoj 8ca471679d
Allow FilteredDocIdSetIterator.match(doc) to throw IOException (#12554) 2023-09-14 17:40:18 +02:00
Adrien Grand 37a42219fc
Reduce the overhead of ImpactsDISI. (#12490)
`ImpactsDISI` is nice: you give it an `ImpactsEnum`, typically coming from the
`PostingsFormat` and it will automatically skip hits whose score cannot be
greater than the minimum competitive score. This is the class that yields 10x
or more speedups on top-level `TermQuery`s compared to exhaustive evaluation.

However, when nested under a disjunction or a conjunction, `ImpactsDISI`
typically adds more overhead than it enables skipping. The reason is that on a
disjunction `a OR b`, the minimum competitive score of `a` is the minimum score
for the disjunction minus the maximum score of `b`. While this sort of
propagation of minimum competitive scores down the query tree sometimes helps,
it does hurt more than it helps on average, because `ImpactsDISI` adds quite
some overhead and the per-clauses minimum scores are usually so low that they
don't actually enable skipping hits. I looked into reducing this overhead, but
a big part of it is the additional virtual call, so the only way to get rid of
this overhead is to not wrap with an `ImpactsDISI` at all.

This means that scorers need a way to know whether they are producing the
top-level score, or whether they are producing a partial score that then gets
combined into the top-level score. Term queries would then only wrap with
`ImpactsDISI` when they produce the top-level score. Note that this does not
only include top-level term queries, but also conjunctions that have a single
scoring clause (`a #b`) or combinations of a term query and one or more
prohibited clauses (`a -b`).
2023-09-12 15:23:28 +02:00
Jim Ferenczi c26b0180bd
Introduce a random vector scorer in HNSW builder/searcher (#12529)
This PR involves the refactoring of the HNSW builder and searcher, aiming to create an abstraction for the random access and vector comparisons conducted during graph traversal.

The newly added RandomVectorScorer provides a means to directly compare ordinals, eliminating the need to expose the raw vector primitive type.
This scorer takes charge of vector retrieval and comparison during the graph's construction and search processes.

The primary purpose of this abstraction is to enable the implementation of various strategies.
For example, it opens the door to constructing the graph using the original float vectors while performing searches using their quantized int8 vector counterparts.
2023-09-12 13:57:07 +01:00
Tony-X d77195d705
Document why we need `lastPosBlockOffset` (#12541)
* Document why we need `lastPosBlockOffset`

* Let ./gradlew tidy fix the formatting

* Fix '<' with &lt;

---------

Co-authored-by: Tony Xu <tonyx@amazon.com>
2023-09-12 07:32:58 -04:00
Michael McCandless 57dd5a4bda
The bitsRequired passed during NodeHash rehash (when building an FST) (#12545) 2023-09-09 19:14:18 -04:00
Luca Cavanna a7202e2e6f
Close index readers in tests (#12544)
There are a few places where tests don't close index readers. This has
not caused problems so far, but it becomes an issue when the reader gets
an executor, because its shutdown happens as a closing listener of the
reader. This has become more evident since we now offload sequential
execution to the executor. If there's an executor, but it's never used,
no threads are created, and no threads are leaked. If we do use the
executor, and the reader is not closed, the test leaks threads.
2023-09-08 14:55:01 +02:00
Christine Poerschke ef42af65f2
clarify QueryVisitor.acceptField javadoc w.r.t. not being term-specific (#12540) 2023-09-06 11:18:46 +01:00
Luca Cavanna d62ca4a01f add missing changelog entry for #12498 2023-09-05 16:41:38 +02:00
Luca Cavanna da894151a6
Offload single slice to executor (#12515)
When an executor is set to the IndexSearcher, we should try and offload
most of the computation to such executor. Ideally, the caller thread
would only do light coordination work, and the executor is responsible
for the heavier workload. If we don't offload sequential execution to
the executor, it becomes very difficult to make any distinction about
the type of workload performed on the two sides.

Closes #12498
2023-09-05 16:30:20 +02:00
Luca Cavanna 947b2c5e5a
Unwrap execution exceptions cause and rethrow as is when possible (#12516)
When performing concurrent search, we may get an execution exception
from one or more slices. In that case, we'd like to rethrow the cause of
the execution exception, which we do by wrapping it into a new runtime
exception. Instead, we can rethrow runtime exceptions as-is, and the
same is true for io exceptions. Any other exception is still wrapped
into a new runtime exception. This unifies the exceptions that get
thrown between sequential codepath (when no executor is provided) and
concurrent codepath (when an executor is provided).
2023-09-05 15:55:48 +02:00
Chaitanya Gohel d631615665
Honor topvalue while determining isMissingvalueCompetitive in case bottom is not set (#12520) 2023-09-04 18:25:34 +02:00