Commit Graph
84 Commits
Author SHA1 Message Date
Ivan PleshkovandAndrey Vasnetsov 5174388ab4 integrate quantized data to storages (#1311)
* integrate quantized data to storages

* revert gitignore

* are you happy clippy

* quantize in optimizer

* provide flag

* fix segfault

* skip quantization flag, update scores

* use quantization flag

* are you happy fmt

* use quantization flag

* quantized search test

* are you happy fmt

* refactor test, refactor scorer choosing

* are you happy fmt

* run quantization on segment builder

* decrease testing parameters

* simplify segment

* update version

* remove use_quantization flag

* provide quantization config

* quantization version up

* euclid dist

* add euclid test

* saveload

* fix initialization bugs

* quantization lib version up

* fix arm build

* refactor scorer selecting

* quant lib version up

* are you happy fmt

* are you happy fmt

* are you happy clippy

* add save/load test for simple storage

* add comments

* quantiles

* quantization mmap

* remove f32

* mmap test

* fix mmap slice

* fix mmap test

* use chunks for quantization storage

* fix build

* are you happy fmt

* update quantization library

* update quantization lib

* update quantization lib

* integrate api changes

* are you happy fmt

* change quantization api

* additional checks in tests

* update quantization version

* fix unit tests

* add quantization to storage config

* use quantization for all cardinality search cases

* Integrate quantization suggestions 2 (#1520)

* review api

* wip: refactor quantization integrations

* wip: refactor quantization integrations

* wip: fmt

* include quantization into snapshot

* fmt

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-03-03 17:46:17 +01:00
Arnaud Gourlay 4c0f849749 Clippy rust 1.67 (#1406)
* inline format! args

* inline format! args

* explicit lifetime could be elided

* fmt
2023-01-26 17:48:52 +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
Roman Titov 2ed11d544b Add configuration option to select "memory advice" used for memmapped storage
- Add a simple abstraction/wrapper over `memmap2::Advice` and a global switch
  to select "memory advice" used for memmapped storage to the `segment` crate
- Add `mmap_advice` configuration option to the `storage::types::StorageConfig`
- Implement `search-points` benchmark
2023-01-06 21:02:57 +10: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
Arnaud Gourlay d77debf122 Clippy for Rust 1.66 (#1284) 2022-12-16 10:53:51 +01:00
Ivan Pleshkov 02071314bd remove obsolete internal scorer (#1271) 2022-12-14 14:47:22 +04:00
Andrey Vasnetsov aeba32ba3e Shard build refactoring (#1280)
* refactor some code of shard creation and optimizers

* Shard build refactoring debug (#1279)

* add debig code

* debug code

* debug code

* debug code

* debug code

* debug code

* debug code

* debug code

* debug code

* debug code

* debug code

* refactor stop-checking during the optimization

* remove debug logs

* improve delete-renaming schema

* fmt

* move collection file removing to the async task

* rename check_optimization_stopped into more general check_process_stopped
2022-12-14 10:11:46 +01:00
erare-humanumandAndrey Vasnetsov 93a4499859 Update: unmaintained crate memmap -> memmap2 (#559) (#1160)
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-10-30 11:50:27 +01:00
Andrey Vasnetsov ab19576c5d Force sync vector storage offset (#1110)
* simplify vector storage `update` semantic, always assume inplace vector replacement

* fmt
2022-10-24 12:34:26 +02:00
Andrey Vasnetsov ba26e2f85e Faster filtered scroll (#1003)
* faster filtered scroll for low cardinality filters

* add test

* scroll strategy heuristics
2022-09-12 17:55:56 +02:00
Ivan PleshkovandAndrey Vasnetsov f6b2186193 [WIP] Many named vectors per point (#958)
* many named vectors per point (segment-level)

* operation result for dim function

* beautifulized vector name

* fix naming bug

* segment version migration

* fmt

* add segment tests

* are you happy clippy

* fix build

* [WIP] many named vectors per point (collection-level) (#975)

* config and search

* fix placeholders for proxy segment move

* remove VectorType from collection

* are you happy fmt

* vectors in grps messages

* create collections with vectors

* segment holder fixes

* are you happy fmt

* remove default vector name placeholders

* are you happy fmt

* are you happy clippy

* fix build

* fix web api

* are you happy clippy

* are you happy fmt

* record vector&vectors

* openapi update

* fix openapi integration tests

* segment builder fix todo

* vector names for update from segment

* remove unwrap

* backward compatibility

* upd openapi

* backward compatible PointStruct

* upd openapi

* fix record back-comp

* fmt

* vector configuration backward compatibility

* fix vetor storage size estimation

* fmt

* multi-vec segment test + index test

* fmt

* api integration tests

* [WIP] Named vectors struct (#1002)

* move to separate file

* named vectors as struct

* use cow

* fix build

* keys iterator

* avoid copy in PointStruct -> get_vectors

* avoid another copy

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

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-09-11 20:59:23 +02:00
Andrey Vasnetsov be38254ee8 small refactoring (#746)
* small refactoring

* fix tests
2022-09-01 12:36:28 +02:00
Ivan Pleshkov f9fb0777a0 Wrap rocksdb column usages (#951)
* wrap rocksdb column usages

* remove obsolete comments

* are you happy clippy
2022-08-22 09:41:08 +02:00
f357bd5d9b Allow to flush segment in separate thread (#927)
* allow to flush segment in separate thread

* flush as separate function (#928)

* flush as separate function

* review suggestion

* reduce locks during vector scoring

* fmt

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

* don't run background flush twice

* Update lib/segment/src/segment.rs

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

* increase flush interval

* Update lib/segment/src/segment.rs

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

* are you happy fmt

* test background flush

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-08-15 13:47:52 +04:00
Russ Cam 8e1f2ca353 Use tempfile (#922)
This commit replaces tempdir with tempfile.
tempdir is archived.

Closes #544
2022-08-10 09:39:21 +02:00
dependabot[bot]andArnaud Gourlay 9713267358 Bump rocksdb from 0.18.0 to 0.19.0 (#920)
* Bump rocksdb from 0.18.0 to 0.19.0

Bumps [rocksdb](https://github.com/rust-rocksdb/rust-rocksdb) from 0.18.0 to 0.19.0.
- [Release notes](https://github.com/rust-rocksdb/rust-rocksdb/releases)
- [Changelog](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-rocksdb/rust-rocksdb/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: rocksdb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* iterator_cf returns a Result

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-08-08 11:12:22 +02:00
Arnaud Gourlay dc4cccde3d Prevent Vector size zero (#876) 2022-07-31 13:03:53 +02:00
Egor Ivkov 026bd040b0 Add import formatting rules (#820)
* Add import formatting rules

* Review fix: update rusty hook
2022-07-15 15:42:25 +03:00
Arnaud Gourlay cb82b7be01 Fix clippy 1.62 (#771)
* clippy let_unit_value

error: this let-binding has unit value
   --> lib/segment/src/vector_storage/simple_vector_storage.rs:397:9
    |
397 | /         let _top_idx = match closest.get(0) {
398 | |             Some(scored_point) => {
399 | |                 assert_ne!(scored_point.idx, 2);
400 | |                 assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);
...   |
404 | |             }
405 | |         };
    | |__________^
    |
    = note: `-D clippy::let-unit-value` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding
    |
397 ~         match closest.get(0) {
398 +             Some(scored_point) => {
399 +                 assert_ne!(scored_point.idx, 2);
400 +                 assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);
401 +             }
402 +             None => {

* clippy format_push_string

error: `format!(..)` appended to existing `String`
   --> src/main.rs:224:21
    |
224 |                     error.push_str(&format!("Deadlock #{}\n", i));
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::format-push-string` implied by `-D warnings`
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: `format!(..)` appended to existing `String`
   --> src/main.rs:226:25
    |
226 | /                         error.push_str(&format!(
227 | |                             "Thread Id {:#?}\n{:#?}\n",
228 | |                             t.thread_id(),
229 | |                             t.backtrace()
230 | |                         ));
    | |__________________________^
    |
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: could not compile `qdrant` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `qdrant` due to 2 previous errors
2022-07-01 01:59:49 +02:00
Andrey Vasnetsov 8ac3eef4c7 fix db flush ordering to prevent persisting versions for un-persisted points 2022-06-28 00:38:10 +02:00
Andrey Vasnetsov 850e937c2a Storage points tracking refactoring (#750)
* segment refactoring

* rm points iterator

* fmt
2022-06-27 15:17:09 +02:00
Ivan Pleshkov effb79733d Unite rocksdb of segment (#585)
unite rocksdb for segment
2022-05-13 17:06:07 +04:00
Ivan Pleshkov a402b0ad84 Disable wal for rocksdb (#576)
rocksdb disable wal
2022-05-11 14:22:09 +04:00
Ivan Pleshkov e5f83bf479 rocksdb limited logs and common settings (#571) 2022-05-10 10:20:28 +04:00
Andrey VasnetsovandArnaud Gourlay 5800319edb refactor distances + add score_threshold + fix negative euclid distance (#569)
* refactor distances + add score_threshold + fix negative euclid distance

* generate docs

* fix clippy

* Update lib/segment/src/spaces/tools.rs

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

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-05-09 17:32:48 +02:00
Andrey VasnetsovandEgor Ivkov ef67a2ec59 Condition search benchmark (#435)
* decouple payload index and vector storage

* wip: test fixtures

* conditional search benchmark

* fmt

* use arc iterator for filtered queries

* fmt

* enable all benches

* fix warn

* upd tests

* fmt

* Update lib/segment/src/fixtures/payload_context_fixture.rs

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

* Update lib/segment/src/payload_storage/query_checker.rs

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

Co-authored-by: Egor Ivkov <e.o.ivkov@gmail.com>
2022-04-11 17:43:02 +02:00
Ivan PleshkovandAndrey Vasnetsov 757652c59e Use chunked vec in vector storage (#457)
avoid vec of vec in simple storage

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-04-09 20:47:11 +04:00
Ivan PleshkovandAndrey Vasnetsov ff21a13083 Remove overcomplicated iterator (#409)
remove dyn iterator from filtered scorer

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-04-08 18:04:59 +04:00
Arnaud Gourlay 2a81fc9142 Remove sled for alias mappings (#402)
* improve alias tests

* introduce new alias persistence and remove Sled

* introduce FileStorageError

* use new error in AliasMapping

* aliases are kept in memory and saved to disk when modified

* better naming

* make alias renaming atomic

* fmt

* use correct alias and docs

* code review: cleaner error conversion
2022-03-23 14:21:04 +01:00
Ivan Pleshkov 2c4fd0a205 Merge branch 'master' into remove-blas 2022-03-09 15:48:25 +00:00
Prokudin AlexanderandAndrey Vasnetsov ee461ce0a6 Extend clippy to workspace and fix some warnings (#199)
* Fix clippy in linting workflow

* Add toolchain override flag

* Add components to toolchain installation explicitly

* Add --workspace flag to clippy to check all packages

* Remove unnecessary clones

* remove redundant .clone() calls

* fix wrong arguments order in tests (typo)

* Fix vec! macro usage in test

* Correct redundant assert! usages

* Provide a quick fix for 'unused' test function lint

* fix unsound Send + Sync

* fix clippy complains

* fmt

* fix clippy

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-01-17 23:33:26 +01:00
Ivan Pleshkov 8daacbd160 are you happy fmt? 2022-01-04 18:19:34 +03:00
Ivan Pleshkov 1e5670399f Merge branch 'master' into remove-blas 2022-01-04 18:05:39 +03:00
Ivan Pleshkov 297f54141d remove blas 2022-01-03 22:16:27 +03:00
Anton Kaliaev cb0a1b6bbc use map_or instead of map & unwrap_or (#172)
https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
2022-01-03 17:28:56 +01:00
Anton Kaliaev 298685102c add missing commas (#173) 2022-01-03 17:28:46 +01:00
Anton Kaliaev e196ce025b fix clippy warnings (#175)
* fix clippy warnings

- doc links
- explicit deref
- if instead of match for single bool condition
- combine similar match branches

* revert removal of transmute

* return Some when vec is not empty
2022-01-03 17:28:21 +01:00
Ivan PleshkovandAndrey Vasnetsov bcaa160ad8 Remove dyn Metric from vector storage and use generics (#163)
* Remove dyn Metric from vector storage and use generics

* upd benchmark code

* fix benchmark usage

* fmt

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2021-12-31 09:38:33 +01:00
Andrey Vasnetsov 617b97d3f7 add comments for segment entitites (#136)
* add comments for segment entitites

* fmt

* cargo fmt
2021-12-09 11:06:25 +01:00
Marcin Puc c603f0075e Add various refactorings (#118) 2021-11-10 21:32:25 +01:00
Andrey Vasnetsov 0bd0a1da42 fix new clippy suggestions 2021-07-30 23:49:02 +02:00
Konstantin 93e0fb5c2c [CLIPPY] Fix the last portion of rules and enable CI check (#53)
* [CLIPPY] Fixed the warning for references of the user defined types

* [CLIPPY] Fix module naming issue

* [CLIPPY] Fix the last set of warnings and enable clippy check during CI

* Moved cargo fmt and cargo clippy into it's own action
2021-07-03 13:12:21 +02:00
Konstantin 0e1a6e1750 [Clippy] Fix a range of warnings (#52) 2021-07-02 17:51:54 +02:00
Konstantin d796c9da42 Avoid useless vector copy during scoring (#51)
* Avoid vector copy during scoring

* Fixing ptr_arg clippy rules for &[VectorElementType]
2021-07-02 15:17:04 +02:00
Konstantin b253b03ae1 [CLIPPY] Fix File::write and option_env! (#49)
* Replace File::write to write_all to ensure the whole vector is written

* [CLIPPY] Replace option_env! with env!
2021-07-02 10:41:01 +02:00
Konstantin a667747369 Applied and enforced rust fmt code formatting tool (#48)
* Apply cargo fmt command

* Enabled cargo fmt on build
2021-06-29 10:17:50 +02:00
Andrey Vasnetsov 3616631300 Filtrable hnsw (#26)
* raw points scorer

* raw point scorer for memmap storage

* search interface prepare

* graph binary saving + store PointOffsetId as u32

* WIP: entry points

* connect new link method

* update libs + search layer method + visited list + search context + update rust

* implement Euclid metric + always use MinHeap for priority queue

* small refactor

* search for 0 level entry

* update visited pool to be lock free and thread safe

* use ef_construct from graph layer struct + limit visited links to M

* add metric pre-processing before on vector upsert

* old hnsw heuristic

* save hnsw graph for export

* search method + tests

* small fixes

* add benchmark and profiler

* build time optimizations

* use SeaHash

* remove unsed benchmark

* merge hnsw graph function

* WIP:HNSW index build function

* HNSW build_index with additional indexing

* refactor fixtures

* graph save and load test

* test and fixes for filterable HNSW

* enable hnsw index for query planning

* fix cardinality estimation tests + remove query planner as class

* small refactor

* store full copy of collection settings with collection + allow partial override on creation #16

* API for updating collection parameters #16

* refactor: move collection error -> types

* report collection status in info API #17

* update OpenAPI Schema
2021-05-30 17:14:42 +02:00
Andrey Vasnetsov 398da04aad add indexing optimizer + enable mmap and structure index rebuilding + fix issues 2021-04-06 14:12:46 +02:00
Andrey Vasnetsov 0dd48e0acb WIP: should, must and must_not estimators 2021-04-06 14:12:46 +02:00