@@ -48,7 +48,7 @@ use crate::metrics::upsert::UpsertMetrics;
48
48
use crate :: storage_state:: StorageInstanceContext ;
49
49
use crate :: upsert_continual_feedback;
50
50
use types:: {
51
- BincodeOpts , StateValue , UpsertState , UpsertStateBackend , Value , consolidating_merge_function,
51
+ BincodeOpts , StateValue , UpsertState , UpsertStateBackend , consolidating_merge_function,
52
52
upsert_bincode_opts,
53
53
} ;
54
54
@@ -58,7 +58,7 @@ pub(crate) mod rocksdb;
58
58
// TODO(aljoscha): Move next to upsert module, rename to upsert_types.
59
59
pub ( crate ) mod types;
60
60
61
- pub type UpsertValue = Result < Row , UpsertError > ;
61
+ pub type UpsertValue = Result < Row , Box < UpsertError > > ;
62
62
63
63
#[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
64
64
pub struct UpsertKey ( [ u8 ; 32 ] ) ;
@@ -508,7 +508,7 @@ enum DrainStyle<'a, T> {
508
508
async fn drain_staged_input < S , G , T , FromTime , E > (
509
509
stash : & mut Vec < ( T , UpsertKey , Reverse < FromTime > , Option < UpsertValue > ) > ,
510
510
commands_state : & mut indexmap:: IndexMap < UpsertKey , types:: UpsertValueAndSize < T , FromTime > > ,
511
- output_updates : & mut Vec < ( Result < Row , UpsertError > , T , Diff ) > ,
511
+ output_updates : & mut Vec < ( UpsertValue , T , Diff ) > ,
512
512
multi_get_scratch : & mut Vec < UpsertKey > ,
513
513
drain_style : DrainStyle < ' _ , T > ,
514
514
error_emitter : & mut E ,
@@ -607,15 +607,15 @@ async fn drain_staged_input<S, G, T, FromTime, E>(
607
607
if let Some ( old_value) =
608
608
existing_value. replace ( StateValue :: finalized_value ( value. clone ( ) ) )
609
609
{
610
- if let Value :: FinalizedValue ( old_value) = old_value. into_decoded ( ) {
610
+ if let Some ( old_value) = old_value. into_decoded ( ) . finalized {
611
611
output_updates. push ( ( old_value, ts. clone ( ) , Diff :: MINUS_ONE ) ) ;
612
612
}
613
613
}
614
614
output_updates. push ( ( value, ts, Diff :: ONE ) ) ;
615
615
}
616
616
None => {
617
617
if let Some ( old_value) = existing_value. take ( ) {
618
- if let Value :: FinalizedValue ( old_value) = old_value. into_decoded ( ) {
618
+ if let Some ( old_value) = old_value. into_decoded ( ) . finalized {
619
619
output_updates. push ( ( old_value, ts, Diff :: MINUS_ONE ) ) ;
620
620
}
621
621
}
@@ -691,12 +691,16 @@ where
691
691
let value = match result {
692
692
Ok ( ok) => Ok ( ok) ,
693
693
Err ( DataflowError :: EnvelopeError ( err) ) => match * err {
694
- EnvelopeError :: Upsert ( err) => Err ( err) ,
694
+ EnvelopeError :: Upsert ( err) => Err ( Box :: new ( err) ) ,
695
695
_ => return None ,
696
696
} ,
697
697
Err ( _) => return None ,
698
698
} ;
699
- Some ( ( UpsertKey :: from_value ( value. as_ref ( ) , & key_indices) , value) )
699
+ let value_ref = match value {
700
+ Ok ( ref row) => Ok ( row) ,
701
+ Err ( ref err) => Err ( & * * err) ,
702
+ } ;
703
+ Some ( ( UpsertKey :: from_value ( value_ref, & key_indices) , value) )
700
704
} ) ;
701
705
let ( output_handle, output) = builder. new_output ( ) ;
702
706
@@ -931,7 +935,7 @@ where
931
935
(
932
936
output. as_collection ( ) . map ( |result| match result {
933
937
Ok ( ok) => Ok ( ok) ,
934
- Err ( err) => Err ( DataflowError :: from ( EnvelopeError :: Upsert ( err) ) ) ,
938
+ Err ( err) => Err ( DataflowError :: from ( EnvelopeError :: Upsert ( * err) ) ) ,
935
939
} ) ,
936
940
health_stream,
937
941
snapshot_stream,
0 commit comments