@@ -47,7 +47,7 @@ use uuid::Uuid;
47
47
use wal3:: {
48
48
Cursor , CursorName , CursorStore , CursorStoreOptions , Fragment , GarbageCollectionOptions ,
49
49
Limits , LogPosition , LogReader , LogReaderOptions , LogWriter , LogWriterOptions , Manifest ,
50
- MarkDirty as MarkDirtyTrait , Witness ,
50
+ ManifestAndETag , MarkDirty as MarkDirtyTrait , Witness ,
51
51
} ;
52
52
53
53
pub mod state_hash_table;
@@ -289,10 +289,10 @@ async fn get_log_from_handle_with_mutex_held<'a>(
289
289
} )
290
290
}
291
291
292
- ////////////////////////////////////// cache_key_for_manifest //////////////////////////////////////
292
+ ////////////////////////////////////////// cache_key_for_* /// //////////////////////////////////////
293
293
294
- fn cache_key_for_manifest ( collection_id : CollectionUuid ) -> String {
295
- format ! ( "{collection_id}::MANIFEST" )
294
+ fn cache_key_for_manifest_and_etag ( collection_id : CollectionUuid ) -> String {
295
+ format ! ( "{collection_id}::MANIFEST/ETAG " )
296
296
}
297
297
298
298
fn cache_key_for_cursor ( collection_id : CollectionUuid , name : & CursorName ) -> String {
@@ -1352,11 +1352,11 @@ impl LogServer {
1352
1352
Err ( err) => return Err ( Status :: new ( err. code ( ) . into ( ) , err. to_string ( ) ) ) ,
1353
1353
} ;
1354
1354
if let Some ( cache) = self . cache . as_ref ( ) {
1355
- let cache_key = cache_key_for_manifest ( collection_id) ;
1356
- if let Some ( manifest ) = log. manifest ( ) {
1357
- if let Ok ( manifest_bytes ) = serde_json:: to_vec ( & manifest ) {
1355
+ let cache_key = cache_key_for_manifest_and_etag ( collection_id) ;
1356
+ if let Some ( manifest_and_etag ) = log. manifest_and_etag ( ) {
1357
+ if let Ok ( manifest_and_etag_bytes ) = serde_json:: to_vec ( & manifest_and_etag ) {
1358
1358
let cache_value = CachedBytes {
1359
- bytes : manifest_bytes ,
1359
+ bytes : manifest_and_etag_bytes ,
1360
1360
} ;
1361
1361
cache. insert ( cache_key, cache_value) . await ;
1362
1362
}
@@ -1427,16 +1427,17 @@ impl LogServer {
1427
1427
pull_logs : & PullLogsRequest ,
1428
1428
) -> Option < Vec < Fragment > > {
1429
1429
if let Some ( cache) = self . cache . as_ref ( ) {
1430
- let cache_key = cache_key_for_manifest ( collection_id) ;
1430
+ let cache_key = cache_key_for_manifest_and_etag ( collection_id) ;
1431
1431
let cached_bytes = cache. get ( & cache_key) . await . ok ( ) . flatten ( ) ?;
1432
- let manifest: Manifest = serde_json:: from_slice ( & cached_bytes. bytes ) . ok ( ) ?;
1432
+ let manifest_and_etag: ManifestAndETag =
1433
+ serde_json:: from_slice ( & cached_bytes. bytes ) . ok ( ) ?;
1433
1434
let limits = Limits {
1434
1435
max_files : Some ( pull_logs. batch_size as u64 + 1 ) ,
1435
1436
max_bytes : None ,
1436
1437
max_records : Some ( pull_logs. batch_size as u64 ) ,
1437
1438
} ;
1438
1439
LogReader :: scan_from_manifest (
1439
- & manifest,
1440
+ & manifest_and_etag . manifest ,
1440
1441
LogPosition :: from_offset ( pull_logs. start_from_offset as u64 ) ,
1441
1442
limits,
1442
1443
)
@@ -2027,7 +2028,7 @@ impl LogServer {
2027
2028
let collection_id = Uuid :: parse_str ( & x)
2028
2029
. map ( CollectionUuid )
2029
2030
. map_err ( |_| Status :: invalid_argument ( "Failed to parse collection id" ) ) ?;
2030
- Some ( cache_key_for_manifest ( collection_id) )
2031
+ Some ( cache_key_for_manifest_and_etag ( collection_id) )
2031
2032
}
2032
2033
Some ( EntryToEvict :: Fragment ( f) ) => {
2033
2034
let collection_id = Uuid :: parse_str ( & f. collection_id )
0 commit comments