Commit Graph

743 Commits

Author SHA1 Message Date
Arnaud Gourlay
6157fe8585 Fix bench for sparse vector build index (#3617) 2024-03-05 17:07:37 +01:00
Ivan Pleshkov
97e0ae1716 text index immutable state without documents (#3497)
color ci into green

immutable index tests

deletion test

separate filter function

are you happy fmt

add shrink_to_fit

refactor estimate_cardinality

check is points_count is zero
2024-03-05 17:07:34 +01:00
Arnaud Gourlay
385840a67a Decrease sparse vector index build bench parameters (#3609) 2024-03-05 17:07:32 +01:00
amietn
5d162707b2 Fix geo radius panic (#3608)
* Fix geo radius filter panic

* Empty-Commit

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-05 17:07:29 +01:00
dependabot[bot]
47f3d01819 Bump num-traits from 0.2.17 to 0.2.18 (#3599)
Bumps [num-traits](https://github.com/rust-num/num-traits) from 0.2.17 to 0.2.18.
- [Changelog](https://github.com/rust-num/num-traits/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-traits/compare/num-traits-0.2.17...num-traits-0.2.18)

---
updated-dependencies:
- dependency-name: num-traits
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 17:07:04 +01:00
dependabot[bot]
e8ccee3156 Bump num-derive from 0.4.1 to 0.4.2 (#3598)
Bumps [num-derive](https://github.com/rust-num/num-derive) from 0.4.1 to 0.4.2.
- [Changelog](https://github.com/rust-num/num-derive/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-derive/compare/num-derive-0.4.1...num-derive-0.4.2)

---
updated-dependencies:
- dependency-name: num-derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 17:07:02 +01:00
dependabot[bot]
282c63c74c Bump chrono from 0.4.33 to 0.4.34 (#3601)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.33 to 0.4.34.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.33...v0.4.34)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 17:06:57 +01:00
dependabot[bot]
b59145cec0 Bump tempfile from 3.9.0 to 3.10.0 (#3596)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.9.0 to 3.10.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.9.0...v3.10.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 17:06:54 +01:00
Arnaud Gourlay
02004c8720 Pool larger memory batches for sparse vector search (#3560)
* Pool larger memory batches for sparse vector search

* rework naming

* refine naming

* address great comments

* bump ADVANCE_BATCH_SIZE to use power of 2

* 16k performs bad - trying 8k

* 10k offers the best tradeoff
2024-03-05 17:06:10 +01:00
Luis Cossío
475c1aadf6 refactor: add DateTime wrapper (#3578)
* Refactor datetime deserialization and timestamp representation into newtype

* implement `FromStr` instead of custom fn
2024-03-05 17:06:02 +01:00
generall
4781170d84 fix merge conflict 2024-03-05 17:04:54 +01:00
ding-young
112b5d66f3 Support Min should clause (#3331) (#3466)
* Add min_should field in Filter struct

* min_should clause checks whether at least given number (min_count) of conditions are met
* modify test cases due to change in Filter struct (set min_should: None)
* add simple condition check unit test
* docs, cardinality estimation, grpc not implemented yet

* Add min_should field in Filter struct

* min_should clause checks whether at least given number (min_count) of conditions are met
* modify test cases due to change in Filter struct (set min_should: None)
* add simple condition check unit test

* Impl min_should clause in REST API

* perform cardinality estimation by estimating cardinalities of intersection and combining as union
* add openapi spec with docs update
* add integration test

* Impl min_should clause in gRPC

* Cargo fmt & clippy

* Fix minor comments

* add equivalence test between min_should and must

* shortcut at min_count matches

* use `Filter::new_*` whenever possible

* Add missing min_should field

* Fix gRPC field ordering & remove deny_unknown_fields

* Empty commit

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-03-05 17:04:51 +01:00
Ivan Pleshkov
b876203ba8 Allocate all chunks data in chunked vectors except the last one (#3580)
* allocate all chunks data in chunked vectors except last one

* more readable for

* more readable comments
2024-03-05 17:04:44 +01:00
Luis Cossío
fb46ec8af1 Order-by: support datetimes (#3540)
* support \`start_from\`: DateTime

* add order by datetime test

* generate openapi models and grpc docs

* fixup after rebase

* allow string representation of datetime in grpc

* add TODO

* fix `.start_from()`

* use custom deserialization on datetime
2024-03-05 17:04:26 +01:00
Arnaud Gourlay
b622b7f48a Configure default RocksDB column family (#3565) 2024-03-05 17:04:23 +01:00
Luis Cossío
e4044ea738 Order-by: use pre-filtering for high-constraining filters (#3562)
* use pre-filtering for high-constraining filters

* fix repeated points
2024-03-05 17:04:18 +01:00
Zihong Lin
5c08c27233 Extend datetime formats in REST API (#3529) (#3549)
* Extend datetime formats in REST API (#3529)

* Fix linter problem

* Support indexing and condition checking and optimize tests

* Update lib/segment/src/types.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/types.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/types.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Add some more tests for wrong or unsupported datetime format

* Reformat

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:04:04 +01:00
Jojii
8ae92d4716 allow stopping segment loading (#3498)
* allow stopping segment loading

* fix benches
2024-03-05 17:04:02 +01:00
Jojii
3ee5aac011 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-03-05 17:03:59 +01:00
Luis Cossío
7d0e4e76ff Fix clippy 1.77 lints: explicitly set truncate flag on file creation (#3561)
* add `truncate(true)` where unspecified

* remove unused `WriteGuard` wrapper

* Don't truncate if we explicitly set the size later

---------

Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:03:56 +01:00
Luis Cossío
ffa27c4fd2 Order-by: Introduce OrderingValue for ordering also based on int values (#3533)
* introduce `OrderingValue` for ordering also based on int values

* use `num-cmp` for comparing ints and floats

* Update comparison logic

---------

Co-authored-by: Albert Safin <xzfcpw@gmail.com>
2024-03-05 17:02:53 +01:00
Arnaud Gourlay
7ffb1b6a4f Apply RocksDB options to all column families (#3557)
* Apply RocksDB options to all column families

* clean
2024-03-05 17:01:45 +01:00
dependabot[bot]
1f8b29b155 bump io-uring from 0.6.2 to 0.6.3 (#3539)
---
updated-dependencies:
- dependency-name: io-uring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:57:58 +01:00
Luis Cossío
9c93020bde Datetime index: Introduce RangeInterface (#3516)
* merge range and datetime range into one interface

* remove separate datetime_range from FieldCondition

* review fixes, remove code duplication. Thanks @xzfc

* update openapi test
2024-03-05 16:57:54 +01:00
Tim Visée
c6407abbb3 Dynamic CPU saturation integration (#3115)
* Integrate dynamic CPU saturation with public API changes

This reverts commit 08930fefa9.

* Call num_cpus only once
2024-03-05 16:57:43 +01:00
Luis Cossío
320b7f2621 order_by in scroll (#3493)
* first PR implementation (#2865)

- fetch offset id
- restructure tests
- only let order_by with numeric
- introduce order_by interface

cargo fmt

update openapi

calculate range to fetch using offset + limit, do some cleanup

enable index validation, fix test

Fix pagination

add e2e tests

make test a little more strict

select numeric index on read_ordered_filtered

add filtering test 🫨

fix filtering on order-by

fix pip requirements

add grpc interface, make read_ordered_filtered fallible

fmt

small optimization of `with_payload` and `with_vector`

refactor common logic of point_ops and local_shard_operations

Make filtering test harder and fix limit for worst case

update openapi

small clarity refactor

avoid extra allocation when sorting with offset

stream from numeric index btree instead of calculating range

use payload to store order-by value, instead of modifying Record interface

various fixes:
- fix ordering at collection level, when merging shard results
- fix offset at segment level, to take into account also value offset
- make rust tests pass

remove unused histogram changes

fix error messages and make has_range_index exhaustive

remove unused From impl

Move OrderBy and Direction to segment::data_types::order_by

Refactor normal scroll_by in local_shard_operations.rs

More cleanup + rename OrderableRead to StreamWithValue

empty commit

optimization for merging results from shards and segments

fix case of multi-valued fields

fix IntegerIndexParams name after rebase

precompute offset key

use extracted `read_by_id_stream`

Expose value_offset to user
- rename offset -> value_offset
- extract offset value fetching logic

* remove offset functionality when using order_by

* include order_by in ForwardProxyShard

* extra nits

* remove histogram changes

* more nits

* self review

* resolve conflicts after rebase, not enable order-by with datetime index schema

* make grpc start_from value extendable

* gen grpc docs

---------

Co-authored-by: kwkr <kawka.maciej.93@gmail.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-05 16:57:35 +01:00
Ivan Pleshkov
7031d194ae filed index point to values as separate struct (#3297)
numeric index

immutable geo index

are you happy clippy

use ImmutablePointToValues in geo index

flatten point and values

is_appendable flag

flatten points_map

unit tests

fix unit tests

are you happy fmt

more tests
2024-03-05 16:57:31 +01:00
Roman Titov
99b750fcfa Add clock_tag field to update operations (#3408) 2024-03-05 16:57:21 +01:00
Tim Visée
1951426533 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-03-05 16:57:12 +01:00
xzfc
2f76603ddf DateTime payload index (#3395)
* Datetime payload index

* Introduce IndexMapItem

* Drop FieldIndex::DatetimeIndex

* Rename OpenAPI struct names

* Switch to microseconds

* Validate and serialize grpc timestamps

* Add tests with different timezones

* minor review fixes

* Revert "Drop FieldIndex::DatetimeIndex"

This reverts commit d55f251afd.

* Revert "Introduce IndexMapItem"

This reverts commit c5255f6b1a.

* fix: back to microseconds after reverts

* extract range conversion from boxed checker fn

* add log to deps

* don't run macro doctest

* no_run -> ignore

* remove prost-types in favor of prost-wkt-types

* better assertion on test_payload_indexing.py

* propagate unparsable datetime

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-03-05 16:57:08 +01:00
Tim Visée
1ec9e6493c Demote thread priority setting warning to debug message (#3494) 2024-03-05 16:57:04 +01:00
Tim Visée
71bcbf4bb3 Move common dependencies to workspace (#3490) 2024-03-05 16:56:33 +01:00
Luis Cossío
1fddcb55df Fix potential context search edge case (#3374)
* constrain loss to [0, -1)

* fmt

* update 2-d model link
2024-03-05 16:56:18 +01:00
dependabot[bot]
a3a22dbb93 Bump chrono from 0.4.31 to 0.4.33 (#3483)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.31 to 0.4.33.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.31...v0.4.33)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:55:55 +01:00
dependabot[bot]
bd0208dd1d Bump memmap2 from 0.9.3 to 0.9.4 (#3484)
Bumps [memmap2](https://github.com/RazrFalcon/memmap2-rs) from 0.9.3 to 0.9.4.
- [Changelog](https://github.com/RazrFalcon/memmap2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/RazrFalcon/memmap2-rs/compare/v0.9.3...v0.9.4)

---
updated-dependencies:
- dependency-name: memmap2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:55:51 +01:00
Arnaud Gourlay
ecd62fb0d3 Remove doctest usage (#3475) 2024-03-05 16:55:21 +01:00
Ivan Pleshkov
f6b081d967 Filed index point-to-values as separate struct (#3296)
* filed index point to values as separate struct

* numeric index

* return removed values

* add comments

* codespell

* add unit test

* fix counters

* review remarks
2024-03-05 16:52:46 +01:00
dependabot[bot]
966111222c Bump uuid from 1.6.1 to 1.7.0 (#3441)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.6.1...1.7.0)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:51:59 +01:00
dependabot[bot]
6367ba9f40 Bump smol_str from 0.2.0 to 0.2.1 (#3440)
Bumps [smol_str](https://github.com/rust-analyzer/smol_str) from 0.2.0 to 0.2.1.
- [Commits](https://github.com/rust-analyzer/smol_str/commits)

---
updated-dependencies:
- dependency-name: smol_str
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:51:44 +01:00
dependabot[bot]
f5f4ccec0c Bump rayon from 1.8.0 to 1.8.1 (#3437)
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.8.0 to 1.8.1.
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.8.0...rayon-core-v1.8.1)

---
updated-dependencies:
- dependency-name: rayon
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:51:32 +01:00
Arnaud Gourlay
b26b87c8d5 Remove unused dependencies (#3435) 2024-03-05 16:49:09 +01:00
dependabot[bot]
c1bc4d5896 Bump semver from 1.0.20 to 1.0.21 (#3399)
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.20...1.0.21)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:47:49 +01:00
dependabot[bot]
12b93f7e20 Bump atomicwrites from 0.4.2 to 0.4.3 (#3396)
Bumps [atomicwrites](https://github.com/untitaker/rust-atomicwrites) from 0.4.2 to 0.4.3.
- [Commits](https://github.com/untitaker/rust-atomicwrites/compare/0.4.2...0.4.3)

---
updated-dependencies:
- dependency-name: atomicwrites
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:47:34 +01:00
Tim Visée
41b7a55e16 Fix multiple vector updates on same point in batch not working (#3386)
* Fix merge of vector operations, don't drop earlier updates on same point

* Add unit test for vector struct merging

* Add integration test for fix, also covering bug report
2024-03-05 16:47:28 +01:00
Tim Visée
3281be7402 Rename IntegerParams to IntegerIndexParams to be consistent with text (#3385) 2024-03-05 16:47:18 +01:00
Tim Visée
820ade7494 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-03-05 16:47:07 +01:00
Arnaud Gourlay
7ceaf73a46 Handle empty sparse vector search (#3368) 2024-03-05 16:46:27 +01:00
dependabot[bot]
861714196b Bump tempfile from 3.8.1 to 3.9.0 (#3353)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.8.1 to 3.9.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.8.1...v3.9.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 16:46:10 +01:00
Tim Visée
cf7f78b77b Custom thread priorities on Linux (#3235)
* Set high/low priority for consensus and HNSW threads

* Make setting thread priority Linux specific

* Fix compilation on non-Linux platforms

* Remove unused dependencies from Cargo.toml

* Rename function

* Add warning that setting lower nice is likely to fail
2024-03-05 16:44:33 +01:00
Tim Visée
88c493c051 Bump sysinfo to 0.30.3 (#3310)
* Bump sysinfo to 0.30.3

* Remove redundant refresh, new_with_specifics already refreshes
2024-03-05 16:44:24 +01:00