@@ -19,8 +19,8 @@ use differential_dataflow::trace::Description;
1919use futures:: StreamExt ;
2020use futures:: stream:: FuturesUnordered ;
2121use mz_dyncfg:: Config ;
22- use mz_ore:: instrument;
2322use mz_ore:: task:: RuntimeExt ;
23+ use mz_ore:: { instrument, soft_panic_or_log} ;
2424use mz_persist:: location:: Blob ;
2525use mz_persist_types:: schema:: SchemaId ;
2626use mz_persist_types:: { Codec , Codec64 } ;
@@ -32,7 +32,7 @@ use timely::PartialOrder;
3232use timely:: order:: TotalOrder ;
3333use timely:: progress:: { Antichain , Timestamp } ;
3434use tokio:: runtime:: Handle ;
35- use tracing:: { Instrument , debug_span, info, warn} ;
35+ use tracing:: { Instrument , debug_span, error , info, warn} ;
3636use uuid:: Uuid ;
3737
3838use crate :: batch:: {
@@ -568,6 +568,23 @@ where
568568 TODO: Error on very old versions once the leaked blob detector exists."
569569 )
570570 }
571+ fn assert_schema < A : Codec > ( writer_schema : & A :: Schema , batch_schema : & bytes:: Bytes ) {
572+ if batch_schema. is_empty ( ) {
573+ // Schema is either trivial or missing!
574+ return ;
575+ }
576+ let batch_schema: A :: Schema = A :: decode_schema ( batch_schema) ;
577+ if * writer_schema != batch_schema {
578+ error ! (
579+ ?writer_schema,
580+ ?batch_schema,
581+ "writer and batch schemas should be identical"
582+ ) ;
583+ soft_panic_or_log ! ( "writer and batch schemas should be identical" ) ;
584+ }
585+ }
586+ assert_schema :: < K > ( & * self . write_schemas . key , & batch. schemas . 0 ) ;
587+ assert_schema :: < V > ( & * self . write_schemas . val , & batch. schemas . 1 ) ;
571588 }
572589
573590 let lower = expected_upper. clone ( ) ;
@@ -822,6 +839,7 @@ where
822839 metrics : Arc :: clone ( & self . metrics ) ,
823840 shard_metrics : Arc :: clone ( & self . machine . applier . shard_metrics ) ,
824841 version : Version :: parse ( & batch. version ) . expect ( "valid transmittable batch" ) ,
842+ schemas : ( batch. key_schema , batch. val_schema ) ,
825843 batch : batch
826844 . batch
827845 . into_rust_if_some ( "ProtoBatch::batch" )
0 commit comments