@@ -47,7 +47,7 @@ use uuid::Uuid;
4747use wal3:: {
4848 Cursor , CursorName , CursorStore , CursorStoreOptions , Fragment , GarbageCollectionOptions ,
4949 Limits , LogPosition , LogReader , LogReaderOptions , LogWriter , LogWriterOptions , Manifest ,
50- MarkDirty as MarkDirtyTrait , Witness ,
50+ ManifestAndETag , MarkDirty as MarkDirtyTrait , Witness ,
5151} ;
5252
5353pub mod state_hash_table;
@@ -289,10 +289,10 @@ async fn get_log_from_handle_with_mutex_held<'a>(
289289 } )
290290}
291291
292- ////////////////////////////////////// cache_key_for_manifest //////////////////////////////////////
292+ ////////////////////////////////////////// cache_key_for_* /// //////////////////////////////////////
293293
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 " )
296296}
297297
298298fn cache_key_for_cursor ( collection_id : CollectionUuid , name : & CursorName ) -> String {
@@ -1352,11 +1352,11 @@ impl LogServer {
13521352 Err ( err) => return Err ( Status :: new ( err. code ( ) . into ( ) , err. to_string ( ) ) ) ,
13531353 } ;
13541354 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 ) {
13581358 let cache_value = CachedBytes {
1359- bytes : manifest_bytes ,
1359+ bytes : manifest_and_etag_bytes ,
13601360 } ;
13611361 cache. insert ( cache_key, cache_value) . await ;
13621362 }
@@ -1427,16 +1427,17 @@ impl LogServer {
14271427 pull_logs : & PullLogsRequest ,
14281428 ) -> Option < Vec < Fragment > > {
14291429 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) ;
14311431 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 ( ) ?;
14331434 let limits = Limits {
14341435 max_files : Some ( pull_logs. batch_size as u64 + 1 ) ,
14351436 max_bytes : None ,
14361437 max_records : Some ( pull_logs. batch_size as u64 ) ,
14371438 } ;
14381439 LogReader :: scan_from_manifest (
1439- & manifest,
1440+ & manifest_and_etag . manifest ,
14401441 LogPosition :: from_offset ( pull_logs. start_from_offset as u64 ) ,
14411442 limits,
14421443 )
@@ -2027,7 +2028,7 @@ impl LogServer {
20272028 let collection_id = Uuid :: parse_str ( & x)
20282029 . map ( CollectionUuid )
20292030 . 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) )
20312032 }
20322033 Some ( EntryToEvict :: Fragment ( f) ) => {
20332034 let collection_id = Uuid :: parse_str ( & f. collection_id )
0 commit comments