mirror of
https://github.com/qdrant/qdrant.git
synced 2026-07-23 11:11:00 -05:00
* Update: unmaintained crate memmap -> memmap2 (#559) (#1160) Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com> * Consensus q n a (#1169) * Expand comments and minor refactoring for raft state * fmt * add comments to consensus.rs * fix "Consensus q n a" compatibility * Use less ram for id tracker (#1176) * use less ram for id tracker * are you happy clippy * use vec for internals * use versions for internal ids * keys test * Use less ram for id tracker fixes (#1182) * WIP: internal_to_version * fmt * fix unit tests * add comment Co-authored-by: Ivan Pleshkov <pleshkov.ivan@gmail.com> Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com> * remove suggesting changes in replications on replication factor change (#1177) * Bump actix-cors from 0.6.3 to 0.6.4 (#1185) Bumps [actix-cors](https://github.com/actix/actix-extras) from 0.6.3 to 0.6.4. - [Release notes](https://github.com/actix/actix-extras/releases) - [Commits](https://github.com/actix/actix-extras/compare/cors-v0.6.3...cors-v0.6.4) --- updated-dependencies: - dependency-name: actix-cors dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * enable HTTP compression middleware (#1184) * 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 * Bump pprof from 0.10.1 to 0.11.0 (#1188) Bumps [pprof](https://github.com/tikv/pprof-rs) from 0.10.1 to 0.11.0. - [Release notes](https://github.com/tikv/pprof-rs/releases) - [Changelog](https://github.com/tikv/pprof-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/tikv/pprof-rs/commits) --- updated-dependencies: - dependency-name: pprof dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Cosine dist zero vectors (#1198) * skip pre-processing of zero-length vector for cosine distance * fmt * Bump env_logger from 0.9.1 to 0.9.3 (#1201) Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.1 to 0.9.3. - [Release notes](https://github.com/env-logger-rs/env_logger/releases) - [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md) - [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.1...v0.9.3) --- updated-dependencies: - dependency-name: env_logger dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump indicatif from 0.17.1 to 0.17.2 (#1202) Bumps [indicatif](https://github.com/console-rs/indicatif) from 0.17.1 to 0.17.2. - [Release notes](https://github.com/console-rs/indicatif/releases) - [Commits](https://github.com/console-rs/indicatif/compare/0.17.1...0.17.2) --- updated-dependencies: - dependency-name: indicatif dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ordered-float from 3.3.0 to 3.4.0 (#1204) Bumps [ordered-float](https://github.com/reem/rust-ordered-float) from 3.3.0 to 3.4.0. - [Release notes](https://github.com/reem/rust-ordered-float/releases) - [Commits](https://github.com/reem/rust-ordered-float/compare/v3.3.0...v3.4.0) --- updated-dependencies: - dependency-name: ordered-float dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump clap from 4.0.18 to 4.0.22 (#1205) Bumps [clap](https://github.com/clap-rs/clap) from 4.0.18 to 4.0.22. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.22) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump num_cpus from 1.13.1 to 1.14.0 (#1203) * wait for state deactivation on replica update failure (#1200) * wait for state deactivation on replica update failure * review fixes * upd version to 0.11.2 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: erare-humanum <116254494+erare-humanum@users.noreply.github.com> Co-authored-by: Ivan Pleshkov <pleshkov.ivan@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
99 lines
3.3 KiB
Python
99 lines
3.3 KiB
Python
import pathlib
|
|
|
|
from .utils import *
|
|
from .assertions import assert_http_ok
|
|
|
|
N_PEERS = 5
|
|
N_SHARDS = 4
|
|
N_REPLICA = 2
|
|
|
|
|
|
def test_collection_sharding(tmp_path: pathlib.Path):
|
|
assert_project_root()
|
|
peer_dirs = make_peer_folders(tmp_path, N_PEERS)
|
|
|
|
# Gathers REST API uris
|
|
peer_api_uris = []
|
|
|
|
# Start bootstrap
|
|
(bootstrap_api_uri, bootstrap_uri) = start_first_peer(
|
|
peer_dirs[0], "peer_0_0.log")
|
|
peer_api_uris.append(bootstrap_api_uri)
|
|
|
|
# Wait for leader
|
|
leader = wait_peer_added(bootstrap_api_uri)
|
|
|
|
# Start other peers
|
|
for i in range(1, len(peer_dirs)):
|
|
peer_api_uris.append(start_peer(
|
|
peer_dirs[i], f"peer_0_{i}.log", bootstrap_uri))
|
|
|
|
# Wait for cluster
|
|
wait_for_uniform_cluster_status(peer_api_uris, leader)
|
|
|
|
# Check that there are no collections on all peers
|
|
for uri in peer_api_uris:
|
|
r = requests.get(f"{uri}/collections")
|
|
assert_http_ok(r)
|
|
assert len(r.json()["result"]["collections"]) == 0
|
|
|
|
# Create collection in first peer
|
|
r = requests.put(
|
|
f"{peer_api_uris[0]}/collections/test_collection", json={
|
|
"vectors": {
|
|
"size": 4,
|
|
"distance": "Dot"
|
|
},
|
|
"shard_number": N_SHARDS,
|
|
"replication_factor": N_REPLICA,
|
|
})
|
|
assert_http_ok(r)
|
|
|
|
# Check that it exists on all peers
|
|
wait_collection_exists_and_active_on_all_peers(collection_name="test_collection", peer_api_uris=peer_api_uris)
|
|
|
|
# Check collection's cluster info
|
|
collection_cluster_info = get_collection_cluster_info(peer_api_uris[0], "test_collection")
|
|
assert collection_cluster_info["shard_count"] == N_SHARDS
|
|
|
|
# Create points in first peer's collection
|
|
r = requests.put(
|
|
f"{peer_api_uris[0]}/collections/test_collection/points?wait=true", json={
|
|
"points": [
|
|
{
|
|
"id": 1,
|
|
"vector": [0.05, 0.61, 0.76, 0.74],
|
|
"payload": {
|
|
"city": "Berlin",
|
|
"country": "Germany",
|
|
"count": 1000000,
|
|
"square": 12.5,
|
|
"coords": {"lat": 1.0, "lon": 2.0}
|
|
}
|
|
},
|
|
{"id": 2, "vector": [0.19, 0.81, 0.75, 0.11],
|
|
"payload": {"city": ["Berlin", "London"]}},
|
|
{"id": 3, "vector": [0.36, 0.55, 0.47, 0.94],
|
|
"payload": {"city": ["Berlin", "Moscow"]}},
|
|
{"id": 4, "vector": [0.18, 0.01, 0.85, 0.80],
|
|
"payload": {"city": ["London", "Moscow"]}},
|
|
{"id": 5, "vector": [0.24, 0.18, 0.22, 0.44],
|
|
"payload": {"count": [0]}},
|
|
{"id": 6, "vector": [0.35, 0.08, 0.11, 0.44]}
|
|
]
|
|
})
|
|
assert_http_ok(r)
|
|
|
|
# Check that 'search' returns the same results on all peers
|
|
for uri in peer_api_uris:
|
|
r = requests.post(
|
|
f"{uri}/collections/test_collection/points/search", json={
|
|
"vector": [0.2, 0.1, 0.9, 0.7],
|
|
"top": 3,
|
|
}
|
|
)
|
|
assert_http_ok(r)
|
|
assert r.json()["result"][0]["id"] == 4
|
|
assert r.json()["result"][1]["id"] == 1
|
|
assert r.json()["result"][2]["id"] == 3
|