|
13 | 13 | import com.marklogic.client.DatabaseClient.ConnectionType;
|
14 | 14 | import com.marklogic.client.DatabaseClientBuilder;
|
15 | 15 | import com.marklogic.client.DatabaseClientFactory;
|
| 16 | +import com.marklogic.client.FailedRequestException; |
16 | 17 | import com.marklogic.client.admin.ServerConfigurationManager;
|
17 | 18 | import com.marklogic.client.impl.SSLUtil;
|
18 | 19 | import com.marklogic.client.io.DocumentMetadataHandle;
|
@@ -317,10 +318,15 @@ public static void clearDB(int port) {
|
317 | 318 | try (DatabaseClient client = newDatabaseClientBuilder().withPort(port).build()) {
|
318 | 319 | QueryManager mgr = client.newQueryManager();
|
319 | 320 | mgr.delete(mgr.newDeleteDefinition());
|
320 |
| - // Clearing the database occasionally causes a forest to not be available for a moment or two when the tests |
321 |
| - // are running on Jenkins. This leads to intermittent failures. Waiting is not guaranteed to avoid the |
322 |
| - // error but simply hopes to minimize the chance of an intermittent failure. |
323 |
| - waitFor(2000); |
| 321 | + } catch (FailedRequestException ex) { |
| 322 | + LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " + |
| 323 | + "happens while running tests on Jenkins, typically with a server error message such as: " + |
| 324 | + "XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " + |
| 325 | + "Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " + |
| 326 | + "rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " + |
| 327 | + "/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " + |
| 328 | + "This error is caught and logged in the hopes that proceeding tests will succeed even though " + |
| 329 | + "this clearDB call failed.", ex); |
324 | 330 | }
|
325 | 331 | }
|
326 | 332 |
|
|
0 commit comments