From 61ae138c73dd68ee02eab77639308c6f16b54a75 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Tue, 2 Sep 2025 17:19:32 +0200 Subject: [PATCH] qos: disable dynamic replica reduction Motivation: Due to concurrent nature of message processing in dCache data migration by `migration move` command we might observe a raise condition between PIN and UNPIN operations, which might be sent and processed in different order. Thus UNPIN, followed by PIN, with expected result in file being pinned may be processed as PIN followed by UNPIN, with file ending in unpinned state. The reduction of pinned replicas on migration event can be skipped. The redundant pin will be adjusted by scanner on the next run. Modification: Skip unpinning if it's not done by scanner. Result: no danger in running into raise condition with a cost of redundant pinned replica for some period of time. Acked-by: Dmitry Litvintsev Target: master, 11.0, 10.2, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes (cherry picked from commit ef27b1f9c7c0c46dd8365a4bf3076e2fd3917d59) Signed-off-by: Tigran Mkrtchyan --- .../verifier/handlers/FileStatusVerifier.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/dcache-qos/src/main/java/org/dcache/qos/services/verifier/handlers/FileStatusVerifier.java b/modules/dcache-qos/src/main/java/org/dcache/qos/services/verifier/handlers/FileStatusVerifier.java index 412cf919b82..8a9e31d3530 100644 --- a/modules/dcache-qos/src/main/java/org/dcache/qos/services/verifier/handlers/FileStatusVerifier.java +++ b/modules/dcache-qos/src/main/java/org/dcache/qos/services/verifier/handlers/FileStatusVerifier.java @@ -87,6 +87,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING import org.dcache.cells.CellStub; import org.dcache.qos.data.FileQoSRequirements; import org.dcache.qos.data.QoSAction; +import org.dcache.qos.data.QoSMessageType; import org.dcache.qos.services.verifier.data.PoolInfoMap; import org.dcache.qos.services.verifier.data.VerifiedLocations; import org.dcache.qos.services.verifier.data.VerifyOperation; @@ -449,6 +450,18 @@ private Optional checkForLocationAdjustment(FileQoSRequirements requi } } + // REVISIT: effectively disable adjustment if we need to reduce the number of replicas. + // + // This section is added due to race condition between PIN and UNPIN operations, which + // may lead to PIN and UNPIN requests processed out of order. Thus UNPIN, followed by PIN, with + // expected result in file being pinned may be processed as PIN followed by UNPIN, with + // file ending in unpinned state. + // + // The redundant pinned copy will be reduced by scanner at the next run. + if (missing < 0 && operation.getMessageType() != QoSMessageType.SYSTEM_SCAN) { + missing = 0; + } + operation.setNeeded(Math.abs(missing)); LOGGER.debug("{}, checkForLocationAdjustment; required {}, excluded {}, missing {}.",