Commit Graph

206 Commits

Author SHA1 Message Date
Andrey Vasnetsov
e0036e4fcc use mutex to ensure sequential segment flushed + await on drop (#7416) 2025-11-14 12:29:33 +01:00
Andrey Vasnetsov
01de0a3a7b single thread flush (#7388)
* flush all segments in one thread sequentially

* bonus: move flush-related functions into dedicated file

* Minor comment tweaks

* await for flush on segment holder level

* fmt

* Minor improvement, preallocate vector for payload index flushers

* Remove invalid comment

---------

Co-authored-by: timvisee <tim@visee.me>
2025-11-14 12:29:31 +01:00
xzfc
6a2830db1c Use fs-err (#7319) 2025-11-14 12:26:51 +01:00
Arnaud Gourlay
b8c567a20d Clippy 1.90 (#7253)
* Fix Clippy 1.90

* fmt
2025-09-29 11:29:50 +02:00
Ivan Pleshkov
a3d3da735d Enable BQ in appendable segments (#7145)
* Create and load for an appendable quantization

remove feature flag

more todo

review remarks

review remarks

* fix after rebase

* Enable BQ in appendable segments

* remove const placeholder

* fix after rebase

* fix after rebase

* fix config mismatch optimizer

* fix sq infinity loop

* add comment
2025-09-29 11:26:37 +02:00
Ivan Pleshkov
470c115334 Create and load for an appendable quantization (#7193)
* Create and load for an appendable quantization

remove feature flag

more todo

review remarks

review remarks

* fix after rebase

* Rename is_appendable to supports_appendable

---------

Co-authored-by: timvisee <tim@visee.me>
2025-09-29 11:26:01 +02:00
xzfc
4473d36834 Generic AccessPattern (#7166) 2025-09-29 11:26:00 +02:00
Ivan Pleshkov
d379c476ed using quantization in plain segment (#7060) 2025-08-26 13:17:45 +02:00
Arnaud Gourlay
118ff6dda3 Fix Clippy 1.89 (#6981) 2025-08-11 13:16:42 +02:00
Tim Visée
ef521f4a7d Enable Gridstore in mutable payload indices, don't eagerly create storage (#6805)
* Enable Gridstore payload index storage, rename storage types

* Respect payload_index_skip_mutable_rocksdb feature flag

* Minor cleanup

* Fix map payload index Gridstore semantics, only create files if desired

The semantics of backing storages in payload indices are inconsistent.
This aligns the Gridstore backing storage to our RocksDB backing
storage, matching the create/open/load behavior. Now, it will only
create Gridstore files on disk if we request it to do so.

This commit only implements it on the map index. In following comments
the same will be implemented in all other payload indices too.

* Apply same Gridstore semantics to other payload index types

* Rename create parameter to create_if_missing

* Fix bench compilation errors
2025-07-17 13:53:23 +02:00
Andrey Vasnetsov
310c717d95 use sequential reads for building quantized vectors (#6796)
* use sequential reads for building quantized vectors

* populate vector storages before indexing

* consistent naming

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-07-17 13:42:35 +02:00
Tim Visée
50c43a35da Actively migrate payload storage from RocksDB to Gridstore (#6734)
* Migrate RocksDB based payload storage into Gridstore

* Add migrate_rocksdb_payload_storage feature flag

* Minor tweaks

* Use iter to migrate all payloads

* Fix clippy warning

* Update OpenAPI spec

* Track if mmap payload storage is populated, set memory/disk storage type

* Add test

* Log amount of bytes we migrate instead of point count

* Remove TODO

* Render storage size migrated in human human readable format, not bytes

* On migration failure, drop full payload storage directory

* Fix missing import
2025-07-17 13:36:07 +02:00
Tim Visée
e8f3a282bf Add in-memory payload storage on Gridstore (#6722)
* Add in-ram-mmap payload storage type

* When RocksDB is not compiled, select in-ram mmap payload storage

* Enable payload storage on-disk check again in config mismatch optimizer

* Add feature flag to build in-ram-mmap payload storage

* Tweak is_on_disk condition

* Bump version estimates in runtime feature flags
2025-07-17 13:27:33 +02:00
xzfc
231567c31a Configurable HNSW healing threshold (#6756) 2025-07-17 13:26:25 +02:00
Tim Visée
0167f73afd Fix vector storage migration error (#6718)
* Fix not changing storage states, migrate vector storages in full segment

* Destroy old vector storage data after updating segment config

* Disable existing migrations, only use segment level ones

* Remove segment config update warnings

* Correctly bump sparse vector storage type

* Fix clippy warnings without RocksDB feature flag
2025-07-17 13:16:49 +02:00
Roman Titov
082f101988 Track version of mutable files in vector and payload storage (#6652) 2025-07-17 13:14:45 +02:00
Tim Visée
ce4371dfba Fix tests after removing RocksDB feature flag (#6649)
* Use sparse vector storage fixture without RocksDB

* Fix some tests

* Replace RocksDB sparse storage with Gristore in mutable text index tests

* Use in-memory vector storage in multivector HNSW test

* Flag many more RocksDB specifics in tests

* Use database placeholder type without RocksDB flag

* Flag more tests

* Flag even more tests

* Fix imports, fix typo, and repair base test build

* Initialize dummy database if RocksDB flag is disabled

* Assert correct storage types

* Don't use old vector storage type when RocksDB is disabled

* Expos default for vector storage type only in tests

* Only expose simple segment constructor in tests

* Don't derive Default

* Fix inverted appendable flag
2025-07-17 13:06:46 +02:00
Tim Visée
66352e4950 Feature flag RocksDB dependency (#6646)
* Flag index selector

* Flag take_database_snapshot

* Flag field index builder

* Flag bool index

* Flag full text index

* Flag geo index

* Flag map index

* Feature flag numeric index

* Flag skip_rocksdb

* Flag payload storage

* Flag segment

* Flag builder

* Flag backup

* Make RocksDB crate optional

* Tweak feature flag gate

* Disable default segment crate features from all dependents

* Handle flag in collection crate correctly

* Flag payload storage types in tests

* Temporarily disable on-disk check for sparse vectors

* Flag sparse vector RocksDB in GPU code

* Fix compilation error since recent merge

* Flag payload storage types in new function

* remove todo

* Explicitly implement default to more clearly state difference

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-07-17 13:06:39 +02:00
Roman Titov
9dd3b6ff9e Simpler partial snapshots implementation based on immutable_files (#6599) 2025-07-17 13:04:15 +02:00
Tim Visée
c6d2379074 Migrate away from RocksDB based sparse vector storage (#6607)
* Reformat

* Add function to find appendable sparse storage files without opening it

* Actively migrate away from RocksDB based sparse vector storage

* Add test for simple sparse vector storage migration

* Fix test comments

* Also migrate vector deletes for sparse storage

* Use walkdir to list files
2025-07-17 13:02:38 +02:00
Tim Visée
5cc77051af Migrate away from RocksDB based multi dense vector storage (#6604)
* Add function to open all multi dense vector storage types

* Move list files function into common crate

* Add function to find appendable multi dense storage files without opening it

* Actively migrate away from RocksDB based multi dense vector storage

* Add test for simple multi dense vector storage migration

* Also migrate vector deletes for multi dense storage
2025-07-17 13:01:53 +02:00
Tim Visée
3fc861976d Add mutable numeric payload index on top of Gridstore (#6609)
* Extend Gridstore blob trait, support basic primitives and vector of them

* Implement mutable numeric index on top of Gridstore

* Wrap Gridstore in rwlock, flush asynchronously

* Set custom Gridstore options tuned to numeric index

* Fix compilation errors

* Destruct RocksDB selector everywhere

* Add Gridstore payload index selector, build numeric, fallback others

* Add feature flag to Gridstore mutable payload index

* Don't store empty values in gridstore, it's not supported

* Reformat

* Initialize Gridstore during init of index builder

* Use owned and referenced paths correctly around Gridstore

* Change Gridstore page size in numeric index as suggested

* Make Gridstore block size dependent on size of numeric type

* Add tests

* Add separate fixed size blob trait for vec, prevent footgun

* Improve page size calculation

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

* Simplify Blob requirement for numeric payload index

* Add missing test cases

* Replace ref mut with &mut

* Use correct hardware counter

* Implement clear cache for numeric payload index on Gridstore

* The block size is dynamic

* Error if trying to load index from storage that doesn't match backend

* fix counter

* Add comment on why we change page size

---------

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2025-07-17 11:36:11 +02:00
Tim Visée
d9a36cdd0a Migrate away from RocksDB based dense vector storage (#6603)
* Add function to open all appendable dense vector storage types

* Add function to find appendable dense storage files without opening it

* Add function to migrate RocksDB dense vector storage into mmap

* Add feature flag and actively migrate on load

* Log number of migrated points

* Add function to open all simple dense vector storage types

* Add test for simple dense vector storage migration

* Use correct column families

* Use more generic feature flag

* Also migrate vector deletes

* Fix review remarks
2025-07-17 11:23:24 +02:00
Tim Visée
d09682886a Actively migrate away from RocksDB based ID tracker (#6579)
* Actively migrate RocksDB ID tracker to new format on segment load

* Extract ID tracker migration logic to function

* Feature flag ID tracker migration

* Simplify ID tracker migration by moving it deeper into load function

* Move migrate function to the bottom

* Add test to assert RocksDB to mutable ID tracker migration

* Assert new mutable ID tracker is empty

* Review remarks

* On RocksDB to mutable ID tracker migration failure, clean up files

* Demote empty mutable ID tracker to debug assertion

* Copy all point versions, including deleted, set known mappings

* read links and versions separatelly

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-07-17 11:04:38 +02:00
Andrey Vasnetsov
9054a872ac use id-tracker to estimate internal points range (#6593) 2025-07-17 11:02:39 +02:00
Tim Visée
dd1ed15c37 Add RocksDB feature flag to ID trackers (#6572)
* Move point ID conversions

* Extract segment ID tracker creation into function

* Feature flag RocksDB based ID tracker
2025-05-22 23:25:31 +02:00
Tim Visée
a8ead042d7 Add RocksDB feature flag to vector storage (#6566)
* Add no-rocksdb feature flag, disable dense vector storage using RocksDB

* Disable multi dense vector storage using RocksDB

* Feature flag now unused function arguments

* Invert no-rocksdb, use rocksdb and enable by default

* RocksDB is required in some benches

* Feature flag RocksDB based sparse vector storage

* Propagate rocksdb feature flag to root crate

* Feature flag stored point, only used in context of RocksDB

* Mention what disabling RocksDB feature does in Cargo.toml
2025-05-22 23:25:15 +02:00
Jojii
0d2c1ce254 Make gridstore Advise::Random and add function for sequential read (#6510)
* Make gridstore Advise::Random and add function for sequential read

* Reduce duplicate code in gridstore

* use sequential implementation in iterator

* actually use the sequential read

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2025-05-22 23:12:43 +02:00
dependabot[bot]
a6d5e9720a build(deps): bump tempfile from 3.19.1 to 3.20.0 (#6523)
* build(deps): bump tempfile from 3.19.1 to 3.20.0

Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.19.1 to 3.20.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.19.1...v3.20.0)

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

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

* Use keep now as into_path is deprecated

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: timvisee <tim@visee.me>
2025-05-22 23:10:59 +02:00
Andrey Vasnetsov
2fe62d4b7e Batched reader for segment construction (#6487)
* naive implementation of batched reader for segment construction

* Make reads sequential in BatchedVectorReader (#6508)

* Add sequential reads and improve BatchedVectorReader

* implement get_many_sequential

---------

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

* implement get_many_sequential

---------

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
2025-05-22 23:07:39 +02:00
Luis Cossío
c29479cac7 Deterministic HNSW builder (#6477)
* pass a RNG to hnsw index building

* use single-threaded build for accuracy-measuring tests

* clippy
2025-05-22 23:00:58 +02:00
Roman Titov
1bcf466b17 Make segment RocksDB optional, only initialize if required (#6441) 2025-05-22 22:53:41 +02:00
Andrey Vasnetsov
492bf0387b careful index creation (#6403)
* make sure to delete existing index, if it is not compatible with a new one

* fmt

* fix tests

* review fixes
2025-05-22 22:48:39 +02:00
Tim Visée
a6d57e910a Qdrant 1.14: enable mutable ID tracker by default (#6268)
* Enable mutable ID tracker by default

* Remove now obsolete feature flag for new mutable ID tracker
2025-04-21 00:51:00 +02:00
xzfc
7a1a96e22b Incremental HNSW index building: append-only case (#6325)
* Pass FeatureFlags into VectorIndexBuildArgs

* Incremental HNSW index building: append-only case

* Use debug_assert

* first_few_ids

* Check deleted_point_count

* Drop unused method
2025-04-20 23:55:57 +02:00
Andrey Vasnetsov
6e0ddbafa9 disk cache hygiene (#6323)
* wip: implement explicit populate and clear_cache functions for all components

* fmt

* implement clear and populate for vector storages

* fmt

* implement clear and populate for payload storage

* wip: implement explicit populate and clear_cache functions payload indexes

* implement explicit populate and clear_cache functions payload indexes

* fix clippy on CI

* only compile posix_fadvise on linux

* only compile posix_fadvise on linux

* implement explicit populate and clear_cache functions for quantized vectors

* fmt

* remove post-load prefault

* fix typo

* implement is-on-disk for payload indexes, implement clear on drop for segment, implement clear after segment build

* fmt

* also evict quantized vectors after optimization

* re-use and replace advise_dontneed
2025-04-20 23:54:40 +02:00
dependabot[bot]
f230629fa0 build(deps): bump log from 0.4.26 to 0.4.27 (#6247)
* build(deps): bump log from 0.4.26 to 0.4.27

Bumps [log](https://github.com/rust-lang/log) from 0.4.26 to 0.4.27.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.26...0.4.27)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* put variables inside the strings for log macros

* also for pyroscope

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2025-03-31 16:19:55 +02:00
Jojii
5cd7239b61 Measure Payload Index IO Writes (#6137)
* Prepare measurement of index creation + Remove vector deletion
measurement

* add hw_counter to add_point functions

* Adjust add_point(..) function signatures

* Add new measurement type: payload index IO write

* Measure payload index IO writes

* Some Hw measurement performance improvements

* Review remarks

* Fix measurements in distributed setups

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-03-31 16:19:19 +02:00
Roman Titov
03dc95c74c Check use_mutable_id_tracker_without_rocksdb feature flag when building new segment (#6211) 2025-03-21 11:46:51 +01:00
Tim Visée
abf433e6c0 Mutable ID tracker integration (#6174)
* Rename mutable ID tracker mappings file

* Make new ID tracker the default, add new variant for RocksDB tracker

* In mutable ID tracker, only list files if they exist on disk

* Don't use the new mutable ID tracker yet

* Feature flag usage of new mutable ID tracker

* Simplify RocksDB check a bit

* Rename both the mutable ID tracker files
2025-03-21 11:46:14 +01:00
Andrey Vasnetsov
706b1a3166 IsEmpty/IsNull index (#6088)
* create initial strucutres

* clippy

* start field-query refactoring

* start field-query refactoring (2/N)

* start field-query refactoring (3/N): duplicate is_empty/null condiftions as field condition

* start field-query refactoring (4/N): re-instate is_empty fallback in case new index is not built yet

* filter for is_empty/is_null

* implement add/remove point

* upd schema

* open and create of null-index

* create null-index

* fix test

* Update lib/segment/src/index/query_optimization/condition_converter.rs

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

* unit test for null-index

* more unit tests

* add openapi tests

* fmt

* fix for integartion tests

* rabbit review fix

* make [null] non-empty

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-03-21 11:41:12 +01:00
Tim Visée
8ad2b34265 Bump Rust edition to 2024 (#6042)
* Bump Rust edition to 2024

* gen is a reserved keyword now

* Remove ref mut on references

* Mark extern C as unsafe

* Wrap unsafe function bodies in unsafe block

* Geo hash implements Copy, don't reference but pass by value instead

* Replace secluded self import with parent

* Update execute_cluster_read_operation with new match semantics

* Fix lifetime issue

* Replace map_or with is_none_or

* set_var is unsafe now

* Reformat
2025-03-21 11:38:56 +01:00
Andrey Vasnetsov
f6d58b46bf notify optimizers scheduler of the budget change (#6040)
* notify optimizers scheduler of the budget change

* Zero permit count when releasing CPU or IO

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-03-21 11:38:09 +01:00
Andrey Vasnetsov
66dd336cf7 Optimize immutable id tracker mapping (#6023)
* clone PointMappings into CompressedPointMappings

* fmt

* compressed internal to external

* implement compressed external to internal mapping

* some autogenerated tests

* fix test

* Explicitly resize deleted flags, ensure length matches number of points

* Review remarks

---------

Co-authored-by: timvisee <tim@visee.me>
2025-03-21 11:37:37 +01:00
Andrey Vasnetsov
caed5729e5 IO resource usage permit (#6015)
* rename cpu_budget -> resource_budget

* clippy

* add io budget to resources

* fmt

* move budget structures into a separate file

* add extend permit function

* dont extend existing permit

* switch from IO to CPU permit

* do not release resource before aquiring an extension

* fmt

* Review remarks

* Improve resource permit number assertion

* Make resource permit replace_with only acquire extra needed permits

* Remove obsolete drop implementation

* allocate IO budget same as CPU

* review fixes

---------

Co-authored-by: timvisee <tim@visee.me>
2025-03-21 11:37:12 +01:00
Luis Cossío
b4328bb7c5 [mmap sparse vector storage] return cancelled error if stopped (#5938)
* return cancelled error if stopped

* add doc comment and renames
2025-02-11 14:40:25 +01:00
xzfc
cf3240d923 Use simple_segment_constructor (#5919)
* VECTOR1_NAME and VECTOR2_NAME

* Use simple_segment_constructor
2025-02-11 14:38:10 +01:00
xzfc
6e1316bfb5 Add payload_json! macro (#5881)
* Add payload_json! macro

* Replace usage of `json!({...})` with `payload_json! {...}`

* Drop `impl From<Value> for Payload`
2025-01-28 10:44:27 +01:00
xzfc
64d5beb141 Pass old_indices to HNSWIndex::new (#5835) 2025-01-27 18:25:53 +01:00
xzfc
e85a9f18b4 Add VectorName type alias (#5763)
* Add VectorName/VectorNameBuf type aliases [1/2]

* Add VectorName/VectorNameBuf type aliases [2/2]
2025-01-27 18:25:41 +01:00