added option to re-boot the embedded solr during run-time. Added also

API recording for this method so it can be repeated automatically. The
index dump generation is now also available for API recording. Added
some synchronization in backend which was necessary for this.
pull/1/head
Michael Peter Christen 12 years ago
parent 80a7989e8c
commit 281959a2d7

@ -161,6 +161,15 @@ function updatepage(str) {
</dd>
</dl>
</fieldset>
</form>
<form action="IndexControlURLs_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset><legend>Reboot Solr Core</legend>
<dl>
<dt class="TableCellLight">&nbsp;</dt>
<dd><input type="submit" name="rebootsolr" value="Shut Down and Re-Start Solr" class="submitready" style="width:240px;"/>
</dd>
</dl>
</fieldset>
</form>::
#(/dumprestore)#

@ -270,6 +270,7 @@ public class IndexControlURLs_p {
final File dump = segment.fulltext().dumpSolr();
prop.put("indexdump", 1);
prop.put("indexdump_dumpfile", dump.getAbsolutePath());
sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr dump generation");
}
if (post.containsKey("indexrestore")) {
@ -277,6 +278,11 @@ public class IndexControlURLs_p {
segment.fulltext().restoreSolr(dump);
}
if (post.containsKey("rebootsolr")) {
segment.fulltext().rebootSolr();
sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr reboot");
}
if (post.containsKey("deletedomain")) {
final String domain = post.get("domain");
segment.fulltext().deleteDomainHostname(domain, null);

@ -221,12 +221,16 @@ public final class Fulltext {
}
public SolrConnector getDefaultConnector() {
synchronized (this.solrInstances) {
return this.solrInstances.getDefaultMirrorConnector();
}
}
public SolrConnector getWebgraphConnector() {
synchronized (this.solrInstances) {
return this.solrInstances.getMirrorConnector(WebgraphSchema.CORE_NAME);
}
}
public void clearCache() {
if (this.urlIndexFile != null && this.urlIndexFile instanceof Cache) ((Cache) this.urlIndexFile).clearCache();
@ -247,6 +251,7 @@ public final class Fulltext {
}
public void clearLocalSolr() throws IOException {
synchronized (this.solrInstances) {
EmbeddedInstance instance = this.solrInstances.getSolr0();
if (instance != null) {
for (String name: instance.getCoreNames()) new EmbeddedSolrConnector(instance, name).clear();
@ -254,14 +259,17 @@ public final class Fulltext {
this.commit(false);
this.solrInstances.clearCache();
}
}
public void clearRemoteSolr() throws IOException {
synchronized (this.solrInstances) {
ShardInstance instance = this.solrInstances.getSolr1();
if (instance != null) {
for (String name: instance.getCoreNames()) new RemoteSolrConnector(instance, name).clear();
}
this.solrInstances.clearCache();
}
}
/**
* get the size of the default index
@ -822,6 +830,22 @@ public final class Fulltext {
}
}
/**
* reboot solr (experimental to check resource management
*/
public void rebootSolr() {
synchronized (this.solrInstances) {
this.disconnectLocalSolr();
this.solrInstances.close();
this.solrInstances = new InstanceMirror();
try {
this.connectLocalSolr();
} catch (IOException e) {
Log.logException(e);
}
}
}
// export methods
public Export export(final File f, final String filter, final int format, final boolean dom) {
if ((this.exportthread != null) && (this.exportthread.isAlive())) {

Loading…
Cancel
Save