Commit Graph

617 Commits

Author SHA1 Message Date
Andrey Vasnetsov
da239b9082 Shard key index consistency (#2938)
* WIP: collection-level storage for payload indexe scheme

* introduce consensus-level operation for creating payload index

* make operation_id optional in the UpdateResult

* set payload index in newly created shards

* upd api definitions

* include payload index schema into collection consensus state

* include payload index schema into shard snapshot

* review fixes
2023-11-10 17:23:30 +01:00
Andrey Vasnetsov
c95b2448d9 Shard key routing for update requests (#2909)
* add shard_key into output data structures for points

* fmt

* add shard selector for point update operations

* fix creating index without sharding

* Merge serde attributes

* Code review changes

* review fixes

* upd openapi

---------

Co-authored-by: timvisee <tim@visee.me>
2023-11-09 15:06:02 +01:00
Luis Cossío
42c0ed4a2e Improve discovery openapi and grpc comments (#2956)
* improve openapi descriptions

* update grpc docs

* replace em for en dashes with spaces
2023-11-09 10:57:47 -03:00
Luis Cossío
904a7ab306 Discovery API (#2861)
* create and connect discovery http and grpc interfaces

* add openapi tests

* fix bad rebase

* Add better descriptions

* remove numpy from openapi tests

* fix rebase artifact

* remove already addressed TODO

* add more tests

* 🤡🔫 (cfg batch handler)

* add timeout query param for discover requests

* More gRPC validation

* make fields pydantic_openapi_generator_v3 friendly

* `context_pairs` -> `context` with struct for pairs

* discovery api is only discovery or context,
move struct description to fields

---------

Co-authored-by: timvisee <tim@visee.me>
2023-11-08 14:22:31 +01:00
Andrey Vasnetsov
c5c0b871fa remove serde(default) (#2936) 2023-11-06 13:55:59 +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
Luis Cossío
4700e2a86a Expose timeout query param for search requests (#2748)
* add timeout query param for search requests

* enable timeout for recommend requests

* Add query timeout for group by requests

* update openapi models

* Don't decrease timeout after recommend preprocessing

* Add openapi test

* code review

* add timeout to individual group by requests, non-decreasing

* handle timeout for discover

* Update timeout field tag in SearchBatchPoints
message
2023-11-02 12:45:46 -04:00
Andrey Vasnetsov
30d05fe8c9 Shard key - consensus (#2811)
* wip: implement consensus operations to create and delete shard keys

* Fix typo in variable name

* wip: methods to add shard keys

* fmt

* api for submitting creating and deleting shard keys operations into consensus

* fmt

* apply shard mapping in with the collection state transfer

* handle single-to-cluster transition

* fix api structure and bugs

* fmt

* rename param

* review fixes

---------

Co-authored-by: timvisee <tim@visee.me>
2023-11-02 12:27:28 +01:00
Tim Visée
c75eae0c4a Shard snapshot transfer integration (#2467)
* Clone inside blocks

* Add shard transfer method to distinguish between batching and snapshots

* Add stub method to drive snapshot transfer

* Store remote shard in forward proxy, merge unproxy methods

* On snapshot shard transfer, create a shard snapshot

* Unify logic for unproxifying forward and queue proxy

* Error snapshot transfer if shard is not a queue proxy

* Add remote shard function to request remote HTTP port

* Handle all specific shard types when proxifying

* Allow queue proxy for some shard holder snapshot methods

* Bring local and remote shard snapshot transfer URLs into transfer logic

* Expose optional shard transfer method parameter in REST and gRPC API

* Expose shard transfer method in list of active transfers

* Fix off-by-one error in queue proxy shard batch transfer logic

* Do not set max ack version for WAL twice, already set when finalizing

* Merge comment for two similar calls

* Use reqwest client to transfer and recover shard snapshot on remote

Using the reqwest client should be temporary. We better switch to a gRPC
call here eventually to use our existing channels. That way we don't
require an extra HTTP client (and dependency) just for this.

* Send queue proxy updates to remote when shard is transferred

* On shard queue transfer, set max WAL ack to last transferred

* Add safe queue proxy destructor, skip destructing in error

This adds a finalize method to safely destruct a queue proxy shard. It
ensures that all remaining updates are transferred to the remote, and
that the max acknowledged version for our WAL is released. Only then is
the queue proxy shard destructed unwrapping the inner local shard.

Our unproxify logic now ensures that the queue proxy shard remains if
transferring the updates fails.

* Clean up method driving shard snapshot transfer a bit

* Change default shard transfer method to stream records

This changes the default transfer method to stream records rather than
using a snaphsot transfer. We can switch this once snapshot transfer is
fully integrated.

* Improve error handling, don't panic but return proper error

* Do not unwrap in type conversions

* Update OpenAPI and gRPC specification

* Resolve and remove some TODOs

* During shard snapshot transfer, use REST port from config

* Always release max acknowledged WAL version on queue proxy finalize

* Rework queue unproxying, transform into forward proxy to handle errors

When a queue or forward proxy shard needs to be unproxified into a local
shard again we typically don't have room to handle errors. A queue proxy
shard may error if it fails to send updates to the remote shard, while a
forward proxy does not fail at all when transforming.

We now transfer queued updates before a shard is unproxified. This
allows for proper error handling. After everything is transferred the
shard is transformed into a forward proxy which can eventually be safely
unproxified later.

* Add trace logging for transferring queue proxy updates in batch

* Simplify snapshot method conversion from gRPC

* Remove remote shard parameter

* Add safe guard to queue proxy handler, panic in debug if not finalized

* Improve safety and architecture of queue proxy shard

Switch from an explicit finalized flag to an outer-inner architecture.
This improves the interface and robustness of the type.

* Do not panic on drop if already unwinding

* Make REST port interface in channel service for local node explicitly

* Recover shard on remote over gRPC, remove reqwest client

* Use shard transfer priority for shard snapshot recovery

* Remove obsolete comment

* Simplify qualified path with use

* Don't construct URLs ourselves as a string, use `parse` and `set_port`

* Use `set_path` when building shard download URL

* Fix error handling in queue to forward proxy transformation

Before, we didn't handle finalization errors properly. If this failed,
tie shard would be lost.  With this change the queue proxy shard is put
back.

* Set default shard transfer method to stream records, eliminate panics

* Fix shard snapshot transfer not correctly aborting due to queue proxy

When a shard transfer fails (for any reason), the transfer is aborted.
If we still have a queue proxy shard it should also be reverted, and
collected updates should be forgotten. Before this change it would try
to send all collected updates to the remote, even if the transfer
failed.

* Review fixes

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

* Review fixes

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

* Initiate forward and queue proxy shard in specialized transfer methods

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

* Add consensus interface to shard transfer, repurpose dispatcher (#2873)

* Add shard transfer consensus interface

* Integrate shard transfer consensus interface into toc and transfer logic

* Repurpose dispatcher for getting consensus into shard transfer

* Derive clone

* Mark consensus as unused for now

* Use custom dispatcher with weak ref to prevent Arc cycle for ToC

* Add comment on why a weak reference is used

* Do exhaustive match in shard unproxy logic

* Restructure match statement, use match if

* When queue proxifying shard, allow forward proxy state if same remote

* Before retrying a shard transfer after error, destruct queue proxy

* Synchronize consensus across all nodes for shard snapshot transfer (#2874)

* Move await consensus commit functions into channel service

* Add shard consensus method to synchronize consensus across all nodes

* Move transfer config, channels and local address into snapshot transfer

* Await other nodes to reach consensus before finalizing shard transfer

* Do not fail right away awaiting consensus if still on older term

Instead, give the node time to reach the same term.

* Fix `await_commit_on_all_peers` not catching peer errors properly

* Change return type of `wait_for_consensus_commit` to `Result`

This is of course more conventional, and automatically sets `must_use`.

* Explicitly note number of peers when awaiting consensus

* Before consensus sync, wait for local shard to reach partial state

* Fix timeout error handling when waiting for replica set state

* Wait for replica set to have remote in partial state instead

* Set `(Partial)Snapshot` states for shard snapshot transfer through consensus (#2881)

* When doing a shard snapshot transfer, set shard to `PartialSnapshot`

* Add shard transfer method to set shard state to partial

It currently uses a naive implementation. Using a custom consensus
operation to also confirm a transfer is still active will be implemented
later.

* Add consensus snapshot transfer operation to change shard to partial

The operation `ShardTransferOperations::SnapshotRecovered` is called
after the shard snapshot is recovered on the remote and it progresses
the transfer further.

The operation sets the shard state from `PartialSnapshot` to `Partial`
and ensures the transfer is still active.

* Confirm consensus put shard into partial state, retry 3 times

* Get replica set once

* Add extensive shard snapshot transfer process docs, clean up function

* Fix typo

* Review suggestion

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

* Add delay between consensus confirmation retries

* Rename retry timeout to retry delay

---------

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

* On replicate shard, remember specified method

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
2023-10-30 12:44:39 +01:00
Tim Visée
1462b3bebe Remove GetHttpPort from gRPC API (#2843) 2023-10-26 16:36:49 +02:00
Roman Titov
1f57ffc8f5 Add ReplicaState::PartialSnapshot (#2858)
* WIP: Add `ReplicaState::PartialSnapshot`

* Add documentation

* fixup! Add documentation

* Update OpenAPI spec

* Remove `notify_peer_failure` call for `PartialSnapshot` branch in `apply_state`
2023-10-25 16:12:19 +02:00
Roman Titov
cab234c391 Add shard snapshot gRPC API (#2825)
* Fix paste-bugs in `snapshot_service.proto`

* Add shard snapshot gRCP API definition

* Add validation to shard snapshot gRPC API definition

* Implement conversions between gRPC and `collection` types

* Extract shard snapshot API implementation into common sub-module

* Implement shard snapshot gRPC API

* Generate gRPC docs

* Refactor `ShardSnapshots` gRPC service to be internal API only

* fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Move `ShardSnapshotRecoverResponse` to `shard_snapshots_service.proto`

* fixup! fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Update `api/src/grpc/qdrant.rs`

* fixup! fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Update gRPC docs

* Switch `ShardSnapshots` gRPC service to use `validate_and_log` instead of `validate`
2023-10-18 14:34:58 +02:00
Andrey Vasnetsov
bce52a88e4 Shard key - create collection (#2810)
* introduce sharding strategy configuration into collection config

* enable custom sharding method config on collection creation

* review fixes

* Use `debug_assert_eq` for equality check

---------

Co-authored-by: timvisee <tim@visee.me>
2023-10-16 14:23:37 +02:00
Andrey Vasnetsov
57b1428817 Shard key (#2808)
* introduce shard_key to shard info API and shard holder

* Remove obsolete move

* Update OpenAPI and gRPC specification

* fix shard key mapping condition

---------

Co-authored-by: timvisee <tim@visee.me>
2023-10-13 13:36:13 +02:00
kwkr
55b7cf582d add grpc compliant health check (#2738)
* add grpc compliant health check

* add source link
2023-10-06 12:13:01 +02:00
Arnaud Gourlay
3bff12dba6 Make GeoPolygon interiors optional (#2766) 2023-10-05 18:34:39 +02:00
Tim Visée
97b8964215 Improve description of vector parameters in update collection REST call (#2765) 2023-10-05 17:39:12 +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
Andrey Vasnetsov
1c0ff3c836 improve compatibility with existing clients (#2746) 2023-09-29 12:38:00 +02:00
Luis Cossío
b0e5f5586a Update new reco doc comments (#2740) 2023-09-28 12:47:28 -03:00
Andrey Vasnetsov
3c06601003 nullable recommendation strategy (#2729) 2023-09-25 23:45:47 +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
faab742048 Allow vectors in recommend API (#2693)
* allow raw vectors in recommend

* add openapi test

* keep point id input separately forever in grpc

* minor fix

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-09-24 15:31:27 +02:00
Luis Cossío
e98a3c7d3d Expose new recommend scorer via recommend strategy (#2662) 2023-09-22 17:18:25 -03:00
Roman Titov
789992d3f7 Fan out read operations if local shard is updated (#2642)
* Fan-out read operations if local shard is being updated

* Implement `is_update_in_progress` check for all shard types

* fixup! Implement `is_update_in_progress` check for all shard types

Reverse conditional 🤦‍♀️

* WIP: Add `read_fan_out_factor` collection parameter...

...and refactor `execute_read_operation`/`execute_and_resolve_read_operation` to use it reasonably

* WIP: Refactor `info` and `count` requests to utilize `read_fan_out_factor` properly

* fixup! WIP: Refactor `info` and `count` requests to utilize `read_fan_out_factor` properly

Fix typo

* fixup! WIP: Add `read_fan_out_factor` collection parameter...

Initialize `read_fan_out_factor` in tests

* fixup! WIP: Add `read_fan_out_factor` collection parameter...

Add `TODO` marker (:

* fixup! WIP: Add `read_fan_out_factor` collection parameter...

* fixup! fixup! WIP: Add `read_fan_out_factor` collection parameter...

* fixup! fixup! fixup! WIP: Add `read_fan_out_factor` collection parameter...

🤦‍♀️

* Add `read_fan_out_factor` to required HTTP and gRPC APIs

* WIP: Generate OpenAPI spec and gRPC docs

* fixup! Add `read_fan_out_factor` to required HTTP and gRPC APIs

* fixup! WIP: Add `read_fan_out_factor` collection parameter...

Fix the comment

* Add documentation

* fixup! Add documentation

Update OpenAPI spec and gRPC docs

* optional param by default + comment

* fmt

* rollback test fixes

* review changes

* fmt

* revert api changes

* upd openapi

* upd comment

* fix info api

* resolve merge conflicts

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-09-22 21:56:10 +02: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
Tim Visée
bb5635e17b Add method to wait for commit/term on other peers (#2434)
* Add naive wait-on-consensus-commit gRPC call with spinlock

* Add method for waiting on all other nodes to reach a consensus commit

* Fix codespel issue

* Consensus commit spin lock should use consensus tick interval

* Move consensus commit spin lock function into consensus manager module

* Demote function to wait on single peer

* Add explicit timeout to all consensus await commit methods

* Update gRPC docs

* Peer must be on the same term when waiting on a commit

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

* Update generated gRPC code
2023-09-13 14:03:56 +02:00
Andrey Vasnetsov
205458425e do not use top-level array in API request (#2596)
* do not use top-level array in API request

* fix integration tests

* fix integration tests
2023-09-05 15:25:04 +02: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
Andrey Vasnetsov
90a9db2a33 rename LocalOnly -> NoSync (#2594)
* rename LocalOnly -> NoSync

* Improve readability in OpenAPI description

---------

Co-authored-by: timvisee <tim@visee.me>
2023-09-05 13:13:31 +02:00
Andrey Vasnetsov
ecca2850e8 rename batch update API name for consistency (#2595) 2023-09-05 12:54:13 +02:00
Andrey Vasnetsov
326ef54664 openapi definitions for shard shashots API (#2571)
* openapi definitions for shard shashots API

* review fixes
2023-09-04 14:54:08 +02:00
Tim Visée
2854127495 Add healthz, livez and readyz endpoints for Kubernetes (#2409)
* Add healthz, livez and readyz endpoints

* Describe healthz, livez and readyz endpoints in OpenAPI definition

* Add integration test for healthz, livez and readyz endpoints

* Fix typo
2023-09-04 10:57:42 +02:00
Roman Titov
36e317d623 Shard snapshot API (#2410)
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-08-30 12:41:29 +02:00
Tim Visée
dd0f83dffa Report optimizer status and history in telemetry (#2475)
* Add name to optimizers

* Track optimizer status in update handler

* Remove unused optimizer telemetry implementation

* Report tracked optimizer status in local shard telemetry

* Keep just the last 16 optimizer trackers and non successful ones

* Also eventually truncate cancelled optimizer statuses

* Fix codespell

* Assert basic optimizer log state in unit test

* Remove repetitive suffix from optimizer names

* Loosen requirements for optimizer status test to prevent flakyness
2023-08-28 09:14:37 +02:00
Andrey Vasnetsov
4bbdec3da9 Fix batch update api schema (#2496)
* restructure batch update API

* fmt
2023-08-23 12:16:35 +02:00
Ivan Pleshkov
d14d2c2e36 binary quantization (#2470)
* binary quantization

* update quantization version

* fix quantizing bug

* are you happy fmt
2023-08-21 21:16:27 +02:00
Tim Visée
11ff28dc40 Add internal gRPC call to request remote HTTP port (#2406)
* Add gRPC endpoint to request remote HTTP port

* Add basic gRPC test for fetching remote HTTP port

* Extract gRPC endpoint for fetching HTTP port into internal service

* Add basic internal gRPC test

* Other minor improvements
2023-08-17 09:42:27 +02:00
Di Zhao
034b46e83e Add indexed_only to speed up search (#2431)
* add ignore_plain_index to speed up search

* remove unnecessary & for vectors_batch

* format

* add special handle for proxy segments where the wrapped segment is plain
indexed

* review refactoring

* rollback changes in google.protobuf.rs

---------

Co-authored-by: Di Zhao <diz@twitter.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2023-08-16 10:56:44 +02:00
Roman Titov
6fe7410261 tracing improvements (#2187)
* Add optional `tracing` crate dependency to all `lib/*` sub-crates

* Add optional alternative "tracing-logger"...

...that works a bit better with logs produced by the `tracing` crate

* Make `tracing-logger` reuse `log_level` config parameter (and `QDRANT__LOG_LEVEL` env-var)...

...instead of default `RUST_LOG` env-var only

* Replace `env_logger` with `tracing` (#2381)

* Replace `env_logger` with `tracing`/`tracing-subscriber`/`tracing-log`

TODO:
- Implement slog drain that would *properly* convert slog records into tracing events
  (`slog-stdlog` is fine for now, though)

* fixup! Replace `env_logger` with `tracing`/`tracing-subscriber`/`tracing-log`

Fix `consensus` test

* fixup! fixup! Replace `env_logger` with `tracing`/`tracing-subscriber`/`tracing-log`

Forget to `unwrap` the result 🙈

* fixup! fixup! Replace `env_logger` with `tracing`/`tracing-subscriber`/`tracing-log`

`tracing_subscriber::fmt::init` initializes `tracing_log::LogTracer`
automatically with default `tracing-subscriber` features enabled 💁‍♀️

* Update `DEVELOPMENT.md` documentation regarding `tracing`

* Update default log level for development to make it less noisy

---------

Co-authored-by: timvisee <tim@visee.me>

* Implement "intelligent" default log-level filtering

---------

Co-authored-by: timvisee <tim@visee.me>
2023-08-15 18:44:44 +02:00
Jesse
a9f9b7fcc9 Add batch update endpoint for points API (#1951)
* Add batch update endpoint for points API

* Add validation to batch update operation

* Update gRPC

* Add update and delete vector operations to point update batch

* Improve batch point update tests, add multivec, extract into module

---------

Co-authored-by: timvisee <tim@visee.me>
2023-08-07 16:16:41 +02:00
Tim Visée
cf013c2b2f update collection: on_disk parameters (#2097)
* Add on_disk_payload field to collections params diff

* Add on_disk flag to update collection vector params

* Add on_disk parameters to collection update integration test

* Update and extend unit tests

* monitor on-disk params in optimizr

* fmt

* review fix

* fmt

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2023-07-31 11:43:39 +02:00
Andrey Vasnetsov
1ea3df92d6 temporary exclude geo_polygon from API (#2352) 2023-07-30 01:29:16 +02:00
Tim Visée
ef692499ee Update collection: quantization config (#2090)
* Reoptimize segments on quantization mismatch

* Add collection quantization params to collection update REST endpoint

* Do not require rebuild of quantization for on_disk change

* Add collection quantization params to collection update gRPC endpoint

* Add option to update vector specific quantization config to REST API

* Add option to update vector specific quantization config to gRPC API

* Update OpenAPI and gRPC specification

* Fix quantization mismatch detecting not working as expected

* Fix config mismatch optimizer not using vector specific quantization

* Add unit test for quantization in config mismatch optimizer

* Add some quantization params to collection update integration test

* Reformat

* Apply suggestions from code review

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

* Remove if-statement, simply return

* Move quantization params in named vector in integration test

* Test updating quantization params in multivec integration test

* Fix gRPC docs

* Fix quantization rebuild on changing enabled state on indexed segment

* allow disabling quantization config

* fmt

* clippy

* compare all params of the quantization for rebuild

* explicitly use params on update

* test for disabling quantization

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2023-07-28 19:48:08 +02:00
Andrey Vasnetsov
363aab5815 Fix for updating vector-specific config params (#2328)
* unit-test for updating multivec config

* Remove single vector support from vector params update in REST API

With this change, a user is always required to specify vector names when
updating their parameters. Updating vector parameters in a collection
with a single vector is still possible by providing an empty name. This
is very reasonable as updating vector parameters on a single vector
collection is a bad pattern, since parameters can be set on the
collection itself.

* Update integration tests to reflect REST API change

* Update OpenAPI specification

* Remove obsolete VectorsConfigDiff functions, update docs

* Update OpenAPI specification

* Add name validation to update collection endpoint for vector params

---------

Co-authored-by: timvisee <tim@visee.me>
2023-07-27 12:19:10 +02:00
Tim Visée
f551e73629 Update collection: vector HNSW config (#2087)
* Add update vector config type

* Add mutable getter to update vector config

* Add update vector config to update collection REST operation, reorder

* Add logic to update vector HNSW in collection

* Update OpenAPI specification

* If HNSW diff is empty, consider it as unset

* Update descriptions to clarify an empty HNSW diff unsets

* Make new vector HNSW diff update existing diff

This means that the existing vector HNSW diff is kept intact. Specified
fields are updated in the existing diff. An empty HNSW diff object may
be provided to unset the diff.

* Add update vector config to update collection gRPC operation

* Update gRPC docs

* Use vector specific HNSW config in integration test

* Extract & improve gRPC type conversions, fix collection update with None

* Validate vector specific HNSW config in collection update gRPC endpoint

* Explicitly test we do not rebuild on on_disk change

* Use new method to recreate optimizers

* Don't test on_disk change anymore

* Reuse collection write lock to save, do not relock

* Fix invalid update collection request body in OpenAPI test

* Simplify update collection test

* Add update collection test for HNSW parameters

* Extract vector param update logic into local functions

* Reformat

* Transform UpdateVectorParams into VectorParamsDiff

* Transform UpdateVectorsConfig into VectorsConfigDiff

* Combine serde attributes

* Make HNSW diff empty check generic over DiffConfig types

* Move DiffConfig implementation

* Fix typo
2023-07-25 12:19:59 +02:00
Andrey Vasnetsov
5d2ec88276 Second thoughts on CJK tokenizer (#2260)
* charabia tokenizer for CJK, init

* add charabia to .proto

* generate grpc docs

* rename charabia to multilingual

* disable charabia default features

* ignore stopwords and separators in tokenizer

* fix rebase conflict

* fix test

* fix test

* Bump `charabia` crate version...

...and enable `charabia` features that does not require any additional dependencies by default

* Expose optional `charabia` features in the `segment` crate

* Expose optional `charabia` features in the `qdrant` crate

* fix codespell

* more regression tests

* more regression tests

* make language-specific tests feature-flagged

---------

Co-authored-by: Anatolii Smolianinov <zarkonesmall@gmail.com>
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2023-07-19 14:59:40 +02:00
Tim Visée
4827a362e8 Update collection: HNSW config (#2083)
* Add field to REST collection update to change HNSW config

* Add field to gRPC collection update to change HNSW config

* Update OpenAPI specification

* Update gRPC docs

* Improve optimizer filtering for excluded segment IDs

* Add config mismatch optimizer detecting basic HNSW mismatches

* Trigger optimizers when changing collection HNSW config

* Make config mismatch optimizer aware of vector specific HNSW configs

* Extract triggering optimizers after collection update into function

* Add config mismatch optimizer test for changing HNSW config

* Simplify config mismatch optimizer test

* Add config mismatch optimizer test for vector specific HNSW change

* Reformat

* Update collection HNSW params in integration test

* Validate HNSW config in collection update gRPC endpoint

* Improve description of update collection request

* Do not require to rebuild HNSW when on_disk flag changes

Ref: https://github.com/qdrant/qdrant/pull/2083#discussion_r1231002072

* Do rebuild segment with on_disk change

* Trigger optimizers in parallel

* Recreate optimizers only once on collection update

* Reformat

* Fix incorrect usage of self

* Fix deadlock in collection state config update

* Also rebuild index on full scan threshold change

* decompose worst_segment condition check

* review refactor

* Update lib/storage/src/content_manager/collection_meta_ops.rs

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

* Update lib/api/src/grpc/proto/collections.proto

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

* upd grpc docs

* upd grpc docs

* update openapi

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
2023-07-18 14:32:13 +02:00
Zein Wen
79475ea972 Add geo_polygon filter to proto interface, complete conversion fn, and add an integration test (#2188) 2023-07-17 12:36:50 +02:00
Yaroslav Halchenko
6624c95afd codespell: workflow, config, typos fixed (#2248)
* Add github action to codespell master on push and PRs

* Add rudimentary codespell config

* some skips

* fix some ambigous typos

* [DATALAD RUNCMD] run codespell throughout

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

* Add dev branch as target for the workflow
2023-07-12 16:30:42 +02:00