Commit Graph

289 Commits

Author SHA1 Message Date
Jojii
c15adf5c72 allow stopping segment loading (#3498)
* allow stopping segment loading

* fix benches
2024-02-08 12:52:03 +01:00
Jojii
7f33ac1f63 Optimize MatchAny (#3525)
* add benches for large MatchAny

* use HashSet for MatchAny

* use fnv hash

* make fnv workspace level dependency; apply clippy

* remove SmolStr from Keyword; Improve performance

* add bench for small number of keywords

* fix openapi

* fix performance issue

* apply integer optimization; create magic number constant
2024-02-08 12:50:58 +01:00
Tim Visée
0301e39943 Dynamic CPU saturation internals (#3364)
* Move CPU count function to common, fix wrong CPU count in visited list

* Change default number of rayon threads to 8

* Use CPU budget and CPU permits for optimizer tasks to limit utilization

* Respect configured thread limits, use new sane defaults in config

* Fix spelling issues

* Fix test compilation error

* Improve breaking if there is no CPU budget

* Block optimizations until CPU budget, fix potentially getting stuck

Our optimization worker now blocks until CPU budget is available to
perform the task.

Fix potential issue where optimization worker could get stuck. This
would happen if no optimization task is started because there's no
available CPU budget. This ensures the worker is woken up again to
retry.

* Utilize n-1 CPUs with optimization tasks

* Better handle situations where CPU budget is drained

* Dynamically scale rayon CPU count based on CPU size

* Fix incorrect default for max_indexing_threads conversion

* Respect max_indexing_threads for collection

* Make max_indexing_threads optional, use none to set no limit

* Update property documentation and comments

* Property max_optimization_threads is per shard, not per collection

* If we reached shard optimization limit, skip further checks

* Add remaining TODOs

* Fix spelling mistake

* Align gRPC comment blocks

* Fix compilation errors since last rebase

* Make tests aware of CPU budget

* Use new CPU budget calculation function everywhere

* Make CPU budget configurable in settings, move static budget to common

* Do not use static CPU budget, instance it and pass it through

* Update CPU budget description

* Move heuristic into defaults

* Fix spelling issues

* Move cpu_budget property to a better place

* Move some things around

* Minor review improvements

* Use range match statement for CPU count heuristics

* Systems with 1 or 2 CPUs do not keep cores unallocated by default

* Fix compilation errors since last rebase

* Update lib/segment/src/types.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

* Update lib/storage/src/content_manager/toc/transfer.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

* Rename cpu_budget to optimizer_cpu_budget

* Update OpenAPI specification

* Require at least half of the desired CPUs for optimizers

This prevents running optimizations with just one CPU, which could be
very slow.

* Don't use wildcard in CPU heuristic match statements

* Rename cpu_budget setting to optimizer_cpu_budget

* Update CPU budget comments

* Spell acquire correctly

* Change if-else into match

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

* Rename max_rayon_threads to num_rayon_threads, add explanation

* Explain limit in update handler

* Remove numbers for automatic selection of indexing threads

* Inline max_workers variable

* Remove CPU budget from ShardTransferConsensus trait, it is in collection

* small allow(dead_code) => cfg(test)

* Remove now obsolete lazy_static

* Fix incorrect CPU calculation in CPU saturation test

* Make waiting for CPU budget async, don't block current thread

* Prevent deadlock on optimizer signal channel

Do not block the optimization worker task anymore to wait for CPU budget
to be available. That prevents our optimizer signal channel from being
drained, blocking incoming updates because the cannot send another
optimizer signal. Now, prevent blocking this task all together and
retrigger the optimizers separately when CPU budget is available again.

* Fix incorrect CPU calculation in optimization cancel test

* Rename CPU budget wait function to notify

* Detach API changes from CPU saturation internals

This allows us to merge into a patch version of Qdrant. We can
reintroduce the API changes in the upcoming minor release to make all of
it fully functional.

---------

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-01-31 11:56:34 +01:00
Tim Visée
cf8d13cf6c Rename IntegerParams to IntegerIndexParams to be consistent with text (#3385) 2024-01-12 16:16:22 +01:00
Tim Visée
e42f35b623 Parameterize integer index, allow lookup or range exclusively (#3380)
* Merge serde attributes

* Remove obsolete conversion

* Add integer type with parameters

* Make integer lookup and range parameters non-optional

* Add parameterized integer index types test

Co-authored-by: Di Zhao <diz@twitter.com>

* Cleanup

---------

Co-authored-by: Di Zhao <diz@twitter.com>
2024-01-11 18:41:14 +00:00
Arnaud Gourlay
2cd426dccf Fix clippy 1.75 (#3270) 2023-12-25 13:26:21 +00:00
Ivan Pleshkov
84f9011537 sparse vectors with large indices support (#3230)
* sparse vectors with large indices support

* fix unit tests

* add tracker file to snapshot

* fix unit tests

* are you happy clippy

* fix config loading

* test with max value

* fix python tests

* fix consensus tests

* review remarks; acc test for inverted index
2023-12-16 00:02:01 +00:00
Ivan Pleshkov
4f0211af5e Remove quantization update from hnsw index (#3221)
* remove quantization update from hnsw index

* test that hnsw was builded with presented quantization

* are you happy codespell

* prefer method over public field

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-12-15 13:00:28 +00:00
Ivan Pleshkov
c054773296 Load non-appendable ram sparse vector index from file (#3154)
* internal sparse vector segment configs

update openapi

fix build

provide correct index type to fixtures

internal sparse vector segment configs

update openapi

fix build

load ram sparse index from file

fix spelling

add test

spelling error

use appendable flag to decide load or not

fix conflict

dont flush mmap when file is empty

* fix build

* set list of files for snapshot

* fix snapshots test

* fix codespell

* simple save-load unit test

* refactor InvertedIndex::files

* fix unit tests

* add debug_assert

* test all persistence loading cases
2023-12-06 17:36:08 +01:00
Ivan Pleshkov
83e2e167e8 Internal sparse configs for segment (#3168)
* internal sparse vector segment configs

update openapi

fix build

provide correct index type to fixtures

rename grpc stuff

optional search threshold

update api consistency

* review fix

* rollback rename

* reger docs

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-12-06 13:28:17 +01:00
Arnaud Gourlay
32e1bbb601 Fix sparse mmap snapshot (#3166) 2023-12-06 10:58:11 +01:00
Ivan Pleshkov
7d57fb8859 Sparse vectors advanced search api support (#3128)
* sparse vectors query scorer

plain search test without internals

fix sparse_vector_index_plain_search

fix async scorer build

fix unit tests

are you happy fmt

sparse index with full query support

fix benches, use exact flag to force plain search

add alias and comment to exact flag

fix tests

recommendations TODOs fix

add simple test

add todo

refactor index

test vs comparison dense and sparse discovery

are you happy fmt

propogate error from avg negatives

reuse filtered points list

rollback api changes

better discovery test

are you happy fmt

rollback openapi

fix build

fix tests

review remark recommendations

review remarks

review remarks

codespell

integrate plain search

Update lib/collection/src/recommendations.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

Update lib/collection/src/recommendations.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

Update lib/collection/src/recommendations.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

fix comment of plain search

Update lib/collection/src/recommendations.rs

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

fix tests

* simplify search query function
2023-12-05 20:32:23 +01:00
Arnaud Gourlay
032025c447 Fix optimizer change sparse index on disk (#3143)
* Estimate sparse vector dimension for optimizer (#3142)

* Estimate sparse vector dimension for optimizer

* add hack explanation + todo

Fix optimizer change sparse index on disk

fix index to disk

is appendable fix

add index files if necessary

fix test

* fix tests

---------

Co-authored-by: Ivan Pleshkov <pleshkov.ivan@gmail.com>
2023-12-05 00:24:30 +01:00
Ivan Pleshkov
d272bf4b90 Sparse index persistence (#3131)
* sparse index persistence

* fix tests

* remove defaults
2023-12-04 12:02:53 +01:00
Kaan C. Fidan
c7402a45d7 Manhattan distance (#3079)
* implemented Manhattan distance

* updated quantization dependency

* fixed negative distances and doc consistency

* fixed neon implementation

* updated quantization dependency

* updated quantization dependency

* removed redundant copy operation

* updated quantization dependency

* Change back to upstream quantization dependency

---------

Co-authored-by: timvisee <tim@visee.me>
2023-12-02 21:28:38 +01:00
Ivan Pleshkov
336efea59e Sparse index segment and collection config (#2802)
* quantization storage as separate entity

sparse index try to extend segment types

fix build

fix async scorer

codespell

update openapi

update vector index

remove code duplications

more fixes

more fixes

fix build

fix deserialization test

remove transform_into

are you happy clippy

update openapi

update openapi

are you happy clippy

fix build

optional serialize

more defaults

update openapi

fix comments

generic transpose_map_into_named_vector

rename fields in tests

remove obsolete parts

only named sparse config

VectorStruct without unnamed sparse

NamedVectorStruct without unnamed sparse

remove obsolete test

update openapi

mmap index

revert preprocess function

are you happy fmt

update openapi

fix build

fix tests

are you happy fmt

fix for client generation

fix sparse segment creation

fix basic sparse test

fix conflicts

remove obsolete convertion

fix build

config diffs

update openapi

review remarks

update openapi

fix batch upsert

add failing test showing bad ids matching

fix sparse vector insertion

remove on_disk flag

update openapi

revert debug assert

simplify conversions

update openapi

remove on disk storage flag

update openapi

default for vector config

update openapi comment

remove diffs

update openapi

* enable consensus test

* add comment

* update openapi
2023-12-01 13:10:58 +01:00
Ivan Pleshkov
db330370d4 Sparse vector storage rocksdb only (#3112)
* sparse vector storage rocksdb only

* fix build

* spelling fix

* simplify get_cf

* restore deleted flags loading
2023-11-30 17:48:19 +01:00
Arnaud Gourlay
bbc7b37123 Accept empty sparse vectors (#3057)
* Accept empty sparse vectors

* sparse vector index is responsbile for filtering empty vectors
2023-11-21 11:27:12 +01:00
Ivan Pleshkov
0607be64c9 Sparse vectors rest search and upsert (#3051)
* sparse vector sparse search and upsert

are you happy fmt

fix build

update openapi

batch changes

update openapi

named sparse vector

* review remarks

* cowvalue to cowvector
2023-11-21 09:18:15 +01:00
Arnaud Gourlay
d69b38a05d Better heuristic for sparse vector pruning (#3048) 2023-11-20 15:58:10 +01:00
Arnaud Gourlay
3a0353ede0 Deactivate sparse index pruning for negative query vectors (#3024) 2023-11-16 10:51:02 +01:00
Arnaud Gourlay
6266a438f0 Add fallback to plain search for sparse vectors (#2963) 2023-11-14 19:58:52 +01:00
Arnaud Gourlay
46c5b2a30c Fix vector count in sparse index (#2992)
* Fix vector count in sparse index

* simplify naming

* rely on max id for count
2023-11-14 17:31:18 +01:00
Arnaud Gourlay
1ae1f483d4 Benchmark sparse filter plain search (#2947)
* Sparse filter plain search

* code review
2023-11-09 09:57:43 +01:00
Arnaud Gourlay
6d5fa056b9 Sparse vector search benchmarks (#2944) 2023-11-08 13:07:33 +01:00
Arnaud Gourlay
b3aea28426 Extra tests for Sparse Vector Index (#2925) 2023-11-07 15:03:37 +01:00
Arnaud Gourlay
ec2dc36719 SparseVectorIndex implements VectorIndex (#2900)
* SparseVector implements VectorIndex

* dedicated telemetry

* conflict

* easy code reviews

* simplify tracking indexed points count

* move telemetry conversion to sparse file

* move max_result_count out of inverted index trait

* unify sparse vector fixtures

* simpler conversion

* add todo regarding OOM potential

* reuse check deleted from raw scorer with TODO

* change new to open to handle mmap index
2023-11-03 16:23:05 +01:00
Ivan Pleshkov
cb917ea0db raw scorer with operation result (#2897) 2023-10-31 23:44:20 +01:00
Luis Cossío
7dd2efa6e0 increase ef to get better precision on tests (#2894) 2023-10-30 22:33:11 +01:00
Luis Cossío
3b17deb259 Discovery search handler at hnsw level (#2836)
* add discovery_search_with_graph handler

* add precision test

* rename `DiscoveryPair` -> `ContextPair`

* review fixes

* renames + comments

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-10-26 19:36:15 -04:00
Andrey Vasnetsov
fa3aebe660 optimize usage of the match-any filter in case it is empty (#2803)
* optimize usage of the match-any filter in case it is empty

* fix outdated tests
2023-10-12 15:45:32 +02:00
Ivan Pleshkov
8cdeda26d8 Quantization storage as separate entity (#2797)
* quantization storage as separate entity

* simplify max threads calculation
2023-10-12 11:21:34 +02:00
Ivan Pleshkov
baf7e5fc82 fix rescoring for small cardinality case (#2789)
* fix rescoring for small cardinality case

* remove obsolete comment

* review fix
2023-10-11 13:57:29 +02:00
Arnaud Gourlay
3bff12dba6 Make GeoPolygon interiors optional (#2766) 2023-10-05 18:34:39 +02:00
Zein Wen
5c7b57c970 Extend GeoPolygon to support interiors (#2315)
* Extend GeoPolygon to support interiors (#2315)

Per GeoJson, we should support polygon with exterior and interiors (holes on the surface) in Geo Filter by Polygon(#795). This commit extend current GeoPolygon filter to accept interiors. It includes:

1. changes to proto and internal GeoPolygon struct, and validation fn
2. add and refactor some tests
3. add integration test

* add gRPC geo_polygon validation

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2023-10-04 11:57:51 +02:00
Arnaud Gourlay
2e4729a1f3 Promote operation error to dedicated file (#2736) 2023-09-29 16:23:24 +02:00
Arnaud Gourlay
5bb80fbc77 Move ScoredPointOffset into common (#2734) 2023-09-28 12:11:29 +02:00
Ivan Pleshkov
3ffaa76d8c Search rescoring modes (#2628)
* search rescoring modes

* fix tests build

* use bool option in rest api

* minor refactoring

* fmt

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-09-24 16:27:05 +02:00
Luis Cossío
4e24ce2219 Increase acceptable stopping delay, better debug info in test_building_cancellation (#2713) 2023-09-22 09:42:28 -03:00
Arnaud Gourlay
74980c0439 Fix cardinality estimation for Any matcher (#2710) 2023-09-21 19:42:03 +02:00
Tim Visée
b62ab26f1f Fix test_building_cancellation flakiness with different delays (#2697)
* Reduce flakiness of `test_building_cancellation` with 5k base segment

* use fixed acceptable stopping delay, and relative cancelling delay

* Remove debug statement

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2023-09-20 10:56:33 +02:00
Tim Visée
9b848e5929 Reduce flakiness of test_building_cancellation with larger base seg… (#2682)
* Reduce flakiness of `test_building_cancellation` with larger base segment

* Change number of points to 2k, increase timeouts a bit
2023-09-18 14:31:57 -03:00
Josh Soref
a0bbc40bc9 Spelling (#2658)
* spelling: accumulating

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: and

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: back

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: batching

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: been

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: benchmark

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: collections

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: confusion

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: consensus

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: decrease

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: equal

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: minimal

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: oversampling

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: paths

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: points

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: prevent

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: protobuf

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: proxied

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: randomness

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: recover

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-09-14 11:38:23 +02:00
Ivan Pleshkov
7d9662d19a Fix flaky test in quantization oversampling (#2629) 2023-09-11 14:56:43 +02:00
Luis Cossío
562b3aa070 fix clippy errors on segment_builder_test.rs (#2606) 2023-09-06 12:32:10 -03:00
Luis Cossío
3558c71285 fix test_building_cancellation (#2094) 2023-09-06 11:34:01 -03:00
Luis Cossío
b25fc4c8ea Refactor batch search to allow different scorers (#2529)
* add enum for vector query on segment search

* rename newly introduced types

* fix: handle QueryVector on async scorer

* handle QueryVector in QuantizedVectors impl

* fix async scorer test after refactor

* rebase + refactor on queue_proxy_shard.rs

* constrain refactor propagation to segment_searcher

* fmt

* fix after rebase
2023-09-05 09:26:24 -03:00
Ivan Pleshkov
2a29cf0241 immutable map index integration (#2524)
* immutable map index integration

* remove wipe

* fix unit tests

* get appendable flag from config

* minor refactoring

* fix chunked mmap appendable flag

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-09-04 15:24:52 +02:00
Ivan Pleshkov
fef89e84b9 fix flaky oversampling test (#2494)
* fix unstable oversampling test

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-08-23 11:26:54 +02:00
Ivan Pleshkov
db3f712b4d fix quantization oversampling (#2478) 2023-08-21 18:04:38 +02:00