Commit Graph

806 Commits

Author SHA1 Message Date
Daniel Boros
8b7c9f051f fix/inference timeout error (#7598)
* fix: inference timeout error

* chore: cleanup timeout from inference config

* cleanup timeout from InferenceConfig

* chore: revert config.toml changes

* inference_token -> infrence_params for timeout propagation

* always use at least some timeout

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-11-25 14:25:39 +01:00
Arnaud Gourlay
70b8623bb1 Add timeout to cancel metrics and telemetry calls (#7579)
* Add timeout to cancel metrics and telemetry calls

* relax constraints

* Configure timeout default in OpenAPI schema

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-25 12:56:45 +01:00
Tim Visée
a4dd7b3fce Fix WAL handling on consensus snapshot (#7577)
* After clearing WAL, flush segment

* Add debug log when WAL is cleared

* Clear WAL on consensus snapshot after writing state, truncate on start

* Apply consensus snapshot offset

* Fix off by one error

* Tweak debug assertion message

* Change WAL reconciliation condition, and fully clear WAL in this case

* Add debug assertion to prove Raft index and snapshot index are equal

* Add documentation to resolve bot nit

* Return error on WAL clear failure

* Fix typo

* Remove unused truncate functions
2025-11-25 11:16:01 +01:00
Arnaud Gourlay
dda47e8388 Fix use the update runtime for update operations (#7569)
* Fix use the update runtime for update operations

* Enable IO on update runtime

FAILED tests/consensus_tests/test_collection_recovery_limits.py::test_collection_recovery_reach_limit - Exception: HTTP request to http://127.0.0.1:33891/collections/test_collection/points?wait=true&ordering=weak failed with status code 500 after 5.20299s with response body:
{'status': {'error': 'Service internal error: task 240 panicked with message "A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO."'}, 'time': 3.28820663, 'usage': {'hardware': {'cpu': 0, 'payload_io_read': 0, 'payload_io_write': 70315, 'payload_index_io_read': 0, 'payload_index_io_write': 0, 'vector_io_read': 0, 'vector_io_write': 1649102}, 'inference': None}}
2025-11-25 11:15:36 +01:00
Tim Visée
6e11c74073 Audit all spawn blocking calls, prematurely abort them (#7533)
* Prematurely abort blocking task in `spawn_cancel_on_drop` on drop

These tasks are intended to be cancellable. Now we prematurely abort the
task if the future was dropped before the task is executed.

* Prematurely abort blocking task in `spawn_cancel_on_token` on cancel

These tasks are intended to be cancellable. Now we prematurely abort the
task if the cancellation token is triggered before the task is executed.

* Prematurely abort blocking task for fetching telemetry

* Prematurely abort stoppable task on drop, all are safe to abort early

* Make `move_dir` either move everything, or nothing at all

That is with the exception of file IO errors in which case data may be
partially moved.

Before this PR it was possible for the new target directory to be
created without moving all data into it. Now we either do all, or
nothing.

* Prematurely abort task for creating full snapshot

It is fine to either create it, or not at all.

* Prematurely abort blocking task for waiting on consensus leader

* Prematurely abort blocking cardinality estimation and shard info tasks

* Prematurely abort blocking point deduplication task

* Prematurely abort blocking task for checking available disk space

* Prematurely abort blocking shard read operations

All shard read operations, such as retrieve, scroll, facets and more can
be safely aborted prematurely.

Related to: <https://github.com/qdrant/qdrant/pull/7530>

* Prematurely abort blocking task for waiting on replica state

* Prematurely abort blocking task for waiting on transfer replica states

* Prematurely abort blocking task for loading segment

This can safely be aborted before the task is started

* Prematurely abort blocking task waiting for replica states

* Prematurely abort blocking task for creating snapshot file

Safe because it aborts before writing any snapshot files to disk
2025-11-14 13:31:04 +01:00
Andrey Vasnetsov
20826e0dc7 wal_pop: binary to remove latest entry of WAL (#7526)
* binary to remove latest entry of WAL

* fix clippy
2025-11-14 12:31:08 +01:00
Roman Titov
32b7fdfb7f Restrict /logger API (#7527) 2025-11-14 12:31:08 +01:00
Tim Visée
ed99c3b15c Final metrics tweaks for Qdrant 1.16.0 (#7516)
* Add collections_vector_total metric for backwards compatibility

Only this metric was removed since Qdrant version 1.15.5, and so this
adds it back for backwards compatibility. Though it has been marked as
deprecated now.

* Prefix replica metrics with collection, part of collection namespace

* Count running optimizations per collection

* Remove deprecation flag

* Minor optimization, preallocate vectors
2025-11-14 12:31:06 +01:00
Jojii
0f191bfcf6 Metrics for snapshots (#7497)
* Add atomic counter for running snapshots

* Refactor collection telemetry + export prometheus metric

* Handle collection in ToC + current recovery measurements

* Fix openapi tests

* Fix tests

* Add snapshot metrics for streaming and partial snapshots.

* Fix typo in metrics name

* Adjust metrics names

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:31:06 +01:00
Tim Visée
28a863509c In metrics, only show cumulative number of page faults (#7482)
* In metrics, aggregate page faults

* Include page fault of active children (recursively)

* type alias Pid: i32

* Code improvements

* Ignore already terminated processes

* Clippy

* Also count faults for joined descendant threads in children

* Import std::cmp::min

* Rework child fault recursion, remove second hash set

* Add simple test for iterating child processes

* Fix typo

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Use limit values directly

* We don't include the parent PID

* Don't allocate hashmap when listing process children

* Extend process child PIDs test, fork recursively

---------

Co-authored-by: jojii <jojii@gmx.net>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-14 12:31:06 +01:00
Tim Visée
6b39ff1353 Add ReadActive replica state, use in some stream records transfers (#7474)
* Add ReadActive replica state

* Add consensus function to switch from Partial to ReadActive and confirm

* On stream records to a different shard ID, switch to ReadActive first

* Update OpenAPI spec

* In stream records peer sync, require all peers to be up-to-date

* Review fixes

* Rename ReadActive to ActiveRead

* update openapi spec

* explicit state checking functions

* typo

* update fallback routing with usage of a new state

---------

Co-authored-by: KShivendu <kshivendu1@gmail.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2025-11-14 12:31:04 +01:00
Tim Visée
8977db33a2 Report max system wide mmap count in metrics (#7487) 2025-11-14 12:31:04 +01:00
Tim Visée
bbb0a6838a In metrics, expose current thread count (#7484) 2025-11-14 12:31:03 +01:00
Roman Titov
59b6c5db77 Fix clippy 🙄 (#7486)
Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:31:03 +01:00
Tim Visée
e88f36ac82 Various metrics tweaks (#7480)
* Change page fault metrics from gauges to counters

* Change collection_vectors_total to collection_vectors

* Rename metric for page faults in joined child processes

* Rename some procfs metrics

* Show single limit for number of open files

* For number of file descriptors and mmaps follow convential names

* Rename dead_shards_total to dead_replicas

* Fix metric prefix for gRPC entries, add missing underscore

A underscore was missing if no global prefix was set
2025-11-14 12:31:03 +01:00
Andrey Vasnetsov
3556f7b52a remove filter level jwt (#7450)
* make jwt with payload filter fail

* remove `whole` access requirement

* remove unnecessary mut

* fmt

* adjust test

* fix test

* remove more tests

* fix test

* fix test again

* fix test again

* Replace deprecated PayloadConstraint with JSON Value placeholder

* Fix expect message

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:31:03 +01:00
Jojii
8ec08c4cd8 Fix panic on empty collections (#7478) 2025-11-14 12:31:03 +01:00
Jojii
ed8e9dce76 Add global metrics prefix (#7438)
* Qdrant prefix for metrics

* Update metrics tests

* Update openapi docs

* Make prefix configurable

* don't enable metrics prefix by default

* Adjust tests and openapi specs

* Custom validation for metrics_prefix setting
2025-11-14 12:30:22 +01:00
Andrey Vasnetsov
6257371413 remove init_from (#7454)
* wip: remove init_from

* remove init_from tests

* upd schema

* rm test
2025-11-14 12:30:16 +01:00
Andrey Vasnetsov
2a423d1f11 remove lock api (#7449)
* remove lock api

* fix api count + remove tests

* remove another test

* remove more tests
2025-11-14 12:30:16 +01:00
Jojii
f220845f84 Procfs metrics (#7451)
* Procfs metrics

* Clippy

* Fix compiling on non linux targets

* Move procfs up

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:30:16 +01:00
Jojii
df2b1c6232 Metrics vectors by name per collection (#7441)
* Add vector count per vector-name to metrics API

* Add to metrics API

* Improve TinyMap::get_or_insert_default and add tests

* Minor improvements

* Update openapi

* Review remarks

* Remove `collection_vectors` since it can be calculated manually
2025-11-14 12:30:15 +01:00
Jojii
cc4bff1615 Dead shards in /metrics (#7310)
* Dead shards in /metrics

* Update src/common/metrics.rs

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-11-14 12:30:15 +01:00
Jojii
40acac3c37 Add unindexed vectors to telemetry and metrics API (#7307)
* New metric for excluded vectors in indexed_only requests

* Make metric name align with prometheus naming convention

* Fix nit

* Fix tests

* Fix openapi

* Rename index_only into indexed_only

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:30:15 +01:00
Jojii
debb913da5 Add num points/vectors to metrics API (#7302) 2025-11-14 12:30:15 +01:00
Jojii
69d3198248 Add replica metrics (#7301)
* Add replica metrics

* Clippy

* Properly ignore shards with resharding status

* Include 0 as value in metrics

* Remove total_active_replicas and total_expected_replicas

* Improve minimum active replica count in case of resharding

* Reorder metrics calls min < max (to trigger CI)

* Fix metrics help

* Fix typo

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:30:15 +01:00
Kumar Shivendu
dc64d308b8 Respect payload filters while replicating point (#7362)
* Respect payload and hashring filters while replicating point

* Merge points instead of replacing for filtered stream records transfer

* cleanup

* Update utils

* Allow filters in transfer

* drop hashring filter since its not required when destination has single shard

* test comment

* Pass actual filter

* use exact=True

* Forward updates that satisfy the filter

* make test long enough for extra points to be upserted

* minor improvements

* fix test

* try with only inserting new points

* Temporarily forward points that match before or after

* Fix failing test

* Only do inserts

* Dont merge points and update old points in test

* Fix the bug in integration test

* fix read_batch_with_hashring fn name and docs

* changes after rebase

* add validation check

* apply suggestions

* Always trim clock tag when forwarding to a different shard ID

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-11-14 12:30:15 +01:00
Jojii
30fc847643 Add avx512vl and avx512vpopcntdq in telemetry (#7471) 2025-11-14 12:30:14 +01:00
Andrey Vasnetsov
fa7bd8677f Move Query Context into shard crate (#7459)
* Move modifier to segment level

* write idf modifier into segment config

* fmt

* use proper query context in edge

* simplify init_query_context
2025-11-14 12:30:13 +01:00
Kumar Shivendu
cda75c7ea0 Introduce fallback shard key for read and write requests (#7356)
* Allow passing fallback shard key on request level

* clippy & fmt

* Check target shard key replica states for routing

* fmt

* clippy

* Add shard fallback in gRPC

* updates

* clippy fix

* Check for empty replicas

* review: validate grpc shard key selector with fallback

* write routing logic (doesnt work yet)

* Don't hold shard holder guard for too long

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:30:13 +01:00
Kumar Shivendu
1c50da2e39 Implement logic to replicate points between shards (#7361)
* Allow replicating points between shards

* Add integration test for replicating points between shards

* Drop filter from ForwardProxyShard to for now

* Clean up test

* fix assert failures

* Fix integration test

* Drop reliance on FilteredStreamRecords

* minor improvements
2025-11-14 12:30:12 +01:00
Jojii
3fd07eb082 Currently running optimizers in Metrics (#7316)
* Currently running optimizer count in metrics

* Clearly state the prerequisites of count_optimizers_running()

* Minor improvements

* improve metric naming
2025-11-14 12:29:36 +01:00
Kumar Shivendu
c31593bdab Introduce replicate points action (#7063)
* Introduce new replicate points action

* fmt

* Introduce filter in shard transfer and new transfer method

* clippy & fmt

* Update OpenAPI specs and gRPC API

* Update gRPC docs

* Take from/to shard key as input for replicate_points

* update gRPC docs

* Make filters optional

* fmt

* clippy

* drop FilteredStreamRecords

* Add validation

* update gRPC docs

* Drop FIlteredStreamRecords

* clippy

* update openapi spec

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-11-14 12:29:34 +01:00
Andrey Vasnetsov
b219a61119 derive Eq for Filter (and underlying types) (#7419)
* derive Eq for Filter (and underlying types)

* fix tests

* use ptr to compare and hash CustomIdChecker

* fix gpu test

* fmt

* use OrderedFloat directly

* post-rebase fixes

* fmt

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2025-11-14 12:29:34 +01:00
eltu
d6d52d4b81 Full-Text Index ASCII Folding (Normalization) (#7408)
* Add ASCII folding to tokenization process

Introduced an optional ASCII folding feature within the `TokensProcessor` to normalize non-ASCII characters to their ASCII equivalents. Updated tests and documentation to reflect the changes.

* Refactor tokenization code for improved readability and maintainability

Reorganized and reformatted the tokenization module, including `TokensProcessor` initialization and ASCII folding mappings for better clarity. Updated tests to align with the changes.

* Update test cases to reflect optional tokenizer settings changes

Adjusted `ascii_folding`, `lowercase`, and `phrase_matching` settings in tests to `None` where applicable, aligning with updates in tokenizer configuration defaults.

* address review remarks

* fix codespell

* thx coderabbit

* Don't copy tokens that are already ASCII

* Shrink folded string to fit

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:29:32 +01:00
Andrey Vasnetsov
2aecef294f make flush worker loop async (#7405)
* make flush worker loop async

* await flush worker properly finishes

* simplify flush await

* Improved future select, inline return

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:29:31 +01:00
Kumar Shivendu
228d066edc Shard key initial state (#7371)
* Allow specifying initial state while creating shard key

* Dont wait for Active state if initial_state is set

* Generate gRPC docs and OpenAPI spec

* Apply suggestions

* Skip from scheamrs not serde

* Add integration test

* minor suggestions
2025-11-14 12:28:15 +01:00
Tim Visée
fb277d3eb5 Forbid peer to join cluster with URI that is already used (#7375)
* Disallow peer to join with URI that is already used

* Add test for rejecting peer join with duplicate URI

* Improve peer rejection logic

* Try to rejoin twice, we expect a consistent result
2025-11-14 12:28:15 +01:00
Daniel Boros
2c734e52a4 feat: handle 429 properly on infer svc (#7377)
* feat: handle 429 properly

* feat: change to rate limit error

* feat: handle http_date

* chore: remove unsued imports

* chore: make it more readable
2025-11-14 12:28:14 +01:00
Andrey Vasnetsov
51b3a62977 edge retrieve api (#7344)
* refactor: move RecordInternal into Shard crate

* refactor: move retrieve_blocking into Shard crate

* implement retrieve method + move some structures into dedicated files
2025-11-14 12:27:29 +01:00
Roman Titov
7977dbf9e7 Python bindings for Qdrant on Edge (#7312)
* Qdrant Edge Python binding 🐍⛓️💥

* fixup! Qdrant Edge Python binding 🐍⛓️💥

Fix example + cleanup

* review: move QueryEnum + mark search as deprecated

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-11-14 12:27:28 +01:00
Roman Titov
81834ec8a0 Qdrant on Edge prototype (#7170) 2025-11-14 12:26:52 +01:00
xzfc
6a2830db1c Use fs-err (#7319) 2025-11-14 12:26:51 +01:00
Andrey Vasnetsov
5b84dbdae0 log requests by type (#7292)
* store slow request log per request type

* filter by request name in API

* review fixes
2025-09-29 11:31:35 +02:00
dependabot[bot]
f940be4dd4 build(deps): bump anyhow from 1.0.99 to 1.0.100 (#7287)
* build(deps): bump anyhow from 1.0.99 to 1.0.100

Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.99 to 1.0.100.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.99...1.0.100)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-version: 1.0.100
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Inline formatting argument

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: timvisee <tim@visee.me>
2025-09-29 11:31:35 +02:00
Andrey Vasnetsov
1771696d55 slow requests log (#7188)
* wip: generalization trait for queries

* implement generalization for point operations

* fmt

* log priority queue

* wip: SlowRequestsListener

* fmt

* fix clippy

* simplify generalization

* fmt

* implement collection of requests profiles for update API

* implement API for viewing slow requests log

* add collection name to update worker

* add datetime to log

* fmt

* probabilistic counter of unique requests

* rename

* compute hash before converting into json value

* move logable out of generalizable

* fmt

* log query request

* fmt

* some fixes

* move measurement into local shard

* fmt

* upd openapi (not important)

* For enum variants, has discriminant

* Make SearchParams Copy

* Hash 0.0 and -0.0 the same

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Correctly hash enum variants and float values

* Hash through ordered float instead

* Fix priority queue not keeping longest request for hash

* SearchParams implements Copy

* Fix clippy warning

* Add unordered_hash_unique

* skip serialization if none

* Use OrderedFloat for hashing a float

* Use OrderedFloat for hashing a float

* only log updates if they are performed

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: xzfc <xzfcpw@gmail.com>
2025-09-29 11:31:11 +02:00
Arnaud Gourlay
ad76b196d7 Always run Telemetry on a blocking thread (#7269)
* Always run Telemetry on a blocking thread

* run Telemetry on general runtime instead of the blocking Actix one

* Polish test
2025-09-29 11:31:11 +02:00
Arnaud Gourlay
57831a355c [strict-mode] Add max number of payload index count (#7222)
* [strict-mode] Add max number of payload index count

* improve docs and validation for StrictModeConfig

* fix from coderabbit

* test blocking access to payload indexes

* polish test
2025-09-29 11:29:50 +02:00
Arnaud Gourlay
9c53c57130 Fix missing REST API validation for point batch update (#7219)
* Fix missing REST API validation for point batch update

* use a valid vector
2025-09-29 11:28:29 +02:00
Andrey Vasnetsov
db34245b54 make sure that grpc::Vector can always use new format (#7185)
* make sure that grpc::Vector can always use new format

* specify target version for ToDo

* Update lib/api/src/conversions/vectors.rs

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2025-09-29 11:28:28 +02:00