mirror of https://github.com/apache/lucene.git
SOLR-11198: downconfig downloads empty file as folder, test failures possible fix and logging
This commit is contained in:
parent
44de7b2306
commit
e053e2298f
|
@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.FileVisitResult;
|
import java.nio.file.FileVisitResult;
|
||||||
|
@ -40,9 +41,13 @@ import org.apache.zookeeper.data.Stat;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class SolrCLIZkUtilsTest extends SolrCloudTestCase {
|
public class SolrCLIZkUtilsTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupCluster() throws Exception {
|
public static void setupCluster() throws Exception {
|
||||||
configureCluster(1)
|
configureCluster(1)
|
||||||
|
@ -401,7 +406,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
args = new String[]{
|
args = new String[]{
|
||||||
"-src", "file:" + emptyFile.toAbsolutePath().toString(),
|
"-src", "file:" + emptyFile.toAbsolutePath().toString(),
|
||||||
"-dst", "zk:/cp7/conf/stopwords/emptyFile",
|
"-dst", "zk:/cp7/conf/stopwords/emptyfile",
|
||||||
"-recurse", "false",
|
"-recurse", "false",
|
||||||
"-zkHost", zkAddr,
|
"-zkHost", zkAddr,
|
||||||
};
|
};
|
||||||
|
@ -410,9 +415,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {
|
||||||
assertEquals("Copy should have succeeded.", 0, res);
|
assertEquals("Copy should have succeeded.", 0, res);
|
||||||
|
|
||||||
Path tmp2 = createTempDir("cp9");
|
Path tmp2 = createTempDir("cp9");
|
||||||
Path emptyDest = Paths.get(tmp2.toAbsolutePath().toString(), "emptyFile");
|
Path emptyDest = Paths.get(tmp2.toAbsolutePath().toString(), "emptyfile");
|
||||||
args = new String[]{
|
args = new String[]{
|
||||||
"-src", "zk:/cp7/conf/stopwords/emptyFile",
|
"-src", "zk:/cp7/conf/stopwords/emptyfile",
|
||||||
"-dst", "file:" + emptyDest.toAbsolutePath().toString(),
|
"-dst", "file:" + emptyDest.toAbsolutePath().toString(),
|
||||||
"-recurse", "false",
|
"-recurse", "false",
|
||||||
"-zkHost", zkAddr,
|
"-zkHost", zkAddr,
|
||||||
|
@ -445,7 +450,12 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {
|
||||||
res = cpTool.runTool(SolrCLI.processCommandLineArgs(SolrCLI.joinCommonAndToolOptions(cpTool.getOptions()), args));
|
res = cpTool.runTool(SolrCLI.processCommandLineArgs(SolrCLI.joinCommonAndToolOptions(cpTool.getOptions()), args));
|
||||||
assertEquals("Copy should have succeeded.", 0, res);
|
assertEquals("Copy should have succeeded.", 0, res);
|
||||||
|
|
||||||
Path locEmpty = Paths.get(tmp2.toAbsolutePath().toString(), "stopwords", "emptyFile");
|
Path locEmpty = Paths.get(tmp2.toAbsolutePath().toString(), "stopwords", "emptyfile");
|
||||||
|
log.info("EOE Checking file at (var1) " + locEmpty.toAbsolutePath().toString()); // TODO: remove me EOE
|
||||||
|
log.info("EOE Checking file at (var2) " + locEmpty.toFile().getAbsolutePath()); // TODO: remove me EOE
|
||||||
|
log.info("EOE Checking file exists: " + Boolean.toString(locEmpty.toFile().exists()));
|
||||||
|
log.info("EOE Checking isFile: " + Boolean.toString(locEmpty.toFile().isFile()));
|
||||||
|
log.info("EOE Checking isDirectory: " + Boolean.toString(locEmpty.toFile().isDirectory())); //TODO: remove me EOE to here.
|
||||||
assertTrue("Empty files should NOT be copied down as directories", locEmpty.toFile().isFile());
|
assertTrue("Empty files should NOT be copied down as directories", locEmpty.toFile().isFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,12 @@ public class ZkMaintenanceUtils {
|
||||||
// If we didn't copy data down, then we also didn't create the file. But we still need a marker on the local
|
// If we didn't copy data down, then we also didn't create the file. But we still need a marker on the local
|
||||||
// disk so create an empty file.
|
// disk so create an empty file.
|
||||||
if (copyDataDown(zkClient, zkPath, file.toFile()) == 0) {
|
if (copyDataDown(zkClient, zkPath, file.toFile()) == 0) {
|
||||||
|
log.info("EOE Creating file at (var 1)" + file.toAbsolutePath().toString()); // TODO remove me EOE
|
||||||
|
log.info("EOE Creating file at (var2) " + file.toFile().getAbsolutePath()); // TODO remove me EOE
|
||||||
Files.createFile(file);
|
Files.createFile(file);
|
||||||
|
log.info("EOE Creating file exists: " + Boolean.toString(file.toFile().exists()));
|
||||||
|
log.info("EOE Creating isFile: " + Boolean.toString(file.toFile().isFile()));
|
||||||
|
log.info("EOE Creating isDirectory: " + Boolean.toString(file.toFile().isDirectory())); //TODO: remove me EOE to here.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Files.createDirectories(file); // Make parent dir.
|
Files.createDirectories(file); // Make parent dir.
|
||||||
|
|
Loading…
Reference in New Issue