Skip to content

Commit

Permalink
storcon: make attach_hook safer for tests that call concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsp committed Jun 25, 2024
1 parent c605697 commit 810bed0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions storage_controller/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,13 @@ impl Service {
&self,
attach_req: AttachHookRequest,
) -> anyhow::Result<AttachHookResponse> {
let _tenant_lock = trace_exclusive_lock(
&self.tenant_op_locks,
attach_req.tenant_shard_id.tenant_id,
TenantOperations::ShardSplit,
)
.await;

// This is a test hook. To enable using it on tenants that were created directly with
// the pageserver API (not via this service), we will auto-create any missing tenant
// shards with default state.
Expand Down

0 comments on commit 810bed0

Please sign in to comment.