Peter Toth created SPARK-59734:
----------------------------------

             Summary: Remove the unreachable resource retain handling from 
`ApplicationStatus.terminateOrRestart`
                 Key: SPARK-59734
                 URL: https://issues.apache.org/jira/browse/SPARK-59734
             Project: Spark
          Issue Type: Sub-task
          Components: Kubernetes
    Affects Versions: kubernetes-operator-1.1.0
            Reporter: Peter Toth


After SPARK-59732, `AppCleanUpStep` is the only production caller of 
`ApplicationStatus.terminateOrRestart` and it always passes 
`ResourceRetainPolicy.Never`. That makes the retain handling inside the method 
unreachable:

* the guard in the "no restart configured" branch,
* the guard in the "restart limit exceeded" branch,
* the private `terminateAppWithoutReleaseResource` helper they both call.

Every `TerminatedWithoutReleaseResources` state a running operator writes comes 
from `AppCleanUpStep` itself, which keeps the retain decision in one place. 
Deleting both guards and the helper leaves the whole `spark-operator` test 
suite green; only the two `ApplicationStatusTest` cases that call the method 
directly with `ResourceRetainPolicy.Always` fail, so the branch's only 
remaining coverage asserts a state no production path can reach.

Proposed:

* delete the two guards and `terminateAppWithoutReleaseResource`,
* drop the now unused `resourceRetainPolicy` parameter of `terminateOrRestart`, 
which is the part that changes a public signature in `spark-operator-api`,
* adjust the two `ApplicationStatusTest` assertions.

Note that `terminateAppWithoutReleaseResource` also concatenates its message 
without a separating space, the same defect SPARK-59732 fixed in the live 
branch. Deleting it resolves that too, so it should not be patched separately.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to