Apache Solr open-source search software
Debug logging for TestIncrementalCoreBackup Windows failures
Jason Gerlowskied2eebfa4d7f
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.javaindex 8928fbedcaf..9de6b6e2c8e 100644--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java@@ -90,7 +90,11 @@ public class BackupCmd implements OverseerCollectionMessageHandler.Cmd {try (BackupRepository repository = cc.newBackupRepository(repo)) {// Backup location+ if (log.isDebugEnabled()) {+ log.debug("Backup location received by overseer is: {}", message.getStr(CoreAdminParams.BACKUP_LOCATION));+ }URI location = repository.createURI(message.getStr(CoreAdminParams.BACKUP_LOCATION));+ log.debug("Resolved backup URI in overseer is: {}", location);final URI backupPath = createAndValidateBackupPath(repository, incremental, location, backupName, collectionName);BackupManager backupMgr = (incremental) ?@@ -146,6 +150,7 @@ public class BackupCmd implements OverseerCollectionMessageHandler.Cmd {private URI createAndValidateBackupPath(BackupRepository repository, boolean incremental, URI location, String backupName, String collection) throws IOException{final URI backupNamePath = repository.resolve(location, backupName);+ log.debug("Location {} and backup-name {} combine to make path {}", location, backupName, backupNamePath);if ( (!incremental) && repository.exists(backupNamePath)) {throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "The backup directory already exists: " + backupNamePath);diff --git a/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java b/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.javaindex f16db6d693f..3d82cbbb2fe 100644--- a/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java+++ b/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java@@ -19,6 +19,7 @@ package org.apache.solr.core.backup.repository;import java.io.IOException;import java.io.OutputStream;+import java.lang.invoke.MethodHandles;import java.net.URI;import java.net.URISyntaxException;import java.nio.file.FileVisitResult;@@ -42,6 +43,8 @@ import org.apache.solr.common.util.NamedList;import org.apache.solr.core.DirectoryFactory;import com.google.common.base.Preconditions;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;/*** A concrete implementation of {@linkplain BackupRepository} interface supporting backup/restore of Solr indexes to a@@ -49,6 +52,8 @@ import com.google.common.base.Preconditions;* interface e.g. NFS).*/public class LocalFileSystemRepository implements BackupRepository {+ private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());+@SuppressWarnings("rawtypes")private NamedList config = null;@@ -66,23 +71,26 @@ public class LocalFileSystemRepository implements BackupRepository {@Overridepublic URI createURI(String location) {Objects.requireNonNull(location);+ log.debug("Creating URI from location: {}", location);URI result = null;try {result = new URI(location);if (!result.isAbsolute()) {- result = Paths.get(location).toUri();+ result = Paths.get(result).toUri();}} catch (URISyntaxException ex) {result = Paths.get(location).toUri();}+ log.debug("Created URI is: {}", result);return result;}@Overridepublic URI resolve(URI baseUri, String... pathComponents) {Preconditions.checkArgument(pathComponents.length > 0);+ log.debug("Resolving URI from base: {}", baseUri);Path result = Paths.get(baseUri);for (int i = 0; i < pathComponents.length; i++) {@@ -95,6 +103,9 @@ public class LocalFileSystemRepository implements BackupRepository {}+ if (log.isDebugEnabled()) {+ log.debug("Resolved URI is: {}", result.toUri());+ }return result.toUri();}@@ -125,6 +136,7 @@ public class LocalFileSystemRepository implements BackupRepository {@Overridepublic boolean exists(URI path) throws IOException {+ log.debug("Checking whether URI exists: {}", path);return Files.exists(Paths.get(path));}diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.javaindex 32061c04bc3..60f56d11be6 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java@@ -1028,11 +1028,12 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission+ " parameter or as a default repository property or as a cluster property.");}}-+ log.debug("Provided backup location is: {}", location);boolean incremental = req.getParams().getBool(CoreAdminParams.BACKUP_INCREMENTAL, true);// Check if the specified location is valid for this repository.final URI uri = repository.createURI(location);+ log.debug("Provided backup location uri is: {}", uri);try {if (!repository.exists(uri)) {throw new SolrException(ErrorCode.SERVER_ERROR, "specified location " + uri + " does not exist.");diff --git a/solr/core/src/test/org/apache/solr/handler/TestIncrementalCoreBackup.java b/solr/core/src/test/org/apache/solr/handler/TestIncrementalCoreBackup.javaindex 531b1beb7b0..d8301da3846 100644--- a/solr/core/src/test/org/apache/solr/handler/TestIncrementalCoreBackup.java+++ b/solr/core/src/test/org/apache/solr/handler/TestIncrementalCoreBackup.java@@ -27,6 +27,7 @@ import org.apache.solr.core.backup.ShardBackupMetadata;import org.apache.solr.core.backup.repository.BackupRepository;import org.apache.solr.handler.admin.CoreAdminHandler;import org.apache.solr.response.SolrQueryResponse;+import org.apache.solr.util.LogLevel;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -37,6 +38,7 @@ import java.net.URI;import java.nio.file.Paths;import java.util.Arrays;+@LogLevel("org.apache.solr.cloud.api.collections.BackupCmd=DEBUG;org.apache.solr.handler.admin.BackupCoreOp=DEBUG;org.apache.solr.core.backup.repository.LocalFileSystemRepository=DEBUG")public class TestIncrementalCoreBackup extends SolrTestCaseJ4 {@Before // unique core per testpublic void coreInit() throws Exception {