fix(opensearch): make ML model registration idempotent
Reuse any existing model version (including DEPLOY_FAILED) instead of registering a new copy. Prevents accumulation of stale model chunks in .plugins-ml-model when OpenSearch restarts between applies.
This commit is contained in:
@@ -617,10 +617,14 @@ async fn ensure_opensearch_ml() {
|
|||||||
already_deployed = true;
|
already_deployed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
"REGISTERED" | "DEPLOYING" => {
|
// Any existing model (even DEPLOY_FAILED) — reuse it instead of
|
||||||
model_id = Some(id.to_string());
|
// registering a new version. This prevents accumulating stale
|
||||||
|
// copies in .plugins-ml-model when the pod restarts.
|
||||||
|
_ => {
|
||||||
|
if model_id.is_none() && !id.is_empty() {
|
||||||
|
model_id = Some(id.to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user