Repository navigation
Controller: finish a resource-definition delete after a successful resource retry - #577
Open
webdock-cloudv2 wants to merge 2 commits into
Open
webdock-cloudv2 wants to merge 2 commits into
webdock-cloudv2 wants to merge 2 commits into
Conversation
…source retry A resource-definition delete whose first answer from a satellite is an error (e.g. "dataset is busy" from zfs destroy) left the resource definition flagged DELETE with no resources, until a satellite reconnected or the delete was issued again: - deleteResourceDefinitionInTransaction returns truncate(...).concatWith( deleteData).onErrorResume(DelayedApiRcException -> empty): the satellite error ends the truncate, so deleteData is skipped and the error swallowed. - CtrlSatelliteUpdateCaller puts the failed resource into RetryResourcesTask with the per-resource next step only. The retry removes the resource, and nothing removes the resource definition; only resourceDefinitionConnected restarts the delete, on a satellite reconnect. CtrlRscDfnDeleteApiCallHandler.finishDeleteIfFlagged(rscName) runs the same delete as the reconnect hook and a re-issued delete, under the resource definition map's write lock, if the resource definition still exists and is flagged DELETE. RetryResourcesTask calls it after the satellite's answer to a retry and the stored next step, if that answer had no error entries; a retry that fails again leaves the resource definition alone. The handler is resolved lazily through the injector, because it depends on this task. Refs: LINBIT#574 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MdF8CnRMuczotcRYmButcR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MdF8CnRMuczotcRYmButcR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #574
Problem
A
resource-definition deletewhose first answer from a satellite is an error leaves the resource definition flaggedDELETEwith no resources. It stays that way until a satellite reconnects or someone issues the delete again. In our case the error was a busyzfs destroy(#545): the satellite destroyed the zvol on its next run, and the controller's retry removed the resource, but not the resource definition.Cause
CtrlRscDfnDeleteApiCallHandler.deleteResourceDefinitionInTransactionreturnstruncate(...).concatWith(deleteData).onErrorResume(DelayedApiRcException -> empty). The satellite error ends the truncate, sodeleteDatais skipped and the error is swallowed.CtrlSatelliteUpdateCaller.updateResourceputs the failed resource intoRetryResourcesTaskwith the per-resource next step only.resourceDefinitionConnectedrestarts the delete only on a satellite reconnect.Change
CtrlRscDfnDeleteApiCallHandler.finishDeleteIfFlagged(rscName): under the resource-definition map's write lock, if the resource definition exists and is flaggedDELETE, rundeleteResourceDefinitionInTransaction. That is the same path as the reconnect hook and a re-issued delete.RetryResourcesTaskcalls it after the satellite's answer to a retry and the stored next step, if that answer had no error entries. A retry that fails again leaves the resource definition alone.Injector, not as a constructor dependency. The handler depends on this task (through truncate and the satellite update caller), and even aProviderwould make Guice require the handler's whole graph wherever the task is bound, for example in reduced test modules.Notes for review
.concatWith(nextStep)is not gated. The controller can then remove a resource whose backing device still exists on the satellite. This change gates only its own step. Gating the next step would touch more callers (toggle-disk, activation and so on), so we kept it separate.DELETEmeans its delete was requested. So finishing it from a retry of any of its resources (also after a per-node delete or a toggle-disk retry) is the intended outcome.Tests
On this branch, based on master e1d9994:
assemble :controller:test :testplus checkstyle (main and test, controller and root): BUILD SUCCESSFUL.RetryResourcesTaskFinishDeleteTest(3), with a mocked peer and handler and the satellite answer serialized as protobufApiCallResponse:FAIL_UNKNOWN_ERROR) does not touch the resource definition;CtrlRscDfnDeleteApiCallHandlerTest+3: a flagged empty resource definition is deleted, an unflagged one is kept, and a missing one is a no-op.Results on our dev cluster
These are from the same change on a 1.35.3 base, as posted on #574: 21 resource definitions (a source and 20
--use-zfs-cloneclones) on two ZFS-thin nodes, deleted one by one.DELETEwith no resourcesThe sample of busy-first deletes with the change is small (2).
Prepared with AI assistance at Webdock; reviewed and tested by Arni from Webdock
🤖 Generated with Claude Code
https://claude.ai/code/session_01MdF8CnRMuczotcRYmButcR