-
Notifications
You must be signed in to change notification settings - Fork 144
Fix SciTag WAN TPC marker generation and validation #8044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kofemann
merged 4 commits into
dCache:master
from
ShawnMcKee:pr/firefly-collector-master
Mar 20, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cfa8482
Fix SciTag WAN TPC marker generation and validation
ShawnMcKee 5cef4f7
xrootd: fix logSciTagsRequest called before cell address initialization
ShawnMcKee db22839
firefly: address PR 8044 review fixes
ShawnMcKee d0be764
firefly: address latest PR 8044 inline feedback
ShawnMcKee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
55 changes: 55 additions & 0 deletions
55
modules/dcache-webdav/src/test/java/org/dcache/webdav/DcacheResourceFactoryTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package org.dcache.webdav; | ||
|
|
||
| import static org.hamcrest.MatcherAssert.assertThat; | ||
| import static org.hamcrest.Matchers.is; | ||
| import static org.mockito.BDDMockito.given; | ||
| import static org.mockito.Mockito.mock; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import javax.servlet.http.HttpServletRequest; | ||
| import org.junit.Test; | ||
|
|
||
| public class DcacheResourceFactoryTest { | ||
|
|
||
| @Test | ||
| public void shouldFindSciTagHeaderIgnoringCase() { | ||
| HttpServletRequest request = mock(HttpServletRequest.class); | ||
| given(request.getHeaderNames()).willReturn(Collections.enumeration(List.of("scitag"))); | ||
| given(request.getHeader("scitag")).willReturn("313"); | ||
|
|
||
| Optional<String> header = | ||
| DcacheResourceFactory.findHeaderIgnoreCase(request, "SciTag"); | ||
|
|
||
| assertThat(header.isPresent(), is(true)); | ||
| assertThat(header.get(), is("313")); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldFindTransferHeaderSciTagIgnoringCase() { | ||
| HttpServletRequest request = mock(HttpServletRequest.class); | ||
| given(request.getHeaderNames()).willReturn( | ||
| Collections.enumeration(List.of("transferheaderscitag"))); | ||
| given(request.getHeader("transferheaderscitag")).willReturn("777"); | ||
|
|
||
| Optional<String> header = | ||
| DcacheResourceFactory.findHeaderIgnoreCase(request, "TransferHeaderSciTag"); | ||
|
|
||
| assertThat(header.isPresent(), is(true)); | ||
| assertThat(header.get(), is("777")); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldFallbackToServletHeaderLookup() { | ||
| HttpServletRequest request = mock(HttpServletRequest.class); | ||
| given(request.getHeaderNames()).willReturn(null); | ||
| given(request.getHeader("SciTag")).willReturn("313"); | ||
|
|
||
| Optional<String> header = | ||
| DcacheResourceFactory.findHeaderIgnoreCase(request, "SciTag"); | ||
|
|
||
| assertThat(header.isPresent(), is(true)); | ||
| assertThat(header.get(), is("313")); | ||
| } | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
| import org.dcache.pool.movers.Mover; | ||
| import org.dcache.pool.movers.MoverProtocol; | ||
| import org.dcache.pool.movers.MoverProtocolMover; | ||
| import org.dcache.pool.movers.TransferLifeCycle; | ||
| import org.dcache.pool.repository.ReplicaDescriptor; | ||
| import org.dcache.pool.repository.RepositoryChannel; | ||
| import org.dcache.util.CDCExecutorServiceDecorator; | ||
|
|
@@ -52,19 +53,26 @@ public abstract class AbstractMoverProtocolTransferService | |
|
|
||
| private static final Logger LOGGER = | ||
| LoggerFactory.getLogger(MoverMapTransferService.class); | ||
| private static final Logger SCITAGS_LOGGER = | ||
| LoggerFactory.getLogger("org.dcache.scitags"); | ||
| private final ExecutorService _executor = | ||
| new CDCExecutorServiceDecorator<>( | ||
| Executors.newCachedThreadPool( | ||
| new ThreadFactoryBuilder().setNameFormat( | ||
| getClass().getSimpleName() + "-transfer-service-%d").build())); | ||
| private PostTransferService _postTransferService; | ||
| private TransferLifeCycle _transferLifeCycle; | ||
|
|
||
|
|
||
| @Required | ||
| public void setPostTransferService(PostTransferService postTransferService) { | ||
| _postTransferService = postTransferService; | ||
| } | ||
|
|
||
| public void setTransferLifeCycle(TransferLifeCycle transferLifeCycle) { | ||
| _transferLifeCycle = transferLifeCycle; | ||
| } | ||
|
|
||
| @Override | ||
| public Mover<?> createMover(ReplicaDescriptor handle, PoolIoFileMessage message, | ||
| CellPath pathToDoor) | ||
|
|
@@ -155,10 +163,22 @@ public void run() { | |
| _completionHandler.completed(null, null); | ||
|
|
||
| } catch (InterruptedException e) { | ||
| SCITAGS_LOGGER.debug( | ||
| "scitags lifecycle=start abort reason=interrupted protocol={} pnfsid={} transferTag={} message={}", | ||
| protocolName(), | ||
| _mover.getFileAttributes().getPnfsId(), | ||
| transferTag(), | ||
| formatError(e)); | ||
| InterruptedException why = _explanation == null ? e : | ||
| (InterruptedException) (new InterruptedException(_explanation).initCause(e)); | ||
| _completionHandler.failed(why, null); | ||
| } catch (Throwable t) { | ||
| SCITAGS_LOGGER.debug( | ||
| "scitags lifecycle=start abort reason=execution-failed protocol={} pnfsid={} transferTag={} message={}", | ||
| protocolName(), | ||
| _mover.getFileAttributes().getPnfsId(), | ||
| transferTag(), | ||
| formatError(t)); | ||
| _completionHandler.failed(t, null); | ||
| } | ||
| } | ||
|
|
@@ -200,6 +220,21 @@ private void runMoverForWrite(RepositoryChannel fileIoChannel) throws Exception | |
| } | ||
| } | ||
|
|
||
| private String protocolName() { | ||
| return _mover.getProtocolInfo().getProtocol().toLowerCase(); | ||
| } | ||
|
|
||
| private String transferTag() { | ||
| String transferTag = _mover.getProtocolInfo().getTransferTag(); | ||
| return transferTag == null || transferTag.isEmpty() ? "-" : transferTag; | ||
| } | ||
|
|
||
| private String formatError(Throwable t) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use our utility method |
||
| return t instanceof Exception | ||
| ? Exceptions.messageOrClassName((Exception) t) | ||
| : t.getClass().getName(); | ||
| } | ||
|
|
||
| private synchronized void setThread() throws InterruptedException { | ||
| if (_needInterruption) { | ||
| throw new InterruptedException("Thread interrupted before execution"); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that we need extra logger for sitags
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this. After operational debugging and validation, I would like to keep a dedicated org.dcache.scitags logger. It was important for diagnosing and fixing the firefly marker issue. This remains debug-gated, so it stays quiet by default, and can be enabled for targeted troubleshooting when needed.