@@ -46,7 +46,7 @@ use uuid::Uuid;
4646use wal3:: {
4747 Cursor , CursorName , CursorStore , CursorStoreOptions , Fragment , GarbageCollectionOptions ,
4848 Limits , LogPosition , LogReader , LogReaderOptions , LogWriter , LogWriterOptions , Manifest ,
49- MarkDirty as MarkDirtyTrait , Witness ,
49+ ManifestAndETag , MarkDirty as MarkDirtyTrait , Witness ,
5050} ;
5151
5252pub mod state_hash_table;
@@ -288,10 +288,10 @@ async fn get_log_from_handle_with_mutex_held<'a>(
288288 } )
289289}
290290
291- ////////////////////////////////////// cache_key_for_manifest //////////////////////////////////////
291+ ////////////////////////////////////////// cache_key_for_* /// //////////////////////////////////////
292292
293- fn cache_key_for_manifest ( collection_id : CollectionUuid ) -> String {
294- format ! ( "{collection_id}::MANIFEST" )
293+ fn cache_key_for_manifest_and_etag ( collection_id : CollectionUuid ) -> String {
294+ format ! ( "{collection_id}::MANIFEST/ETAG " )
295295}
296296
297297fn cache_key_for_cursor ( collection_id : CollectionUuid , name : & CursorName ) -> String {
@@ -1104,11 +1104,11 @@ impl LogServer {
11041104 Err ( err) => return Err ( Status :: new ( err. code ( ) . into ( ) , err. to_string ( ) ) ) ,
11051105 } ;
11061106 if let Some ( cache) = self . cache . as_ref ( ) {
1107- let cache_key = cache_key_for_manifest ( collection_id) ;
1108- if let Some ( manifest ) = log. manifest ( ) {
1109- if let Ok ( manifest_bytes ) = serde_json:: to_vec ( & manifest ) {
1107+ let cache_key = cache_key_for_manifest_and_etag ( collection_id) ;
1108+ if let Some ( manifest_and_etag ) = log. manifest_and_etag ( ) {
1109+ if let Ok ( manifest_and_etag_bytes ) = serde_json:: to_vec ( & manifest_and_etag ) {
11101110 let cache_value = CachedBytes {
1111- bytes : manifest_bytes ,
1111+ bytes : manifest_and_etag_bytes ,
11121112 } ;
11131113 cache. insert ( cache_key, cache_value) . await ;
11141114 }
@@ -1181,16 +1181,17 @@ impl LogServer {
11811181 pull_logs : & PullLogsRequest ,
11821182 ) -> Option < Vec < Fragment > > {
11831183 if let Some ( cache) = self . cache . as_ref ( ) {
1184- let cache_key = cache_key_for_manifest ( collection_id) ;
1184+ let cache_key = cache_key_for_manifest_and_etag ( collection_id) ;
11851185 let cached_bytes = cache. get ( & cache_key) . await . ok ( ) . flatten ( ) ?;
1186- let manifest: Manifest = serde_json:: from_slice ( & cached_bytes. bytes ) . ok ( ) ?;
1186+ let manifest_and_etag: ManifestAndETag =
1187+ serde_json:: from_slice ( & cached_bytes. bytes ) . ok ( ) ?;
11871188 let limits = Limits {
11881189 max_files : Some ( pull_logs. batch_size as u64 + 1 ) ,
11891190 max_bytes : None ,
11901191 max_records : Some ( pull_logs. batch_size as u64 ) ,
11911192 } ;
11921193 LogReader :: scan_from_manifest (
1193- & manifest,
1194+ & manifest_and_etag . manifest ,
11941195 LogPosition :: from_offset ( pull_logs. start_from_offset as u64 ) ,
11951196 limits,
11961197 )
@@ -1715,7 +1716,7 @@ impl LogServer {
17151716 let collection_id = Uuid :: parse_str ( & x)
17161717 . map ( CollectionUuid )
17171718 . map_err ( |_| Status :: invalid_argument ( "Failed to parse collection id" ) ) ?;
1718- Some ( cache_key_for_manifest ( collection_id) )
1719+ Some ( cache_key_for_manifest_and_etag ( collection_id) )
17191720 }
17201721 Some ( EntryToEvict :: Fragment ( f) ) => {
17211722 let collection_id = Uuid :: parse_str ( & f. collection_id )
0 commit comments