Skip to content
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

[XrdCmsRedirLocal] Add localroot option for plug-in. Improve fault tolerance of RedirLocal plug-in #1523

Merged
merged 4 commits into from
Dec 1, 2021
Merged

Conversation

panik4
Copy link
Contributor

@panik4 panik4 commented Oct 4, 2021

Until now, the plug-in used oss.localroot set in the redirector, to calculate the new paths. This led to conflicts described in issue #1278 . Adding a config option with a localroot onl for the plug-in, this issue is resolved.

The second commit increases the fault tolerance: Before this commit, if a client is redirected to the local filesystem, but does not find the file there, a redirection loop is started.
Example:
Open has returned with status [FATAL] Redirect limit has been reached Error while opening at 192.168.122.200:1094: [FATAL] Redirect limit has been reached Redirect trace-back: 0. Redirected from: root://192.168.122.200:1094//autoTest1 to: file://localhost/xrdmnt//autoTest1 1. Retrying: root://192.168.122.200:1094//autoTest1 2. Redirected from: root://192.168.122.200:1094//autoTest1 to: file://localhost/xrdmnt//xrdmnt/autoTest1 3. Retrying: root://192.168.122.200:1094//autoTest1 4. Redirected from: root://192.168.122.200:1094//autoTest1 to: file://localhost/xrdmnt//xrdmnt/xrdmnt/autoTest1 ...
With the new changes, the plug-in checks if localroot is in the path AND if the EnvInfo shows that the client has already tried localhost. The result is this:
Redirect trace-back: 0. Redirected from: root://192.168.122.200:1094//autoTest1 to: file://localhost/xrdmnt//autoTest1 1. Retrying: root://192.168.122.200:1094//autoTest1 2. Waited at server request. Resending: root://192.168.122.200:1094//autoTest1 3. Waited at server request. Resending: root://192.168.122.200:1094//autoTest1 4. Redirected from: root://192.168.122.200:1094//autoTest1 to: root://192.168.122.202:1094//autoTest1

The client tries a second time and gets redirected to the dataserver it would normally have contacted

panik4 and others added 3 commits September 29, 2021 15:54
…n oss.localroot config in redirector, which caused problems if path of oss.localroot was not available to the redirector and therefore required a dummy path
… available after redirect to local, instead using regular dataserver
// search for localroot,
// which manually sets localroot to prepend
else if (strcmp(word, "xrdcmsredirlocal.localroot") == 0){
localroot = std::string(Config.GetWord(true));//to lower case
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure you want to restrict localroot to be nothing but lower case? Also, there should be a check that it starts with a slash since root paths should be absolute to avoid unpleasant surprises.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, fixed. The error checks are in as well

// the redirection loop
int param = 0; // need it to get Env
std::string envInfo(EnvInfo->Env(param)); // get already tried hosts
std::string searchPattern = "&tried=localhost"; //search for this pattern
Copy link
Member

Choose a reason for hiding this comment

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

Note that if "tried=" is the first token after the question mark it will not (typically) have a leading '&'. This doesn't take care of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, corrected. But we're now searching for "tried=localhost" in the full envInfo. Otherwise, it might be missed, if other params are passed first.

src/XrdCms/XrdCmsRedirLocal.cc Show resolved Hide resolved
…nfig option xrdcmsredirlocal.localroot overwrites older. Look for tried=localhost in full EnvInfo to prevent missing it due to other params. Allow upper- and lower case for localroot. Error checking when localroot doesn't start with /. Refactor reading of config options for plug-in.
@panik4 panik4 requested a review from abh3 November 3, 2021 13:10
@abh3
Copy link
Member

abh3 commented Nov 3, 2021 via email

@abh3 abh3 merged commit 514929d into xrootd:master Dec 1, 2021
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.

None yet

2 participants