Commit Graph

1497 Commits

Author SHA1 Message Date
Tim Visée
42b80f4543 Add WAL type with integrated clock map (#3620)
* Add WAL type with integrated clock map

* Rename clock map field to last clocks

* Move WAL delta logic into separate module
2024-03-05 17:07:39 +01:00
Arnaud Gourlay
6157fe8585 Fix bench for sparse vector build index (#3617) 2024-03-05 17:07:37 +01:00
Ivan Pleshkov
97e0ae1716 text index immutable state without documents (#3497)
color ci into green

immutable index tests

deletion test

separate filter function

are you happy fmt

add shrink_to_fit

refactor estimate_cardinality

check is points_count is zero
2024-03-05 17:07:34 +01:00
Arnaud Gourlay
385840a67a Decrease sparse vector index build bench parameters (#3609) 2024-03-05 17:07:32 +01:00
amietn
5d162707b2 Fix geo radius panic (#3608)
* Fix geo radius filter panic

* Empty-Commit

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-03-05 17:07:29 +01:00
Luis Cossío
7ef8012c79 remove secondary ordering by id description from order_by parameter (#3589) 2024-03-05 17:07:26 +01:00
Tim Visée
f4389e68b0 Fix broken serialization of ClockMap (#3590)
* Serialize clock map entries as vector tuple, cannot use struct as map key

* Log warning when storing clock map or acknowledging fails

* Add test for (de)serializing, storing and loading clock map

* Tweak serialization/deserialization format

* fixup! Tweak serialization/deserialization format

* Remove transparent from clock, we flatten it elsewhere

* Tweak `ClockMap` serde tests so that they don't require disk access

* fixup! Tweak `ClockMap` serde tests so that they don't require disk access

* fixup! Tweak `ClockMap` serde tests so that they don't require disk access

Run `cargo check` without `--all --tests` 🤦‍♀️

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2024-03-05 17:07:15 +01:00
Tim Visée
988d4ce926 Recovery point should list first unseen ticks rather than last seen (#3593) 2024-03-05 17:07:11 +01:00
dependabot[bot]
955d03c5dc Bump thiserror from 1.0.56 to 1.0.57 (#3602)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.56...1.0.57)

---
updated-dependencies:
- dependency-name: thiserror
  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>
2024-03-05 17:07:07 +01:00
dependabot[bot]
47f3d01819 Bump num-traits from 0.2.17 to 0.2.18 (#3599)
Bumps [num-traits](https://github.com/rust-num/num-traits) from 0.2.17 to 0.2.18.
- [Changelog](https://github.com/rust-num/num-traits/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-traits/compare/num-traits-0.2.17...num-traits-0.2.18)

---
updated-dependencies:
- dependency-name: num-traits
  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>
2024-03-05 17:07:04 +01:00
dependabot[bot]
e8ccee3156 Bump num-derive from 0.4.1 to 0.4.2 (#3598)
Bumps [num-derive](https://github.com/rust-num/num-derive) from 0.4.1 to 0.4.2.
- [Changelog](https://github.com/rust-num/num-derive/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-derive/compare/num-derive-0.4.1...num-derive-0.4.2)

---
updated-dependencies:
- dependency-name: num-derive
  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>
2024-03-05 17:07:02 +01:00
dependabot[bot]
282c63c74c Bump chrono from 0.4.33 to 0.4.34 (#3601)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.33 to 0.4.34.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.33...v0.4.34)

---
updated-dependencies:
- dependency-name: chrono
  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>
2024-03-05 17:06:57 +01:00
dependabot[bot]
b59145cec0 Bump tempfile from 3.9.0 to 3.10.0 (#3596)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.9.0 to 3.10.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.9.0...v3.10.0)

---
updated-dependencies:
- dependency-name: tempfile
  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>
2024-03-05 17:06:54 +01:00
dependabot[bot]
311eba3950 Bump indicatif from 0.17.7 to 0.17.8 (#3594)
Bumps [indicatif](https://github.com/console-rs/indicatif) from 0.17.7 to 0.17.8.
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](https://github.com/console-rs/indicatif/commits)

---
updated-dependencies:
- dependency-name: indicatif
  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>
2024-03-05 17:06:49 +01:00
Tim Visée
f9e32ee5fa Fix queue proxy always forwarding successful requests three times (#3592) 2024-03-05 17:06:30 +01:00
Tim Visée
671822b1d8 Improve recovery point display formatting (#3588) 2024-03-05 17:06:17 +01:00
Tim Visée
5b406a0257 Resolve WAL delta for shard diff transfer (#3571)
* Take clock tag as value, because it implements Copy

* Implement Display for recovery point

* Add WAL function to read from newest to oldest, including physical

* Add local shard method to resolve WAL delta based on recovery point

* Add error reporting to WAL delta resolve method

* Use lowercase error message

* Use real first physical WAL index

* Do not skip forced entries when resolving WAL delta

* Use single error branch for unsupported shard types

* Propagate WAL delta resolve method up to shard replica set

* Change physical WAL naming

* Decouple WAL delta resolve method into standalone function
2024-03-05 17:06:14 +01:00
Luis Cossío
b503e6da47 refactor test to remove thread::sleep (#3587) 2024-03-05 17:06:12 +01:00
Arnaud Gourlay
02004c8720 Pool larger memory batches for sparse vector search (#3560)
* Pool larger memory batches for sparse vector search

* rework naming

* refine naming

* address great comments

* bump ADVANCE_BATCH_SIZE to use power of 2

* 16k performs bad - trying 8k

* 10k offers the best tradeoff
2024-03-05 17:06:10 +01:00
Tim Visée
cd6a1ef103 Allow using queue proxy on WAL in the past (#3551)
* Repurpose queue proxy, allow using history as well for WAL diff transfer

* Use physical WAL bounds for queue proxy range checking

* Update lib/collection/src/shards/queue_proxy_shard.rs

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>

* Define WAL bound constraints differently

* Fix off by one error in queue proxy, rename last field to transfer_from

* Start from should be one higher

* WAL bounds are inclusive

* Fix items left calculations in queue proxy shard

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2024-03-05 17:06:07 +01:00
Ivan Pleshkov
4397b28530 Validate sparse indices in grpc search (#3225)
* validate sparse indices in grpc search

* add test

* validate into vector conversion
2024-03-05 17:06:04 +01:00
Luis Cossío
475c1aadf6 refactor: add DateTime wrapper (#3578)
* Refactor datetime deserialization and timestamp representation into newtype

* implement `FromStr` instead of custom fn
2024-03-05 17:06:02 +01:00
generall
4781170d84 fix merge conflict 2024-03-05 17:04:54 +01:00
ding-young
112b5d66f3 Support Min should clause (#3331) (#3466)
* Add min_should field in Filter struct

* min_should clause checks whether at least given number (min_count) of conditions are met
* modify test cases due to change in Filter struct (set min_should: None)
* add simple condition check unit test
* docs, cardinality estimation, grpc not implemented yet

* Add min_should field in Filter struct

* min_should clause checks whether at least given number (min_count) of conditions are met
* modify test cases due to change in Filter struct (set min_should: None)
* add simple condition check unit test

* Impl min_should clause in REST API

* perform cardinality estimation by estimating cardinalities of intersection and combining as union
* add openapi spec with docs update
* add integration test

* Impl min_should clause in gRPC

* Cargo fmt & clippy

* Fix minor comments

* add equivalence test between min_should and must

* shortcut at min_count matches

* use `Filter::new_*` whenever possible

* Add missing min_should field

* Fix gRPC field ordering & remove deny_unknown_fields

* Empty commit

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-03-05 17:04:51 +01:00
Andrey Vasnetsov
69b6a9866e Print version on startup (#3581)
* add logging of the version and git commit ID to the welcome message

* review fixes
2024-03-05 17:04:47 +01:00
Ivan Pleshkov
b876203ba8 Allocate all chunks data in chunked vectors except the last one (#3580)
* allocate all chunks data in chunked vectors except last one

* more readable for

* more readable comments
2024-03-05 17:04:44 +01:00
Tim Visée
f08df0b22e Add endpoint to request recovery point for remote shard (#3510)
* Add initial gRPC call for requesting WAL recovery point for remote shard

* Add remote shard method to request WAL recovery point

* Add recovery point type in gRPC, use it in recovery point functions

* Add function to extend recovery point with missing clocks from clock map

* Add new gRPC type for recovery point clocks

* Remove atomic loading, because we use regular integers now
2024-03-05 17:04:41 +01:00
Tim Visée
1391a9e861 Add clock set unit tests (#3573)
* Add clock set test for single clock

* Add clock set test for ticking a single clock guard twice

* Add test for advancing single clock to a high number

* Add test for advancing single clock to a low number

* Add test for ticking multiple clocks in various configurations

* Add clock test with some clocks that take a long time to resolve

* Test with 5000 clocks from a clock set

* Test many clocks, where each iteration, we get one more clock stuck

* Add documentation to test functions

* Reformat
2024-03-05 17:04:38 +01:00
Tim Visée
0889dbeb59 Change io imports because it breaks on auto formatters (#3576) 2024-03-05 17:04:36 +01:00
Roman Titov
23eb319943 ClockMap improvements (#3567) 2024-03-05 17:04:33 +01:00
Luis Cossío
fb46ec8af1 Order-by: support datetimes (#3540)
* support \`start_from\`: DateTime

* add order by datetime test

* generate openapi models and grpc docs

* fixup after rebase

* allow string representation of datetime in grpc

* add TODO

* fix `.start_from()`

* use custom deserialization on datetime
2024-03-05 17:04:26 +01:00
Arnaud Gourlay
b622b7f48a Configure default RocksDB column family (#3565) 2024-03-05 17:04:23 +01:00
Luis Cossío
e4044ea738 Order-by: use pre-filtering for high-constraining filters (#3562)
* use pre-filtering for high-constraining filters

* fix repeated points
2024-03-05 17:04:18 +01:00
Luis Cossío
48b5e39675 Issues API: internal crate (#3375) 2024-03-05 17:04:15 +01:00
Roman Titov
1df94c53b1 Add ClockMap type to track versions of update operations in the local shard WAL (#3506)
* Add `ClockMap` type to track versions of update operation in local shard WAL

* `ClockMap::advance_clock_and_correct_tag`: only correct `clock_tag.clock_tick` if it's `0`

* Add `ClockMap::load` and `ClockMap::store`

* WIP: Load/restore `ClockMap` from disk/WAL when loading `LocalShard`

* WIP: Save `ClockMap` to disk when truncating WAL

* Do not apply operation with `clock_tick` that is older than clock value in `ClockMap`

* Handle `ClockMap` properly during shard snapshot operations

* Use "atomic disk write" when saving `ClockMap` to disk

* Use `into` instead of explicit `Atomic*::new`

* Return *local* shard result (instead of *remote* shard result) when updating `ForwardProxyShard`

* Refactor `ClockMap::advance_clock*`

* Refactor `ClockMap::advance_clock*` once again

* Add documentation and `must_use` attributes

* Use `atomicwrites` crate for `ClockMap::store`

* WIP: Add `force` flag to the operations forwarded by forward/queue proxy shards...

...and add `force` flag handling to the `ClockMap`

* Disable force on forward proxy, always accept old clock values

---------

Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:04:07 +01:00
Zihong Lin
5c08c27233 Extend datetime formats in REST API (#3529) (#3549)
* Extend datetime formats in REST API (#3529)

* Fix linter problem

* Support indexing and condition checking and optimize tests

* Update lib/segment/src/types.rs

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

* Update lib/segment/src/types.rs

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

* Update lib/segment/src/types.rs

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

* Add some more tests for wrong or unsupported datetime format

* Reformat

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:04:04 +01:00
Jojii
8ae92d4716 allow stopping segment loading (#3498)
* allow stopping segment loading

* fix benches
2024-03-05 17:04:02 +01:00
Jojii
3ee5aac011 Optimize MatchAny (#3525)
* add benches for large MatchAny

* use HashSet for MatchAny

* use fnv hash

* make fnv workspace level dependency; apply clippy

* remove SmolStr from Keyword; Improve performance

* add bench for small number of keywords

* fix openapi

* fix performance issue

* apply integer optimization; create magic number constant
2024-03-05 17:03:59 +01:00
Luis Cossío
7d0e4e76ff Fix clippy 1.77 lints: explicitly set truncate flag on file creation (#3561)
* add `truncate(true)` where unspecified

* remove unused `WriteGuard` wrapper

* Don't truncate if we explicitly set the size later

---------

Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:03:56 +01:00
Tim Visée
a51bc421eb Bump wal to acaf1b2 (#3559) 2024-03-05 17:03:34 +01:00
Tim Visée
08e870c4bc Bump env_logger to 0.11 (#3558) 2024-03-05 17:03:19 +01:00
Tim Visée
fd9e8bf311 Change max_ack_version to be wal_keep_from (#3550)
* Change max_ack_version to be wal_keep_from

This shifts the logic by one. The variable now specifies what version to
keep rather than the last version we can acknowledge.

* Update comment

* Limit ack function visibility to prevent unwanted callers

* Use better name for wal_keep_from parameter
2024-03-05 17:03:12 +01:00
Luis Cossío
ffa27c4fd2 Order-by: Introduce OrderingValue for ordering also based on int values (#3533)
* introduce `OrderingValue` for ordering also based on int values

* use `num-cmp` for comparing ints and floats

* Update comparison logic

---------

Co-authored-by: Albert Safin <xzfcpw@gmail.com>
2024-03-05 17:02:53 +01:00
Andrey Vasnetsov
d5e5e36ea3 Assign clock tags to internal update operations (and update operation responses) (#3426)
* Add `ClockSet` type to generate clock tags for update operations

* Generate and assign clock tag to update operations

* Advance clock if replica returns *newer* tick for operation

* Cleanup `clock_set` module (and fix a minor bug in `Clock::advance_to`)

* Apply suggestions from code review

* Minor `ClockSet` fixes

* Make `Clock` start from `0` instead of `1`

* Rename clock value to next_tick to prevent ambiguity

The field always holds the next tick value we will be using, and our
tick functions return first and increment after. This helps making this
behavior more clear.

* add drops

* Minor `ClockSet` fixes

* Safe-guard `ClockSet` from advancing past clock `0` "prematurely"

* Use `into` instead of explicit `Atomic*::new`

* Remove unnecessary conditional in `ShardReplicaSet::update`

* Update `clock_set::Clock` documentation, rename `Clock::lock` to `Clock::try_lock`

* fixup! Update `clock_set::Clock` documentation, rename `Clock::lock` to `Clock::try_lock`

Fix a typo

---------

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: timvisee <tim@visee.me>
2024-03-05 17:01:48 +01:00
Arnaud Gourlay
7ffb1b6a4f Apply RocksDB options to all column families (#3557)
* Apply RocksDB options to all column families

* clean
2024-03-05 17:01:45 +01:00
Arnaud Gourlay
a51275b476 Optimize sparse search by advancing postings without binary search (#3527)
* Optimize search by advancing posting list with binary search

* better name for offset
2024-03-05 17:01:42 +01:00
Roman Titov
08831f9d2a Add force field to the ClockTag type (#3530) 2024-03-05 16:58:12 +01:00
dependabot[bot]
1f8b29b155 bump io-uring from 0.6.2 to 0.6.3 (#3539)
---
updated-dependencies:
- dependency-name: io-uring
  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>
2024-03-05 16:57:58 +01:00
Luis Cossío
9c93020bde Datetime index: Introduce RangeInterface (#3516)
* merge range and datetime range into one interface

* remove separate datetime_range from FieldCondition

* review fixes, remove code duplication. Thanks @xzfc

* update openapi test
2024-03-05 16:57:54 +01:00
Arnaud Gourlay
7d6a0972e8 Optimize sparse vector search with batched scoring (#3464)
* Optimize sparse vector search with batched scoring

* replace roaring bitmap by id generation

* compute intersections in Vec instead of Map

* cargo update ahash@0.8.7 --precise 0.8.5

* let rustc handle the pattern match optimization

* profiling done

* remove Option and filter out zero scores

* restore integration test assertion

* filter based on min score to avoid work

* decrease batch size and cleanup posting creation

* remove outdated tests

* remove dead test - I know where to find it if I need it
2024-03-05 16:57:50 +01:00