Commit Graph

80 Commits

Author SHA1 Message Date
Jojii
791d064bde [Strict mode] default config (#5037)
* add default config for strict mode

* add default values as example to config/config.yaml

* improve implementation

* update grpc docs
2024-09-25 14:22:36 +02:00
Justin Miller
43ab766e32 Adding logging to disk note to config.yaml. (#5041)
* Adding logging to disk note to config.yaml.

* Update config/config.yaml

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2024-09-11 09:33:38 +02:00
David Myriel
64c17ff13d update config.yaml (#4710)
* update config.yaml

* Update config/config.yaml

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2024-07-22 20:33:57 +02:00
Jojii
3005de2a01 Add optimizer_overwrite config option (#4317)
* add config option

* add optimizers_config to optimizer calls

* also add for tests

* add to build_optimizers

* rename function parameter
2024-05-31 09:02:44 +02:00
Jojii
f6fa1216c5 Add config option shard_nr_per_node (#4309) 2024-05-30 14:43:01 +02:00
Jojii
6249623f35 Add vectors and quantization options and defaults (#4299)
* add vectors and quantization options and defaults

* remove default quantization settings and add config options for consensus

* change config structure

* change parameter hierarchy

* apply new config values

* review changes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-05-23 14:16:00 +02:00
Kenshin Tanaka
0d46aeb460 Implement S3 snapshot manager (#4150)
* Add SnapshotsStorageConfig enum(Local or S3) and deserialize implementation

* [refactor]  use snapshots_config instead of s3_config

* update config

* add AWS official`aws-sdk-s3`

* implement store_file() WITHOUT error handling

* implement list_snapshots

* implement delete_snapshot

* run `cargo +nightly fmt`

* delete println

* implement get_stored_file

* Add error handlings

* Refactor AWS S3 configuration and error handling

* fix bugs

* create an empty test file

* fix `alias_test.rs` for StorageConfig type

* tempolary delete some test and try s3 test

* Update integration-tests.yml to use snap instead of apt-get for installing yq

* Update integration-tests.yml to use sudo when installing yq

* add sudo

* make (full/non-full) snapshots downloadable

* debug

* small fix

* Add S3 endpoint URL configuration option

* fix

* fix

* debug

* fix endpoint

* update to http://127.0.0.1:9000/

* update

* fix

* fix `#[get("/collections/{collection}/shards/{shard}/snapshots/{snapshot}")]` for s3

* put original tests back

* refactor

* small fix (delete println & echo)

* use object_store and refactor

* create snapshot_storage_ops and implement

* Refactor get_appropriate_chunk_size function to adjust chunk size based on service limits and file size

* cargo +nightly fmt --all

* make it more abstract

* Refactor SnapshotsStorageConfig deserialization in SnapShotsConfig

* small update

* small fix

* Update dependencies in Cargo.lock

* Update minio image to satantime/minio-server

* Refactor snapshot storage paths in snapshots_manager.rs and snapshot_storage_ops.rs

* Fix issue with downloaded file size not matching expected size in download_snapshot function

* add flush

* Use Streaming instead of donloading once

* apply `cargo +nightly fmt --all`

* Fix issue with opening file in SnapshotStream::LocalFS variant

* Fix error handling in SnapshotStream::LocalFS variant

* Add integration test for Shard Snapshot API with S3 storage (#7)
2024-05-10 16:54:23 +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
97241d04e7 add config property to disable jwt by default (#3923) 2024-03-27 14:05:01 +01:00
Tim Visée
230f307b27 Use WAL delta transfer by default for shard recovery for 1.9 (#3800)
* Move peer metadata type around

* Expose peer metadata in channel service

* Use WAL delta transfer by default for recovery, if all nodes are 1.8+

* Add check for missing metadata, assume versionless if we have less

* Use user configured shard transfer method, fall back to WAL delta/stream

* Minor improvements

* Update variable name
2024-03-19 17:08:49 +01:00
Tim Visée
56171c6087 Dynamic CPU saturation integration (#3115)
* Integrate dynamic CPU saturation with public API changes

This reverts commit 08930fefa9.

* Call num_cpus only once
2024-02-05 14:08:02 +01:00
Tim Visée
0301e39943 Dynamic CPU saturation internals (#3364)
* Move CPU count function to common, fix wrong CPU count in visited list

* Change default number of rayon threads to 8

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

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

* Fix spelling issues

* Fix test compilation error

* Improve breaking if there is no CPU budget

* Block optimizations until CPU budget, fix potentially getting stuck

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

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

* Utilize n-1 CPUs with optimization tasks

* Better handle situations where CPU budget is drained

* Dynamically scale rayon CPU count based on CPU size

* Fix incorrect default for max_indexing_threads conversion

* Respect max_indexing_threads for collection

* Make max_indexing_threads optional, use none to set no limit

* Update property documentation and comments

* Property max_optimization_threads is per shard, not per collection

* If we reached shard optimization limit, skip further checks

* Add remaining TODOs

* Fix spelling mistake

* Align gRPC comment blocks

* Fix compilation errors since last rebase

* Make tests aware of CPU budget

* Use new CPU budget calculation function everywhere

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

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

* Update CPU budget description

* Move heuristic into defaults

* Fix spelling issues

* Move cpu_budget property to a better place

* Move some things around

* Minor review improvements

* Use range match statement for CPU count heuristics

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

* Fix compilation errors since last rebase

* Update lib/segment/src/types.rs

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

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

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

* Rename cpu_budget to optimizer_cpu_budget

* Update OpenAPI specification

* Require at least half of the desired CPUs for optimizers

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

* Don't use wildcard in CPU heuristic match statements

* Rename cpu_budget setting to optimizer_cpu_budget

* Update CPU budget comments

* Spell acquire correctly

* Change if-else into match

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

* Rename max_rayon_threads to num_rayon_threads, add explanation

* Explain limit in update handler

* Remove numbers for automatic selection of indexing threads

* Inline max_workers variable

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

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

* Remove now obsolete lazy_static

* Fix incorrect CPU calculation in CPU saturation test

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

* Prevent deadlock on optimizer signal channel

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

* Fix incorrect CPU calculation in optimization cancel test

* Rename CPU budget wait function to notify

* Detach API changes from CPU saturation internals

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

---------

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-01-31 11:56:34 +01:00
Tim Visée
d04c552619 Limit automatic shard transfers (stateless) (#3458)
* Do not select ourselves when finding auto shard transfer source

* Limit automatic shard transfers with basic transfer count check

* Extract shard recovery transfer request logic to separate function

* Add global shard transfer tracker structure to allow rate limiting

* Count and limit incoming and outgoing shard transfers separately

* Make automatic shard transfer limit configurable

* Move shard transfer tracker from global to collection level

* Comment out new config parameters

* Fix incorrect comment

* Fix missing space in log message

* Fix negated condition

* Remove logic for requesting shard transfer on replica state change

* Check shard transfer limits in consensus sync, use consensus state

Instead of bothering with tracking proposed shard transfers, this now
purely relies on state that is already in consensus. Each time we sync
consensus, we request the maximum number of shard transfers up to the
limit at that time.

* Remove now obsolete shard transfer tracker

* Revert now obsolete changes

* Improve transfer IO counting comment, revert now obsolete code

* Fix typos

* Fix flipped variables, don't take self reference on Copyable type

* Update lib/collection/src/collection/shard_transfer.rs

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

* Handle incoming/outgoing transfer counts separately, don't tuple it

* Improve loop for counting incoming/outgoing transfers

* Remove unused test function

* Add consensus tests for automatic shard transfer limits

* Apply suggestions from code review

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

* Remove debug lines from new test

* Reorder last test a bit to resolve flakyness

* We can have one more transfer for recovery on the other alive node

* Attempt to reduce test flakyness, more points and more frequent polling

* Update config/config.yaml

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

* Explicitly note default shard transfer limit in configuration

* Use default for shard transfer IO everywhere

* Rename transfer limit check function to be more explicit

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
2024-01-26 16:09:43 +01:00
Tim Visée
c8b0b0a484 Add config property to set default shard transfer method (#3255)
* Add config option to set default automatic shard transfer method

* Also use configured shard transfer method if user doesn't specify

This is not for automatic shard transfers, but when a user initiates a
transfer manually.

* Improve comment for shard transfer method configuration

* Fix test compilation
2023-12-21 20:22:04 +00:00
Wesley
8b806f90de Read-Only API keys (#2979)
* Read-only API keys

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

Correct placement of OpenAPI security

Place regex dep with actix/tonic

* Read-only API keys

* Replace with pytests

* API Key tests run on the same job

* Drop allow dead-code

* Rename setting key

* Containerized tests

* No special config files

* DRY

* refactor: re-use can_write method

* refactor: replace static by constants

* refactor: get PID from `$!`

* refactor: use explicit brackets on boolean condition

* style: fix identation

* small fixes + account for new APIs

* specify security in openapi

* small fix + chmod for .sh testfile

* add best-efford check for api consistency

---------

Co-authored-by: Amr Hassan <amr.hassan@gmail.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2023-11-23 21:58:35 +01:00
Alexander A
9c4d01e89a add update_rate_limit param into config file (#2848) 2023-10-26 16:26:27 +02:00
Di Zhao
8c79041552 Add update_concurrency option to control the parallelism of shard updates (#2599)
* add update_concurrency to control the parallelism of updating shards

* reformat the files

* reformat

* add update_concurrency control to shard updates

* use unwrap_or

* test using buffer_ordered

* use buffered (testing)

* Pre-allocate space for update futures

* use NonZeroUsize

* linter

* use NonZeroUsize in the test

* consensus test for update_concurrency

* update config commit

---------

Co-authored-by: Di Zhao <diz@twitter.com>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: generall <andrey@vasnetsov.com>
2023-09-12 20:21:19 +02:00
Arnaud Gourlay
e527af28d7 Remove unused debug setting (#2339) 2023-08-21 13:41:43 +02:00
Damien Castelltort
4f875f5d48 Configurable location of temporary snapshot files (#1960)
* Issue 1905: Configurable location for the tmp snapshot files

* Apply suggestions from code review

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

* fix code review suggestions

* clippy fix

* Propagate temp path, use configured dir for snapshot creation

* Use real temp dir in snapshot tests

* Mention default temporary snapshot file path in configuration

* Use temp everywhere rather than a mix of temp and tmp

* Use consistent naming for temporary snapshot directories

* Extract logic for temporary storage path into toc method

* Resolve clippy warnings

* Apply suggestions from code review

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2023-06-21 22:53:19 +02:00
Yusuf Anı
9801f41602 Update config.yaml (#2059) 2023-06-12 16:01:34 +02:00
Andrey Vasnetsov
967d387a37 Web UI integration (#2009)
* wip: integrate UI web interface

* fmt

* Api key exclusion rule + fixes

* upd welcome url

* rollback api key in config
2023-06-06 21:42:24 +02:00
Russ Cam
8342288e1f Fix documentation links (#2000)
* Update documentation links

This commit updates documentation links to point to
the correct locations.

* formatting
2023-05-31 10:08:43 +02:00
llogiq
7916f01fa4 Migrate from OpenSSL to Rustls (#1865)
* Migrate from OpenSSL to Rustls

* Add TTL based certificate rotation for Rustls in actix

See: <https://github.com/qdrant/qdrant/pull/1865#issuecomment-1539752859>

* Update last update time when certificate is replaced

* Update error message

* Add option to disable certificate TTL, add TTL validation

* Cleanup

* Update comment for service.enable_tls, also enables TLS for gRPC

* Apply suggestions from code review

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

* Move with_buf_read into certificate_helpers, it is used there

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

* Remove level of scoping

* Add TLS enabled/disabled log messages

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2023-05-30 10:24:52 +02:00
Luis Cossío
d89d2ec24b Disable indexing and memmap with 0 (#1824)
* feat: use 0 as disable for indexing and memmap

* amend: edit test, update doc comments, remove validation

* fix: use constant instead of literal, reword doc comments

* test: update test for loop and timeout

* fix: remove validation on OptimizerConfigDiff and fix test_validatioin.py

* fix: remove validation from build.rs, remove internal hack from  doccomments

* fix: update grpc docs

* revert max_optimization_threads validation in test

* update config comments and minor test change

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-05 10:10:35 +02:00
Yiping Deng
e23bd9cf7f Add support for TLS certificate rotation (#1808)
* Add certificate roatation for actix

* Add config file explaination

* Fix code style

* Drop pub modifier for helper module

* Fix clippy error

* Fixing PR comments

* Remove unused variable and fix clippy

* Transform option building in if-else to then_some

---------

Co-authored-by: timvisee <tim@visee.me>
2023-05-02 13:29:32 +02:00
paulotten
2fd3531f89 feat: embed default config file at compile time (#1776)
* feat: embed default config file at compile time

* Add `test_no_config_files` and supporting `find_config_files` parameter

* Error if `RUN_MODE` set but can't find config files

* feat: warn if config files not found

* remove find_config_files flag

* Add test to deserialize just the embedded default config

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2023-04-26 09:23:34 +02:00
Roman Titov
5d3f9e167e Improve handling of out-of-disk-space errors during Qdrant startup (#1755)
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-04-24 13:02:29 +02:00
paulotten
17379a09c5 feat: built in api-key auth (#1745)
* feat: built in api-key auth

* doc: Sending an api-key over an unencrypted channel is insecure.

* feat: constant time comparision for api-keys

* use `option_layer`
2023-04-20 10:17:21 +02:00
Tim Visée
4cd5e4e205 Minor HNSW configuration comment improvement to match docs (#1693)
See https://github.com/qdrant/docs/pull/89
2023-04-11 11:02:17 +02:00
Tim Visée
e985ff31b6 General improvements (#1687)
* Change file mode of some .sh files to make them executable

* Remove whitespace on empty lines from YAML configurations

* Fix unused import warning on Windows
2023-04-10 20:03:56 +02:00
Yiping Deng
0d6e7ca952 Add user client certificate validation capabiltiy (#1663)
* Add user client certificate validation capabiltiy

* Add integration test for client side certificate validation

* Add server side ca certificate to verify

* Use store builder for client side certificate

* Use a trust store

* Fix config for TLS test

* Fix test, remove mTLS for external grpc endpoint

* Fix config comment

* Remove useless commit

* Fix style

* Fix internodal TLS test

* Simplify setting SSL verify mode

---------

Co-authored-by: timvisee <tim@visee.me>
2023-04-10 16:03:30 +02:00
Roman Titov
7f184700e1 Add TLS support bikeshedding (#1593, #1581)
Minor improvements, style fixes and code cleanup on top of #1581
2023-03-21 00:44:33 +01:00
stencillogic
21f1d90cea Add tls support (#1581)
* add TLS support

* update github workflow

* fix formatting

* fix tests

* fix clippy warning

* fix PR remarks
2023-03-20 20:59:49 +01:00
Andrey Vasnetsov
5849adca91 add listener shard state (#1482)
* add listener shard state

* add to config

* add test
2023-02-23 14:11:59 +01:00
Andrey Vasnetsov
5c2cd2f49d add default values to confog.yaml and extend comment (#1426) 2023-02-03 20:08:03 +01:00
George
e70344b7d0 Enable on disk payload option by default (#1415) 2023-01-31 15:43:40 +04:00
Andrey Vasnetsov
8bc8f63988 Telemetry collection (#1401)
* sending telemetry requests

* report panics

* fmt

* remove extra runtime

* fix telemetry lock release
2023-01-26 00:49:18 +01:00
Arnaud Gourlay
287ac89369 Collections share a single optimizer runtime (#1396)
* Collections share a single optimizer runtime

* review fixes

* rename: optimizer_runtime -> update_runtime

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-01-25 08:05:50 +01:00
Andrey Vasnetsov
ef7b4ac2a7 propagate payload index to temporary segment during optimization (#1133) 2022-10-18 10:49:37 +02:00
Ivan Pleshkov
f357bd5d9b Allow to flush segment in separate thread (#927)
* allow to flush segment in separate thread

* flush as separate function (#928)

* flush as separate function

* review suggestion

* reduce locks during vector scoring

* fmt

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>

* don't run background flush twice

* Update lib/segment/src/segment.rs

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>

* increase flush interval

* Update lib/segment/src/segment.rs

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

* are you happy fmt

* test background flush

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-08-15 13:47:52 +04:00
Aaron Peddle
7df9ec4598 Updates comment for max_optimization_threads (#899)
Updates storage.optimizers.max_optimization_threads comment to reflect implementation.
2022-08-03 10:19:28 +02:00
Andrey Vasnetsov
c53f19c0dd Disable mmap threshold (#877)
* allow to disable mmap by not specifying mmap threshold

* fmt

* smart default max_segment_size

* upd openapi for max_segment_size
2022-08-01 15:18:40 +02:00
Arnaud Gourlay
672cde0fee Storage compatibility for HNSW graph file (#875)
* Storage compatibility for HNSW graph file

* create collection with a lower indexing_threshold_kb to avoid manual config. change
2022-08-01 13:53:22 +02:00
Andrey Vasnetsov
e983b07a15 Parallel hnsw building (#773)
* parallel hnsw building

* improve hnsw payload blocks condition

* update indexing optimizer condition

* fmt
2022-07-03 01:14:05 +02:00
Andrey Vasnetsov
fac87018c4 Snapshoting API (#764)
* wip: rest api for snapshots

* fmt

* fix tests

* fmt

* wip: collection snapshoting and recovery

* fmt

* remote shard snapshots

* remote shard test

* fmt

* extend proxy snapshot test + fix double read lock

* fmt + clippy

* openapi schema

* Update openapi/openapi-snapshots.ytt.yaml

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

* Update openapi/openapi-snapshots.ytt.yaml

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

* Update src/main.rs

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

* Update src/main.rs

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

* reduce writes on snapshots location

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-07-01 13:21:57 +02:00
Andrey Vasnetsov
8ac3eef4c7 fix db flush ordering to prevent persisting versions for un-persisted points 2022-06-28 00:38:10 +02:00
Andrey Vasnetsov
63b868233e release v0.8.0 (#667)
* release v0.8.0

* upd roadmap
2022-06-08 12:47:10 +02:00
Andrey Vasnetsov
3bc9c76370 Update config.yaml 2022-06-07 10:39:39 +02:00
Andrey Vasnetsov
27856b1cb1 disable cluster by default 2022-06-06 21:52:44 +02:00
Andrey Vasnetsov
8e52c255ab add consensus configuration + lower log level + fix flickering test 2022-06-06 21:44:03 +02:00