Commit graph

23 commits

Author SHA1 Message Date
Edward Wang
96e561a999 Allow miss handler to lookup storage using streaming write tag
When supporting streaming partial writes, the cache miss request may not
always find the corresponding body reader for the storage asset that its
upstream write is trying to fill.

This change adds a lookup_streaming_write storage API and allows the
miss handler to provide a streaming write tag for use with the API, so
that it may find the matching hit handler to serve downstream.
2024-09-13 14:11:24 -07:00
Matthew Gumport
e288bfe8f0 change lock status memory ordering, tag spans
This changes the memory ordering for the lock status load to `SeqCst` from
`Relaxed` to eliminate a potential source of panics.

Panics had the frames:
```
pingora_proxy::proxy_cache::<T>::handle_lock_status (proxy_cache.rs:748)
pingora_proxy::proxy_cache::<T>::proxy_cache::{{closure}} (proxy_cache.rs:211)
pingora_proxy::HttpProxy<T>::process_request::{{closure}} (lib.rs:509)
pingora_proxy::HttpProxy<T>::process_new_http::{{closure}} (lib.rs:727)
```

which showed we were checking on the status of the lock, after waiting on it,
and still seeing its status as waiting. The status is returned by value, so this
is not a time-of-check to time-of-use problem, this is an inconsistency in how
the lock status is managed. The change in memory order is mostly for the sake of
this programmer's attempts to understand what is happening.

This also completes a couple of TODOs to limit the wait period as well as tag
the span with the lock status.
2024-09-06 13:43:53 -07:00
Matthew Gumport
444186eb71 unset meta on cache miss
If we have a cache miss, any meta in this object is invalid. Unset
it so that we don't use it later.
2024-09-06 13:43:53 -07:00
Kevin Guthrie
24d722920a Derive Ord and PartialOrd for CompactCacheKey 2024-08-09 14:30:49 -07:00
Edward Wang
7003ac34ad Set stale-updating as an explicit CachePhase
This cache phase indicates when we are serving a stale cache hit, but
there is another request currently updating the asset.
2024-08-09 14:30:49 -07:00
Edward Wang
e5fda7c657 Allow Stale phase in cache_miss
There could be a race condition where a Stale request waiting on cache
lock retries the cache lock and lookup, but enters cache_miss after
finding the asset is no longer present.
2024-08-09 14:30:49 -07:00
Yuchen Wu
32303b9258 Address Rust 1.80 clippy warnings.
Also remove the doc_async_trait cfg since it is no longer viable.
2024-07-26 13:35:13 -07:00
Yuchen Wu
9f70abe97b Release 0.3.0 2024-07-12 11:24:29 -07:00
Yuchen Wu
f9148430db Report evction/invalidtion types
This helps the storage to log/track different type of cache deletions.
2024-06-28 12:34:25 -07:00
Zaidoon Abd Al Hadi
e3c655b781 update CacheKey to allow overriding primary key hash 2024-06-07 15:42:30 -04:00
Yuchen Wu
6f4f4cc41e Allow the lookup_duration to be read 2024-05-24 10:00:06 -07:00
Yuchen Wu
ac25f03e62 Track cache lookup time 2024-05-24 10:00:06 -07:00
Yuchen Wu
3dbdcc6b09 Release 0.2.0 2024-05-10 15:22:37 -07:00
Matthew Gumport
a8b6bbe9f4 address string interpolation outside of proper context
https://github.com/cloudflare/pingora/issues/181

Ran:
```
rg --pcre2 '(?<!(trace\!\()|(println\!\()|(warn\!\()|(info\!\()|(debug\!\()|(format\!\()|(error\!\()|(write\!\()|(panic\!\())\".*\{.+\"'
```

and audited the 200+ results by hand. Only messed up in a few places!

Hat-tip to Kevin for helping me understand the compile error messages I was
seeing trying to fix this naively.
2024-04-22 08:48:19 -07:00
Gustav Davidsson
881db9e32c Add/polish some comments 2024-04-05 11:46:20 -07:00
ewang
f54d17a339 Clarify cache-control regex comments
Also update a few comment links for the newest HTTP RFCs.
2024-04-05 11:46:20 -07:00
Yuchen Wu
dfcd3d1d9f Fix typos and grammar issues in docs
And other things.

Co-authored-by: DimanNe <causal.consistency@proton.me>
Co-authored-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: lilo <luolee.me@gmail.com>
Co-authored-by: Yang He <abruzzi.hraig@gmail.com>
2024-04-05 11:46:20 -07:00
afon
aca70af5e5 Only compile pingora-openssl when openssl feature is enabled.
Replicated-from: https://github.com/cloudflare/pingora/pull/131
Includes-commit: ae706cdf49
2024-04-05 11:46:20 -07:00
pluveto
59a9f93bd6 tests(cache): add tests for purge method
Replicated-from: https://github.com/cloudflare/pingora/pull/18
Includes-commit: e5a3865e9d
Includes-commit: f4af9ad3a5
Includes-commit: bbfb1eb5ba
Includes-commit: f74cf9f82a
2024-04-05 11:46:20 -07:00
battmdpkq
8a84b24ad0 fix some comments
Signed-off-by: battmdpkq <cmaker@163.com>
Replicated-from: https://github.com/cloudflare/pingora/pull/123
Includes-commit: 943bedb281
2024-03-15 14:37:56 -07:00
Matthew Gumport
ae8ea771b1 compile and test cleanly with nightly
The vast majority of these are redundant imports.
2024-03-15 14:37:56 -07:00
Yuchen Wu
8160ad1698 Fix typos and grammar issues
Co-authored-by: =?~~~?q?Ren=C3=A9=20Kla=C4=8Dan?= <rene@klacan.sk>
Co-authored-by: 12932 <68835423+12932@users.noreply.github.com>
Co-authored-by: Alessandro <aleferrara1998@gmail.com>
Co-authored-by: InImpasse <40639475+InImpasse@users.noreply.github.com>
Co-authored-by: Paul James Cleary <pauljamescleary@gmail.com>
Co-authored-by: Yang Hau <yuanyanghau@gmail.com>
Co-authored-by: Morpheus <40785143+Muzych@users.noreply.github.com>
Co-authored-by: mobeicanyue <81098819+mobeicanyue@users.noreply.github.com>
Co-authored-by: Twacqwq <69360546+Twacqwq@users.noreply.github.com>
Co-authored-by: Bobby <zkd8907@live.com>
Co-authored-by: Dup4 <lyuzhi.pan@gmail.com>
Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: Sheldon <1415182877@qq.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: ZhangIvan1 <zhang_ivan1@163.com>
Co-authored-by: GrahamQuan <33834833+GrahamQuan@users.noreply.github.com>
Co-authored-by: =?~~~?q?Cristian=20Paul=20Pe=C3=B1aranda=20Rojas?= <paul@kristianpaul.org>
Co-authored-by: Nathan Sit <nsit.earth@gmail.com>
Co-authored-by: David Lee <67067729+LordMoMA@users.noreply.github.com>
Co-authored-by: Mengliang Su <mengliang.su@shopee.com>
Co-authored-by: =?~~~?q?=EA=B9=80=EC=84=A0=EC=9A=B0?= <seonwoo960000@toss.im>
Co-authored-by: Allen Huang <huangseji@meituan.com>
Co-authored-by: Opacity <70315161+zreren@users.noreply.github.com>
Co-authored-by: cris <sqdcmk@gmail.com>
Co-authored-by: Killian Ye <40255385+ykw1129@users.noreply.github.com>
Co-authored-by: Jiwei-dev <hi.jiwei@gmail.com>
Co-authored-by: Jinfeng Wang <41931794+wjf40390@users.noreply.github.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-03-01 13:47:27 -08:00
Yuchen Wu
8797329225 Release Pingora version 0.1.0
Co-authored-by: Andrew Hauck <ahauck@cloudflare.com>
Co-authored-by: Edward Wang <ewang@cloudflare.com>
2024-02-27 20:25:44 -08:00