Commit Graph
131 Commits
Author SHA1 Message Date
Arnaud Gourlay 511b7af6a6 Add missing assertion to shard transfer test (#2254) 2023-07-12 17:44:37 +02:00
Tim Visée c06e60a59d Fix expired TLS certificates in CI tests (#2239)
* Mark certificate generate script as executable

* Update TLS test certificates

* Extend TLS test certificate expiry to 10 years
2023-07-10 14:16:55 +02:00
Luis Cossíoandtimvisee f1279b4fcb Tests: Update storage compat with quantized collections (#2040)
* update storage compat test to include quantized collections

* remove unused collection snapshot

* increase dims and range of vectors

* capture pid right after starting qdrant

* Remove extra space

* storage-compatibility.sh: capture PID right after instantiation

---------

Co-authored-by: timvisee <tim@visee.me>
2023-06-14 14:03:27 -04:00
Roman Titov 4f01f9fbb1 Fix WriteOrdering::Medium and WriteOrdering::Strong semantics (#2053)
`WriteOrdering::Medium` and `WriteOrdering::Strong` were swapped 🤡
2023-06-09 16:23:06 +02:00
Arnaud Gourlay a22c58d951 Fix flaky test: Wait for node to go down (#2029) 2023-06-06 15:02:46 +02:00
Arnaud Gourlay 00709dc6ea Cluster operation coalescing channel requires only one message (#2008) 2023-06-01 13:49:27 +02:00
Arnaud Gourlay 77fe829b40 Coalesce cluster operation to fix dropped callback (#2003) 2023-05-31 19:42:21 +02:00
Russ Cam 8342288e1f Fix documentation links (#2000)
* Update documentation links

This commit updates documentation links to point to
the correct locations.

* formatting
2023-05-31 10:08:43 +02:00
Roman TitovandTim Visée abffa27ff0 Refactor Dockerfile (#1594)
* Refactor Dockerfile

- fix cross-compilation
- improve caching

TODO:
- check if `lld` is used/works for linkage (and enable if not used, or remove if doesn't work)

* Remove `aarch64` linker config from `.cargo/config.toml` (seems to be unnecessary)

* Expose `LINKER` argument and enable `lld` linker

* Add `mold` linker support

* Document Dockerfile

* Add closing ` in the Dockerfile comments

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2023-05-26 16:01:43 +02:00
Tim Visée 511d20deea Simplify TLS test config, don't overwrite production config (#1977)
This is now possible since <https://github.com/qdrant/qdrant/pull/1972>
is merged.
2023-05-25 18:18:52 +02:00
Andrey Vasnetsov 5f0e3585db move linker to docker (#1863)
* move linker to docker

* move mold install to builder

* use release profile by default

* fix mold download

* add build-args to CI builds

* add missing buil args
2023-05-09 11:57:31 +02:00
JesseandAndrey Vasnetsov b67c655ddb Add caching of docker layers in CI (#1856)
* Add caching of docker layers in CI

Build required docker images for CI in a workflow step using buildkit's
gha cache type. This will populate the local layer cache from github
actions' cache. Builds in subsequent CI steps will be nearly instant,
because all layers can be reused.

* add minor change to see if build time is any faster

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-08 17:02:29 +02:00
Roman TitovandAndrey Vasnetsov 16b7fb7688 Improve handling out-of-RAM errors during Qdrant startup (#1777)
* 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>
2023-05-02 20:54:13 +02:00
9873ac88ec Make query planner aware of deleted points and vectors (#1757)
* Exclude deleted vectors from HNSW graph building stage

* When estimating query cardinality, use available points as baseline

We should not use the total number of points in a segment, because a
portion of it may be soft deleted. Instead, we use the available
(non-deleted) points as baseline.

* Add plain search check to unfiltered HNSW search due to deleted points

* Cardinality sampling on available points, ignore deleted named vectors

* Estimate available vectors in query planner, now consider deleted points

In the query planner, we want to know the number of available points as
accurately as possible. This isn't possible because we only know the
number of deletions and vectors can be deleted in two places: as point
or as vector. These deletions may overlap. This now estimates the number
of deleted vectors based on the segment state. It assumes that point and
vector deletions have an overlap of 20%. This is an arbitrary
percentage, but reflects an almost-worst scenario.

This improves because the number of deleted points wasn't considered at
all before.

* Remove unused function from trait

* Fix bench compilation error

* Fix typo in docs

* Base whether to do plain search in HNSW upon full scan threshold

* Remove index threshold from HNSW config, only use full scan threshold

* Simplify timer aggregator assignment in HNSW search

* Remove vector storage type from cardinality function parameters

* Propagate point deletes to all its vectors

* Check for deleted vectors first, this makes early return possible

Since point deletes are now propagated to vectors, deleted points are
included in vector deletions. Because of that we can check if the vector
is deleted first so we can return early and skip the point deletion
check.

For integrity we also check if the point is deleted, if the vector was
not. That is because it may happen that point deletions are not properly
propagated to vectors.

* Don't use arbitrary vector count estimation, use vector count directly

Before we had to estimate the number of vectors (for a named vector)
because vectors could be deleted as point or vector. Point deletes are
now propagated to vector deletes, that means we can simply use the
deleted vector count which is now much more accurate.

* When sampling IDs, check deleted vecs before deleted points

* On segment consistency check, delete vectors for deleted points

* Fix vector delete state not being kept when updating storage from other

* Fix segment builder skipping deleted vectors breaking offsets

* update segment to handle optional vectors + add test (#1781)

* update segment to handle optional vectors + add test

* Only update stored record when deleting if it wasn't deleted already

* Reformat comment

---------

Co-authored-by: timvisee <tim@visee.me>

* Fix missed vector name test, these are now marked as deleted

* upd test

* upd test

* Update consensus test

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-04-25 14:31:04 +02:00
Roman Titov e240740ff3 Fix payload index snapshot restoration (#1775) 2023-04-24 21:41:11 +02:00
Roman TitovandAndrey Vasnetsov 5d3f9e167e Improve handling of out-of-disk-space errors during Qdrant startup (#1755)
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-04-24 13:02:29 +02:00
Tim Visée e985ff31b6 General improvements (#1687)
* Change file mode of some .sh files to make them executable

* Remove whitespace on empty lines from YAML configurations

* Fix unused import warning on Windows
2023-04-10 20:03:56 +02:00
Yiping Dengandtimvisee 0d6e7ca952 Add user client certificate validation capabiltiy (#1663)
* 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>
2023-04-10 16:03:30 +02:00
Tim Visée d74bfa088c Add CI job to enforce generated OpenAPI and gRPC file consistency (#1667)
* Add test script to ensure OpenAPI files are consistent with sources

* Add CI job to test OpenAPI file consistency

* Add CI task to test gRPC file consistency

* Tweak consistency scripts a bit, touch temp file to trigger gRPC rebuild

* Don't test .gitignored files

* Mention updating the OpenAPI specification is enforced by CI

* Update CI job configuration

* Also check consistency of gRPC docs

* Rename temporary files to have a .diff prefix

* Add docs to consistency checking scripts
2023-04-10 14:38:53 +02:00
Arnaud Gourlay c412e0ae3d cleanup and document openapi issue (#1665) 2023-04-05 13:15:01 +02:00
Tim Visée 91a0200c1b Improve metrics building performance, limit endpoints to whitelist (#1616)
* 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
2023-03-29 13:08:06 +02:00
Arnaud Gourlay 1be333b8df Increase timeout for rejoin cluster test (#1600) 2023-03-27 10:28:56 +02:00
Ibrahim M. AkrabandAndrey Vasnetsov f8e6c58a84 add upload snapshot functionality using multipart request (#1578)
* add upload snapshot functionality using multipart request

* remove unnecessary printing

* Add proper error handling

* add snapshot upload integration tests

* Fix maximum uploaded snapshot size limit

* review changes

* update OpenAPI with upload endpoint

* add missed query param in openapi

* remove unused function

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-03-21 17:17:25 +01:00
stencillogic 21f1d90cea Add tls support (#1581)
* add TLS support

* update github workflow

* fix formatting

* fix tests

* fix clippy warning

* fix PR remarks
2023-03-20 20:59:49 +01:00
Roman Titov accc6f9a39 Add peer_snapshot_bootstrap test (#1548)
* Add a test for new peer bootstrap when all cluster nodes have truncated WAL

* Make the test stable
2023-03-12 13:33:25 +01:00
Arnaud Gourlay d13e38dcff Wait for all shards to be active in when testing collection recovery (#1508) 2023-03-01 14:29:30 +01:00
Roman Titov 77f2acd11e Fix collection recovery during Raft snapshot application (#1475)
- Fix remote shards state recovery during Raft snapshot application
- Fix local shards data recovery during Raft snapshot application
- Refactor `test_collection_recovery` test
2023-02-23 23:13:22 +10: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
Roman Titov cf04b1a92b Add /cluster/recover API endpoint (#1451)
- Add required internal `raft::raw_node::RawNode::report_snapshot` calls
- Add methods to propagate `raft::raw_node::RawNode::request_snapshot` call to the consensus thread
- Add `/cluster/recover` API endpooint
- Add `test_collection_recovery.py` integration test (disabled on CI; documents current, incorrect behavior)
2023-02-15 04:19:11 +10:00
Arnaud Gourlay 3aa148cdf7 Add UUID to storage compatibility tests (#1447) 2023-02-08 20:10:06 +01:00
Andrey Vasnetsov 6965f2f4f9 fix basic-rest-api-test (#1433) 2023-02-06 13:38:16 +01:00
Roman TitovandAndrey Vasnetsov a50e7bdcd4 Add read_consistency parameter to the APIs (#1371) (#1407)
* WIP: Add `read_consistency` parameter to the APIs

* WIP: Add `read_consistency` parameter to the APIs

TODO:
- Add documentation

* `cargo fmt`

* Add gRPC documentation

* Add OpenAPI documentation

* Cleanup

* fixup! Add OpenAPI documentation

* fixup! Add gRPC documentation

Who would have known there's `generate_grpc_docs.sh`!? 🥲🙈🤦‍♀️

* generate openapi

* Fix `read_consistency` query parameter deserialization

* Further improve `read_consistency` query parameter deserialization

* `cargo clippy`

* Fix `Payload` comparison during read operation result resolving

* Fix grammar

* rename `read_consistency` -> `consistency` and add integration test

* use majority for test

* fix tests

* Fix tests

* fixup! Fix tests

Apply the same fix to `ScoredPoint`

* Remove an `unwrap`

* fixup! Fix tests

Gotta love those negative conditions, or how a missed `!` can ruin your day... 🤦‍♀️

* Make internal API calls strictly "local-shard only"

* Implement a few basic traits for `ResolverRecord`

* fixup! Implement a few basic traits for `ResolverRecord`

* Revert "Make internal API calls strictly "local-shard only""

This reverts commit 25378e61ff.

* Fix `Record::payload` and `ScoredPoint::payload` serialization

* Revert "Fix `Record::payload` and `ScoredPoint::payload` serialization"

This reverts commit b566bea49b.

* Fix `Record::payload` and `ScoredPoint::payload` visibility

* fixup! Fix `Record::payload` and `ScoredPoint::payload` visibility

Remove `todo!()`

* refactoring

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-02-03 01:12:28 +01:00
Arnaud Gourlay ad9558d208 Enable ordering of update requests on replica leader (#1410)
* Enable ordering of update requests on replica leader

* add time for replication
2023-01-31 15:06:56 +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 f356455b07 add write consistency param to rest and grpc api (#1397)
* add write consistency param to rest and grpc api

* fix grpcurl + refactor grpc for better extencibility

* upd grpc docs

* fix conversion
2023-01-25 11:49:01 +01:00
Arnaud GourlayandAndrey Vasnetsov e08e3bccbf Recover dead shards pro-actively (#1391)
* Recover dead shards pro-actively

* reuse same ports as changing it requires a full consensus round

* refactoring

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-01-23 20:25:40 +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
Roman TitovandAndrey Vasnetsov ced0abb4c7 Fix segment snapshotting (#1321) (#1334)
* WIP: Fix `Segment::take_snapshot`

TODO:
- This commit, probably, breaks snapshotting of segments with memmapped vector storage
- `ProxySegment::take_snapshot` seems to potentially similar bug

* WIP: Fix `Segment::take_snapshot`

- Fix snapshotting of `StructPayloadIndex`
- Fix snapshotting of segments with memmapped vector storage
- Temporarily break `ProxySegment::take_snapshot`

* Fix `ProxySegment::take_snapshot`

* Remove `copy_segment_directory` test

* nitpicking

* clippy fixes

* use OperationError::service_error

* Cleanup `TinyMap` trait bounds and derive `Debug`

* Fix `test_snapshot` test

- Derive `Debug` for `NamedVectors`

* Move utility functions from `segment.rs` to `utils` module

* Contextualize `segment::utils::fs::move_all` a bit more carefully

* Fix a typo

* add backward compatibility with old snapshot formats

* fmt

* add snapshot for compatibility test

* git lfs is a piece of shit

* Nitpicking

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-01-13 11:44:42 +01:00
Arnaud Gourlay b1bf1e87e1 Add logging to node recovery (#1337) 2023-01-12 17:31:28 +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 bd05a69a5f Id mapper inconsistency (#1302)
* always flush wal

* always flush wal fix

* always flush wal fmt

* flush wal during background flush

* async wal flush

* use id-tracker internal id for next-id instead of vector storage

* add flush order and recovery comment

fix merge bug

* longer timeout in test
2022-12-25 22:36:31 +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 38444d2cc7 Fix consensus freezes (#1241)
* do not await for replica deactivation if there is a logical error

* use async mutex in raft service + integration test for deadlock

* fmt
2022-11-24 15:36:03 +01:00
Andrey Vasnetsov 0e42672525 fix snapshot recovery - fix proper deactivation messages (#1238) 2022-11-23 13:47:14 +01:00
Arnaud Gourlay 6266d9bcdc enable compression for gRPC (#1186)
* enable compression for gRPC

* add benchmarks

* fix grpc benchmark

* discardResponseBodies to reduce memory usage

* improve & split benchmarks

* do not use gzip for inter node communication as benchmarks are not conclusive
2022-11-18 13:34:49 +01:00
Andrey VasnetsovandArnaud Gourlay 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
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