File tree Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -750,15 +750,21 @@ impl Connection {
750
750
self . conn . transaction ( |conn| f ( conn) )
751
751
}
752
752
753
+ /// Copy private data sources if the source uses a schema version that
754
+ /// has a private data sources table. The copying is done in its own
755
+ /// transaction.
753
756
fn copy_private_data_sources ( & mut self , state : & CopyState ) -> Result < ( ) , StoreError > {
754
757
if state. src . site . schema_version . private_data_sources ( ) {
755
- DataSourcesTable :: new ( state. src . site . namespace . clone ( ) ) . copy_to (
756
- & mut self . conn ,
757
- & DataSourcesTable :: new ( state. dst . site . namespace . clone ( ) ) ,
758
- state. target_block . number ,
759
- & self . src_manifest_idx_and_name ,
760
- & self . dst_manifest_idx_and_name ,
761
- ) ?;
758
+ let conn = & mut self . conn ;
759
+ conn. transaction ( |conn| {
760
+ DataSourcesTable :: new ( state. src . site . namespace . clone ( ) ) . copy_to (
761
+ conn,
762
+ & DataSourcesTable :: new ( state. dst . site . namespace . clone ( ) ) ,
763
+ state. target_block . number ,
764
+ & self . src_manifest_idx_and_name ,
765
+ & self . dst_manifest_idx_and_name ,
766
+ )
767
+ } ) ?;
762
768
}
763
769
Ok ( ( ) )
764
770
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use diesel::{
9
9
} ;
10
10
11
11
use graph:: {
12
- anyhow:: Context ,
12
+ anyhow:: { anyhow , Context } ,
13
13
components:: store:: { write, StoredDynamicDataSource } ,
14
14
constraint_violation,
15
15
data_source:: CausalityRegion ,
@@ -258,12 +258,24 @@ impl DataSourcesTable {
258
258
let name = & src_manifest_idx_and_name
259
259
. iter ( )
260
260
. find ( |( idx, _) | idx == & src_manifest_idx)
261
- . context ( "manifest_idx not found in src" ) ?
261
+ . with_context ( || {
262
+ anyhow ! (
263
+ "the source {} does not have a template with index {}" ,
264
+ self . namespace,
265
+ src_manifest_idx
266
+ )
267
+ } ) ?
262
268
. 1 ;
263
269
let dst_manifest_idx = dst_manifest_idx_and_name
264
270
. iter ( )
265
271
. find ( |( _, n) | n == name)
266
- . context ( "name not found in dst" ) ?
272
+ . with_context ( || {
273
+ anyhow ! (
274
+ "the destination {} is missing a template with name {}. The source {} created one at block {:?}" ,
275
+ dst. namespace,
276
+ name, self . namespace, block_range. 0
277
+ )
278
+ } ) ?
267
279
. 0 ;
268
280
269
281
let query = format ! (
You can’t perform that action at this time.
0 commit comments