File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
graph/src/components/store Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,17 @@ impl<'a> WriteChunk<'a> {
933933 count : 0 ,
934934 }
935935 }
936+
937+ pub fn as_vec ( & self ) -> Vec < Self > {
938+ ( 0 ..self . len ( ) )
939+ . into_iter ( )
940+ . map ( |position| WriteChunk {
941+ group : self . group ,
942+ chunk_size : 1 ,
943+ position : self . position + position,
944+ } )
945+ . collect ( )
946+ }
936947}
937948
938949impl < ' a > IntoIterator for & WriteChunk < ' a > {
Original file line number Diff line number Diff line change @@ -767,13 +767,18 @@ impl Layout {
767767 for chunk in group. write_chunks ( chunk_size) {
768768 // Empty chunks would lead to invalid SQL
769769 if !chunk. is_empty ( ) {
770- InsertQuery :: new ( table, & chunk) ?
771- . execute ( conn)
772- . await
773- . map_err ( |e| {
774- let ( block, msg) = chunk_details ( & chunk) ;
775- StoreError :: write_failure ( e, table. object . as_str ( ) , block, msg)
776- } ) ?;
770+ if let Err ( _) = InsertQuery :: new ( table, & chunk) ?. execute ( conn) . await {
771+ for single_chunk in chunk. as_vec ( ) {
772+ InsertQuery :: new ( table, & single_chunk) ?
773+ . execute ( conn)
774+ . await
775+ . map_err ( |e| {
776+ let ( block, msg) = chunk_details ( & single_chunk) ;
777+ let msg = format ! ( "{}: offending row {:?}" , msg, single_chunk) ;
778+ StoreError :: write_failure ( e, table. object . as_str ( ) , block, msg)
779+ } ) ?;
780+ }
781+ }
777782 }
778783 }
779784 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments