Skip to content

Commit 6a96161

Browse files
fix(pool): don't delete pool on abort
When creating pool, it may timeout. In this case we leave it as is, and allow the caller to retry. But on the first retry, if the pool has not completed the create, then we see the abort error code instead, and in this case we should also leave as is, and allow caller to retry again. Also update the existing test to do the retry. Signed-off-by: Tiago Castro <[email protected]>
1 parent e997890 commit 6a96161

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

control-plane/agents/src/bin/core/controller/resources/operations_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl OnCreateFail {
8989
// 3. dataplane core is shared with other processes
9090
// TODO: use higher timeout on larger pool sizes or potentially make this
9191
// an async operation.
92-
tonic::Code::Cancelled => Self::LeaveAsIs,
92+
tonic::Code::Cancelled | tonic::Code::Aborted => Self::LeaveAsIs,
9393
_ => Self::SetDeleting,
9494
}
9595
}

control-plane/agents/src/bin/core/tests/pool/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,16 @@ async fn slow_create() {
10871087
}
10881088
}
10891089

1090+
let result = client.pool().create(&create, None).await;
1091+
match result {
1092+
Err(error) => assert_eq!(error.kind, ReplyErrorKind::Aborted),
1093+
Ok(_) => {
1094+
let info = lvol.dm_info().unwrap();
1095+
tracing::error!("Log DMSetup info:\n{info}");
1096+
panic!("Should have failed!");
1097+
}
1098+
}
1099+
10901100
lvol.resume().unwrap();
10911101

10921102
let start = std::time::Instant::now();
@@ -1114,6 +1124,17 @@ async fn slow_create() {
11141124
}
11151125
break;
11161126
}
1127+
1128+
let result = client.pool().create(&create, None).await;
1129+
match result {
1130+
Err(error) => assert_eq!(error.kind, ReplyErrorKind::AlreadyExists),
1131+
Ok(_) => {
1132+
let info = lvol.dm_info().unwrap();
1133+
tracing::error!("Log DMSetup info:\n{info}");
1134+
panic!("Should have failed!");
1135+
}
1136+
}
1137+
11171138
let destroy = DestroyPool::from(create.clone());
11181139
client.pool().destroy(&destroy, None).await.unwrap();
11191140

0 commit comments

Comments
 (0)