losfair / mvsqlite

Distributed, MVCC SQLite that runs on FoundationDB.
https://github.com/losfair/mvsqlite/wiki
Apache License 2.0
1.35k stars 38 forks source link

fix(deps): update rust crate moka to 0.12.0 #100

Open renovate[bot] opened 1 year ago

renovate[bot] commented 1 year ago

Mend Renovate

This PR contains the following updates:

Package Type Update Change
moka dependencies minor 0.9.4 -> 0.12.0

Release Notes

moka-rs/moka (moka) ### [`v0.12.7`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0127) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.6...v0.12.7) ##### Changed - Ensure a single call to `run_pending_tasks` to evict as many entries as possible from the cache (\[[#​417](https://togithub.com/moka-rs/moka/issues/417)]\[gh-pull-0417]). ### [`v0.12.6`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0126) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.5...v0.12.6) ##### Fixed - Fixed a bug in `future::Cache` that pending `run_pending_tasks` calls may cause infinite busy loop in an internal `schedule_write_op` method (\[[#​412](https://togithub.com/moka-rs/moka/issues/412)]\[gh-issue-0412]): - This bug was introduced in `v0.12.0` when the background threads were removed from `future::Cache`. - This bug can occur when `run_pending_task` method is called by user code while cache is receiving a very high number of concurrent cache write operations. (e.g. `insert`, `get_with`, `invalidate` etc.) - When it occurs, the `schedule_write_op` method will be spinning in a busy loop forever, causing high CPU usage and all other async tasks to be starved. ##### Changed - Upgraded `async-lock` crate used by `future::Cache` from `v2.4` to the latest `v3.3`. ### [`v0.12.5`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0125) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.4...v0.12.5) ##### Added - Added support for a plain LRU (Least Recently Used) eviction policy (\[[#​390](https://togithub.com/moka-rs/moka/issues/390)]\[gh-pull-0390]): - The LRU policy is enabled by calling the `eviction_policy` method of the cache builder with a policy obtained by `EvictionPolicy::lru` function. - The default eviction policy remains the TinyLFU (Tiny, Least Frequently Used) as it maintains better hit rate than LRU for most use cases. TinyLFU combines LRU eviction policy and popularity-based admission policy. A probabilistic data structure is used to estimate historical popularity of both hit and missed keys. (not only the keys currently in the cache.) - However, some use cases may prefer LRU policy over TinyLFU. An example is recency biased workload such as streaming data processing. LRU policy can be used for them to achieve better hit rate. - Note that we are planning to add an adaptive eviction/admission policy called Window-TinyLFU in the future. It will adjust the balance between recency and frequency based on the current workload. ### [`v0.12.4`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0124) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.3...v0.12.4) ##### Fixed - Ensure `crossbeam-epoch` to run GC when dropping a cache (\[[#​384](https://togithub.com/moka-rs/moka/issues/384)]\[gh-pull-0384]): - `crossbeam-epoch` crate provides an epoch-based memory reclamation scheme for concurrent data structures. It is used by Moka cache to safely drop cached entries while they are still being accessed by other threads. - `crossbeam-epoch` does its best to reclaim memory (drop the entries evicted from the cache) when the epoch is advanced. However, it does not guarantee that memory will be reclaimed immediately after the epoch is advanced. This means that entries can remain in the memory for a while after the cache is dropped. - This fix ensures that, when a cache is dropped, the epoch is advanced and `crossbeam-epoch`'s thread local buffers are flushed, helping to reclaim memory immediately. - Note that there are still chances that some entries remain in the memory for a while after a cache is dropped. We are looking for alternatives to `crossbeam-epoch` to improve this situation (e.g. \[[#​385](https://togithub.com/moka-rs/moka/issues/385)]\[gh-issue-0385]). ##### Added - Added an example for reinserting expired entries to the cache. (\[[#​382](https://togithub.com/moka-rs/moka/issues/382)]\[gh-pull-0382]) ### [`v0.12.3`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0123) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.2...v0.12.3) ##### Added - Added the upsert and compute methods for modifying a cached entry (\[[#​370](https://togithub.com/moka-rs/moka/issues/370)]\[gh-pull-0370]): - Now the `entry` and `entry_by_ref` APIs have the following methods: - `and_upsert_with` method to insert or update the entry. - `and_compute_with` method to insert, update, remove or do nothing on the entry. - `and_try_compute_with` method, which is similar to above but returns `Result`. ##### Fixed - Raised the version requirement of the `quanta` from `>=0.11.0, <0.12.0` to `>=0.12.2, <0.13.0` to avoid under-measuring the elapsed time on Apple silicon Macs (\[[#​376](https://togithub.com/moka-rs/moka/issues/376)]\[gh-pull-0376]). - Due to this under-measurement, cached entries on macOS arm64 can expire sightly later than expected. ### [`v0.12.2`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0122) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.1...v0.12.2) ##### Fixed - Prevent timing issues in writes that cause inconsistencies between the cache's internal data structures (\[[#​348](https://togithub.com/moka-rs/moka/issues/348)]\[gh-pull-0348]): - One way to trigger the issue is that insert the same key twice quickly, once when the cache is full and a second time when there is a room in the cache. - When it occurs, the cache will not return the value inserted in the second call (which is wrong), and the `entry_count` method will keep returning a non zero value after calling the `invalidate_all` method (which is also wrong). - Now the last access time of a cached entry is updated immediately after the entry is read (\[[#​363](https://togithub.com/moka-rs/moka/issues/363)]\[gh-pull-0363]): - When the time-to-idle of a cache is set, the last access time of a cached entry is used to determine if the entry has been expired. - Before this fix, the access time was updated (to the time when it was read) when pending tasks were processed. This delay caused issue that some entries become temporarily unavailable for reads even though they have been accessed recently. And then they will become available again after the pending tasks are processed. - Now the last access time is updated immediately after the entry is read. The entry will remain valid until the time-to-idle has elapsed. Note that both of \[[#​348](https://togithub.com/moka-rs/moka/issues/348)]\[gh-pull-0348] and \[[#​363](https://togithub.com/moka-rs/moka/issues/363)]\[gh-pull-0363] were already present in `v0.11.x` and older versions. However they were less likely to occur because they had background threads to periodically process pending tasks. So there were much shorter time windows for these issues to occur. ##### Changed - Updated the Rust edition from 2018 to 2021. (\[[#​339](https://togithub.com/moka-rs/moka/issues/339)]\[gh-pull-0339], by \[[@​nyurik](https://togithub.com/nyurik)]\[gh-nyurik]) - The MSRV remains at Rust 1.65. - Changed to use inline format arguments throughout the code, including examples. (\[[#​340](https://togithub.com/moka-rs/moka/issues/340)]\[gh-pull-0340], by \[[@​nyurik](https://togithub.com/nyurik)]\[gh-nyurik]) ##### Added - Added an example for cascading drop triggered by eviction (\[[#​350](https://togithub.com/moka-rs/moka/issues/350)]\[gh-pull-0350], by \[[@​peter-scholtens](https://togithub.com/peter-scholtens)]\[gh-peter-scholtens]) ### [`v0.12.1`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0121) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.12.0...v0.12.1) ##### Fixed - Fixed memory leak in `future::Cache` that occurred when `get_with()`, `entry().or_insert_with()`, and similar methods were used (\[[#​329](https://togithub.com/moka-rs/moka/issues/329)]\[gh-issue-0329]). - This bug was introduced in `v0.12.0`. Versions prior to `v0.12.0` do not have this bug. ##### Changed - (Performance) Micro-optimize `ValueInitializer` (\[[#​331](https://togithub.com/moka-rs/moka/issues/331)]\[gh-pull-0331], by \[[@​Swatinem](https://togithub.com/Swatinem)]\[gh-Swatinem]). ### [`v0.12.0`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0120) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.11.3...v0.12.0) > **Note** > `v0.12.0` has major breaking changes on the API and internal behavior. - **`sync` caches are no longer enabled by default**: Please use a crate feature `sync` to enable it. - **No more background threads**: All cache types `future::Cache`, `sync::Cache`, and `sync::SegmentedCache` no longer spawn background threads. - The `scheduled-thread-pool` crate was removed from the dependency. - Because of this change, many private methods and some public methods under the `future` module were converted to `async` methods. You may need to add `.await` to your code for those methods. - **Immediate notification delivery**: The `notification::DeliveryMode` enum for the eviction listener was removed. Now all cache types behave as if the `Immediate` delivery mode is specified. Please read the [MIGRATION-GUIDE.md][migration-guide-v012] for more details. [migration-guide-v012]: https://togithub.com/moka-rs/moka/blob/main/MIGRATION-GUIDE.md#migrating-to-v0120-from-a-prior-version ##### Changed - Removed the thread pool from `future` cache (\[[#​294](https://togithub.com/moka-rs/moka/issues/294)]\[gh-pull-0294]) and `sync` caches (\[[#​316](https://togithub.com/moka-rs/moka/issues/316)]\[gh-pull-0316]). - Improved async cancellation safety of `future::Cache`. (\[[#​309](https://togithub.com/moka-rs/moka/issues/309)]\[gh-pull-0309]) ##### Fixed - Fixed a bug that an internal `do_insert_with_hash` method gets the current `Instant` too early when eviction listener is enabled. (\[[#​322](https://togithub.com/moka-rs/moka/issues/322)]\[gh-issue-0322]) ### [`v0.11.3`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0113) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.11.2...v0.11.3) ##### Fixed - Fixed a bug in `sync::Cache` and `sync::SegmentedCache` where memory usage kept increasing when the eviction listener was set with the `Immediate` delivery mode. (\[[#​295](https://togithub.com/moka-rs/moka/issues/295)]\[gh-pull-0295]) ### [`v0.11.2`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0112) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.11.1...v0.11.2) Bumped the minimum supported Rust version (MSRV) to 1.65 (Nov 3, 2022). (\[[#​275](https://togithub.com/moka-rs/moka/issues/275)]\[gh-pull-0275]) ##### Removed - Removed `num_cpus` crate from the dependency. (\[[#​277](https://togithub.com/moka-rs/moka/issues/277)]\[gh-pull-0277]) ##### Changed - Refactored internal methods of the concurrent hash table to reduce compile times. (\[[#​265](https://togithub.com/moka-rs/moka/issues/265)]\[gh-pull-0265], by \[[@​Swatinem](https://togithub.com/Swatinem)]\[gh-Swatinem]) ### [`v0.11.1`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0111) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.11.0...v0.11.1) ##### Fixed - Fixed occasional panic in internal `FrequencySketch` in debug build. (\[[#​272](https://togithub.com/moka-rs/moka/issues/272)]\[gh-pull-0272]) ##### Added - Added some example programs to the `examples` directory. (\[[#​268](https://togithub.com/moka-rs/moka/issues/268)]\[gh-pull-0268], by \[[@​peter-scholtens](https://togithub.com/peter-scholtens)]\[gh-peter-scholtens]) ### [`v0.11.0`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0110) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.10.4...v0.11.0) ##### Added - Added support for per-entry expiration (\[[#​248](https://togithub.com/moka-rs/moka/issues/248)]\[gh-pull-0248]): - In addition to the existing TTL and TTI (time-to-idle) expiration times that apply to all entries in the cache, the `sync` and `future` caches can now allow different expiration times for individual entries. - Added the `remove` method to the `sync` and `future` caches ([#​255](gh-issue-0255)): - Like the `invalidate` method, this method discards any cached value for the key, but returns a clone of the value. ##### Fixed - Fixed the caches mutating a deque node through a `NonNull` pointer derived from a shared reference. (\[[#​259](https://togithub.com/moka-rs/moka/issues/259)]\[gh-pull-0259]) ##### Removed - Removed `unsync` cache that was marked as deprecated in [v0.10.0](#version-0100). ### [`v0.10.4`](https://togithub.com/moka-rs/moka/compare/v0.10.3...v0.10.4) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.10.3...v0.10.4) ### [`v0.10.3`](https://togithub.com/moka-rs/moka/compare/v0.10.2...v0.10.3) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.10.2...v0.10.3) ### [`v0.10.2`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0102) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.10.1...v0.10.2) Bumped the minimum supported Rust version (MSRV) to 1.60 (Apr 7, 2022). (\[[#​252](https://togithub.com/moka-rs/moka/issues/252)]\[gh-issue-0252]) ##### Changed - Upgraded `quanta` crate to v0.11.0. (\[[#​251](https://togithub.com/moka-rs/moka/issues/251)]\[gh-pull-0251]) - This resolved "\[RUSTSEC-2020-0168]: `mach` is unmaintained" (\[[#​243](https://togithub.com/moka-rs/moka/issues/243)]\[gh-issue-0243]) by replacing `mach` with `mach2`. - `quanta` v0.11.0's MSRV is 1.60, so we also bumped the MSRV of Moka to 1.60. ### [`v0.10.1`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0101) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.10.0...v0.10.1) ##### Fixed - Fixed a bug that `future` cache's `blocking().invalidate(key)` method does not trigger the eviction listener. (\[[#​242](https://togithub.com/moka-rs/moka/issues/242)]\[gh-issue-0242]) ##### Changed - Now `sync` and `future` caches will not cache anything when the max capacity is set to zero (\[[#​230](https://togithub.com/moka-rs/moka/issues/230)]\[gh-issue-0230]): - Previously, they would cache some entries for short time (< 0.5 secs) even though the max capacity is zero. ### [`v0.10.0`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-0100) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.9...v0.10.0) ##### Breaking Changes - The following caches have been moved to a separate crate called \[Mini-Moka]\[mini-moka-crate]: - `moka::unsync::Cache` → `mini_moka::unsync::Cache` - `moka::dash::Cache` → `mini_moka::sync::Cache` - The following methods have been removed from `sync` and `future` caches (\[[#​199](https://togithub.com/moka-rs/moka/issues/199)]\[gh-pull-0199]). They were deprecated in v0.8.0: - `get_or_insert_with` (Use `get_with` instead) - `get_or_try_insert_with` (Use `try_get_with` instead) - The following methods of `sync` and `future` caches have been marked as deprecated (\[[#​193](https://togithub.com/moka-rs/moka/issues/193)]\[gh-pull-0193]): - `get_with_if` (Use `entry` API's `or_insert_with_if` instead) ##### Added - Add `entry` and `entry_by_ref` APIs to `sync` and `future` caches (\[[#​193](https://togithub.com/moka-rs/moka/issues/193)]\[gh-pull-0193]): - They allow users to perform more complex operations on a cache entry. At this point, the following operations (methods) are provided: - `or_default` - `or_insert` - `or_insert_with` - `or_insert_with_if` - `or_optionally_insert_with` - `or_try_insert_with` - The above methods return `Entry` type, which provides `is_fresh` method to check if the value was freshly computed or already existed in the cache. ### [`v0.9.9`](https://togithub.com/moka-rs/moka/compare/v0.9.8...v0.9.9) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.8...v0.9.9) ### [`v0.9.8`](https://togithub.com/moka-rs/moka/compare/v0.9.7...v0.9.8) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.7...v0.9.8) ### [`v0.9.7`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-097) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.6...v0.9.7) ##### Fixed - Fix an issue that `get_with` method of `future` cache inflates future size by ~7x, sometimes causing stack overflow (\[[#​212](https://togithub.com/moka-rs/moka/issues/212)]\[gh-issue-0212]): - This was caused by a known `rustc` optimization issue on async functions (\[[rust-lang/rust#62958](https://togithub.com/rust-lang/rust/issues/62958)]\[gh-rust-issue-62958]). - Added a workaround to our cache and now it will only inflate the size by ~2.5x. - Fix a bug that setting the number of segments of `sync` cache will disable notifications. (\[[#​207](https://togithub.com/moka-rs/moka/issues/207)]\[gh-issue-0207]) ##### Added - Add examples for `build_with_hasher` method of cache builders. (\[[#​216](https://togithub.com/moka-rs/moka/issues/216)]\[gh-pull-0216]) ### [`v0.9.6`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-096) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.5...v0.9.6) ##### Fixed - Prevent race condition in `get_with` family methods to avoid evaluating `init` closure or future multiple times in concurrent calls. (\[[#​195](https://togithub.com/moka-rs/moka/issues/195)]\[gh-pull-0195]) ### [`v0.9.5`](https://togithub.com/moka-rs/moka/blob/HEAD/CHANGELOG.md#Version-095) [Compare Source](https://togithub.com/moka-rs/moka/compare/v0.9.4...v0.9.5) ##### Added - Add `optionally_get_with` method to `sync` and `future` caches (\[[#​187](https://togithub.com/moka-rs/moka/issues/187)]\[gh-pull-0187], by \[[@​LMJW](https://togithub.com/LMJW)]\[gh-LMJW]): - It is similar to `try_get_with` but takes an init closure/future returning an `Option` instead of `Result`. - Add `by_ref` version of API for `get_with`, `optionally_get_with`, and `try_get_with` of `sync` and `future` caches (\[[#​190](https://togithub.com/moka-rs/moka/issues/190)]\[gh-pull-0190], by \[[@​LMJW](https://togithub.com/LMJW)]\[gh-LMJW]): - They are similar to the non-`by_ref` versions but take a reference of the key instead of an owned key. If the key does not exist in the cache, the key will be cloned to create new entry in the cache. ##### Changed - Change the CI to run Linux AArch64 tests on real hardware using Cirrus CI. (\[[#​180](https://togithub.com/moka-rs/moka/issues/180)]\[gh-pull-0180], by \[[@​ClSlaid](https://togithub.com/ClSlaid)]\[gh-ClSlaid]) ##### Fixed - Fix a typo in the documentation. (\[[#​189](https://togithub.com/moka-rs/moka/issues/189)]\[gh-pull-0189], by \[[@​Swatinem](https://togithub.com/Swatinem)]\[gh-Swatinem])

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Mend Renovate. View repository job log here.