Skip to content

Commit e21f67d

Browse files
committed
store: Take ownership of self in CopyConnection.copy_data
This ensures that `copy_data` can't be called more than once on any instance; when copying encounters an error, it might leave the CopyConnection in an inconsistent state and should therefore not be reused
1 parent 3c4a1a9 commit e21f67d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

store/postgres/src/copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ impl Connection {
11421142
/// lower(v1.block_range) => v2.vid > v1.vid` and we can therefore stop
11431143
/// the copying of each table as soon as we hit `max_vid = max { v.vid |
11441144
/// lower(v.block_range) <= target_block.number }`.
1145-
pub async fn copy_data(&mut self, index_list: IndexList) -> Result<Status, StoreError> {
1145+
pub async fn copy_data(mut self, index_list: IndexList) -> Result<Status, StoreError> {
11461146
// We require sole access to the destination site, and that we get a
11471147
// consistent view of what has been copied so far. In general, that
11481148
// is always true. It can happen though that this function runs when

store/postgres/src/deployment_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ impl DeploymentStore {
15191519
// as adding new tables in `self`; we only need to check that tables
15201520
// that actually need to be copied from the source are compatible
15211521
// with the corresponding tables in `self`
1522-
let mut copy_conn = crate::copy::Connection::new(
1522+
let copy_conn = crate::copy::Connection::new(
15231523
logger,
15241524
self.pool.clone(),
15251525
src.clone(),

0 commit comments

Comments
 (0)