Skip to content

MLE-23146 Trying another approach with clearDB #1811

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
merged 1 commit into from
Jul 25, 2025
Merged

Conversation

rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Jul 25, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 12:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the database clearing mechanism in functional tests to handle intermittent failures more gracefully. Instead of using a blanket wait period, it now catches specific exceptions and logs them with detailed context.

  • Replaces fixed 2-second wait with exception handling for database clearing failures
  • Adds detailed logging for forest availability errors that occur during Jenkins test runs
  • Imports FailedRequestException to handle specific database operation failures
Comments suppressed due to low confidence (1)

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java:322

  • [nitpick] The error message is extremely verbose and contains implementation-specific details that may not be helpful to users. Consider simplifying to focus on the key issue and potential impact rather than including specific file paths and internal error codes.
			LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " +

Comment on lines +322 to +329
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " +
"happens while running tests on Jenkins, typically with a server error message such as: " +
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " +
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " +
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " +
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " +
"This error is caught and logged in the hopes that proceeding tests will succeed even though " +
"this clearDB call failed.", ex);
Copy link
Preview

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

Consider catching a more specific exception type or adding additional catch blocks for different failure scenarios. FailedRequestException is quite broad and may catch unrelated database errors that should be handled differently than forest availability issues.

Suggested change
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " +
"happens while running tests on Jenkins, typically with a server error message such as: " +
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " +
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " +
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " +
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " +
"This error is caught and logged in the hopes that proceeding tests will succeed even though " +
"this clearDB call failed.", ex);
String errorMessage = ex.getMessage();
if (errorMessage != null && (errorMessage.contains("XDMP-FORESTNOT") || errorMessage.contains("XDMP-FORESTERR"))) {
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database due to forest-related error. " +
"This intermittently happens while running tests on Jenkins, typically with a server error message such as: " +
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " +
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " +
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " +
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " +
"This error is caught and logged in the hopes that proceeding tests will succeed even though " +
"this clearDB call failed.", ex);
} else {
LoggerFactory.getLogger(ConnectedRESTQA.class).error("Failed to clear database due to an unexpected error.", ex);
throw ex; // Rethrow the exception to ensure proper handling.
}

Copilot uses AI. Check for mistakes.

Also making one particular test that intermittently fails a little less worse.
@rjrudin rjrudin force-pushed the feature/test-fix branch from 9b9ec90 to e33267a Compare July 25, 2025 12:36
@rjrudin rjrudin merged commit 71d50ff into develop Jul 25, 2025
2 checks passed
@rjrudin rjrudin deleted the feature/test-fix branch July 25, 2025 12:53
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.

1 participant