You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/06/04 21:24:08 UTC
svn commit: r1683615 [11/12] - in /lucene/dev/branches/LUCENE-6481: ./
dev-tools/ dev-tools/idea/.idea/ dev-tools/maven/solr/core/src/test/
dev-tools/scripts/ lucene/ lucene/codecs/
lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/ lucene/cor...
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java Thu Jun 4 19:24:05 2015
@@ -20,7 +20,6 @@ package org.apache.solr.cloud;
import javax.security.auth.login.Configuration;
import java.io.File;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
@@ -76,14 +75,9 @@ public class TestSolrCloudWithKerberosAl
REPLICATION_FACTOR = 1;
}
- protected final static List<String> brokenLocales =
- Arrays.asList(
- "th_TH_TH_#u-nu-thai",
- "ja_JP_JP_#u-ca-japanese",
- "hi_IN");
-
private MiniKdc kdc;
+ private Locale savedLocale; // in case locale is broken and we need to fill in a working locale
@Rule
public TestRule solrTestRules = RuleChain
.outerRule(new SystemPropertiesRestoreRule());
@@ -95,9 +89,7 @@ public class TestSolrCloudWithKerberosAl
@Override
public void setUp() throws Exception {
- if (brokenLocales.contains(Locale.getDefault().toString())) {
- Locale.setDefault(Locale.US);
- }
+ savedLocale = KerberosTestUtil.overrideLocaleIfNotSpportedByMiniKdc();
super.setUp();
setupMiniKdc();
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
@@ -237,6 +229,7 @@ public class TestSolrCloudWithKerberosAl
if (kdc != null) {
kdc.stop();
}
+ Locale.setDefault(savedLocale);
super.tearDown();
}
}
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java Thu Jun 4 19:24:05 2015
@@ -56,7 +56,6 @@ public class UnloadDistributedZkTest ext
public UnloadDistributedZkTest() {
super();
- checkCreatedVsState = false;
}
@Test
@@ -375,7 +374,7 @@ public class UnloadDistributedZkTest ext
// create the cores
createCores(adminClient, executor, "multiunload", 2, cnt);
} finally {
- ExecutorUtil.shutdownAndAwaitTermination(executor, 120, TimeUnit.SECONDS);
+ ExecutorUtil.shutdownAndAwaitTermination(executor);
}
executor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE, 5,
@@ -399,7 +398,7 @@ public class UnloadDistributedZkTest ext
Thread.sleep(random().nextInt(50));
}
} finally {
- ExecutorUtil.shutdownAndAwaitTermination(executor, 120, TimeUnit.SECONDS);
+ ExecutorUtil.shutdownAndAwaitTermination(executor);
}
}
}
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java Thu Jun 4 19:24:05 2015
@@ -18,7 +18,11 @@
package org.apache.solr.core;
import java.nio.file.Path;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.NoLockFactory;
@@ -26,6 +30,7 @@ import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.DirectoryFactory.DirContext;
+import org.apache.solr.handler.SnapShooter;
import org.apache.solr.util.BadHdfsThreadsFilter;
import org.apache.solr.util.MockCoreContainer.MockCoreDescriptor;
import org.junit.AfterClass;
@@ -53,7 +58,7 @@ public class HdfsDirectoryFactoryTest ex
System.clearProperty(HdfsDirectoryFactory.NRTCACHINGDIRECTORY_MAXMERGESIZEMB);
dfsCluster = null;
}
-
+
@Test
public void testInitArgsOrSysPropConfig() throws Exception {
@@ -130,4 +135,35 @@ public class HdfsDirectoryFactoryTest ex
hdfsFactory.close();
}
+ @Test
+ public void testCleanupOldIndexDirectories() throws Exception {
+
+ HdfsDirectoryFactory hdfsFactory = new HdfsDirectoryFactory();
+
+ System.setProperty("solr.hdfs.home", HdfsTestUtil.getURI(dfsCluster) + "/solr1");
+ hdfsFactory.init(new NamedList<>());
+ String dataHome = hdfsFactory.getDataHome(new MockCoreDescriptor());
+ assertTrue(dataHome.endsWith("/solr1/mock/data"));
+ System.clearProperty("solr.hdfs.home");
+
+ FileSystem hdfs = dfsCluster.getFileSystem();
+
+ org.apache.hadoop.fs.Path dataHomePath = new org.apache.hadoop.fs.Path(dataHome);
+ org.apache.hadoop.fs.Path currentIndexDirPath = new org.apache.hadoop.fs.Path(dataHomePath, "index");
+ assertTrue(!hdfs.isDirectory(currentIndexDirPath));
+ hdfs.mkdirs(currentIndexDirPath);
+ assertTrue(hdfs.isDirectory(currentIndexDirPath));
+
+ String timestamp1 = new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());
+ org.apache.hadoop.fs.Path oldIndexDirPath = new org.apache.hadoop.fs.Path(dataHomePath, "index."+timestamp1);
+ assertTrue(!hdfs.isDirectory(oldIndexDirPath));
+ hdfs.mkdirs(oldIndexDirPath);
+ assertTrue(hdfs.isDirectory(oldIndexDirPath));
+
+ hdfsFactory.cleanupOldIndexDirectories(dataHomePath.toString(), currentIndexDirPath.toString());
+
+ assertTrue(hdfs.isDirectory(currentIndexDirPath));
+ assertTrue(!hdfs.isDirectory(oldIndexDirPath));
+ }
+
}
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java Thu Jun 4 19:24:05 2015
@@ -114,16 +114,6 @@ public class TestBlobHandler extends Abs
assertTrue(response1.isSuccess());
}
- @Override
- public void distribTearDown() throws Exception {
- super.distribTearDown();
- System.clearProperty("numShards");
- System.clearProperty("zkHost");
-
- // insurance
- DirectUpdateHandler2.commitOnClose = true;
- }
-
public static void postAndCheck(CloudSolrClient cloudClient, String baseUrl, String blobName, ByteBuffer bytes, int count) throws Exception {
postData(cloudClient, baseUrl, blobName, bytes);
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java Thu Jun 4 19:24:05 2015
@@ -47,19 +47,9 @@ import java.util.TreeMap;
*/
@SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
public class TestCloudSchemaless extends AbstractFullDistribZkTestBase {
- private static final Logger log = LoggerFactory.getLogger(TestCloudManagedSchemaConcurrent.class);
+ private static final Logger log = LoggerFactory.getLogger(TestCloudSchemaless.class);
private static final String SUCCESS_XPATH = "/response/lst[@name='responseHeader']/int[@name='status'][.='0']";
- @Override
- public void distribSetUp() throws Exception {
-
- super.distribSetUp();
-
- useJettyDataDir = false;
-
- System.setProperty("numShards", Integer.toString(sliceCount));
- }
-
@After
public void teardDown() throws Exception {
super.tearDown();
@@ -76,7 +66,6 @@ public class TestCloudSchemaless extends
@BeforeClass
public static void initSysProperties() {
System.setProperty("managed.schema.mutable", "true");
- System.setProperty("enable.update.log", "true");
}
@Override
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java Thu Jun 4 19:24:05 2015
@@ -117,7 +117,7 @@ public class TestSearcherReuse extends S
assertSearcherHasNotChanged(expectedSearcher);
assertU(delI("0")); // no doc has this id, yet
- assertU(commit());
+ assertU(commit("softCommit","true"));
assertSearcherHasNotChanged(expectedSearcher);
} finally {
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial2.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial2.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial2.java Thu Jun 4 19:24:05 2015
@@ -126,18 +126,23 @@ public class TestSolr4Spatial2 extends S
assertEquals("1", cache.getStatistics().get("cumulative_hits").toString());
assertEquals("1 segment",
- 1, ((SolrIndexSearcher) h.getCore().getInfoRegistry().get("searcher")).getRawReader().leaves().size());
+ 1, getSearcher().getRawReader().leaves().size());
+ // Get key of first leaf reader -- this one contains the match for sure.
+ Object leafKey1 = getFirstLeafReaderKey();
+
// add new segment
assertU(adoc("id", "3"));
+
assertU(commit()); // sometimes merges (to one seg), sometimes won't
- boolean newSeg =
- (((SolrIndexSearcher)h.getCore().getInfoRegistry().get("searcher")).getRawReader().leaves().size() > 1);
// can still find the same document
assertJQ(sameReq, "/response/numFound==1", "/response/docs/[0]/id=='1'");
- // when there are new segments, we accumulate another hit. This tests the cache was not blown away on commit.
- assertEquals(newSeg ? "2" : "1", cache.getStatistics().get("cumulative_hits").toString());
+ // When there are new segments, we accumulate another hit. This tests the cache was not blown away on commit.
+ // Checking equality for the first reader's cache key indicates wether the cache should still be valid.
+ Object leafKey2 = getFirstLeafReaderKey();
+ assertEquals(leafKey1.equals(leafKey2) ? "2" : "1", cache.getStatistics().get("cumulative_hits").toString());
+
// Now try to see if heatmaps work:
assertJQ(req("q", "*:*", "facet", "true", FacetParams.FACET_HEATMAP, fieldName, "json.nl", "map"),
@@ -145,4 +150,14 @@ public class TestSolr4Spatial2 extends S
}
+ protected SolrIndexSearcher getSearcher() {
+ // neat trick; needn't deal with the hassle RefCounted
+ return (SolrIndexSearcher) h.getCore().getInfoRegistry().get("searcher");
+ }
+
+
+ protected Object getFirstLeafReaderKey() {
+ return getSearcher().getRawReader().leaves().get(0).reader().getCoreCacheKey();
+ }
+
}
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java Thu Jun 4 19:24:05 2015
@@ -174,18 +174,23 @@ public class TestJsonFacets extends Solr
}
+ public void indexSimple(Client client) throws Exception {
+ client.deleteByQuery("*:*", null);
+ client.add(sdoc("id", "1", "cat_s", "A", "where_s", "NY", "num_d", "4", "num_i", "2", "val_b", "true", "sparse_s", "one"), null);
+ client.add(sdoc("id", "2", "cat_s", "B", "where_s", "NJ", "num_d", "-9", "num_i", "-5", "val_b", "false"), null);
+ client.add(sdoc("id", "3"), null);
+ client.commit();
+ client.add(sdoc("id", "4", "cat_s", "A", "where_s", "NJ", "num_d", "2", "num_i", "3"), null);
+ client.add(sdoc("id", "5", "cat_s", "B", "where_s", "NJ", "num_d", "11", "num_i", "7", "sparse_s", "two"),null);
+ client.commit();
+ client.add(sdoc("id", "6", "cat_s", "B", "where_s", "NY", "num_d", "-5", "num_i", "-5"),null);
+ client.commit();
+ }
+
public void testStatsSimple() throws Exception {
- assertU(delQ("*:*"));
- assertU(add(doc("id", "1", "cat_s", "A", "where_s", "NY", "num_d", "4", "num_i", "2", "val_b", "true", "sparse_s","one")));
- assertU(add(doc("id", "2", "cat_s", "B", "where_s", "NJ", "num_d", "-9", "num_i", "-5", "val_b", "false")));
- assertU(add(doc("id", "3")));
- assertU(commit());
- assertU(add(doc("id", "4", "cat_s", "A", "where_s", "NJ", "num_d", "2", "num_i", "3")));
- assertU(add(doc("id", "5", "cat_s", "B", "where_s", "NJ", "num_d", "11", "num_i", "7", "sparse_s","two")));
- assertU(commit());
- assertU(add(doc("id", "6", "cat_s", "B", "where_s", "NY", "num_d", "-5", "num_i", "-5")));
- assertU(commit());
+ Client client = Client.localClient();
+ indexSimple(client);
// test multiple json.facet commands
assertJQ(req("q", "*:*", "rows", "0"
@@ -932,6 +937,7 @@ public class TestJsonFacets extends Solr
",f8:{ type:field, field:${num_i}, sort:'index desc', offset:100, numBuckets:true }" + // test high offset
",f9:{ type:field, field:${num_i}, sort:'x desc', facet:{x:'avg(${num_d})'}, missing:true, allBuckets:true, numBuckets:true }" + // test stats
",f10:{ type:field, field:${num_i}, facet:{a:{query:'${cat_s}:A'}}, missing:true, allBuckets:true, numBuckets:true }" + // test subfacets
+ ",f11:{ type:field, field:${num_i}, facet:{a:'unique(${num_d})'} ,missing:true, allBuckets:true, sort:'a desc' }" + // test subfacet using unique on numeric field (this previously triggered a resizing bug)
"}"
)
, "facets=={count:6 " +
@@ -945,6 +951,7 @@ public class TestJsonFacets extends Solr
",f8:{ buckets:[] , numBuckets:4 } " +
",f9:{ buckets:[{val:7,count:1,x:11.0},{val:2,count:1,x:4.0},{val:3,count:1,x:2.0},{val:-5,count:2,x:-7.0} ], numBuckets:4, allBuckets:{count:5,x:0.6},missing:{count:1,x:0.0} } " + // TODO: should missing exclude "x" because no values were collected?
",f10:{ buckets:[{val:-5,count:2,a:{count:0}},{val:2,count:1,a:{count:1}},{val:3,count:1,a:{count:1}},{val:7,count:1,a:{count:0}} ], numBuckets:4, allBuckets:{count:5},missing:{count:1,a:{count:0}} } " +
+ ",f11:{ buckets:[{val:-5,count:2,a:2},{val:2,count:1,a:1},{val:3,count:1,a:1},{val:7,count:1,a:1} ] , missing:{count:1,a:0} , allBuckets:{count:5,a:5} } " +
"}"
);
@@ -1037,7 +1044,33 @@ public class TestJsonFacets extends Solr
}
+ public void testTolerant() throws Exception {
+ initServers();
+ Client client = servers.getClient(random().nextInt());
+ client.queryDefaults().set("shards", servers.getShards() + ",[ff01::114]:33332:/ignore_exception");
+ indexSimple(client);
+ try {
+ client.testJQ(params("ignore_exception", "true", "shards.tolerant", "false", "q", "*:*"
+ , "json.facet", "{f:{type:terms, field:cat_s}}"
+ )
+ , "facets=={ count:6," +
+ "f:{ buckets:[{val:B,count:3},{val:A,count:2}] }" +
+ "}"
+ );
+ fail("we should have failed");
+ } catch (Exception e) {
+ // ok
+ }
+
+ client.testJQ(params("ignore_exception", "true", "shards.tolerant", "true", "q", "*:*"
+ , "json.facet", "{f:{type:terms, field:cat_s}}"
+ )
+ , "facets=={ count:6," +
+ "f:{ buckets:[{val:B,count:3},{val:A,count:2}] }" +
+ "}"
+ );
+ }
public void XtestPercentiles() {
AVLTreeDigest catA = new AVLTreeDigest(100);
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java Thu Jun 4 19:24:05 2015
@@ -18,18 +18,16 @@ package org.apache.solr.store.hdfs;
*/
import java.io.IOException;
-import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.lucene.store.Lock;
+import org.apache.lucene.store.LockObtainFailedException;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
import org.apache.solr.util.BadHdfsThreadsFilter;
-import org.junit.After;
import org.junit.AfterClass;
-import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -53,34 +51,32 @@ public class HdfsLockFactoryTest extends
dfsCluster = null;
}
- @Before
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
@Test
public void testBasic() throws IOException {
String uri = HdfsTestUtil.getURI(dfsCluster);
Path lockPath = new Path(uri, "/basedir/lock");
Configuration conf = HdfsTestUtil.getClientConfiguration(dfsCluster);
HdfsDirectory dir = new HdfsDirectory(lockPath, conf);
- Lock lock = dir.makeLock("testlock");
- boolean success = lock.obtain();
- assertTrue("We could not get the lock when it should be available", success);
- success = lock.obtain();
- assertFalse("We got the lock but it should be unavailble", success);
- lock.close();
- success = lock.obtain();
- assertTrue("We could not get the lock when it should be available", success);
- success = lock.obtain();
- assertFalse("We got the lock but it should be unavailble", success);
+
+ try (Lock lock = dir.obtainLock("testlock")) {
+ assert lock != null;
+ try (Lock lock2 = dir.obtainLock("testlock")) {
+ assert lock2 != null;
+ fail("Locking should fail");
+ } catch (LockObtainFailedException lofe) {
+ // pass
+ }
+ }
+ // now repeat after close()
+ try (Lock lock = dir.obtainLock("testlock")) {
+ assert lock != null;
+ try (Lock lock2 = dir.obtainLock("testlock")) {
+ assert lock2 != null;
+ fail("Locking should fail");
+ } catch (LockObtainFailedException lofe) {
+ // pass
+ }
+ }
dir.close();
}
-
-
-}
\ No newline at end of file
+}
Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/update/processor/UpdateRequestProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/update/processor/UpdateRequestProcessorFactoryTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/update/processor/UpdateRequestProcessorFactoryTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/update/processor/UpdateRequestProcessorFactoryTest.java Thu Jun 4 19:24:05 2015
@@ -20,22 +20,36 @@ package org.apache.solr.update.processor
import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.solr.core.SolrCore;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.util.AbstractSolrTestCase;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
*
*/
public class UpdateRequestProcessorFactoryTest extends AbstractSolrTestCase {
+
+ private static org.apache.log4j.Level SAVED_LEVEL = null; // SOLR-7603 - remove
@BeforeClass
public static void beforeClass() throws Exception {
+
+ // SOLR-7603 - remove
+ SAVED_LEVEL = org.apache.log4j.LogManager.getRootLogger().getLevel();
+ org.apache.log4j.LogManager.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
+
initCore("solrconfig-transformers.xml", "schema.xml");
}
+ @AfterClass
+ public static void fixLogLevelAfterClass() throws Exception { // SOLR-7603 - remove
+ org.apache.log4j.LogManager.getRootLogger().setLevel(SAVED_LEVEL);
+ }
public void testConfiguration() throws Exception
{
@@ -70,48 +84,95 @@ public class UpdateRequestProcessorFacto
}
public void testUpdateDistribChainSkipping() throws Exception {
+
+ // a key part of this test is verifying that LogUpdateProcessor is found in all chains because it
+ // is a @RunAllways processor -- but in order for that to work, we have to sanity check that the log
+ // level is at least "INFO" otherwise the factory won't even produce a processor and all our assertions
+ // are for nought. (see LogUpdateProcessorFactory.getInstance)
+ //
+ // TODO: maybe create a new mock Processor w/ @RunAlways annot if folks feel requiring INFO is evil.
+ assertTrue("Tests must be run with INFO level logging "+
+ "otherwise LogUpdateProcessor isn't used and can't be tested.",
+ LogUpdateProcessor.log.isInfoEnabled());
+
+ final int EXPECTED_CHAIN_LENGTH = 5;
SolrCore core = h.getCore();
for (final String name : Arrays.asList("distrib-chain-explicit",
"distrib-chain-implicit",
"distrib-chain-noop")) {
UpdateRequestProcessor proc;
+ List<UpdateRequestProcessor> procs;
+
UpdateRequestProcessorChain chain = core.getUpdateProcessingChain(name);
assertNotNull(name, chain);
// either explicitly, or because of injection
- assertEquals(name + " chain length", 5,
+ assertEquals(name + " chain length: " + chain.toString(), EXPECTED_CHAIN_LENGTH,
chain.getFactories().length);
- // Custom comes first in all three of our chains
+ // test a basic (non distrib) chain
proc = chain.createProcessor(req(), new SolrQueryResponse());
- assertTrue(name + " first processor isn't a CustomUpdateRequestProcessor: "
- + proc.getClass().getName(),
- proc instanceof CustomUpdateRequestProcessor);
+ procs = procToList(proc);
+ assertEquals(name + " procs size: " + procs.toString(),
+ // -1 = NoOpDistributingUpdateProcessorFactory produces no processor
+ EXPECTED_CHAIN_LENGTH - ("distrib-chain-noop".equals(name) ? 1 : 0),
+ procs.size());
+
+ // Custom comes first in all three of our chains
+ assertTrue(name + " first processor isn't a CustomUpdateRequestProcessor: " + procs.toString(),
+ ( // compare them both just because i'm going insane and the more checks the better
+ proc instanceof CustomUpdateRequestProcessor
+ && procs.get(0) instanceof CustomUpdateRequestProcessor));
+
+ // Log should always come second in our chain.
+ assertNotNull(name + " proc.next is null", proc.next);
+ assertNotNull(name + " second proc is null", procs.get(1));
+
+ assertTrue(name + " second proc isn't LogUpdateProcessor: " + procs.toString(),
+ ( // compare them both just because i'm going insane and the more checks the better
+ proc.next instanceof LogUpdateProcessor
+ && procs.get(1) instanceof LogUpdateProcessor));
- // varies depending on chain, but definitely shouldn't be Custom
+ // fetch the distributed version of this chain
proc = chain.createProcessor(req(DISTRIB_UPDATE_PARAM, "non_blank_value"),
new SolrQueryResponse());
- assertFalse(name + " post distrib proc should not be a CustomUpdateRequestProcessor: "
- + proc.getClass().getName(),
- proc instanceof CustomUpdateRequestProcessor);
-
- int n=0;
- boolean foundLog = false;
- for (;;) {
- n++;
- if (proc instanceof LogUpdateProcessor) {
- foundLog = true;
- }
- proc = proc.next;
- if (proc == null) break;
- }
-
- assertTrue( n < chain.getFactories().length ); // some processors should have been dropped
- assertTrue( foundLog ); // make sure the marker interface was successful in keeping the log processor
-
+ procs = procToList(proc);
+ assertNotNull(name + " (distrib) chain produced null proc", proc);
+ assertFalse(name + " (distrib) procs is empty", procs.isEmpty());
+
+ // for these 3 (distrib) chains, the first proc should always be LogUpdateProcessor
+ assertTrue(name + " (distrib) first proc should be LogUpdateProcessor because of @RunAllways: "
+ + procs.toString(),
+ ( // compare them both just because i'm going insane and the more checks the better
+ proc instanceof LogUpdateProcessor
+ && procs.get(0) instanceof LogUpdateProcessor));
+
+ // for these 3 (distrib) chains, the last proc should always be RunUpdateProcessor
+ assertTrue(name + " (distrib) last processor isn't a RunUpdateProcessor: " + procs.toString(),
+ procs.get(procs.size()-1) instanceof RunUpdateProcessor );
+
+ // either 1 proc was droped in distrib mode, or 1 for the "implicit" chain
+ assertEquals(name + " (distrib) chain has wrong length: " + procs.toString(),
+ // -1 = all chains lose CustomUpdateRequestProcessorFactory
+ // -1 = distrib-chain-noop: NoOpDistributingUpdateProcessorFactory produces no processor
+ // -1 = distrib-chain-implicit: does RemoveBlank before distrib
+ EXPECTED_CHAIN_LENGTH - ( "distrib-chain-explicit".equals(name) ? 1 : 2),
+ procs.size());
}
}
+ /**
+ * walks the "next" values of the proc building up a List of the procs for easier testing
+ */
+ public static List<UpdateRequestProcessor> procToList(UpdateRequestProcessor proc) {
+ List<UpdateRequestProcessor> result = new ArrayList<UpdateRequestProcessor>(7);
+ while (null != proc) {
+ result.add(proc);
+ proc = proc.next;
+ }
+ return result;
+ }
}
+
Modified: lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/db/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/db/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/db/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/db/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -263,19 +263,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/mail/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/mail/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/mail/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -266,19 +266,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/rss/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/rss/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/rss/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -263,19 +263,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/solr/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/solr/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -263,19 +263,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/tika/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/tika/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/example-DIH/solr/tika/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -264,19 +264,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/README.txt?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/README.txt (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/README.txt Thu Jun 4 19:24:05 2015
@@ -40,7 +40,7 @@ For further explanations, see the freque
bin/solr create -c files -d example/files/conf
-* Now youâve created a core called âfilesâ using a configuration tuned for indexing and query rich text files.
+* Now youâve created a core called âfilesâ using a configuration tuned for indexing and querying rich text files.
* You should see the following response:
@@ -65,6 +65,10 @@ For further explanations, see the freque
<some number> files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/files/update...
Time spent: <some amount of time>
+
+* To see a list of accepted file types, do:
+ bin/post -h
+
<hr>
##BROWSING DOCUMENTS
@@ -73,7 +77,7 @@ For further explanations, see the freque
* To view your document information in the HTML interface view, adjust the URL in your address bar to [http://localhost:8983/solr/files/browse](http://localhost:8983/solr/files/browse)
-* To view your document information in XML or other formats, add &wt (for writer type) to the end of that URL. i.e.:
+* To view your document information in XML or other formats, add &wt (for writer type) to the end of that URL. i.e. To view your results in xml format direct your browser to:
[http://localhost:8983/solr/files/browse?&wt=xml](http://localhost:8983/solr/files/browse?&wt=xml)
<hr>
@@ -81,9 +85,9 @@ For further explanations, see the freque
* Another way to verify that your core has been created is to view it in the Admin User Interface.
-You can use the Admin_UI as a visual tool for most of the things youâll be doing with your cores/collections in Solr.
+ - The Admin_UI serves as a visual tool for indexing and querying your index in Solr.
-* To access the Admin UI, go to your browser visit :
+* To access the Admin UI, go to your browser and visit :
[http://localhost:8983/solr/](http://localhost:8983/solr/)
- <i>The Admin UI is only accessible when Solr is running</i>
@@ -92,13 +96,14 @@ You can use the Admin_UI as a visual too
* Alternatively, you could just go to the core page directly by visiting : [http://localhost:8983/solr/#/files](http://localhost:8983/solr/#/files)
* Now youâve opened the core page. On this page there are a multitude of different tools you can use to analyze and search your core. You will make use of these features after indexing your documents.
+* Take note of the "Num Docs" field in your core Statistics. If after indexing your documents, it shows Num Docs to be 0, that means there was a problem indexing.
<hr>
##QUERYING INDEX
* In the Admin UI, enter a term in the query box to see which documents contain the word.
-* You can filter the results by switching between the different content type tabs.
+* You can filter the results by switching between the different content type tabs. To view an international version of this interface, hover over the globe icon in the top right hand section of the page.
* Notice the tag cloud on the right side, which facets by top phrases extracted during indexing.
Click on the phrases to see which documents contain them.
@@ -130,27 +135,18 @@ You can use the Admin_UI as a visual too
* How can I change the /browse UI?
- The primary templates are under example/files/conf/velocity. In order to edit those files in place (without having to
- re-create or patch a core/collection with an updated configuration), Solr can be started with a special system property
- set to the _absolute_ path to the conf/velocity directory, like this:
-
-
- bin/solr start -Dvelocity.template.base.dir=</full/path/to>/example/files/conf/velocity/
+ The primary templates are under example/files/conf/velocity. **In order to edit those files in place (without having to
+ re-create or patch a core/collection with an updated configuration)**, Solr can be started with a special system property
+ set to the _absolute_ path to the conf/velocity directory, like this:
+ bin/solr start -Dvelocity.template.base.dir=</full/path/to>/example/files/conf/velocity/
-bin/solr stop
-rm -Rf server/solr/files/
+ If you want to adjust the browse templates for an existing collection, edit the coreâs configuration
+ under server/solr/files/conf/velocity.
+
+
+=======
-# templates extracted with:
-# unzip -j dist/solr-velocity-*.jar velocity/* -x *.properties -d example/files/templates/
-bin/solr start -Dvelocity.template.base.dir=<absolute path to example/files/templates>
-# TODO: make it so an install dir relative path can be used somehow?
-bin/solr create_core -c files
-bin/post -c files ~/Documents
-curl http://localhost:8983/solr/files/config/params -H 'Content-type:application/json' -d '{
-"update" : {
- "facets": {
- "facet.field":"content_type"
- }
- }
-}'
\ No newline at end of file
+* Provenance of free images used in this example:
+ - Globe icon: visualpharm.com
+ - Flag icons: freeflagicons.com
\ No newline at end of file
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/managed-schema
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/managed-schema?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/managed-schema (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/managed-schema Thu Jun 4 19:24:05 2015
@@ -398,6 +398,13 @@
<fieldType name="tlong" class="solr.TrieLongField" positionIncrementGap="0" precisionStep="8"/>
<fieldType name="tlongs" class="solr.TrieLongField" positionIncrementGap="0" multiValued="true" precisionStep="8"/>
+ <fieldType name="text_email_url" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.UAX29URLEmailTokenizerFactory"/>
+ <filter class="solr.TypeTokenFilterFactory" types="email_url_types.txt" useWhitelist="true"/>
+ </analyzer>
+ </fieldType>
+
<fieldType name="text_shingles" class="solr.TextField" positionIncrementGap="100" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/params.json
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/params.json?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/params.json (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/params.json Thu Jun 4 19:24:05 2015
@@ -18,6 +18,7 @@
"type_fq":"{!field f=doc_type v=$type}",
"hl":"on",
"hl.fl":"content",
+ "v.locale":"${locale}",
"debug":"true",
"":{"v":0}},
"velocity":{
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -82,6 +82,7 @@
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
+ <lib path="${solr.install.dir:../../../..}/example/files/browse-resources"/>
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
<!-- an exact 'path' can be used instead of a 'dir' to specify a
specific jar file. This will cause a serious error to be logged
@@ -243,19 +244,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/update-script.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/update-script.js?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/update-script.js (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/update-script.js Thu Jun 4 19:24:05 2015
@@ -57,17 +57,27 @@ function processAdd(cmd) {
break;
}
-
// TODO: error handling needed? What if there is no slash?
if(doc_type) { doc.setField("doc_type", doc_type); }
doc.setField("content_type_type_s", ct_type);
doc.setField("content_type_subtype_s", ct_subtype);
+ }
+
+ var analyzer =
+ req.getCore().getLatestSchema()
+ .getFieldTypeByName("text_email_url")
+ .getIndexAnalyzer();
-// doc, image, unknown, ...
- // application/pdf => doc
- // application/msword => doc
- // image/* => image
+ var token_stream =
+ analyzer.tokenStream("content", new java.io.StringReader(doc.getFieldValue("content")));
+ var term_att = token_stream.getAttribute(org.apache.lucene.analysis.tokenattributes.CharTermAttribute.class);
+ var type_att = token_stream.getAttribute(org.apache.lucene.analysis.tokenattributes.TypeAttribute.class);
+ token_stream.reset();
+ while (token_stream.incrementToken()) {
+ doc.addField(type_att.type().replace(/\<|\>/g,'').toLowerCase()+"_ss", term_att.toString());
}
+ token_stream.end();
+ token_stream.close();
}
function processDelete(cmd) {
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/browse.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/browse.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/browse.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/browse.vm Thu Jun 4 19:24:05 2015
@@ -2,12 +2,13 @@
<form id="query-form" action="#{url_for_home}" method="GET">
$resource.find:
<input type="text" id="q" name="q" style="width: 50%" value="$!esc.html($request.params.get('q'))"/>
- <input type="submit"/>
+ <input type="submit" value="$resource.submit"/>
<div id="debug_query" class="debug">
<span id="parsed_query">$esc.html($response.response.debug.parsedquery)</span>
</div>
<input type="hidden" name="type" value="#current_type"/>
+ #if("#current_locale"!="")<input type="hidden" value="locale" value="#current_locale"/>#end
#foreach($fq in $response.responseHeader.params.getAll("fq"))
<input type="hidden" name="fq" id="allFQs" value="$esc.html($fq)"/>
#end
@@ -33,7 +34,7 @@
<div id="results_list">
<div class="pagination">
- <span class="results-found">$page.results_found</span> results found in ${response.responseHeader.QTime}ms
+ <span class="results-found">$page.results_found</span> $resource.results_found_in.insert(${response.responseHeader.QTime})
$resource.page_of.insert($page.current_page_number,$page.page_count)
</div>
@@ -41,7 +42,7 @@
<div class="pagination">
#link_to_previous_page
- <span class="results-found">$page.results_found</span> results found.
+ <span class="results-found">$page.results_found</span> $resource.results_found.
$resource.page_of.insert($page.current_page_number,$page.page_count)
#link_to_next_page
</div>
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/facet_text_shingles.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/facet_text_shingles.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/facet_text_shingles.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/facet_text_shingles.vm Thu Jun 4 19:24:05 2015
@@ -1,5 +1,5 @@
<div id="facet_$field.name">
- <span class="facet-field">Top Phrases</span><br/>
+ <span class="facet-field">$resource.top_phrases</span><br/>
<ul id="tagcloud">
#foreach($facet in $sort.sort($field.values,"name"))
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/head.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/head.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/head.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/head.vm Thu Jun 4 19:24:05 2015
@@ -9,13 +9,19 @@
<script type="text/javascript" src="#{url_root}/js/lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="#{url_for_solr}/admin/file?file=/velocity/jquery.tx3-tag-cloud.js&contentType=text/javascript"></script>
+ <script type="text/javascript" src="#{url_for_solr}/admin/file?file=/velocity/dropit.js&contentType=text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#tagcloud").tx3TagCloud({
multiplier: 5
});
+
+
+ $('.menu').dropit();
});
+
+
</script>
<style>
@@ -33,6 +39,11 @@
font-size: 20pt;
}
+ #header2{
+
+ margin-left:1200px;
+ }
+
#logo {
width: 115px;
margin: 0px 0px 0px 0px;
@@ -42,6 +53,9 @@
a {
color: #305CB3;
}
+ a.hidden{
+ display:none;
+ }
em {
color: #FF833D;
@@ -187,4 +201,22 @@
transition: color 250ms linear;
}
+ .dropit {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ }
+ .dropit .dropit-trigger { position: relative; }
+ .dropit .dropit-submenu {
+ position: absolute;
+ top: 100%;
+ left: 0; /* dropdown left or right */
+ z-index: 1000;
+ display: none;
+ min-width: 150px;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ }
+ .dropit .dropit-open .dropit-submenu { display: block; }
</style>
\ No newline at end of file
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/layout.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/layout.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/layout.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/layout.vm Thu Jun 4 19:24:05 2015
@@ -4,9 +4,25 @@
</head>
<body>
<div id="header">
- <a href="#url_for_home"><img src="#{url_root}/img/solr.svg" id="logo" title="Solr"/></a> Powered File Search
+ <a href="#url_for_home"><img src="#{url_root}/img/solr.svg" id="logo" title="Solr"/></a> $resource.powered_file_search
</div>
+ <div id="header2" onclick="javascript:locale_select()">
+ <ul class="menu">
+
+ <li>
+ <a href="#"><img src="#{url_for_solr}/admin/file?file=/velocity/img/globe_256.png&contentType=image/png" id="locale_pic" title="locale_select" width="30px" height="27px"/></a>
+ <ul>
+ <li><a href="#url_for_locale('fr_FR')" #if("#current_locale"=="fr_FR")class="hidden"#end>
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/france_640.png&contentType=image/png" id="french_flag" width="40px" height="40px"/>Français</a></li>
+ <li><a href="#url_for_locale('de_DE')" #if("#current_locale"=="de_DE")class="hidden"#end>
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/germany_640.png&contentType=image/png" id="german_flag" width="40px" height="40px"/>Deutsch</a></li>
+ <li><a href="#url_for_locale('')" #if("#current_locale"=="")class="hidden"#end>
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/english_640.png&contentType=image/png" id="english_flag" width="40px" height="40px"/>English</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
#if($response.response.error.code)
<div class="error">
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/macros.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/macros.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/macros.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/macros.vm Thu Jun 4 19:24:05 2015
@@ -1,7 +1,7 @@
#macro(lensNoQ)?#if($list.size($response.responseHeader.params.getAll("fq")) > 0)&#fqs($response.responseHeader.params.getAll("fq"))#end#sort($request.params.getParams('sort'))#end
## lens modified for example/files - to use fq from responseHeader rather than request, and #debug removed too as it is built into browse params now, also added type to lens
-#macro(lens)#lensNoQ#q&type=#current_type#end
+#macro(lens)#lensNoQ#q&type=#current_type#if("#current_locale"!="")&locale=#current_locale#end#end
# TODO: make this parameterized fully, no context sensitivity
@@ -44,5 +44,7 @@ $pad$v## #TODO: $esc.html() or maybe ma
#end
## Macros defined custom for the "files" example
-#macro(url_for_type $type)#url_for_home#lensNoQ#q&type=$type#end
+#macro(url_for_type $type)#url_for_home#lensNoQ#q&type=$type#if("#current_locale"!="")&locale=#current_locale#end#end
#macro(current_type)#if($response.responseHeader.params.type)${response.responseHeader.params.type}#{else}all#end#end
+#macro(url_for_locale $locale)#url_for_home#lensNoQ#q&type=#current_type#if($locale!="")&locale=$locale#end#end
+#macro(current_locale)$!{response.responseHeader.params.locale}#end
Modified: lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/results_list.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/results_list.vm?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/results_list.vm (original)
+++ lucene/dev/branches/LUCENE-6481/solr/example/files/conf/velocity/results_list.vm Thu Jun 4 19:24:05 2015
@@ -1,11 +1,11 @@
<ul id="tabs">
- <li><a href="#url_for_type('all')" #if("#current_type"=="all")class="selected"#end>All Types ($response.response.facet_counts.facet_queries.all_types)</a></li>
+ <li><a href="#url_for_type('all')" #if("#current_type"=="all")class="selected"#end>$resource.type.all ($response.response.facet_counts.facet_queries.all_types)</a></li>
#foreach($type in $response.response.facet_counts.facet_fields.doc_type)
#if($type.key)
- <li><a href="#url_for_type($type.key)" #if("#current_type"==$type.key)class="selected"#end>$type.key ($type.value)</a></li>
+ <li><a href="#url_for_type($type.key)" #if("#current_type"==$type.key)class="selected"#end> #if($resource.get("type.${type.key}.label"))$resource.get("type.${type.key}.label")#else$type.key#end ($type.value)</a></li>
#else
#if($type.value > 0)
- <li><a href="#url_for_type('unknown')" #if("#current_type"=="unknown")class="selected"#end>Unknown ($type.value)</a></li>
+ <li><a href="#url_for_type('unknown')" #if("#current_type"=="unknown")class="selected"#end>$resource.type.unknown ($type.value)</a></li>
#end
#end
#end
@@ -17,3 +17,5 @@
#parse("hit.vm")
#end
</div>
+
+
Modified: lucene/dev/branches/LUCENE-6481/solr/server/resources/log4j.properties
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/server/resources/log4j.properties?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/server/resources/log4j.properties (original)
+++ lucene/dev/branches/LUCENE-6481/solr/server/resources/log4j.properties Thu Jun 4 19:24:05 2015
@@ -4,8 +4,8 @@ log4j.rootLogger=INFO, file, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x [%X{collection} %X{shard} %X{replica} %X{core}] \u2013 %m%n
+log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
#- size rotation with log cleanup.
log4j.appender.file=org.apache.log4j.RollingFileAppender
@@ -14,8 +14,8 @@ log4j.appender.file.MaxBackupIndex=9
#- File to log to and log format
log4j.appender.file.File=${solr.log}/solr.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; [%X{collection} %X{shard} %X{replica} %X{core}] %C; %m\n
+log4j.appender.file.layout=org.apache.log4j.EnhancedPatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m\n
log4j.logger.org.apache.zookeeper=WARN
log4j.logger.org.apache.hadoop=WARN
Modified: lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -157,7 +157,7 @@
-->
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
- <int name="">${solr.ulog.numVersionBuckets:65536}</int>
+ <int name="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int>
</updateLog>
<!-- AutoCommit
Modified: lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -244,19 +244,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
@@ -335,7 +322,7 @@
-->
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
- <int name="">${solr.ulog.numVersionBuckets:65536}</int>
+ <int name="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int>
</updateLog>
<!-- AutoCommit
Modified: lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml Thu Jun 4 19:24:05 2015
@@ -246,19 +246,6 @@
-->
<lockType>${solr.lock.type:native}</lockType>
- <!-- Unlock On Startup
-
- If true, unlock any held write or commit locks on startup.
- This defeats the locking mechanism that allows multiple
- processes to safely access a lucene index, and should be used
- with care. Default is "false".
-
- This is not needed if lock type is 'single'
- -->
- <!--
- <unlockOnStartup>false</unlockOnStartup>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
@@ -338,7 +325,7 @@
-->
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
- <int name="">${solr.ulog.numVersionBuckets:65536}</int>
+ <int name="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int>
</updateLog>
<!-- AutoCommit
Modified: lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java Thu Jun 4 19:24:05 2015
@@ -1068,7 +1068,7 @@ public class CloudSolrClient extends Sol
for (String s : collectionNames) {
if(s!=null) collectionStateCache.remove(s);
}
- throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "Not enough nodes to handle the request");
+ throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "Could not find a healthy node to handle the request.");
}
Collections.shuffle(theUrlList, rand);
Modified: lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java Thu Jun 4 19:24:05 2015
@@ -329,6 +329,7 @@ public class ZkStateReader implements Cl
// update volatile
ZkStateReader.this.clusterState = constructState(ln, thisWatch);
}
+ log.info("Updated cluster state version to " + ZkStateReader.this.clusterState.getZkClusterStateVersion());
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.SESSIONEXPIRED
|| e.code() == KeeperException.Code.CONNECTIONLOSS) {
Modified: lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java Thu Jun 4 19:24:05 2015
@@ -1,5 +1,7 @@
package org.apache.solr.common.util;
+import java.util.Collection;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -35,42 +37,37 @@ import org.slf4j.MDC;
public class ExecutorUtil {
public static Logger log = LoggerFactory.getLogger(ExecutorUtil.class);
+ // this will interrupt the threads! Lucene and Solr do not like this because it can close channels, so only use
+ // this if you know what you are doing - you probably want shutdownAndAwaitTermination
public static void shutdownNowAndAwaitTermination(ExecutorService pool) {
pool.shutdown(); // Disable new tasks from being submitted
- pool.shutdownNow(); // Cancel currently executing tasks
+ pool.shutdownNow(); // Cancel currently executing tasks - NOTE: this interrupts!
boolean shutdown = false;
while (!shutdown) {
try {
// Wait a while for existing tasks to terminate
- shutdown = pool.awaitTermination(5, TimeUnit.SECONDS);
+ shutdown = pool.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
// Preserve interrupt status
Thread.currentThread().interrupt();
}
if (!shutdown) {
- pool.shutdownNow(); // Cancel currently executing tasks
+ pool.shutdownNow(); // Cancel currently executing tasks - NOTE: this interrupts!
}
}
}
-
- public static void shutdownAndAwaitTermination(ExecutorService pool) {
- shutdownAndAwaitTermination(pool, 60, TimeUnit.SECONDS);
- }
- public static void shutdownAndAwaitTermination(ExecutorService pool, long timeout, TimeUnit timeUnit) {
+ public static void shutdownAndAwaitTermination(ExecutorService pool) {
pool.shutdown(); // Disable new tasks from being submitted
boolean shutdown = false;
while (!shutdown) {
try {
// Wait a while for existing tasks to terminate
- shutdown = pool.awaitTermination(timeout, timeUnit);
+ shutdown = pool.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
// Preserve interrupt status
Thread.currentThread().interrupt();
}
- if (!shutdown) {
- pool.shutdownNow(); // Cancel currently executing tasks
- }
}
}
@@ -128,8 +125,19 @@ public class ExecutorUtil {
@Override
public void execute(final Runnable command) {
final Map<String, String> submitterContext = MDC.getCopyOfContextMap();
- String ctxStr = submitterContext != null && !submitterContext.isEmpty() ?
- submitterContext.toString().replace("/", "//") : "";
+ StringBuilder contextString = new StringBuilder();
+ if (submitterContext != null) {
+ Collection<String> values = submitterContext.values();
+
+ for (String value : values) {
+ contextString.append(value + " ");
+ }
+ if (contextString.length() > 1) {
+ contextString.setLength(contextString.length() - 1);
+ }
+ }
+
+ String ctxStr = contextString.toString().replace("/", "//");
final String submitterContextStr = ctxStr.length() <= MAX_THREAD_NAME_LEN ? ctxStr : ctxStr.substring(0, MAX_THREAD_NAME_LEN);
final Exception submitterStackTrace = new Exception("Submitter stack trace");
super.execute(new Runnable() {
Modified: lucene/dev/branches/LUCENE-6481/solr/solrj/src/test-files/log4j.properties
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/solrj/src/test-files/log4j.properties?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/solrj/src/test-files/log4j.properties (original)
+++ lucene/dev/branches/LUCENE-6481/solr/solrj/src/test-files/log4j.properties Thu Jun 4 19:24:05 2015
@@ -3,8 +3,28 @@ log4j.rootLogger=INFO, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.err
-log4j.appender.CONSOLE.layout=org.apache.solr.util.SolrLogLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; %C; %m\n
-
+log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r %-5p (%t) [%X{node_name} %X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
log4j.logger.org.apache.zookeeper=WARN
log4j.logger.org.apache.hadoop=WARN
+log4j.logger.org.apache.directory=WARN
+log4j.logger.org.apache.solr.hadoop=INFO
+
+#log4j.logger.org.apache.solr.update.processor.LogUpdateProcessor=DEBUG
+#log4j.logger.org.apache.solr.update.processor.DistributedUpdateProcessor=DEBUG
+#log4j.logger.org.apache.solr.update.PeerSync=DEBUG
+#log4j.logger.org.apache.solr.core.CoreContainer=DEBUG
+#log4j.logger.org.apache.solr.cloud.RecoveryStrategy=DEBUG
+#log4j.logger.org.apache.solr.cloud.SyncStrategy=DEBUG
+#log4j.logger.org.apache.solr.handler.admin.CoreAdminHandler=DEBUG
+#log4j.logger.org.apache.solr.cloud.ZkController=DEBUG
+#log4j.logger.org.apache.solr.update.DefaultSolrCoreState=DEBUG
+#log4j.logger.org.apache.solr.common.cloud.ConnectionManager=DEBUG
+#log4j.logger.org.apache.solr.update.UpdateLog=DEBUG
+#log4j.logger.org.apache.solr.cloud.ChaosMonkey=DEBUG
+#log4j.logger.org.apache.solr.update.TransactionLog=DEBUG
+#log4j.logger.org.apache.solr.handler.ReplicationHandler=DEBUG
+#log4j.logger.org.apache.solr.handler.IndexFetcher=DEBUG
+
+#log4j.logger.org.apache.solr.common.cloud.ClusterStateUtil=DEBUG
+#log4j.logger.org.apache.solr.cloud.OverseerAutoReplicaFailoverThread=DEBUG
\ No newline at end of file
Modified: lucene/dev/branches/LUCENE-6481/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java Thu Jun 4 19:24:05 2015
@@ -84,14 +84,12 @@ public class CloudSolrClientTest extends
@BeforeClass
public static void beforeSuperClass() {
- AbstractZkTestCase.SOLRHOME = new File(SOLR_HOME());
+ // this is necessary because AbstractZkTestCase.buildZooKeeper is used by AbstractDistribZkTestBase
+ // and the auto-detected SOLRHOME=TEST_HOME() does not exist for solrj tests
+ // todo fix this
+ AbstractZkTestCase.SOLRHOME = new File(SOLR_HOME());
}
-
- @AfterClass
- public static void afterSuperClass() {
-
- }
-
+
protected String getCloudSolrConfig() {
return "solrconfig.xml";
}
@@ -105,15 +103,6 @@ public class CloudSolrClientTest extends
return SOLR_HOME;
}
- @Override
- public void distribSetUp() throws Exception {
- super.distribSetUp();
- // we expect this time of exception as shards go up and down...
- //ignoreException(".*");
-
- System.setProperty("numShards", Integer.toString(sliceCount));
- }
-
public CloudSolrClientTest() {
super();
sliceCount = 2;
Modified: lucene/dev/branches/LUCENE-6481/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Thu Jun 4 19:24:05 2015
@@ -17,9 +17,41 @@
package org.apache.solr;
-import com.carrotsearch.randomizedtesting.RandomizedContext;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+
+import javax.xml.xpath.XPathExpressionException;
+
import org.apache.commons.codec.Charsets;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.analysis.MockAnalyzer;
@@ -55,7 +87,6 @@ import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.solr.core.SolrXmlConfig;
-import org.apache.solr.core.ZkContainer;
import org.apache.solr.handler.UpdateRequestHandler;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
@@ -83,42 +114,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
-import javax.xml.xpath.XPathExpressionException;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.regex.Pattern;
-
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.carrotsearch.randomizedtesting.RandomizedContext;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
/**
* A junit4 Solr test harness that extends LuceneTestCaseJ4. To change which core is used when loading the schema and solrconfig.xml, simply
@@ -209,7 +207,6 @@ public abstract class SolrTestCaseJ4 ext
System.setProperty("enable.update.log", usually() ? "true" : "false");
System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
System.setProperty("solr.clustering.enabled", "false");
- setupLogging();
startTrackingSearchers();
ignoreException("ignore_exception");
newRandomConfig();
@@ -229,13 +226,18 @@ public abstract class SolrTestCaseJ4 ext
try {
deleteCore();
resetExceptionIgnores();
- endTrackingSearchers();
- String orr = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();
- if (!RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class)) {
- assertNull(orr, orr);
- } else {
- if (orr != null) {
- log.warn("Some resources were not closed, shutdown, or released. This has been ignored due to the SuppressObjectReleaseTracker annotation.");
+
+ if (suiteFailureMarker.wasSuccessful()) {
+ // if the tests passed, make sure everything was closed / released
+ endTrackingSearchers();
+ String orr = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();
+ if (!RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class)) {
+ assertNull(orr, orr);
+ } else {
+ if (orr != null) {
+ log.warn(
+ "Some resources were not closed, shutdown, or released. This has been ignored due to the SuppressObjectReleaseTracker annotation.");
+ }
}
}
resetFactory();
@@ -396,33 +398,6 @@ public abstract class SolrTestCaseJ4 ext
super.tearDown();
}
- public static SolrLogFormatter formatter;
-
- public static void setupLogging() {
- boolean register = false;
- Handler[] handlers = java.util.logging.Logger.getLogger("").getHandlers();
- ConsoleHandler consoleHandler = null;
- for (Handler handler : handlers) {
- if (handler instanceof ConsoleHandler) {
- consoleHandler = (ConsoleHandler)handler;
- break;
- }
- }
-
- if (consoleHandler == null) {
- consoleHandler = new ConsoleHandler();
- register = true;
- }
-
- consoleHandler.setLevel(Level.ALL);
- formatter = new SolrLogFormatter();
- consoleHandler.setFormatter(formatter);
-
- if (register) {
- java.util.logging.Logger.getLogger("").addHandler(consoleHandler);
- }
- }
-
public static void setLoggingLevel(Level level) {
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("");
logger.setLevel(level);