Commit Graph

5705 Commits

Author SHA1 Message Date
Luis Cossío
800f01edb1 fmt 2026-04-17 20:11:41 +00:00
Luis Cossío
6e360f8c69 no hugepage 2026-04-17 20:11:41 +00:00
Luis Cossío
0eb435d223 write entire file and use hugepage 2026-04-17 20:03:12 +00:00
Luis Cossío
6c1f1bb7c5 [AI] make integration of disk cache 2026-04-17 20:03:12 +00:00
Luis Cossío
0be286cac1 fmt 2026-04-17 15:16:07 -04:00
Luis Cossío
1fa1400c80 [AI] implement as multi-file 2026-04-17 15:16:00 -04:00
Luis Cossío
e0ba5b5c29 clippy 2026-04-17 11:47:13 -04:00
Luis Cossío
cb904798d9 [AI] impl batch version of CachedSlice::read_range 2026-04-17 11:47:12 -04:00
Luis Cossío
a37110cd3e simplify a bit 2026-04-17 10:40:16 -04:00
Luis Cossío
07be3000f5 [AI] impl read_from_cache_batch 2026-04-17 10:39:56 -04:00
Luis Cossío
730ceb0ae8 fix short reads in io_uring 2026-04-17 08:58:32 -04:00
Luis Cossío
8c551abc1a generalize access for slow disk 2026-04-17 08:58:32 -04:00
qdrant-cloud-bot
252676260f test: add failing tests for non-idempotent resharding consensus ops (#8522)
* test: add failing tests for non-idempotent resharding consensus ops

Add unit tests proving that resharding operations (abort, commit_read,
commit_write, finish) return `BadRequest` errors instead of `Ok` when
re-applied or when local state diverges between peers.

Since `apply_entries` silently swallows all non-`ServiceError` results
(including `BadRequest`), these errors cause permanent resharding state
divergence between peers while consensus term/commit remain identical.

All 6 tests fail on dev, demonstrating the bug.

Made-with: Cursor

* fix: make resharding consensus operations idempotent (#8523)

* fix: make resharding consensus operations idempotent

When apply_entries processes a resharding operation that returns
BadRequest (not ServiceError), the error is silently swallowed and the
entry is marked as applied. If local state on a peer diverges (crash
during partial apply, prior swallowed error), the same committed Raft
entry produces different outcomes on different peers — permanent
resharding state divergence despite identical consensus term/commit.

Fix by making all resharding operations return Ok when the desired
post-condition is already met:

ShardHolder level:
- check_abort_resharding: return Ok when no resharding active or
  different resharding active (already aborted)
- commit_read_hashring: return Ok when no resharding or stage already
  past ReadHashRingCommitted
- commit_write_hashring: return Ok when no resharding or stage already
  past WriteHashRingCommitted
- check_finish_resharding: return Ok when no resharding (already
  finished)
- check_start_resharding: warn instead of error when shard already
  exists for Up direction (leftover from crashed previous attempt)

Collection level (defense in depth):
- start_resharding: return Ok if same resharding already in progress
- commit_read/write_hashring: return Ok if no resharding or past stage
- finish_resharding: return Ok if no resharding active
- abort_resharding: return Ok if no resharding active

Made-with: Cursor

* Fix formatting issue

* Remove resharding idempotency note from logs

* Don't hold shard holder lock

* Committing read/write hash rings are idempotent now and are allowed

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: timvisee <tim@visee.me>

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: timvisee <tim@visee.me>
2026-04-17 13:54:59 +02:00
Andrey Vasnetsov
956dd0624f simplify uio geo index (#8681)
* rollback: iterator of errors into error of iterator

* [AI] ordering iterator

* [AI + manual] simplify geo-index iterators

* [AI] extra test for consistency

* fmt

* [AI] extend test for deleting points + fix the problem

* Update lib/segment/src/index/field_index/geo_index/mmap_geo_index.rs

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2026-04-17 13:07:20 +02:00
tellet-q
8c1f408d24 Test if io_uring handles EINTR properly (#8578)
* Test if io_uring handles EINTR properly

* Fix unit test compilation after read_iter API change

Update test_io_uring_eintr_handling to match the new read_iter signature
that takes (Meta, ReadRange) tuples and returns Result<impl Iterator>.

Made-with: Cursor

* Install no-op SIGUSR1 handler in debug mode on Unix

Prevents SIGUSR1 from terminating the process with the default
disposition, so that io_uring EINTR tests can safely bombard
the process with signals.

Made-with: Cursor

* Enter tokio runtime context for SIGUSR1 handler, fix clippy

tokio::signal::unix::signal requires a reactor context, so enter
the runtime handle before installing the handler.

Also fix manual_let_else clippy warning in the EINTR unit test.

Made-with: Cursor

* Cleanup 🙄

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2026-04-17 12:06:23 +02:00
Arnaud Gourlay
adb528f4ce Sort HashMap keys for deterministic iteration (#8706) 2026-04-17 11:21:07 +02:00
Luis Cossío
d8042fc697 [UIO] Migrate numeric index (#8641)
* [manual + AI] migrate `pairs` field, reimplement iterator

Co-authored by Claude

* [AI] no custom iterator, read whole range

* better bounds
2026-04-16 23:59:57 -04:00
Luis Cossío
a9345a7ee7 [UIO] Explicit padding for numeric point (#8668)
* derive Pod for Point<T>

* remove clones on Copy type

* fix annoying clippy lint

* serde skip padding

* extract point into a new file

* assert aligment
2026-04-16 21:32:29 -04:00
Luis Cossío
3a0591a218 fix remaining clippy lint (#8703) 2026-04-17 00:47:05 +02:00
Arnaud Gourlay
04b34e6e81 Make subgraph_connectivity deterministic (#8693)
* Make subgraph_connectivity deterministic

* Fix missing rng argument in test for subgraph_connectivity

Made-with: Cursor

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-04-16 17:22:33 +02:00
Tim Visée
e001a50dc4 Fix clippy warnings for Rust 1.95 (#8695)
* Remove redundant into_iter

* Remove redundant type casting

* Use if-branches in match

* Use sort_by_key

* Only iterate over values

* Dismiss bench loop counter warning

* done done

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2026-04-16 16:44:20 +02:00
Arnaud Gourlay
d94430ae91 Interrupt subgraph_connectivity if it makes no progress (#8691)
* Interrupt subgraph_connectivity if it makes no progress

* less synthetic test

* test unwrap res
2026-04-16 15:29:04 +02:00
Arnaud Gourlay
c01d16fb0d Queue proxy shard transfer uses pipelining (#8656)
* Queue proxy shard transfer uses pipelining

* make sure last WAL read is made under update_lock

* simplify
2026-04-16 12:32:28 +02:00
Jojii
1346cc56d9 TurboQuant Lloyd Max Codebook (#8672)
* [AI] Add lloyd_max calculation test and constants

* [AI] use closed-form formula

* Review remarks
2026-04-16 12:17:35 +02:00
Jojii
8c72d3b12f API Changes for TurboQuant (#8686)
* [ai + manual] API changes for TQ

* CI

* Add TurboQuant types to Python type stubs

Made-with: Cursor

* Revert "Add TurboQuant types to Python type stubs"

This reverts commit 6543af3244.

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2026-04-16 12:12:33 +02:00
Jojii
8bd160071c TurboQuant hadamard Rotation (#8657)
* [ai + manual] Implement Hadamard rotation

# Conflicts:
#	lib/quantization/src/turboquant/mod.rs

* [ai + manual] Defer normalization and reduce iterations

* Test improvements + Clippy

* [AI] Don't use fixed-size chunks

* [AI + Manual] Extract permutations and add more tests

* Add normalization + Remove signs2

* Remove signs2 too and improve chunk size function

* [ai] Improve code

* [ai] use reversible LCG for O(1) memory shuffle

* Bench fixes + Remove constant in seed

* [ai] Review Remarks

* [ai] Review remarks

* [ai + manual] In-Place rotations
2026-04-16 11:46:43 +02:00
qdrant-cloud-bot
c122b9067b Clean up temporary directories before loading collections (#8689)
Previously `clear_all_tmp_directories()` was called in `main.rs` after
`TableOfContent::new()` had already loaded all collections and applied
WAL. Stale temp files from a previous crash (e.g. interrupted snapshot
transfers) could interfere with the recovery process.

Move the cleanup into `TableOfContent::new()` so it runs before the
collection loading loop. Extract a standalone `clear_tmp_directories()`
function that only needs `StorageConfig`, and delegate the existing
method to it.

Made-with: Cursor

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-04-16 11:04:25 +02:00
Ivan Pleshkov
e6c82db13d TQ variant for QuantizedVectorStorage (#8678)
* TQ variant for QuantizedVectorStorage

* fix gpu build

* fix gpu build

* are you happy clippy
2026-04-16 10:53:15 +02:00
Arnaud Gourlay
40d6b429a2 Revert "Disable CI for edge examples due to yanked core2" (#8684)
* Revert "Disable CI for edge examples due to yanked core2"

This reverts commit dd7a2bd4c5.

* cargo update --package include-flate
2026-04-15 15:19:11 +02:00
qdrant-cloud-bot
0f8f861ac4 Reduce ImmutableGeoMapIndex RAM usage ~7x with flat arrays (#8673)
Replace `Vec<(GeoHash, AHashSet<PointOffsetType>)>` with three flat
parallel arrays: `Vec<GeoHash>`, `Vec<u32>` (offsets), and
`Vec<PointOffsetType>` (IDs).

Each AHashSet carried ~64 bytes of stack overhead (32-byte RandomState +
32-byte RawTable metadata) plus hash-table heap allocations with control
bytes — totalling ~124 bytes per entry even with a single point.  The
flat layout uses 8 + 4 + 4 = 16 bytes per entry, a ~7.75x reduction.

Deletions use a sentinel value (u32::MAX) in the IDs array, filtered
during iteration.  On-disk format is unchanged.

Made-with: Cursor

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-04-15 14:54:44 +02:00
Krzysztof Teodorowski
c46bdc1a49 fix(snapshot): ensure atomic snapshot persistence with rollback on failure (#8357) (#8474)
* fix: issue #8357 patch from pipeline run

* fix(snapshot): correct temp path ownership and rollback on checksum persist failure

* chore(ci): retrigger failed s3 snapshot workflow
2026-04-15 14:19:59 +02:00
qdrant-cloud-bot
ca9566c5a1 Break from deferred points wait when caller times out (#8680)
When `prevent_unoptimized=true` and `wait=true`, the update worker
blocks in `wait_for_deferred_points_ready` until all deferred points
are optimized. If the client specifies a timeout, `LocalShard::update`
drops the oneshot receiver and returns `WaitTimeout` to the caller,
but the update worker remains stuck in the wait loop. Since the worker
processes operations sequentially, this causes head-of-line blocking
for all subsequent updates on that shard.

Fix this by passing the feedback oneshot sender into the wait function
and checking `is_closed()` at the top of each loop iteration. When the
caller's receiver is dropped (timeout), the wait breaks immediately,
allowing the worker to proceed with the next operation.

The data is already written to WAL and applied to segments before we
enter the wait, so deferred points will still be optimized eventually
by the background optimizer.

Made-with: Cursor

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-04-15 11:43:19 +02:00
Arnaud Gourlay
f6ea7b0b36 Disable CI for edge examples due to yanked core2 (#8682) 2026-04-15 11:07:48 +02:00
Ivan Pleshkov
acabdc0a06 Empty turbo quant (#8677)
* copy from placeholder branch

* empty impl
2026-04-15 10:07:45 +02:00
Luis Cossío
ab49dbd188 [UIO] BufferedUpdateBitSlice (#8679)
* rename

* migrate `MmapBitsliceBufferedUpdateWrapper` -> `BufferedUpdateBitSlice`
2026-04-14 17:03:16 -04:00
Kyamran Shakhaev
4dbd23e0b6 Add consistency to test_resharding_deferred (#8658)
* Add consistency to test_resharding_deferred

Add consistency to the test_resharding_transfer_deferred_points test,
which puts shards in the Active state from the ReshardingScaleDown state

* Review fixes

* Sleep once after activating shards when resharding down

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2026-04-14 16:49:47 +02:00
Andrey Vasnetsov
1ad626d983 clearing cache with pageout (#8654)
* use pageout to clear mmap cache

* Also clear cache of deleted flags in mmap dense vector storage

* Add reference to madvise man pages for probe logic

* use deconstruct

---------

Co-authored-by: timvisee <tim@visee.me>
2026-04-14 14:09:19 +02:00
Andrey Vasnetsov
5a899b74de deep memory reporting (#8606)
* Add mincore-based memory stats to MmapFile

Add `resident_bytes()`, `disk_bytes()`, and `probe_memory_stats()` methods
to `MmapFile` for measuring page cache residency via `mincore(2)`. This is
the foundation for per-collection memory usage reporting.

Also extract `page_size()` as a public function in `mmap::advice`, replacing
the internal `PAGE_SIZE_MASK` with a direct page size cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [AI] introduce trait for reporting memory usage per component

* [AI] memory reporter implementation for vector storage

* [AI] implement MemoryReporter for QuantizedVectors

* [AI] implement MemoryReporter for VectorIndexEnum

* Implement MemoryReporter for IdTrackerEnum with RAM estimation

Add ram_usage_bytes() to all ID tracker types and their data structures:
- PointMappings, CompressedPointMappings, CompressedVersions,
  CompressedInternalToExternal, CompressedExternalToInternal
- MutableIdTracker, ImmutableIdTracker, InMemoryIdTracker

All ID trackers load their data into RAM (none use mmap for working data).
Files are reported as OnDisk (persistence only), actual RAM footprint
is reported via extra_ram_bytes. Uses struct destructuring to ensure
new fields trigger compile errors if not accounted for.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [AI] implement MemoryReporter for PayloadStorageEnum and adjust FileStorageIntent

* [AI] implement MemoryReporter for PayloadStorageEnum and adjust FileStorageIntent

* [AI] implement MemoryReporter for payload indexes: in-ram structures memory consumtion computation + caching

* [AI] implement MemoryReporter for payload indexes: in-ram structures memory consumtion computation + caching

* [AI] segment-level memory usage report

* [AI] Block 3: Aggregation Layer and Data Model + internal api for remote shard

* [AI] REST API handler

* fmt

* [AI] clippy fixes

* [AI] macos fix + proxy segment fix

* [AI] make text index estimation a bit more correct

* fix is_on_disk reporting for dense_vector_storage

* fix after rebase

* [AI] deep account for quantized vectors RAM usage + unify chunk size + shring volatile storage after load

* remove debug log

* cache in test

* make manual test easier to run

* rollback chunk size diff, but keep it for test only

* review fixes

* Use exhaustive match

* Use div_ceil on bits everywhere

It does not seem to be strictly necessary because the number of bits
should already be a multiple of the used container size bytes. Still
it's good practice to be careful with this calculation.

* Improve heap size bytes for encoded product quantization vectors

* Include vector stats for binary quantized vectors

* In volatile chunked vectors, include heap allocated vector

* Include rest of heap allocated structures for mutable map index

* In mutable geo index, the hash map is also heap allocated

* Update tests/manual/test_memory_reporting.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-14 12:37:31 +02:00
xzfc
aa3af83403 Migrate geo_index to UIO (#8507)
* Add common::iterator_ext::fallible helpers

* refactor: counts_of_hash

* Add ReadRange::one

* UniversalRead::read_iter: return Result

* Add binary_search module

* Migrate geo_index to UIO

* minor review fixes

* Review fixups

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

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2026-04-14 08:38:21 +00:00
dependabot[bot]
b99c89ae8f build(deps): bump rand from 0.10.0 to 0.10.1 (#8665)
Bumps [rand](https://github.com/rust-random/rand) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.10.0...0.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 09:13:28 +02:00
dependabot[bot]
d51cc35bd3 build(deps): bump indexmap from 2.13.1 to 2.14.0 (#8664)
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.13.1 to 2.14.0.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.13.1...2.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 09:03:07 +02:00
dependabot[bot]
a5e0464267 build(deps): bump docker/build-push-action from 7.0.0 to 7.1.0 (#8660)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](d08e5c354a...bcafcacb16)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 09:01:17 +02:00
dependabot[bot]
f2d4d1a4e9 build(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#8661)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](bbbca2ddaa...043fb46d1a)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 08:58:43 +02:00
dependabot[bot]
ceb2470ded build(deps): bump PyO3/maturin-action from 1.50.1 to 1.51.0 (#8662)
Bumps [PyO3/maturin-action](https://github.com/pyo3/maturin-action) from 1.50.1 to 1.51.0.
- [Release notes](https://github.com/pyo3/maturin-action/releases)
- [Commits](04ac600d27...e83996d129)

---
updated-dependencies:
- dependency-name: PyO3/maturin-action
  dependency-version: 1.51.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 08:57:58 +02:00
dependabot[bot]
b5ba411e71 build(deps): bump rustls from 0.23.37 to 0.23.38 (#8663)
Bumps [rustls](https://github.com/rustls/rustls) from 0.23.37 to 0.23.38.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.23.37...v/0.23.38)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 07:41:37 +02:00
dependabot[bot]
0e8dba7e42 build(deps): bump tokio from 1.51.0 to 1.51.1 (#8666)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.51.0 to 1.51.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.51.0...tokio-1.51.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 06:56:44 +02:00
Roman Titov
6115d762b6 Bump cc to 1.2.60 (#8652) 2026-04-13 13:25:58 +02:00
qdrant-cloud-bot
c6b7446b10 fix: propagate flush cancellation through payload index flushers (#8651)
* fix: propagate flush cancellation through payload index flushers

When a payload index is deleted, the gridstore backing it is dropped.
A concurrent background flush detects this (weak Arc refs fail to upgrade)
and returns GridstoreError::FlushCancelled. The From<GridstoreError> impl
correctly maps this to OperationError::Cancelled, and entry.rs gracefully
handles Cancelled by skipping the flush.

However, two intermediate layers unconditionally wrapped all errors as
ServiceError, destroying the Cancelled variant before it reached the
handler in entry.rs:

1. All 4 mutable index flushers (map, text, numeric, geo) used
   OperationError::service_error(format!(...)) instead of converting
   via Into<OperationError> first.

2. struct_payload_index flusher also unconditionally wrapped sub-flusher
   errors as service_error.

This caused the benign FlushCancelled to surface as a fatal
"last background flush failed" ServiceError.

Fix both layers to propagate Cancelled errors as-is, matching the
pattern already used for vector storage, quantization, and id tracker
flushers in entry.rs.

Made-with: Cursor

* simplify error conversion

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: generall <andrey@vasnetsov.com>
2026-04-13 12:37:46 +02:00
xzfc
48165575a3 Propagate OperationResult in PayloadFieldIndex::filter (#8647) 2026-04-11 06:57:43 +00:00
Ivan Daschinskiy
38f9b1e093 Fix read from cold storage with O_DIRECT on linux by using aligned buffer (#8631)
* Fix read from cold storage with O_DIRECT on linux by using aligned buffer

* Review fixes

* Review fixes: 2
2026-04-10 16:14:32 -04:00