Skip to content

Fix TransferLifeCycle SciTag boundary and FQAN fallback mapping#8039

Merged
DmitryLitvintsev merged 4 commits intodCache:masterfrom
ShawnMcKee:fix/firefly-sci-tag-boundary-fqan-fallback
Mar 13, 2026
Merged

Fix TransferLifeCycle SciTag boundary and FQAN fallback mapping#8039
DmitryLitvintsev merged 4 commits intodCache:masterfrom
ShawnMcKee:fix/firefly-sci-tag-boundary-fqan-fallback

Conversation

@ShawnMcKee
Copy link
Contributor

@ShawnMcKee ShawnMcKee commented Mar 10, 2026

Summary

This PR fixes three firefly marker eligibility issues in TransferLifeCycle.

  1. Primary SciTag boundary bug:
  • Before: valid transfer tag value 64 was rejected by <= 64 check.
  • After: range validation is 64..65535 inclusive.
  1. Fallback FQAN normalization bug:
  • Before: fallback lookup used raw vo.getGroup() values (for example /atlas/usatlas) against plain VO keys (atlas).
  • After: fallback normalizes group path by stripping a leading slash and taking the first path component.
  1. Excludes semantics bug:
  • Before: excludes were applied when only the source endpoint matched an excluded subnet.
  • After: excludes are applied only when both source and destination endpoints match excluded subnets.

Code Changes

  • modules/dcache/src/main/java/org/dcache/pool/movers/TransferLifeCycle.java
    • Fix SciTag range validation.
    • Normalize FQAN group for fallback VO mapping.
    • Require both endpoints to match pool.firefly.excludes before suppressing a marker.
  • modules/dcache/src/test/java/org/dcache/pool/movers/TransferLifeCycleTest.java
    • Add regression tests for SciTag boundary and FQAN fallback behavior.
    • Add regression tests for excludes behavior (both excluded vs source-only/destination-only).

Tests

Executed:

  • mvn -pl modules/dcache -am -Dtest=org.dcache.pool.movers.TransferLifeCycleTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false test

Result:

  • Tests run: 6
  • Failures: 0
  • Errors: 0
  • Skipped: 0

UMFS19 Runtime Verification

Verified on deployed 11.2.1 RPM runtime after replacing dcache-core jar and restarting pool domains:

Applied full excludes configuration:

  • pool.firefly.excludes=10.10.0.0/16,192.41.230.0/23,192.41.236.0/23,2001:48a8:68f7:1::/50,2001:48a8:68f7:8001::/50

Installed-runtime matrix check:

  • neither excluded => marker sent
  • destination-only excluded => marker sent
  • source-only excluded => marker sent
  • both excluded => marker suppressed

Live capture verification (udp dst port 10514, 3 minutes):

  • udp_packets_total=3
  • non_excluded_network_payloads=3
  • both_endpoints_excluded_payloads=0
  • sample non-excluded src=2001:4118:1a:2c10:7ec2:55ff:fe6b:9705

This confirms markers are still emitted for transfers involving non-excluded networks while suppressing excluded-to-excluded transfers.

Operational Impact

  • No mandatory end-user configuration changes are required after deploying this fix.
  • Sites can keep standard pool.firefly.vo-mapping entries (temporary slash-prefixed workaround entries can be removed after upgrade).

return trimmed;
}

// If both headers are present, SciTag takes precedence.
Copy link
Member

@DmitryLitvintsev DmitryLitvintsev Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this comment here on this line will be confusing (as we never get here if scitag is present). Suggest:

comment just afert line

String scitag = request.getHeader(HEADER_SCITAG)

somethig like

// if defined SciTag is always returned (or takes precedence) 

I possible impovement (to avoi repetition) would be:

 private static final String[] SCITAG_HEADERS = { “SciTag”, “TransferHeaderSciTag};
... 

 private String readTransferTag(HttpServletRequest request) {
    for (String header: SCITAG_HEADERS) { 
            String tag = request.getHeader(header); 
            if (tag != null && !tag.isBlank()) {
                String trimmed = tag.trim();
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug(“{} header found: {} (from client={})",
                          header, trimmed, request.getRemoteAddr());
                }
                return trimmed;
            }
  }

@kofemann
Copy link
Member

Hi @ShawnMcKee. Thanks for the contribution. Please sigh your commits with the Signed-off-by tag as described in the CONTRIBUTING.md

Signed-off-by: Shawn McKee <smckee@umich.edu>
Signed-off-by: Shawn McKee <smckee@umich.edu>
Signed-off-by: Shawn McKee <smckee@umich.edu>
@ShawnMcKee ShawnMcKee force-pushed the fix/firefly-sci-tag-boundary-fqan-fallback branch 2 times, most recently from 7e70343 to df11a53 Compare March 12, 2026 16:20
Copy link
Contributor Author

@ShawnMcKee ShawnMcKee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed review. I have addressed the requested updates:

  • Refactored SciTag parsing to reduce repetition and made precedence explicit (SciTag is checked first).
  • Replaced transfer-tag magic numbers with named constants.
  • Updated fallback VO extraction to use Splitter-based parsing.
  • Added Signed-off-by to all commits to satisfy contributor requirements (history was rewritten and force-pushed).

The sync check is now passing.
Please take another look when you have a moment.


return voToExpId.containsKey(vo.getGroup().toLowerCase())
? OptionalInt.of(voToExpId.get(vo.getGroup().toLowerCase()))
String groupPath = vo.getGroup().toLowerCase();
Copy link
Member

@DmitryLitvintsev DmitryLitvintsev Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be something along these lines:

  String groupPath = vo.getGroup();
  if (groupPath == null || groupPath.isBlank()) { 
     return OptionalInt.empty();
  }
  groupPath = groupPath.toLowerCase();
  String voName =  FQAN_GROUP_SPLITTER.splitToList(groupPath).get(0);

to avoid too much fussing with checking arrays. It is my understanding that

FQAN_GROUP_SPLITTER.splitToList(groupPath).get(0)

will never fail as long as there is non-empty string as input.

also, just curious, what is the significance of lowering the case? These strings are not supposed to be ever capitalized? (IOW there is RFC for that?)

Copy link
Contributor Author

@ShawnMcKee ShawnMcKee Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Dmitry, We lower-cased the strings to fix some issues we had early on with some implementations using capital letters. We don't really have use for mixed-case values. I am happy to change as you noted. It is a bit more logical in how it is processed. Thanks,
Shawn

Signed-off-by: Shawn McKee <smckee@umich.edu>
@ShawnMcKee ShawnMcKee force-pushed the fix/firefly-sci-tag-boundary-fqan-fallback branch from df11a53 to 1a16d61 Compare March 12, 2026 18:30
Copy link
Member

@DmitryLitvintsev DmitryLitvintsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@ShawnMcKee
Copy link
Contributor Author

OK, our target for this functionality would be 11.2.2 if possible. Also I am working on another PR, also targeting 11.2.2. The problem is that fireflies, when enabled, are intended to be sent to the same destination as the flow they are identifying. This allows any network along the path to discover the data flow owner and purpose. For ease of accounting we also want to support sending an optional firefly to a regional or global collector. This is not yet implemented in 11.2 but I will make a PR to do so.

@kofemann
Copy link
Member

Looks good to me. Shall I merge?

@DmitryLitvintsev DmitryLitvintsev merged commit e5e7b9f into dCache:master Mar 13, 2026
1 check passed
DmitryLitvintsev added a commit that referenced this pull request Mar 14, 2026
…-fqan-fallback

Fix TransferLifeCycle SciTag boundary and FQAN fallback mapping
kofemann added a commit that referenced this pull request Mar 16, 2026
Merge pull request #8039 from ShawnMcKee/fix/firefly-sci-tag-boundary…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants