Skip to content

MLE-31224: Support isolated HTTP and XDBC requests#610

Merged
vzhang-progress merged 1 commit into
develop-11.3from
MLE-31224-backport-isolation-fix
Jul 16, 2026
Merged

MLE-31224: Support isolated HTTP and XDBC requests#610
vzhang-progress merged 1 commit into
develop-11.3from
MLE-31224-backport-isolation-fix

Conversation

@vzhang-progress

Copy link
Copy Markdown
Contributor

Backport isolation support from develop to develop-11.3.

Tests:

  • MLCP unit tests
  • 06mlcp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Backports “isolation support” logic to determine whether requests are forwarded (for both HTTP and XDBC paths) so MLCP can correctly enable host restriction behavior when running behind forwarding/isolation layers.

Changes:

  • Updated split-query construction to evaluate both HTTP and XDBC forwarded-header checks.
  • Added xdmp:is-forwarded()-based logic (with backward-compatible fallbacks) for forwarded detection in XQuery snippets.
  • Ignored .vscode workspace settings via .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/java/com/marklogic/mapreduce/MarkLogicInputFormat.java Adds both HTTP and XDBC forwarded checks to the split query and consumes the extra result item.
src/main/java/com/marklogic/mapreduce/ContentOutputFormat.java Updates forwarded-detection XQuery strings to prefer xdmp:is-forwarded() with backward-compatible fallbacks.
.gitignore Adds .vscode to ignored paths.
Comments suppressed due to low confidence (1)

src/main/java/com/marklogic/mapreduce/MarkLogicInputFormat.java:417

  • The parsing of the split query results assumes the extra forwarded-header booleans are always present; with the additional XDBC header query this now does two unguarded result.next() calls. If the server returns an unexpected sequence (e.g., query error/empty item), this will throw NoSuchElementException and surface as an opaque failure. Consider adding hasNext() checks and throwing an IOException with a clear message (similar to ContentOutputFormat.initialize).
                if (!advancedMode && result.hasNext()) {
                    ResultItem item = result.next();
                    if (getForwardHeader) {
                        forwardHeaderExists = item.asString().equals("true");
                        item = result.next();
                        forwardHeaderExists |= item.asString().equals("true");
                        item = result.next();
                        if (forwardHeaderExists) {
                            restrictHosts = true;
                            jobConf.setBoolean(INPUT_RESTRICT_HOSTS, true);
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("HTTP compliant mode enabled since x-forwarded-for exists");
                            }
                        } // delay disable http mode since the output host may need it
                    }
                    localHost = item.asString();
                }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vzhang-progress
vzhang-progress merged commit 77227b3 into develop-11.3 Jul 16, 2026
4 checks passed
@vzhang-progress
vzhang-progress deleted the MLE-31224-backport-isolation-fix branch July 16, 2026 20:51
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