src/api2/pull.rs: aquire try_shared_chunk_store_lock inside pull_store
This commit is contained in:
parent
a3016d6583
commit
183125d576
@ -315,6 +315,9 @@ pub async fn pull_store(
|
|||||||
username: String,
|
username: String,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
|
// explicit create shared lock to prevent GC on newly created chunks
|
||||||
|
let _shared_store_lock = tgt_store.try_shared_chunk_store_lock()?;
|
||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/groups", src_repo.store());
|
let path = format!("api2/json/admin/datastore/{}/groups", src_repo.store());
|
||||||
|
|
||||||
let mut result = client.get(&path, None).await?;
|
let mut result = client.get(&path, None).await?;
|
||||||
@ -431,7 +434,6 @@ async fn pull (
|
|||||||
user_info.check_privs(&username, &["datastore", &store], PRIV_DATASTORE_PRUNE, false)?;
|
user_info.check_privs(&username, &["datastore", &store], PRIV_DATASTORE_PRUNE, false)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let tgt_store = DataStore::lookup_datastore(&store)?;
|
let tgt_store = DataStore::lookup_datastore(&store)?;
|
||||||
|
|
||||||
let (remote_config, _digest) = remote::config()?;
|
let (remote_config, _digest) = remote::config()?;
|
||||||
@ -453,9 +455,6 @@ async fn pull (
|
|||||||
|
|
||||||
worker.log(format!("sync datastore '{}' start", store));
|
worker.log(format!("sync datastore '{}' start", store));
|
||||||
|
|
||||||
// explicit create shared lock to prevent GC on newly created chunks
|
|
||||||
let _shared_store_lock = tgt_store.try_shared_chunk_store_lock()?;
|
|
||||||
|
|
||||||
pull_store(&worker, &client, &src_repo, tgt_store.clone(), delete, username).await?;
|
pull_store(&worker, &client, &src_repo, tgt_store.clone(), delete, username).await?;
|
||||||
|
|
||||||
worker.log(format!("sync datastore '{}' end", store));
|
worker.log(format!("sync datastore '{}' end", store));
|
||||||
|
Loading…
Reference in New Issue
Block a user