Commit Graph

320 Commits

Author SHA1 Message Date
Luis Cossío
7ef8012c79 remove secondary ordering by id description from order_by parameter (#3589) 2024-03-05 17:07:26 +01:00
Ivan Pleshkov
4397b28530 Validate sparse indices in grpc search (#3225)
* validate sparse indices in grpc search

* add test

* validate into vector conversion
2024-03-05 17:06:04 +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
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
Andrey Vasnetsov
69b6a9866e Print version on startup (#3581)
* add logging of the version and git commit ID to the welcome message

* review fixes
2024-03-05 17:04:47 +01:00
Tim Visée
f08df0b22e Add endpoint to request recovery point for remote shard (#3510)
* Add initial gRPC call for requesting WAL recovery point for remote shard

* Add remote shard method to request WAL recovery point

* Add recovery point type in gRPC, use it in recovery point functions

* Add function to extend recovery point with missing clocks from clock map

* Add new gRPC type for recovery point clocks

* Remove atomic loading, because we use regular integers now
2024-03-05 17:04:41 +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
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
Roman Titov
08831f9d2a Add force field to the ClockTag type (#3530) 2024-03-05 16:58:12 +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
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
71bcbf4bb3 Move common dependencies to workspace (#3490) 2024-03-05 16:56:33 +01:00
Gabriel
3392407f6a API for checking collection exists (#3472)
* saving progress

* tests assertions are working

* fixed lint

* fixed typo, existance -> existence

* added timing on grpc

* added timing on grpc

* fixed double time
2024-03-05 16:55:27 +01:00
Andrey Vasnetsov
e59280f1bb Revert "fix: Include git commit id while building docker image if possible" (#3468) 2024-03-05 16:52:57 +01:00
Kumar Shivendu
de5d120197 fix: Include git commit id while building docker image if possible (#3419)
* feat: Print commit id in dev container build workflow

* fix: Keep .git while building Qdrant binary in docker

* fix: Remove redundant printing of git commit id

* fix: Copy only git files first

* fix: Docker build should have commit id if present

* refactor: Use fewer lines of code
2024-03-05 16:52:51 +01:00
xzfc
a11c6f6a5b add optional checksum to snapshot recovery request (#3381)
* add optional checksum to snapshot recovery request

* Update openapi yaml files

* Add pytests for snapshots restoration
2024-03-05 16:52:38 +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
Arnaud Gourlay
b26b87c8d5 Remove unused dependencies (#3435) 2024-03-05 16:49:09 +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
kwkr
4296226555 Add checksum to SnapshotDescription (#2840)
* add checksum to SnapshotDescription

* implement storing snapshot checksums in a file

* Don't serialize checksum if it's None for backwards compatibility

* Remove hex dependency, use Rust std formatter for this

* Do not error if we cannot remove checksum file for snapshot

Some snapshots may not have a corresponding checksum file. Maybe it was
created in an older Qdrant version that didn't have support for this, or
a user hasn't provided any.

* Add debug message when hashing snapshot, can be expensive on large files

* Inline debug messages

* Add checksum to shard snapshots

* If creating snapshot fails, delete snapshot target and checksum file

* Use Rust idiomatic ok() and improve debug messages

* Use correct snapshot checksum paths, clean up after shard snapshot

* Use better path type in get_checksum_path

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2024-03-05 16:46:31 +01:00
Kumar Shivendu
0fe19cfb60 feat: Expose git commit id in the health check endpoint (#3346)
* feat: Expose git commit id in the health check endpoint

* fix: CI errors

* test: Add test for health check api

* feat: Add / endpoint to openapi schema

* Make git commit hash optional

* ci: Enable debugging setup-protoc action

* Install later protobuf compiler through GitHub Action

* Disable debug mode for setup-protoc job

* refactor: Use commit instead of commit_id

* fix: Use commit instead of commit_id gRPC docs

* test: Update ping API test

* refactor: Rename ping api to root api

---------

Co-authored-by: timvisee <tim@visee.me>
2024-03-05 16:46:04 +01:00
dependabot[bot]
b7a3ae933a Bump tokio from 1.35.0 to 1.35.1 (#3285)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.35.0 to 1.35.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.0...tokio-1.35.1)

---
updated-dependencies:
- dependency-name: tokio
  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:43:43 +01:00
dependabot[bot]
11ebb5d8a7 Bump mio from 0.8.9 to 0.8.11 (#3771)
* Bump mio from 0.8.9 to 0.8.11

Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.9 to 0.8.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.8.9...v0.8.11)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Resolve clippy warnings

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: timvisee <tim@visee.me>
2024-03-05 10:38:41 +01:00
Tim Visée
7aa164bd2d Bump version to 1.7.4 (#3478) 2024-01-29 16:33:27 +01:00
Andrey Vasnetsov
c6a351c82d bump version 1.7.3 (#3256) 2023-12-19 20:19:33 +00:00
Ivan Pleshkov
bd6bd55033 Rename VectorType to DenseVector (#3192)
* rename vectortype to densevector

* rename enums

* are you happy fmt

* openapi

* revert type renamings
2023-12-19 19:26:50 +00:00
dependabot[bot]
a061da1738 Bump tokio from 1.34.0 to 1.35.0 (#3206)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.34.0 to 1.35.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.34.0...tokio-1.35.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2023-12-19 19:26:43 +00:00
Tim Visée
5848d0cbe6 Bump version to 1.7.2 (#3218) 2023-12-12 19:01:26 +01:00
Tim Visée
97b2483660 Bump version to v1.7.1 (#3197) 2023-12-11 21:34:42 +01:00
Andrey Vasnetsov
dbab7f8c1c bump version 1.7.0 (#3175) 2023-12-08 01:46:36 +01:00
Tim Visée
83c0606be9 Make point, vector and indexed vector counts optional in collection info (#2785)
* Make point, indexed point and vector counts optional in collection info

* Update OpenAPI specification and gRPC docs

* Use functional entry API

* Mark point/vector count fields as deprecated

* Use internal collection info structure to remove internal optionals

* Don't deprecate, but mark point counts as approximate
2023-12-06 17:21:55 +01:00
Roman Titov
cb46a73609 Extend /readyz with shards readiness check (#3053, #3084)
Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2023-12-06 17:20:29 +01:00
dependabot[bot]
358a5e4594 Bump uuid from 1.5.0 to 1.6.1 (#3151)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.5.0...1.6.1)

---
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>
2023-12-06 17:20:13 +01:00
Arnaud Gourlay
0935ab5751 Fix naming gRPC shard snapshot service (#3135) 2023-12-06 17:19:01 +01:00
Kaan C. Fidan
8f19257f70 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-06 17:17:34 +01:00
Ivan Pleshkov
a8d634cc9b Sparse vector grpc configs (#3123)
* sparse vector grpc configs

* basic grpc test

* add todo comment

* fix integration test
2023-12-06 17:16:35 +01:00
Arnaud Gourlay
a9b7cba463 Fix gRPC conversion for named sparse vectors (#3120)
* Fix gRPC conversion for named sparse vectors

* remove debug

* use existing converter
2023-12-06 17:16:02 +01:00
dependabot[bot]
0f9c12ed1b Bump env_logger from 0.10.0 to 0.10.1 (#3095)
Bumps [env_logger](https://github.com/rust-cli/env_logger) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1)

---
updated-dependencies:
- dependency-name: env_logger
  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>
2023-12-06 17:13:08 +01:00
Ivan Pleshkov
47690244bc Sparse vector grpc definition (#3070)
* Sparse vector grpc definition

remove obsolete use

update grpc docs

update openapi

more convertion fixes

update grpc docs

* validations

* review renamings

* add todos
2023-12-06 17:11:06 +01:00
timvisee
d8e1290ce6 Revert "bump to tonic 0.10.2 and prost to 0.12.2 (#3068)"
This reverts commit b26c797d6b.
2023-12-06 17:08:54 +01:00
Luis Cossío
dc38661544 bump to tonic 0.10.2 and prost to 0.12.2 (#3068) 2023-12-06 17:08:49 +01:00
Ivan Pleshkov
13f15955fc 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-12-06 17:08:37 +01:00
dependabot[bot]
cac1e4c429 Bump schemars from 0.8.15 to 0.8.16 (#3058)
Bumps [schemars](https://github.com/GREsau/schemars) from 0.8.15 to 0.8.16.
- [Release notes](https://github.com/GREsau/schemars/releases)
- [Changelog](https://github.com/GREsau/schemars/blob/master/CHANGELOG.md)
- [Commits](https://github.com/GREsau/schemars/compare/v0.8.15...v0.8.16)

---
updated-dependencies:
- dependency-name: schemars
  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>
2023-12-06 17:07:45 +01:00
dependabot[bot]
f5107a442f Bump tokio from 1.32.0 to 1.34.0 (#3062)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.32.0 to 1.34.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.32.0...tokio-1.34.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2023-12-06 17:07:41 +01:00
Luis Cossío
3baa33be88 rename context_pairs -> context (#3037) 2023-12-06 17:06:18 +01:00