Skip to content

Commit 57df55d

Browse files
committed
Alter the key used for the chunk cache:
1) Only incorporate request fields that themselves are used in the S3 object download 2) Immediately turn this key into a md5 hash so we're handling a much shorter string when interacting with the cache
1 parent 0ee8298 commit 57df55d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/app.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,18 @@ async fn download_and_cache_s3_object<'a>(
236236
chunk_cache: &ChunkCache,
237237
allow_cache_auth_bypass: bool,
238238
) -> Result<Bytes, ActiveStorageError> {
239-
// We chose a cache key such that any changes to request data
239+
// We choose a cache key such that any changes to request data
240240
// which may feasibly indicate a change to the upstream object
241241
// lead to a new cache key.
242242
let key = format!(
243-
"{}-{}-{}-{}-{:?}-{:?}-{:?}-{:?}",
243+
"{}-{}-{}-{:?}-{:?}",
244244
request_data.source.as_str(),
245245
request_data.bucket,
246246
request_data.object,
247-
request_data.dtype,
248-
request_data.byte_order,
249247
request_data.offset,
250248
request_data.size,
251-
request_data.compression,
252249
);
250+
let key = format!("{:?}", md5::compute(key));
253251

254252
if let Some(metadata) = chunk_cache.get_metadata(&key).await {
255253
if !allow_cache_auth_bypass {

0 commit comments

Comments
 (0)