Commit Graph

683 Commits

Author SHA1 Message Date
Arnaud Gourlay
8c988196ea Remove code duplication for recommendation conversion (#6131) 2025-03-21 11:42:51 +01:00
Jojii
78f0428f3e Measure hardware IO for update operations (#5922)
* Measure update operations hardware IO

* Add support for distributed setups

* also measure update_local

* Add consensus tests for HW metrics of update operations

* add test for upserting without waiting

* Disable HW usage reporting when not waiting for update API

* Review remarks

* Fix resharding collecting hw measurements

* Fix metric type

* New struct HardwareData for better accumulation

* Ensure we always apply CPU multiplier

* Apply suggestions from code review

* Update src/actix/api/update_api.rs

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

* Fix assert_with_upper_bound_error threshold calculation.

* Clarifying why we don't measure shard cleanup

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-03-21 11:42:08 +01:00
xzfc
a17e122557 Anonymize ShardKey in ReplicaSetTelemetry (#6115)
* Anonymize ShardKey in ReplicaSetTelemetry

* Anonymize vector names in CollectionConfigInternal

* no-op: impl HardwareUsage for HardwareUsage (used in HardwareTelemetry)

* no-op: impl Anonymize for OptimizersStatus (used in OptimizerTelemetry and CollectionsAggregatedTelemetry)

* no-op: impl Anonymize for TrackerStatus in (used in TrackerTelemetry)

* no-op: Anonymize VectorParams in VectorsConfig

* no-op: Copy fields explicitly in OperationDurationStatistics

* no-op: `.clone().map(|x| x.anonymize())` -> `.anonymize()`

* no-op: impl Anonymize for ConsensusThreadStatus (used in PeerInfo and ClusterStatusTelemetry)
2025-03-21 11:41:54 +01:00
Arnaud Gourlay
5fdc6c068e Fix logging for remove_started_file_indicator (#6090) 2025-03-21 11:40:52 +01:00
Andrey Vasnetsov
eec3328424 remove warning about bootstrap URI if it is not provided (#6065) 2025-03-21 11:39:32 +01:00
Tim Visée
8ad2b34265 Bump Rust edition to 2024 (#6042)
* Bump Rust edition to 2024

* gen is a reserved keyword now

* Remove ref mut on references

* Mark extern C as unsafe

* Wrap unsafe function bodies in unsafe block

* Geo hash implements Copy, don't reference but pass by value instead

* Replace secluded self import with parent

* Update execute_cluster_read_operation with new match semantics

* Fix lifetime issue

* Replace map_or with is_none_or

* set_var is unsafe now

* Reformat
2025-03-21 11:38:56 +01:00
Luis Cossío
a6043c5db4 [score boosting] add gRPC structures (#6035)
* add grpc structures

* grpc docs

* make by_zero_default optional
2025-03-21 11:38:19 +01:00
Luis Cossío
88701bdb82 [score boosting] Connect formula to query (#6024)
* finish connecting formula query

* upd openapi
2025-03-21 11:37:59 +01:00
Kumar Shivendu
96c8bd6bb4 Log consensus snapshot metadata when applying (#6030) 2025-03-21 11:37:23 +01:00
Andrey Vasnetsov
caed5729e5 IO resource usage permit (#6015)
* rename cpu_budget -> resource_budget

* clippy

* add io budget to resources

* fmt

* move budget structures into a separate file

* add extend permit function

* dont extend existing permit

* switch from IO to CPU permit

* do not release resource before aquiring an extension

* fmt

* Review remarks

* Improve resource permit number assertion

* Make resource permit replace_with only acquire extra needed permits

* Remove obsolete drop implementation

* allocate IO budget same as CPU

* review fixes

---------

Co-authored-by: timvisee <tim@visee.me>
2025-03-21 11:37:12 +01:00
Andrey Vasnetsov
f455669d0a Ca cert for snapshots (#6010)
* make cacert optional

* ignore missing cacertificate on creating https client

* Some tweaks

* Update development.yaml

---------

Co-authored-by: timvisee <tim@visee.me>
2025-03-21 11:36:52 +01:00
Roman Titov
8f4d4beff3 Add common::update::update function (#5977) 2025-03-21 11:36:43 +01:00
Arnaud Gourlay
798f14cafb Fix Clippy 1.85 (#6011)
* Fix Clippy 1.85

* fix false positive
2025-03-21 11:36:07 +01:00
Roman Titov
01acabc0c6 Move UpdateParams structure into common::update... (#5974)
...to easier propagate `wait` and `ordering` API parameters
2025-02-17 10:20:47 +01:00
Roman Titov
363c5412a0 Add InternalUpdateParams structure (#5968)
* Add `InternalUpdateParams` structure...

...to easier propagate `shard_id` and `clock_tag` internal API parameters

* fixup! Add `InternalUpdateParams` structure...

Use `InternalUpdateParams::default` instead of `Default::default`

* Remove now obsolete delinters, expect them where still applicable

---------

Co-authored-by: timvisee <tim@visee.me>
2025-02-17 10:20:37 +01:00
Arnaud Gourlay
aa02c19af9 Properly size Raft message buffer (#5973) 2025-02-17 10:19:03 +01:00
Roman Titov
fa13607f76 Tiny refactoring to reduce some boilerplate in update API (#5953)
* Rename `UpdateParam` into `UpdateParams` and remove `Option`s from fields

* Use `common::inference::extract_token` in internal gRPC API

* Destructure `UpdateVectorsInternal`/`DeleteVectorsInternal` requests in internal gRPC API

* Add `extract_internal_request` helper for internal gRPC API

* fixup! Add `extract_internal_request` helper for internal gRPC API

Use `extract_internal_request` helper in `sync` API

* fixup! Rename `UpdateParam` into `UpdateParams` and remove `Option`s from fields

Remove `JsonSchema` derive from `UpdateParams`
2025-02-11 14:42:04 +01:00
Arnaud Gourlay
27d5b39aee Retry-After on rate limiter hit for REST API (#5917)
* Retry-After on rate limiter hit for REST API

* fix tests

* Ceil retry after seconds number so clients don't retry too early

* Relax retry after time requirement a bit in case CI machines are slow

* Add rate limit test, test retry after if we replanish within a second

* Report time to wait in rate limit error

---------

Co-authored-by: timvisee <tim@visee.me>
2025-02-11 14:41:44 +01:00
Andrey Vasnetsov
361daad1c9 check if bootrap is the same as URI (#5950) 2025-02-11 14:41:22 +01:00
Damian
ef68ed9760 Add NormalizePath middleware to cleanup url (#5946)
* feat: add NormalizePath middleware to cleanup url

Signed-off-by: Damian <damiakpan@gmail.com>

* Cleaned up comment on Normalize Path

* test: add test case to validate behavior

* Update tests/basic_api_test.sh

Co-authored-by: Andrey Vasnetsov <vasnetsov93@gmail.com>

---------

Signed-off-by: Damian <damiakpan@gmail.com>
Co-authored-by: Andrey Vasnetsov <vasnetsov93@gmail.com>
2025-02-11 14:41:16 +01:00
Tim Visée
6cc3ecbc30 Enable consensus compaction by default (#5903)
* Enable consensus compaction by default

* Also set new compaction default in code
2025-02-11 14:41:05 +01:00
Jojii
ec0762a560 Measure IO reads for vectors (#5912) 2025-02-11 14:40:21 +01:00
Jojii
77f65ef95f HwCounter rename IO metrics (#5898)
* Rename io metrics and add vector_io_write

* Chore: Cleanup obsolete TODOs and simplify retrieving HardwareCounterCells (#5899)
2025-02-11 14:37:24 +01:00
Tim Visée
d279de9f0e Allow to set peer and boostrap URI through environment variable (#5904) 2025-02-11 14:36:40 +01:00
Luis Cossío
f110328296 bump and migrate to rand 0.9.0 (#5892)
* bump and migrate to rand 0.9.0

also bump rand_distr to 0.5.0 to match it

* Migrate AVX2 and SSE implementations

* Remove unused thread_rng placeholders

* More random migrations

* Migrate GPU tests

* bump seed

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2025-02-11 14:36:20 +01:00
Roman Titov
8afe42da3e Optimize consensus loop (#5728) 2025-02-11 14:35:51 +01:00
Roman Titov
0d16911607 Split tonic::api::points_common module (#5865) 2025-01-28 10:44:07 +01:00
Roman Titov
8868ecc9b2 Split qdrant::common::points module (#5862) 2025-01-27 18:26:02 +01:00
Jojii
97743b1b62 Propagate hardware counter for more functions (#5844)
* Propagate hardware counter for more functions

* Minor improvements

* use vector_query_contexts hardware_counter
2025-01-27 18:25:49 +01:00
xzfc
e85a9f18b4 Add VectorName type alias (#5763)
* Add VectorName/VectorNameBuf type aliases [1/2]

* Add VectorName/VectorNameBuf type aliases [2/2]
2025-01-27 18:25:41 +01:00
Roman Titov
1a4cc22589 Cleanup #[allow(dead_code)] annotations (#5818) 2025-01-23 14:27:56 +01:00
Jojii
38f478ddf7 Measure payload read IO (#5773)
* Measure read io for payload storage

* Add Hardware Counter to update functions

* Fix tests and benches

* Rename (some) *_measured functions back to original
2025-01-23 14:27:40 +01:00
Arnaud Gourlay
6678050332 API validation for unique dense and sparse vector names (#5808)
* API validation for unique dense and sparse vector names

* less alloc

* test empty name as well

* quotes instead of ticks
2025-01-16 10:52:00 +01:00
Roman Titov
2191b792d4 Add resharding_enabled option to ClusterConfig (#5770)
* Add `resharding_enabled` option to `ClusterConfig`

If `resharding_enabled` is *not* set, `StartResharding` API returns an error

* Enable `resharding_enabled` option in development config

* fixup! Add `resharding_enabled` option to `ClusterConfig`

Fix tests

* fixup! Enable `resharding_enabled` option in development config

😅

* fixup! Enable `resharding_enabled` option in development config

🙄🙄🙄
2025-01-16 10:51:51 +01:00
Jojii
e87123b767 IO metrics in hw counter types (#5769)
* io metrics in hw counter types

* Add new metrics to `new_with`
2025-01-16 10:49:53 +01:00
Arnaud Gourlay
fc41f599d0 Fix Clippy unused import on Windows (#5766) 2025-01-16 10:49:21 +01:00
Andrey Vasnetsov
ee6ae82ed5 Impletement a special type of access to collection suitable for serverless (#5745)
* Impletement a special type of access to collection suitable for serverless

* fix test

* fix test
2025-01-08 14:11:40 +01:00
Tim Visée
ea2a5818a4 Make resharding UUID required, hide field in OpenAPI schema (#5750) 2025-01-08 14:11:30 +01:00
Tim Visée
c7ab594e82 Resharding: add UUID to resharding operation (#5736)
* Add optional UUID to resharding operations

* Generate random UUID for resharding if not specified by user

* Update OpenAPI specification
2025-01-08 14:11:28 +01:00
Roman Titov
a4168cd96e Cleanup JSON logger impl and add JSON support to on-disk logger (#5699)
* Cleanup JSON logger impl and add JSON support to on-disk logger

* fixup! Cleanup JSON logger impl and add JSON support to on-disk logger

Fix tests
2025-01-08 14:09:36 +01:00
Roman Titov
69b7e0e473 Abort scale-down resharding on update error (#5670) 2025-01-08 14:09:01 +01:00
Tim Visée
05e7c48f76 Add task to clean local shard in the background (#5677)
* First naive implementation of local shard clean task

* Add wait and timeout parameters to clean shard API

* Cancel shard cleaning and mark as dirty when changing hash rings

* Expose shards undergoing cleaning in telemetry

* Properly cancel shard clean task, add drop guard to enforce

* Ensure we have a local shard to clean

* Replace existing local shard cleanup API

* Refactor how we create, manage and await clean tasks

* Invalidate only affected shards when committing read hash ring

* Expose all local shard clean task statuses in telemetry

* Properly invalidate shards when aborting resharding

* Add review remark comments

* Log clean task errors, extract task in dedicated function

* Join task when invalidating so we wait for completion

* Invalidate shard clean tasks in a batch to more efficiently join them

* Expose clean progress with number of deleted points

* Annotate cancel safety

* Fix comment

* When calling clean endpoint, ensure we have the specified local shard

* Invalidate shard cleaning when a local shard is being dropped

* Prevent anonymous type in shard clean status telemetry

* Cancel shard clean task directly by dropping future, fix possible deadlock

Before this change trying to invalidate shard cleaning tasks could
deadlock. The actual task only had two cancel points inside a read lock
on the shard holder. The shard holder is constantly released and
relocked.

In some of the places we can trigger invalidation already hold a shard
holder write lock. The task itself would have to grab a read lock in
order to reach the cancel point, in which case the locks would be
fighting each other.

Because invalidation also joins the task and waits for it to abort this
could get stuck forever.

Now we don't have cancellation points anymore and simply drop the whole
future in case of cancellation. That'll prevent it getting stuck.
2025-01-08 14:08:52 +01:00
Jojii
a2ba920a84 [Strict Mode] distributed max collection payload size (#5679)
* Restrict payload size in distributed setup

* Also check overwrite payload API
2025-01-08 14:08:44 +01:00
Gulshan
253362fcc2 Support for JSON logging (#5602)
* Support for json logging

* Rename enum name and verbose matches

* Use snake case formatting for log format variants

---------

Co-authored-by: Gulshan Kumar <kumargu@amazon.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
2025-01-08 14:08:32 +01:00
Jojii
bf4cae8778 [Strict Mode] Max collection size in distributed setup (#5592)
* Strict Mode: distributed checking of max collection size

* add size projections in distributed mode

* Add consensus tests

* New Test: All nodes in cluster

* fix tests

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

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

* increase upsert delay

* add TODO for resharding

* wait for strict mode config to be applied on second node

* remove delays

* Also wait for strict mode in other test

* clearify strict mode config option

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2025-01-08 14:08:12 +01:00
Arnaud Gourlay
0a03e9de74 Use TLS when registering known with TLS server config (#5676) 2025-01-08 14:08:07 +01:00
Andrey Vasnetsov
3f6419d67d Allow telemetry endpoint for JWT-limited requests (#5631)
* WIP: per-collection telemetry permissions

* upd telemetry

* fix clippy

* fix test

* Update src/actix/api/service_api.rs

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-01-08 14:04:20 +01:00
n0x29a
1d7ce8f9ce Pass inference API token from request to inference service (#5589)
Pass inference API token from request to inference service

---------

Co-authored-by: n0x29a <n0x29a@example.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2025-01-08 14:04:11 +01:00
Jojii
5aee24cc08 Timeout aware hardware counter (#5555)
* Make hardware counting timeout aware

* improve test

* rebuild everything

* fmt

* post-rebase fixes

* upd tests

* fix tests

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-01-08 14:03:52 +01:00
Andrey Vasnetsov
7b0911961c Explict configuration for deb package build (#5630)
* explicit configuration of deb package

* use special build feature

* Review suggestions

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-01-08 14:03:45 +01:00