Commit Graph

51 Commits

Author SHA1 Message Date
Tim Visée
61b9fe687a Give the resharding CI test with concurrent updates more time (#4687) 2024-07-18 11:30:53 +02:00
Tim Visée
728b534086 Resume resharding driver on node restart (#4666)
* Resume resharding driver on restart if resharding is active

* Update resharding state comment started text

Using since versus started. 'Since' better clarifies that the current
state has been active since that time. While 'started at' could lead to
confusion on whether that time is for starting the whole resharding
operation or just that state.

* Add resharding resumption test during migrating points

* Recover resharding hash ring after loading shards

* Update resharding resume test, interrupt at multiple stages, less points

* Remove unused parameter

* Update collection shard count at resharding shard creation/destruction

* Apply suggestions from code review

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

* Use debug_assert_eq

* Remove trailing comma

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2024-07-17 17:02:16 +02:00
Tim Visée
54a00da0c2 Make reads and point counts consistent during resharding (#4617)
* Apply resharding filter only to existing shards, include shard selection

* Add test for stable exact point count during resharding

* Improve filtering, only two separate requests, filtered and non-filtered

* Make scrolling stable while resharding

* Add test for stable scroll during resharding

* Make search stable while resharding

* Add test for stable search during resharding

* Remove resharding post filter in retrieve

* Also assert cardinality point count in resharding test

* Fix typos and some tweaks

* Only clone filter if resharding is active

* Also minimize cloning with resharding filter on count request

* Add test for stable exact point count during resharding with indexing

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

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

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

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

* Also apply resharding filter to retrieve

* Restructure resharding filter usage in `Collection::retrieve`

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2024-07-16 17:22:49 +02:00
Tim Visée
699c70e807 Add resharding tests (#4609)
* Add basic resharding test, asserting shard and point counts

* Add resharding replica balancing test

* Always propagate deletes with wait, fix first resharding test flakyness

* Don't count points in balance test for now

* Fix resharding balance test, initial shard may not be on first node

* Count points in resharding balance test

* Test resharding with concurrent updates

* Add point data consistency check to resharding tests

* Fix not using given collection name, list point counts in debug output
2024-07-09 10:28:13 +02:00
Tim Visée
84a2dd8e95 Ensure we have any segment within capacity, otherwise add new one (#4416)
* Extract logic for creating thresholds config

* Put collection params and threshold config in update handler

* Add function to add a new appendable segment if all are over capacity

* Make new method static, call it before each optimization loop

* Update error message formatting

* Use exact point count in replication consensus test

* Add a test to assert segment creation when all are over capacity

* Suffix optimizer thresholds with _kb to clarify unit

* Move segment capacity check logic, run if optimizers are disabled

* fix: add -> mul

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-06-10 18:45:53 +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
20eb2e1f2f remove usage of vectors_count (#4052)
* remove usage of vectors_count

* skip serialization if none

* add deprecated mention

* Add colon after deprecation note

---------

Co-authored-by: timvisee <tim@visee.me>
2024-04-18 15:22:01 +02:00
Luis Cossío
2a00383f62 RBAC: Restructure jwt tests (#4017)
* separate access tests from validation tests

* bring changes from rbac-integration-tests review fixes

* bring changes from rbac-payload-access-tests

* update from base branch

* use const instead of magic number

* move COLL_NAME

* force usage of kill_all_processes()
2024-04-12 12:53:15 -04:00
Luis Cossío
82511e65fa RBAC: [tests] exhaustive access tests (#3961)
* create exhaustive access test (missing body stubs)

* use json body in rest requests

* use better stubs

* green test for create_shard_key

* make it work for delete_shard_key

* make it work for list_collections

* make it work for get_collection

* make it work for create_collection

* make it work for update_collection_params

* make it work for delete_collection

* make it work for update_aliases

* make it work for create_index

* make it work for collection_exists

* make it work for delete_index

* make it work for get_collection_cluster_info

* don't build grpcio and use `uv` for faster deps installation

* partially prepare for update cluster ops

* make it work for list_collection_aliases

* make it work for list_aliases

* make it work for list_collection_snapshots

* make it work for create_collection_snapshot

* huge refactor + make it work for delete_collection_snapshot

* make it work for download_collection_snapshot

* test_upload_collection_snapshot

* test_recover_collection_snapshot

* test_recover_collection_snapshot

* test_upload_shard_snapshot

* test_recover_shard_snapshot

* test_list_shard_snapshots

* test_create_shard_snapshot

* test_delete_shard_snapshot

* test_download_shard_snapshot

* test_list_snapshots and test_create_snapshot

* test_delete_snapshot

* test_download_full_snapshot

* test_get_cluster

* test_recover_raft_state

* test_delete_peer

* prepare for splitting into another PR

* skip api exhaustiveness checks

* lil cleanup

* fix integration tests workflow

* test search api

* test recommend api

* test discover api

* test count and scroll

* test get and upsert points

* test update points batch

* test update and delete vectors

* test set, overwrite, delete, and clear payload

* test service level actions

* finish testing (with errors), introduce not needing success

* make tests much faster

* simplify delete tests

* complete collection cluster operations

* cleanup

* update after rebase

* change permissions for create and delete shard keys

* review fixes

* add newline
2024-04-11 12:42:59 -04:00
Luis Cossío
8a01c7e13c RBAC: stateful validation with value_exists (#3874) 2024-03-21 13:52:32 -03:00
Tim Visée
2724ab6506 Make shard diff transfer fallback to different method through consensus for 1.9 (#3798)
* Add shard transfer consensus method to restart shard transfer

* Arrange shard transfer fallback through consensus

* Properly handle stopping existing transfer, don't finish

* Use user specified shard transfer method as default when falling back

* Report correct fallback transfer method being used

* Always make WAL delta transfer fall back to stream records

* Remove unnecessary clones

* When doing shard transfer fallback, confirm consensus accepted it

* Confirm shard transfer restarts through consensus, rather than state

* Update WAL delta fallback test, assert we switch to stream_records
2024-03-19 15:14:11 +01:00
Tim Visée
e343e575d3 Attempt to improve WAL delta reliability: more throttling (#3790)
* Allow batching in point upsertion fixture

* Increase throttle interval, tweak barrier waiting for transfer progress
2024-03-15 10:07:19 +01:00
Andrey Vasnetsov
bd4104c7bc attempt to fix flacky test_peer_snapshot_bootstrap (#3824) 2024-03-14 10:12:25 +01:00
kwkr
0da5f32b93 Managing assigned ports in the consensus tests #2610 (#2831)
* add draft for managing assigning ports

* track hardcoded ports

* fix cleaning up ports
2024-03-13 10:59:07 +01:00
Arnaud Gourlay
e02a313bdb Consensus tests capture stdout (#3753)
* Consensus tests capture stdout

* configure also second wave of nodes
2024-03-05 15:07:55 +01:00
Tim Visée
6851ec2e50 For WAL delta test assertions, use transfer status rather than logs (#3775)
* Decrease queue proxy batch size to 10

This means each batch will hold 10 user operations. Each user operation
could already be a batch.

* Add test barrier to wait for transfer progress

* Don't assert WAL delta transfer by logs, assert from status if possible

* Fix typo
2024-03-05 12:54:44 +01:00
Tim Visée
420d46f1e1 Add basic integration tests for WAL delta transfer (#3679)
* Add WAL delta transfer integration test for empty delta

* Report size of WAL delta, assert this in integration tests

* Add WAL delta transfer integration test for shard recovery

* Add WAL delta transfer integration test for falling back

* Minor improvements

* Fix typo

* Fix data race in WAL delta integration test, kill upsertions on count

* In WAL delta tests, compare all points, vectors and payload exactly

* add test for fallback in into straming if diff is big

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-02-26 11:06:10 +01:00
Andrey Vasnetsov
3945ce108b use readyz (#3672)
* use readyz

* make test less strict

* disable transfers_reached_threshold
2024-02-22 20:44:35 +01:00
Arnaud Gourlay
014e833d57 Lint Python tests (#3504) 2024-02-01 09:37:29 +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
Arnaud Gourlay
8e709895ef Sparse vectors sanity consensus checks (#3127) 2023-12-03 19:19:39 +01:00
Andrey Vasnetsov
2d8ee774ec await for uniform consensus after index creation (#3035) 2023-11-17 14:21:47 +01: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
1be333b8df Increase timeout for rejoin cluster test (#1600) 2023-03-27 10:28:56 +02: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
Arnaud Gourlay
2d9e015905 Forward write request according to write consistency (#1405)
* Forward write request according to write consistency

* use gRPC internal update API by making shard_id optional

* improve and test

* mark leader peer as failed in case of service error during forward

* forward write ordering param
2023-01-30 15:02:21 +01: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
Andrey Vasnetsov
61d970ef90 Init collection from (#1364)
* WIP

* WIP: add shards selection

* fmt

* WIP: collection init from other collection

* fmt

* fix bugs

* add collection write lock + use collection manager runtime instead of search runtime

* fmt

* integration test

* better names ?

* payload indexes transfer
2023-01-22 01:16:55 +01:00
Arnaud Gourlay
5156fa8966 Stop on fail consensus recovery (#1347) 2023-01-17 15:45:45 +01:00
Arnaud Gourlay
9f48cb8a71 Save consensus logs in case of CI failure (#1335)
* try actions/upload-artifact

* dedicated folder for consensus test logs based on pytest name

* improve naming

* add new transient test folder
2023-01-12 14:52:19 +01:00
Andrey Vasnetsov
926a058c73 Fixing missed leader inconsistency (#1286)
* WIP: introduce local state

* WIP: sync local state with consensus in idle

* fmt

* rm extensive debug

* update triple replication test

* update triple replication test

* rm debug logs

* fix check for established leader + only sync local if no proposals

* remove unused file

* test compatible with python 3.8

* test compatible with python 3.8

* longer wait for consensus

* longer wait for consensus

* extra sleep in test

* remove extra sleep

* Fixing missed leader inconsistency - transfers (#1298)

* explicit request timeout

* explicit request timeout

* explicit request timeout

* explicit request timeout

* explicit request timeout

* prevent double handelling of the transfer termination

* kill the process

* log on inconsistency

* log on inconsistency

* log on inconsistency

* debug

* revert debug in test

* forward updates to partial shards, abort transactions on dead node report

* fmt

* disable retry of transfer, if the transfer was cancelled + allow predictable ports in test

* fix import
2022-12-23 00:45:04 +01:00
Andrey Vasnetsov
772326f848 Recover distributed collection (#1214)
* WIP: shards recovering API: download snapshot

* fmt

* snapshot recovery API

* fmt

* snapshot recovery integration test + fixes

* review fixes

* review fixes 2

* Update lib/storage/src/content_manager/snapshots/recover.rs

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

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-11-16 10:55:23 +01:00
Arnaud Gourlay
fc77e3e511 Use systematically assert_http_ok for better error reporting (#1183)
* Use systematically assert_http_ok for better error reporting

* extraction assertion to use it outside of pytest
2022-11-01 11:19:13 +01:00
Arnaud Gourlay
286ca9f5e4 0.11.0 cherry picks (#1174)
* implement concern-factor, forbig disabling the last node, improve tes… (#1168)

* implement concern-factor, forbig disabling the last node, improve test stability

* upd docs

* improve test_recover_dead_node

* rename to write_consistency_factor

* Fix bug: applied index higher than commit on restart (#1172)

* create collection with default status = dead + await for activation on create_collecton_op_submit

* fmt

* fix unit tests

Co-authored-by: Egor Ivkov <e.o.ivkov@gmail.com>

* upd integration tests

* fix transaction handling

* upd protobuf

* upd to v0.11.0

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: Egor Ivkov <e.o.ivkov@gmail.com>
2022-10-27 10:16:21 +02:00
Andrey Vasnetsov
387b52d7fa propagate peer url to consensus if specified uri is does not match a … (#1156)
* propagate peer url to consensus if specified uri is does not match a stored one + tests

* review fixes
2022-10-23 00:07:39 +02:00
Arnaud Gourlay
faa4008938 Enable replication in consensus test (#1140) 2022-10-20 11:36:22 +02:00
Arnaud Gourlay
9324be1d60 [Replication] Add replicas (#1085)
* Add replicas to ReplicaSet

* unproxify shard & miscs

* no exlusive write locking while adding replicas

* on_optimizer_config_update on Shard with async. recursion

* no exlusive write locking while removing replicas

* shortcut replica set propagation #1101

* remove unused field

* make RequestShardTransfer callback sync.

* promote local & remote to replica state

* fixes for replica sync api (#1123)

* code review

* fix replica set update - fail only if all failed

* Add replica redesign (#1131)

* refactor shard/mod.rs

* wip

* fmt

* it compiles

* temporary disable replica placemeant change on replication factor

* fmt

* finish todos

* small refactoring

* remove change::add

* replica-set -> shard-replica-set

* fmt

* upd openapi

* fix finish transfer logic

* fix existing integration tests

* shard transfer validation

* fmt

* review fixes

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-10-17 20:12:10 +02:00
Andrey Vasnetsov
993e94eaef V0.9.1 (#939)
* minor fix + upd version to 0.9.1

* fmt

* fix clippy

* fix test
2022-08-10 21:15:40 +02:00
Arnaud Gourlay
320b220b01 Move shard API (#869)
* Move shard API

* add missing collection_name to openapi spec

* add basic shard transfer info to collection cluster API

* improve testing
2022-07-28 20:14:15 +02:00
Arnaud Gourlay
9b8b5b6376 [sharding] Collection cluster info API (#822)
* Collection cluster info API

* better output format

* update openapi spec

* local shard info reports number of points

* rebase
2022-07-18 17:57:34 +02:00
Egor Ivkov
ef3c6c5e15 Fair hash ring (#816)
* Fair hash ring

* Python test processes removal fix
2022-07-14 19:27:53 +02:00
Arnaud Gourlay
28f4339ea1 Fix gRPC port for consensus tests (#800)
* Fix gRPC port for consensus tests

* python fmt
2022-07-12 10:11:40 +02:00
Egor Ivkov
75008d8d57 Kill qdrant processes after each python test (#782) 2022-07-05 15:01:17 +03:00
Egor Ivkov
8f8f55f993 Learners switch to voters test (#753) 2022-06-28 11:28:11 +02:00
Arnaud Gourlay
6f8b145b5e test many collections through consensus (#731) 2022-06-24 10:19:00 +02:00
Arnaud Gourlay
fa5a501e25 Remove last sleep consensus test (#720)
* remove sleep by polling peer addition

* cleanup
2022-06-21 17:59:59 +02:00
Arnaud Gourlay
81589c23c4 harden consensus test and debugging (#704) 2022-06-15 19:13:54 +02:00
Egor Ivkov
533fd208b6 Move out consensus logic from ToC (#675) 2022-06-15 16:18:26 +03:00
Arnaud Gourlay
beef4d0185 Consensus tests use cluster API instead of sleep (#674) 2022-06-09 20:49:41 +02:00
Egor Ivkov
5bebd07520 Move out consensus test setup into util (#629) 2022-05-25 19:19:16 +03:00