272 Commits

Author SHA1 Message Date
qdrant-cloud-bot
f9d81f2b92
Enable async_scorer in integration tests (#8487)
* Enable async_scorer in integration tests

Enable `async_scorer=true` for all openapi and shell-based integration
tests by setting the environment variable in `integration-tests.sh`.
This exercises the io_uring vector storage path (on Linux) across all
vector configurations tested there, with graceful fallback if io_uring
is unavailable on the CI runner.

Made-with: Cursor

* Scope async_scorer to test_points_search consensus test only

Revert the blanket async_scorer=true from integration-tests.sh to keep
the normal mmap path covered. Instead, enable it via extra_env in just
the test_points_search consensus test, so we exercise the io_uring path
without losing coverage of the non-io_uring path on Linux.

Made-with: Cursor

* Parametrize test_points_search for sync/async scorer modes

Use pytest.mark.parametrize to run test_points_search twice: once with
the default scorer (sync_scorer) and once with async_scorer=true. This
exercises both the normal mmap and io_uring paths in a single test.

Made-with: Cursor

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-03-26 18:40:47 +01:00
Arnaud Gourlay
a97132fad6
Test all shard transfer methods for deferred points (#8447)
* Test all shard transfer methods for deferred points

* WAL delta carries deferred points

* add point count assertions

- snapshot: asserts target_visible == source_visible — deferred state preserved exactly
- stream_records: asserts target_visible >= source_visible — points may not be deferred on target
2026-03-26 18:40:31 +01:00
Tim Visée
9f8602d854
Allow peer to bootstrap with used URI if empty (#8301)
* [ai] Allow peer to bootstrap with existing URI if peer has no shards

Prompt:

I have a Qdrant cluster in distributed mode with some nodes registered
in consensus. If I bootstrap a new node with an URL that is already used
it is rejected and an error is returned. I would like to change this
behavior and allow this to happen. This would effectively replace a peer
because internally we'd drop the existing peer first, and then we'd add
the new peer so we can reuse the same peer URL. We must still reject
bootstrapping with the same URL if the peer that used the URL before us
still has any shards on it.

* [ai] Add test to assert new behavior, can rejoin if empty

Prompt:

Add two tests to assert the new behavior.

The first test should:
- create a cluster
- create a collection
- bootstrap a new peer
- kill and delete the local data for this peer without removing it from consensus
- bootstrap a new peer but reuse the URI of the peer we just killed to rejoin
- bootstrapping is expected to succeed

The second test should:
- create a cluster
- create a collection
- bootstrap a new peer but reuse the URI of the last node
- bootstrapping is expected to fail because the node being replaced has data on it

* [ai] Attempt to fix new tests

* Reformat

* [ai] Fix deadlock when rejoining with same peer URI

* [ai] Add test to ensure existing peer stops consensus on replace
2026-03-26 18:34:39 +01:00
tellet-q
b9e34b68b8
Add a test for dirty shard crashloop (#8440)
* Add a test for dirty shard crashloop
2026-03-26 18:24:29 +01:00
Arnaud Gourlay
60f32d7e65
Fix update worker hanging in deferred wait loop on config change (#8410)
* Fix update worker hanging in deferred wait loop on config change

* stop ignoring test

* handle timeout

* don't ack deferred points barrier when optimizer channel fails

* WIP: error handelling

* WIP: fmt

* cleanup

* propagate update status

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2026-03-26 18:22:37 +01:00
Arnaud Gourlay
4aa8f98045
Fix timeout in test_shard_snapshot_transfer_deferred (#8398)
* Fix timeout in test_shard_snapshot_transfer_deferred

* more specific exception net

* set client timeout explicitly
2026-03-26 18:16:41 +01:00
qdrant-cloud-bot
a10b033043
Add consensus test for deferred points in snapshot shard transfer (#8393)
* Add consensus test for deferred points in snapshot shard transfer

Verify that deferred points (those beyond the indexing threshold in
appendable segments) are included when performing a shard transfer
with the snapshot method, and become visible after optimization on
both source and target nodes.

Made-with: Cursor

* fix

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2026-03-26 18:16:01 +01:00
Tim Visée
1d43353aee
Fix transfers may lock shard holder for too long (#8373)
* Add basic test that shows shard holder is locked for too long

* Rework test, move into stream records test

* Fix typos

* Don't lock shard holder for a long time in stream records transfer (#8374)

* [ai] Detach shard holder lock from sending update batch

* Fix clippy warning

* Move stream records delay up to sleep in the middle of the batch

* remove unused code

---------

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

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2026-03-26 17:56:35 +01:00
Arnaud Gourlay
d58a6975d0
Default shard transfer with snapshot when prevent_unoptimized (#8358)
* Default shard transfer with snapshot when prevent_unoptimized

* extract heuristic

* adjust all possible call sites

* keep previous style

* rework default shard transfer method

* Ensure we don't combine non-streaming transfers with filters

* Clippy

* add http ok assertion before json()

* Use exhaustive match

* keep stream records as fallback

* use effective_optimizers_config

* fix fallback success signal

---------

Co-authored-by: jojii <jojii@gmx.net>
Co-authored-by: timvisee <tim@visee.me>
2026-03-26 17:55:51 +01:00
Andrey Vasnetsov
c6f7550fdc
Restrict snaphsot recovery to snapshots directory, hide file contents (#8341)
* restrict recovery from snapshot folder

* fmt

* clippy

* Extend test, path must be inside snapshots directory

* In release builds, hide detailed tar error message to not leak contents

* Change from bad request to forbidden

* fix(auth_tests): place snapshot in peer snapshots dir for recover_collection_snapshot

The recover from snapshot API now requires file:// paths to be inside the
configured snapshots directory. Write the test snapshot into the peer's
snapshots directory instead of a temp file so the request is allowed.

Made-with: Cursor

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Cursor Agent <agent@cursor.com>
2026-03-26 17:48:45 +01:00
tellet-q
506b69297f
Add test for snapshot backpressure freeze (#8197)
* Add test for snapshot backpressure freeze
2026-03-26 17:02:10 +01:00
Andrey Vasnetsov
d16c62c76c
Expose shard snapshot API (#8132)
* [AI] generate openapi schema for stream download of shard snapshot

* bump number of APIs

* cover API with access test

* fix test

* fix test
2026-02-17 11:00:47 +01:00
Roman Titov
bdd4bb5180
Ensure WAL and shard clocks consistency when creating shard snapshot (#8104) 2026-02-13 11:52:23 +01:00
Tim Visée
caa5a14866
Fix stream records transfer data race, losing pending updates (#8103)
* Add integration test to assert all queued updates are also transferred

* Plunge update queue in stream records transfers

* Migrate existing plunger usages to new plunge helper

* Skip test if not compiled with staging flag

* Only send delay operation when staging feature is enabled

* Reformat

* Fix review remarks
2026-02-13 09:55:37 +01:00
tellet-q
4cf0bbd63c
Add test for consensus' freeze during streaming snapshot (#8075) 2026-02-13 09:55:36 +01:00
tellet-q
79d0678440
Add more stages for shard transfer profiling (#8027)
* Improve stages reporting

* Remove transferring records info from snapshot transfer's comment

* Add detailed profiling for ReshardingStreamRecords

* Address AI review comment

* Remove some nesting

---------

Co-authored-by: timvisee <tim@visee.me>
2026-02-10 00:03:26 +01:00
Tim Visée
7d2a9657ac
Use local telemetry for peer version check, not cluster level telemetry (#8016) 2026-02-09 23:39:17 +01:00
Andrey Vasnetsov
c755e6bfe8
more reliable version check (#8002) 2026-02-09 23:37:14 +01:00
tellet-q
55969c7e97
Track shard transfer stages and duration (#8001)
* Track shard transfer stages and duration
2026-02-09 23:36:50 +01:00
Andrey Vasnetsov
9099a7ac1b
introduce update_mode parameter for upsert operation to control if we want to insert, update, or upsert (#7963)
* introduce update_mode parameter for upsert operation to control if we want to insert, update, or upsert

* add test

* upd dockstring

* require resharding once all peers have updated version

* use service error

* fix clippy again

* wait for same version before resharding in tests
2026-02-09 23:28:45 +01:00
Kumar Shivendu
a036211a0f
Test behaviour when having no shards in custom sharding (#7867)
* Test behaviour when having no shards in custom sharding

* minor suggestion
2026-02-09 22:56:17 +01:00
tellet-q
30a34642b9
Add a test for recovery after kill during Partial (#7762)
* Add a test for recovery after kill during Partial

* Address AI review

* simplify test

* Merge pull request #7829

* introduce a new state

* switch to ManualRecovery for user-initiated snapshot operations

* fmt

* fix test and regen api

* test fix: instead of force recovery on update failed snapshots now re…

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2026-02-09 22:35:29 +01:00
Andrey Vasnetsov
a21b641d26
Merge pull request #7835
* alt api key

* rm typo

* fix key length check logic

* differnt dirs for tests

* fix tests

* rm unused
2026-02-09 22:35:18 +01:00
Luis Cossío
d889ff90ee
allow collection-level jwt access (#7758) 2026-02-09 22:31:53 +01:00
Luis Cossío
45c560b5bc
[cluster telemetry] Expose endpoint (#7729)
* expose cluster telemetry endpoint

* add endpoint to openapi

* add jwt test

* remove dead_code expectation

* fix consistency check

* fix jwt access test

* use response(reference(..)) in openapi
2026-02-09 22:31:32 +01:00
tellet-q
f1d54ca889
Move test dependencies to tests (#7793)
* Move pyproject and uv.lock to tests folder

* Make tests working-dir agnostic

* Fix test

* Address review
2025-12-18 17:29:18 +01:00
Tim Visée
e35d452043
Add test for broken WAL delta after stream records abort (#7787)
* Add test to reproduce broken WAL delta after aborting stream records

* Add staging env var to slow down stream records transfers for test

* Tweak test formatting and utilities a bit

* Add comment to test, link to PR describing bug

* Update test so it still succeeds with patched behavior

* Fix broken WAL delta after stream records abort (#7791)

* Make set_replica_state async

* Add function called when active state of local replica changes

* Add snapshot for newest clocks

* Bump newest clocks snapshot on replica deactivation

* Use newest clocks snapshot during recovery

* Add enum for specifying whether to take or clear clocks snapshot

* Store clock snapshot inside clock map, removing extra file

This greatly simplifies state handling. It also prevent any kind of
desynchronization because all newest clocks are always persisted
atomically.

* Immediately persist clocks after taking snapshot

* Always update snapshot, only take if missing

* Take clock snapshots through each shard flavor, including proxies

* Propagate dedicated functions for taking and clearing clocks snapshot

* Only persist clocks immediately if changed on snapshot/clear

* Simplify recovery point logic, always take clocks snapshot if exists

* Remove unwrap

* Fix typo

* Fix doc comment

* Transfer driver is async, use Tokio sleep

* Reduce visibility
2025-12-18 17:29:16 +01:00
Andrey Vasnetsov
2101fbdcec
ignore shards with no active replicas (#7707) 2025-12-18 17:27:20 +01:00
xzfc
6c0d10abe7
Indexing progress (#7625)
* Add progress_tracker.rs

* Pass progress tracker around

* Populate progress tracker with actual data

* Expose progress on `/collections/{name}/optimizations` endpoint
2025-12-18 17:27:18 +01:00
Roman Titov
e33b4672e5
Fix test_collection_recovery test (#7700) 2025-12-18 17:26:37 +01:00
Roman Titov
d2834de0b5
Mark *new* local replicas as locally-disabled, when recovering Raft snapshot (#7684)
* Remove faulty mark-as-dead condition when recovering Raft snapshot 😅

* Mark new local replicas as locally-disabled when recovering Raft snapshot

* Add test
2025-12-04 08:44:02 +01:00
AMIR
8eec2046d7
Add list shard keys API (#7615) 2025-12-03 10:20:40 +01:00
Arnaud Gourlay
2b7f25b21f
Missing validations for shard transfers (#7557)
* Missing validations for shard transfers

* some more

* fix test
2025-11-25 11:15:15 +01:00
Arnaud Gourlay
c3470d0948
Fix consensus test port race condition (#7537)
Do not release the port before the process is really gone
otherwise it can be wrongly reused.

E.g.

2025-11-14T10:39:20.156573Z ERROR qdrant::startup: Panic occurred in file src/tonic/mod.rs at line 358:
called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 98, kind: AddrInUse, message: "Address already in use" }))
2025-11-14 20:45:23 +01:00
Roman Titov
32b7fdfb7f
Restrict /logger API (#7527) 2025-11-14 12:31:08 +01:00
Tim Visée
49f6cc9c4c
Fix hash ring initialization for custom sharding, prevent resharding panic (#7517)
* Correctly rebuild hash rings, don't use default with custom sharding

* Correctly initialize hash ring map with custom sharding

Don't load the non key ring by default

* Validate shard key for resharding more aggressively

When using auto sharding, require no shard key. When using custom
sharding, require a shard key.

* Only pass sharding method into shard holder construction

* Remove now obsolete debug assertion, we use same source config

* Correctly reconstruct hash rings, also add shard IDs in auto mode

* Add test, do not break consensus on invalid resharding down operation

* Add tests for resharding down shard count precondition

* Minor test tweaks

* Improve debug assertion

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

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2025-11-14 12:31:06 +01:00
Arnaud Gourlay
0457a5a39b
Fix flaky test consensus compaction (#7513) 2025-11-14 12:31:05 +01:00
Andrey Vasnetsov
749cf3b16c
promotion integration test (#7511)
* test with background update process

* fmt

* remove unused imports

* Remove unused import

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:31:05 +01:00
Andrey Vasnetsov
c8975ca64c
simple integration test for tenant promotion (#7503)
* simple integration test for tenant promotion

* add cleanup after promotion

* When switching to ReadActive state, set it for the correct peer ID

* fix test

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:31:05 +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
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
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
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
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
Andrey Vasnetsov
88060abb82
remove default explicit config for strict mode (#7369)
* remove default explicit config for strict mode

* Don't prefix commented out properties with space to remain consistent

* Don't crash test if strict mode config is not set at all

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:28:13 +01:00
Arnaud Gourlay
be976e42f6
Investigate flaky snapshot transfer test (#7339) 2025-11-14 12:28:13 +01:00
Andrey Vasnetsov
226cf78236
non appendable proxies (#7345)
* WIP: make proxy segment non-appendable

* make deleted points and index changes private to Proxy Segment

* consistently remove empty unused segment from holder on unproxifying and the end of optimization

* remove/fix obsolete test

* Fix comment, some general adjustments

* Also don't remove non-original segments

* Use ahash for map of proxy index changes

* Inline format arguments

* Simplify has point branching

* Assert that proxy flushes to latest wrapped segment version

* make vector deletetion a CoW operation

* relax debug assertions

* Update lib/shard/src/proxy_segment/mod.rs

* fix test_partial_snapshot_empty

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2025-11-14 12:28:13 +01:00
Tim Visée
d72475f590
Only wait for green collection status in empty snapshot test (#7360) 2025-11-14 12:27:48 +01:00