Skip to content

Commit

Permalink
store: Perform private data source copy in its own transaction
Browse files Browse the repository at this point in the history
Fixes #5465
  • Loading branch information
lutter committed Jun 4, 2024
1 parent e876389 commit 33be1a7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions store/postgres/src/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,15 +748,21 @@ impl Connection {
self.conn.transaction(|conn| f(conn))
}

/// Copy private data sources if the source uses a schema version that
/// has a private data sources table. The copying is done in its own
/// transaction.
fn copy_private_data_sources(&mut self, state: &CopyState) -> Result<(), StoreError> {
if state.src.site.schema_version.private_data_sources() {
DataSourcesTable::new(state.src.site.namespace.clone()).copy_to(
&mut self.conn,
&DataSourcesTable::new(state.dst.site.namespace.clone()),
state.target_block.number,
&self.src_manifest_idx_and_name,
&self.dst_manifest_idx_and_name,
)?;
let conn = &mut self.conn;
conn.transaction(|conn| {
DataSourcesTable::new(state.src.site.namespace.clone()).copy_to(
conn,
&DataSourcesTable::new(state.dst.site.namespace.clone()),
state.target_block.number,
&self.src_manifest_idx_and_name,
&self.dst_manifest_idx_and_name,
)
})?;
}
Ok(())
}
Expand Down

0 comments on commit 33be1a7

Please sign in to comment.