Commit Graph

342 Commits

Author SHA1 Message Date
Luis Cossío
8dc1eb235b universal-query: some interface renaming/edits (#4406)
in grpc:
- restructure `ContextInput`, so that it becomes easy to handle both pairs and positive/negative lists in the future

in rest: 
- restructure context queries so that they don't repeat the label in order to be used . E.g. turn `{ query: { context: { context: [ ... ] } } }` into `{ query: { context: [ ... ] } }` 
- fixes fusion so that `{query: { fusion: "rrf" } }` actually works

both:
- renames `RecommendInput` positives and negatives to singular (same as in reco api)
2024-06-10 18:47:40 -04:00
Luis Cossío
6d0d542356 universal-query: Expose REST endpoint (#4380)
Exposes `POST collections/{collection_name}/points/query` for single queries
2024-06-10 11:55:46 -04:00
Luis Cossío
d35319c663 universal-query: validate REST query request (#4388)
Implements `Validate` for REST-facing `QueryRequest`
2024-06-10 11:27:28 -04:00
Tim Visée
81cd8f312b Bump dev version to 1.9.5-dev (#4345) 2024-05-28 16:29:37 +02:00
Luis Cossío
c8e82e75a8 universal-query: Converge API types into CollectionQueryRequest (#4304)
* rest -> collection

* grpc -> collection

* fix rebase

* use constants for defaults
2024-05-27 13:28:08 -04:00
Luis Cossío
b14d0b2463 universal-query: user-facing gRPC and REST request types (#4303)
* add grpc `QueryPoints`

* add rest types

* move to REST types to `api::rest::schema`, decouple `OrderByInterface` and `RecommendStrategy`

* openapi changes

* add score_threshold param

* decouple `ShardKeySelector`, add shard key param

* remove commented-out code

* new codespell
2024-05-24 08:23:12 -04:00
Arnaud Gourlay
cbcdefb310 Cleanup unused dependencies (#4306) 2024-05-23 10:06:44 +02:00
Luis Cossío
2a82ef41a0 universal-query: Introduce order_value field in ScoredPoint (#4291)
* - Fix ordering in group-by for custom scoring
- Rename `OrderingValue` -> `OrderedValue`
- Introduce `order_value` field in `ScoredPoint`

* modify `Ord` implementation

* rename to `OrderValue`

* `has_custom_scoring` -> `is_distance_scored`

* regen apis

* flip bools in `is_distance_scored`
2024-05-22 09:56:31 -04:00
Andrey Vasnetsov
24df71785c [universal-search] refactoring suggestions (#4262)
* rename some structures

* use enum for fusion
2024-05-18 19:09:36 +02:00
Luis Cossío
f3f8c3bc9e Merge pull request #4261
* add `OrderBy` scoring, and add `scrolls` to `PlannedQuery`
2024-05-18 13:07:12 +02:00
Luis Cossío
7dcdae04c7 universal-query: Test and fix PlannedQuery conversion (#4242)
* test and fix PlannedQuery conversion

* add `ScoringQuery::RRF`

* add more test cases, fix more
2024-05-16 10:33:00 -04:00
Luis Cossío
4fd5df9f60 universal-query: Connect grpc internal query service (#4223)
* add grpc -> internal conversions

* return `Status` instead of `CollectionError` in grpc -> internal conversions

* sketch points internal api connection of `query`
2024-05-15 11:53:33 -04:00
Luis Cossío
bfa72bb6d8 universal-query: Add query() to ShardOperation trait (#4210)
* add `query` to shard trait

* add missing conversions for query

* update grpc docs

* Query response has intermediate results

* add ShardQueryResponse description

* move pub use to the top, keep only one way of reaching reexports
2024-05-15 09:36:46 -04:00
Ivan Pleshkov
e80844969f Float16 integration and API (#4234)
* f16 integration

tests

api

fix test

are you happy clippy

* fix build
2024-05-15 10:36:55 +02:00
Luis Cossío
4132d9a226 universal-query: Introduce new RawVector and VectorInput messages (#4209)
* Introduce `RawVector` and `VectorInput` messages

* gen grpc docs

* remove extra `optional`

* gen grpc docs
2024-05-14 11:40:11 -04:00
Luis Cossío
88bb625efd universal-query: Sketch request types pipeline (#4198)
* sketch types pipeline

* separate query, scroll, and search implementations into own files
2024-05-13 12:04:36 -04:00
Roman Titov
dae311e5e8 Add basic resharding types (#4216) 2024-05-13 13:31:03 +02:00
Tim Visée
ac2dd4da1b Bump dev version to 1.9.3-dev (#4208) 2024-05-10 11:28:12 +02:00
xzfc
4f3239f27c Misc fixes (#4212)
* SparseVectorIndex: replace pub with feature-gated getters

* Fixup dev-dependencies

* Fixup rust doc comments
2024-05-10 08:16:28 +00:00
Jojii
2bbf491204 make grpc service type enums unique for UpdateCollectionClusterSetupRequest and PointsUpdateOperation (#4205)
* make grpc service type enums unique
2024-05-09 13:41:06 +02:00
Arnaud Gourlay
b602cb7daa gRPC API multivector for write and retrieve (#4179)
* gRPC API multivector for write and retrieve

* improve naming

* validate multiv + sparse

* code review

* regen gRPC docs

* remove incorrect validation
2024-05-08 19:28:47 +02:00
Luis Cossío
b2538b2a12 remove deprecated internal search api (#4178) 2024-05-07 08:06:54 -04:00
Arnaud Gourlay
4f797c1bb4 REST API multivector for write and retrieve (#4117)
* REST API multivector for write and retrieve

* add test showing search is not supported

* use helper

* debug asserts

* better naming

* iterator style

* better naming

* add validation test for checking all inner vectors have the same size
2024-05-03 10:55:17 +02:00
Tim Visée
e938958d24 Bump dev version to 1.9.2-dev (#4164) 2024-05-03 10:51:48 +02:00
Tim Visée
8723b7e93e Add API key field to snapshot restore, fix snapshot recovery with API key (#4155)
* Add API key to HTTP client

* Add API key field to snapshot recovery requests

* Add API key to channel service

* Provide API key when doing snapshot transfer

* Configure API key header name constant in a central place

* Reformat

* Update OpenAPI spec

* Remove suffixed spaces from configuration file

* Allow to specify HTTP headers in some consensus test utility functions

* Add snapshot transfer test with configured API key

* Use random API key in test

* Fix compilation errors and clippy warnings
2024-05-02 17:10:34 +02:00
Andrey Vasnetsov
c173a9f5e5 Sparse idf dot (#4126)
* introduce QueryContext, which accumulates runtime info needed for executing search

* fmt

* propagate query context into segment internals

* [WIP] prepare idf stats for search query context

* Split SparseVector and RemmapedSparseVector to guarantee we will not mix them up on the type level

* implement filling of the query context with IDF statistics

* implement re-weighting of the sparse query with idf

* fmt

* update idf param only if explicitly specified (more consistent with diff param update

* replace idf bool with modifier enum, improve further extensibility

* test and fixes

* Update lib/collection/src/operations/types.rs

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>

* review fixes

* fmt

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2024-04-29 14:54:14 +02:00
Tim Visée
2de50f9b2a Bump dev version to 1.9.1-dev (#4085) 2024-04-22 14:15:51 +02:00
Arnaud Gourlay
23971e72b7 Add missing validation for gRPC UpsertPoints (#4074) 2024-04-19 13:26:25 +02:00
Andrey Vasnetsov
44f2744d74 Byte storage api support (#4065)
* wip: include datatype in vector params API

* generate api schemas

* propagate datatype to segment creation

* fix review

* fmt
2024-04-18 15:22:28 +02:00
Arnaud Gourlay
885664ea66 Decouple named vector struct (#4014)
* Decouple NamedVectorStruct from REST API

* add NamedVectorStruct::MultiDense to segment

* update doc

* fully qualified segment types

* no need to ser/de anymore

* sprinkle required PartialEq

* new rbac code needs to convert
2024-04-12 14:38:57 +02:00
Arnaud Gourlay
4ff2fb855b promote Validator to workspace (#4013) 2024-04-11 12:01:27 +02:00
Tim Visée
8560f15416 Add grey collection status (#3962)
* Add grey color for collection info status

* Restructure locks in local shard info method

* Set collection status to grey if we have pending optimizations

* Update OpenAPI specification and gRPC documentation

* Set optimizer status instead of color for compatibility reasons

* Only set and check for grey status if there are no other statuses
2024-04-04 10:04:02 +02:00
Ricardo Pallas
265bfa253c Removes method from abort shard transfer operation (#3803)
* Removes method from abort shard transfer operation

* Updates consensus test message assertion

* updates validation message
2024-03-26 14:27:33 +01:00
Tim Visée
a3abcef0f1 Change dev version to 1.9.0-dev (#3881) 2024-03-20 14:54:34 +01:00
Ivan Pleshkov
270e884a08 Rest decouple collection record type (#3865)
* rest decouple collection record type

* are you happy clippy

* remove Vector::to_vec_ref
2024-03-19 18:06:19 +01:00
Tim Visée
d7c888010a Switch to Recovery state, deprecated PartialSnapshot, for Qdrant 1.9 (#3847)
* Deprecate PartialSnapshot replica set state

* Improve logging

* Update gRPC docs

* Remove now obsolete migration TODO
2024-03-19 14:50:13 +01:00
Arnaud Gourlay
144e8aa5b7 Introduce MultiDenseVector to models (#3826)
* Introduce MultiDenseVector to models

* use ref to slice

* annotate with TODO(multi)

* unify on TODO(colbert)
2024-03-18 15:30:51 +01:00
Anush
19c7273864 refactor: Update to Chrono 0.4.35 (#3827)
* refactor: Chrono 0.4.35

* Move chrono dependency to workspace

* Update lib/segment/src/common/anonymize.rs

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

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2024-03-18 13:44:41 +01:00
Ivan Pleshkov
c1e32cf462 Use rest vector type as non segment part (#3829)
* use rest vector type as non-segment part

* add todo

* switch into -> from

* review remarks

* review remarks
2024-03-18 13:31:55 +01:00
Tim Visée
4e234d2110 Add peer metadata to consensus, tracking Qdrant versions (#3702)
* Add peer metadata state to consensus, update on sync local state

* Minor formatting improvements

* Use Qdrant version from constant

* Initialize empty metadata if not present on disk

* Refactor old parameter name

* Logging improvements based on review feedback

* Assert that Qdrant version matches crate version

* Do not use a custom (de)serializer for peer metadata

* Use semver directly for handling Qdrant versions

* Rename is_outdated to is_different_version

* Assert Qdrant version in build.rs

* Disable updating peer metadata until Qdrant 1.9

We do this, because if a node is running 1.8, there may still be nodes
running 1.7. Those nodes do not support this operation.

* clippy

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-04 16:48:44 +01:00
Tim Visée
f0c8350f61 Add unique token to clock tag, detect duplicate operations (#3739)
* Add unique token to clock tags

* Consider last token in clock map

* Mark potential problem with TODO, we might want to keep clock token

* Represent UUID in gRPC as bytes, keep token when converting gRPC to REST

* Do not panic on invalid UUID, propagate parse error

* Use helper function for clock tag conversion with error handling

* Fix accept/reject logic for clocks, accept higher/equal, update token

* Add test for accepting exactly the same last operation multiple times

* Update advance method description to elaborate on what is accepted

* Keep unique clock tag token in recovery point

* Fix WAL delta tests, don't expect rejection from forward proxy anymore

* Extend missing clocks in recovery point in a more efficient way

* Fix clock tick comparison logic in recovery point

* Apply suggestions from code review

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>

* use u64 as token

* Remove failable clock tag conversions, use direct conversion

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-04 11:57:33 +01:00
Luis Cossío
06e8101a3b Fix: Validate datetime_range in FieldCondition validation (#3742) 2024-03-01 17:01:02 -03:00
Roman Titov
5f7e053eaf Logic tweaks for WAL diff shard transfer (#3719)
* Change `ClockMap` to always reject tick 0

* Enable rejecting operations in `LocalShard::update`...

...and propagate updated `clock_tick` back to the caller

* WIP: Retry operation on *all* nodes (with new tick)...

...if *any* node rejected the operation

* fixup! WIP: Retry operation on *all* nodes (with new tick)...

Keep the same `clock` for the whole duration of `update`

* Add update response status for clock rejection (#3725)

* Add clock rejected update status

* Don't hide internal items in docs

* Propagate clock rejected status if operation clock is too old

* Fix test in which we manually define clock ticks

* Expect forward proxy rejection, node already has that operation

* Add constant for first valid clock tick, init clocks in recovery point

* In testing, advance all zero clocks to start ticking from 1

* Attempt to fix clock_set_clock_map_workflow

* Rename WalError::Rejected to ClockRejected

* Limit retry attempts when operation is rejected for an old clock tick

* Don't log rejected clock tag if tick was 0

* Cleanup `ClockMap`/`RecoveryPoint`

* Cleanup `ClockSet` and `ShardReplicaSet::update`

* Fix `clock_set_clock_map_workflow` test

* add debug assertions

* fmt

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-01 12:32:03 +01:00
Tim Visée
7522d89f85 When restarting shard transfer, keep sync if old transfer was sync (#3728)
* When restarting shard transfer, use sync if old or new one had sync set

* refactor restart transfer models

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-02-29 19:15:35 +01:00
Tim Visée
e39c481b17 Add consensus operation to restart shard transfer (#3703)
* Add consensus operation to restart shard transfer with different config

* Require shard transfer restart to have a changed configuration

* implement api

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-02-29 17:03:21 +01:00
Luis Cossío
5deee2a419 OrderBy: Allow integer in StartFrom (#3726) 2024-02-29 12:22:30 -03:00
Arnaud Gourlay
758779c3cd Use DenseVector alias where possible (#3705) 2024-02-28 10:31:16 +01:00
xzfc
ca2cd46f29 Drop unused Deserialize (#3680) 2024-02-24 00:33:21 +01:00
Roman Titov
fb48bdc25a Revert some unnecessary changes to collections_internal_service.proto (#3677)
Introduced in #3510
2024-02-23 17:36:29 +01:00
Tim Visée
44fa95f6d5 Shard diff transfer integration (#3509)
* Add first stubs for WAL delta shard transfer method

* Repurpose queue proxy, use it for transferring WAL diff as well

* Integrate WAL delta transfer is transfer selection logic

* Add WalDelta shard transfer type which is not exposed in public API

* Basic implementation of falling back to stream records transfer

* Share await_consensus_sync function

* Ask remote shard for recovery point

* During WAL delta transfer, resolve shard diff locally for recovery point

* Rebase on latest dev, support empty WAL diff

* Rebase on latest dev, support empty WAL diff

* Use partial snapshot state for WAL delta transfer

* Set cutoff point on remote shard after shard WAL delta transfer

* Set cutoff point on remote shard after stream records transfer

* During WAL delta transfer, set s tate from partial snapshot to partial

* Describe WAL delta transfer in a comment

* Allow updating cutoff point in stream records transfer to fail

* Do not set cutoff point on remote shard on WAL delta transfer

* Make await consensus sync logic easier to read and reason about

* Fix fallback to other shard transfer method on WAL delta transfer fail

* Various minor improvements

* Add TODO for just ignoring API unimplemented errors

* Only allow stream records cutoff point error if remote is older version

* Allow switching to partial to fail when falling back

* Only change shard state to partial if not in partial state already

* Change default shard transfer method back to stream records

* Add important TODO back

* Add WAL delta shard transfer method in gRPC

* Prefer configured shard transfer method as default

* Extract shard transfer fallback logic into separate function
2024-02-23 17:32:22 +01:00