You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ge...@apache.org on 2021/02/08 19:53:07 UTC

[lucene-solr] branch master updated: Debug logging for TestIncrementalCoreBackup Windows failures

This is an automated email from the ASF dual-hosted git repository.

gerlowskija pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new ed2eebf  Debug logging for TestIncrementalCoreBackup Windows failures
ed2eebf is described below

commit ed2eebfa4d7f5642c4ffea0d06efdc6c7ebcaba8
Author: Jason Gerlowski <ja...@lucidworks.com>
AuthorDate: Mon Feb 8 14:07:42 2021 -0500

    Debug logging for TestIncrementalCoreBackup Windows failures
---
 .../org/apache/solr/cloud/api/collections/BackupCmd.java   |  5 +++++
 .../core/backup/repository/LocalFileSystemRepository.java  | 14 +++++++++++++-
 .../org/apache/solr/handler/admin/CollectionsHandler.java  |  3 ++-
 .../org/apache/solr/handler/TestIncrementalCoreBackup.java |  2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)

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.java
index 8928fbe..9de6b6e 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.java
index f16db6d..3d82cbb 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 {
   @Override
   public 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;
   }
 
   @Override
   public 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 {
 
   @Override
   public 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.java
index 32061c0..60f56d1 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.java
index 531b1be..d8301da 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 test
     public void coreInit() throws Exception {