mirror of https://github.com/apache/lucene.git
SOLR-989 -- Expose running statistics from the Context API.
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@741698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
06d1dd5061
commit
8391810098
|
@ -66,6 +66,9 @@ New Features
|
|||
and NumberFormatTransformer.
|
||||
(Fergus McMenemie, Noble Paul, shalin)
|
||||
|
||||
16.SOLR-989: Expose running statistics from the Context API.
|
||||
(Noble Paul, shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
1. SOLR-846: Reduce memory consumption during delta import by removing keys when used
|
||||
|
|
|
@ -139,6 +139,10 @@ public abstract class AbstractDataImportHandlerTest extends
|
|||
public SolrCore getSolrCore() {
|
||||
return delegate.getSolrCore();
|
||||
}
|
||||
|
||||
public Map<String, Object> getStats() {
|
||||
return delegate.getStats();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class Context {
|
|||
|
||||
/**
|
||||
* An object stored in 'solrcore' scope is available across imports, entities and documents throughout the life of
|
||||
* a solr core. A solr core unload or reload will destroy this data.
|
||||
* a solr core. A solr core unload or reload will destroy this data.
|
||||
*/
|
||||
public static final String SCOPE_SOLR_CORE = "solrcore";
|
||||
|
||||
|
@ -102,7 +102,7 @@ public abstract class Context {
|
|||
/**
|
||||
* Gets a new DataSource instance with a name. Ensure that you close() this after use
|
||||
* because this is created just for this method call.
|
||||
*
|
||||
*
|
||||
* @param name Name of the dataSource as defined in the dataSource tag
|
||||
* @return a new DataSource instance
|
||||
* @see org.apache.solr.handler.dataimport.DataSource
|
||||
|
@ -172,4 +172,12 @@ public abstract class Context {
|
|||
* @return the core
|
||||
*/
|
||||
public abstract SolrCore getSolrCore();
|
||||
|
||||
/**
|
||||
* Makes available some basic running statistics such as "docCount",
|
||||
* "deletedDocCount", "rowCount", "queryCount" and "skipDocCount"
|
||||
*
|
||||
* @return a Map containing running statistics of the current import
|
||||
*/
|
||||
public abstract Map<String, Object> getStats();
|
||||
}
|
||||
|
|
|
@ -174,4 +174,9 @@ public class ContextImpl extends Context {
|
|||
public SolrCore getSolrCore() {
|
||||
return dataImporter == null ? null : dataImporter.getCore();
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> getStats() {
|
||||
return docBuilder != null ? docBuilder.importStatistics.getStatsSnapshot() : Collections.<String, Object>emptyMap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,9 +637,9 @@ public class DocBuilder {
|
|||
}
|
||||
|
||||
public static class Statistics {
|
||||
public AtomicInteger docCount = new AtomicInteger();
|
||||
public AtomicLong docCount = new AtomicLong();
|
||||
|
||||
public AtomicInteger deletedDocCount = new AtomicInteger();
|
||||
public AtomicLong deletedDocCount = new AtomicLong();
|
||||
|
||||
public AtomicLong rowsCount = new AtomicLong();
|
||||
|
||||
|
@ -655,6 +655,17 @@ public class DocBuilder {
|
|||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, Object> getStatsSnapshot() {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("docCount",docCount.get());
|
||||
result.put("deletedDocCount",deletedDocCount.get());
|
||||
result.put("rowCount",rowsCount.get());
|
||||
result.put("queryCount",rowsCount.get());
|
||||
result.put("skipDocCount",skipDocCount.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cleanByQuery(String delQuery, AtomicBoolean completeCleanDone) {
|
||||
|
|
Loading…
Reference in New Issue