* fix: validate collection name while creating collection
* fix: validate collection name for Windows
* Use simpler method for checking if collection name contains illegal char
* Add strict collection name validation to gRPC create collection
* Add strict collection name validation to REST create collection
* Add validation error rendering for does_not_contain
* Remove collection name validation from storage internals
* Add some test cases for stricter collection name validation
* Revert ToC changes
---------
Co-authored-by: timvisee <tim@visee.me>
* Add tls directory to .gitignore
* Add error type to certificate helpers
* Log REST and gRPC server errors
* Cleanup
* Rename log_err to log_err_if_any
* Add distinction between no and invalid private key
* 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>
* Add optional `tracing` support
TODO:
- add documentation
* Add explicit compile-time check for `--cfg tokio_unstable` rust flags...
...if `console-subscriber` feature is enabled
* Add basic documentation
* fixup! Add basic documentation
Add links, reworded few phrases and document `tracing` feature
* fixup! fixup! Add basic documentation
- Fix `tokio-tracing` link
* fixup! Add basic documentation
Too much code-blocks...
* Move tracing setup into a separate function
* fixup! Move tracing setup into a separate function
- move tracing setup to a separate file
- fix error handling
* fixup! Move tracing setup into a separate function
Add missing file 🙈
* Improve and simplify settings loading
* Add config/local to .gitignore
* Add error if specified --config-file could not be loaded
* Give custom config path higher priority than other files
* Improve config file validation at loading, report more descriptive errors
* Tweak tests
* Cleanup config building
* Cleanup config tests
* Flatten points selector in delete vectors REST endpoint
This makes the vector deletion API consistent with other endpoints using
the point selector.
* Update tests for flattened delete vectors point selector
* make api consistent with existing ones
* update openapi
---------
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
* wip: chunked mmap
* Fix typo
* insert and get methods
* dynamic bitvec
* clippy
* wip: vector storage
* wip: fmt
* wip: mmap chunks
* wip: mmap problems
* Share transmuted mutable reference over mmap
* option to enable appendable mmap vectors
* fmt
* rename storage status file
* update tests
* fix get deleted value range
* add recovery to vector storage tests
* add flush to tests
* fix transmute from immutable to mutable
* make transmuted pointer private
* remove unused unsafe functions
* force WAL flush if wait=true
* move wal flush into updater thread
* remove flush from update api
* Minimize pub visibility for specialized/dangerous functions
* Allocate vector with predefined capacity
* Inline format parameters
* Assert we have multiple chunks while testing, test is useless otherwise
* Remove unnecessary scope
* Remove unnecessary dereference
* Random bool has 0.5 as standard distribution, use iter::repeat_with
* Replace RemovableMmap::new with Default derive
* Rename len to num_flags
* Use Option replace as it is convention alongside take
* Add FileId enum to replace error prone manual ID rotating
* Use debug_assert_eq where applicable
* Refactor drop and set to replace
* Change default chunk size for chunked mmap vectors to 32MB
This change is made as per GitHub review, because allocating a few
storages with 128MB would take a significant amount of time and storage.
See: https://github.com/qdrant/qdrant/pull/1838#discussion_r1187215475
* Replace for-loops with iterators
* Draft: add typed mmap to improve code safety (#1860)
* Add typed mmap
* Replace some crude mmap usages with typed mmap
* Use typed mmap for deleted flags
* Simplify dynamic mmap flags a lot with new typed mmap, remove flags option
* Reformat
* Remove old mmap functions that are now unused
* Reimplement mmap locking for mmap_vectors
* Add MmapBitSlice tests
* Replace MmapChunk with new typed mmap
* Update docs
* Clean-up
* Disable alignment assertions on Windows for now
* Rename mmap lock to mlock to prevent confusion with lockable types
* one more small test
* Some review fixes
* Add aliasing note
* Add basic error handling in typed mmap constructors
* Use typed mmap error handling throughout project
* Move mmap type module to common
* Fix transmute functions being unsound
See https://github.com/qdrant/qdrant/pull/1860#discussion_r1188593854
---------
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
---------
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
* Add update/delete REST endpoints
* Add update/delete vector REST endpoints to OpenAPI specification
* Fix update vector with no changes not triggering a validation error
* Update OpenAPI specification for updated request type
* Add segment entry function to update named vectors
* Use already available function to update existing vectors
We already had a segment function to update existing named vectors. This
change ensure we use that instead of separating it separately. As a
bonus, this adds support for setting multiple named vectors at once.
* Update set vectors ourselves, don't drop omitted vectors
* Refactor vector updating functions, separate update and replace
* Add basic vector ops, add update/delete functionality to segment updater
* Add internal and public gRPC types and actions for vectors
* Add gRPC API actions
* Reformat
* Add VectorOperations to vector ops, add basic validation
* Validate gRPC vector types
* Validate vector operation structs
* Construct PointIdsList through From trait
* Update gRPC docs
* Use VectorsSelector for vector deletions in gRPC
* Add support for updating multiple points/vectors in update vectors API
* Update gRPC docs
* Fix incorrect gRPC type numbering
* Return point ID error from vector update/delete functions if not found
* Fix disbalanced vectors test
* WIP: Start working on out-of-RAM errors handling [skip ci]
* Implement basic handling of out-of-RAM errors during Qdrant startup
* Try to fix CI fail by allowing both V1 and V2 cgroups
* Try to fix CI fail by improving cgroups handling
* Fix cgroups path detection/handling (+ some minor stylistic changes)
* fixup! Fix cgroups path detection/handling (+ some minor stylistic changes)
* Add test
* Enable low RAM test
* fixup! Add test
* free memory checks
* rm unused function
* Oom fallback script (#1809)
* add recover mode in qdrant + script for handelling OOM
* fix clippy
* reformat entrypoint.sh
* fix test
* add logging to test
* fix test
* fix test
---------
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
* 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>
* 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`
* chore: fix clippy warnings
- Prefer `unwrap_or_else` over `unwrap_or` as the later is always executed.
- Use `clamp`.
* chore: convert `default_quantization_ignore_value` and `default_quantization_rescore_value` to `const fn`
* chore: revert `clamp` change
* Add QuantizationConfigDiff type
* Add quantization config diff to vector parameters
* Prefer vector config over collection config for quantization
* Update OpenAPI specification
* Validate quantization configuration quantile in 0.5-1.0 range
As per https://github.com/qdrant/qdrant/pull/1681
* Add test if check if vector specific quantization config is persisted
* Alias quantization to quantization_config in vector parameters
* Remove quantization config diff, use full vector specific config instead
* Regenerate OpenAPI specification and gRPC docs
* Fix compilation error
* Add error handling to quantization config conversions
* Fix quantization integration test, make HNSW test stricter
* Validate VectorConfig/VectorParams, remove obsolete validation
* Add HNSW config diff to vector parameters
* Validate params in collection config
* Add HNSW config to segment vector data config
* Add VectorsConfig params iterator for more elegant conversions
* Prefer vector HNSW config over collection config for building HNSW index
* Base segment vector param HNSW config on collection config
* General improvements
* Rewrite HNSW ef_construct extract function to also consider vector configs
* Update OpenAPI specification
* Add test to check if vector specific HNSW config is persisted
* review changes
* review changes
* Regenerate gRPC docs
* Fix test on Windows
* Regenerate OpenAPI specification
---------
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
* Implement validation on generated gRPC point types
* Validate gRPC point API requests
* Nicely describe validation errors
* Add validation extensions for special types used in gRPC
* Validate gRPC collection API requests
* Validate gRPC Raft and snapshot API requests
* Simplify validation builder, guess derives from fields, fix two fields
* Remove point recommending limit constraint to fix gRPC tests
* Clean up validation logic for gRPC in build.rs
* Validate internal gRPC requests, don't error but show warnings in log
* Optimize gRPC validation extensions, remove unused bits
* Validate gRPC collection creation configuration
* Add custom validators for special gRPC types
* Value is automatically attached to validation error
* Cleanup
* Remove obsolete tests
* Add basic gRPC validation test
* Add some gRPC request payload validation tests
* Set max collection name length to 255 in validation to match Actix
* 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>
* use common channel pool for healthcheck requests
* add dynamic channel pool
* fmt
* lower parallel connections num
* fmt
* fix clippy
* fix clippy
* better status error message
* smarter channel dropping conditions
* per-channel stats
* refactor pool
* rollback dockerfile
* health-check timeout
* prevent reporting last active peer as dead
* introduce update rate limit
* only rate-limit client requests
* ability to save snapshot without locking wal (#1685)
* ability to save snapshot without locking wal
* fix empty wal saving
* skip waiting on local shard in listener mode even if it is a direct request to listener shard
* snapshot recovery test + better handling of segment versions
* use latest wal
* review changes
* feat: add wait parm for all snapshot API
* update openAPI
* avoid unwrap
* remove all unwarp
* return HTTP 202 when no waiting on snapshot creation
* return 202 when non wait
* update open API
* update param on python test
* update and test api
* optimize the test
* return 202 when non-wait delete
* recover fixes
---------
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
* actix validation
* add check for memmap/indexing_threshold
* fix actix json settings
* Validate settings configuration on start, print pretty warnings on fail
* Add more validation rules for settings and nested types
* Move shared validation logic into collection/operations
* Show validation warning in log when loading some internal configs
* Show prettier actix JSON validation errors
* Stubs for pretty handling of query errors, reformat validation errors
* Use crate flatten function, the hard work was already done for us
We don't have to flatten validation errors into their qualified field
names ourselves because there is a utility function for this.
* Configure actix path validator
* Actix endpoints don't require public
* Extend validation to more actix types
* Validate all remaining actix path and query properties
* Rephrase range validation messages to clearly describe they're inclusive
* Validate all query params to respond with pretty deserialize errors
* Nicely format JSON payload deserialize error responses
* Improve error reporting for upsert point batches
* Add basic validation test that checks a path, query and payload value
* Add some validation constraints
* Add simple validation error render test
* Update Cargo.lock
---------
Co-authored-by: timvisee <tim+github@visee.me>
* Fix incorrect metrics value for cluster commit
* Rewrite metrics logic, don't use registry, write values directly
* Only report REST timings for requests having HTTP 200 response
* Limit metrics reporting of endpoints to whitelist
The whitelist contains a selection of search, recommend and upsert endpoints.
* Add MetricsParam, remove detail level, keep anonymize
* Request metrics in basic API test
* Specify content type for metrics endpoint
* Add OpenAPI test for metrics endpoint, remove from basic API test
This test probes for some strings that must exist in the output
* Add note that metrics endpoint whitelist must be sorted
* Raft-rs 0.7.0
* Remove `request_index` field from `ConsensusOperations::RequestSnapshot` message
---------
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>