Revision: 18055
http://sourceforge.net/p/gate/code/18055
Author: ian_roberts
Date: 2014-06-10 13:46:41 +0000 (Tue, 10 Jun 2014)
Log Message:
-----------
You can now "sync" any index
- added a remote call in IndexManagementController to pass the sync request on
to a remote index
- federated index simply syncs all its components
Modified Paths:
--------------
mimir/trunk/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
mimir/trunk/mimir-web/grails-app/views/indexAdmin/admin.gsp
Modified: mimir/trunk/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
===================================================================
--- mimir/trunk/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
2014-06-10 11:02:20 UTC (rev 18054)
+++ mimir/trunk/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
2014-06-10 13:46:41 UTC (rev 18055)
@@ -109,12 +109,15 @@
title="Click to delete this index." value="Delete" />
</span></td>
</g:form>
- <g:if test="${indexInstance instanceof gate.mimir.web.LocalIndex &&
indexInstance.state == Index.READY}">
- <g:form action="sync" controller="localIndex"
id="${indexInstance?.id}" method="POST">
+ <g:if test="${indexInstance.state == Index.READY}">
+ <g:form action="sync" controller="indexAdmin"
+ params="[indexId:indexInstance.indexId]" method="POST">
<td><span class="button"><input type="submit" class="save"
value="Sync to Disk"
title="Request all documents in memory are saved to disk ASAP."
/>
</span></td>
</g:form>
+ </g:if>
+ <g:if test="${indexInstance instanceof gate.mimir.web.LocalIndex &&
indexInstance.state == Index.READY}">
<g:form action="download" controller="indexDownload"
id="${indexInstance?.id}" method="GET">
<td><span class="button"><input type="submit" class="download"
value="Download"
title="Click to download this index." />
Modified:
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
===================================================================
---
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -60,6 +60,23 @@
}
redirect(action:admin, params:params)
}
+
+ /**
+ * Ask the index to sync all documents to disk
+ */
+ def sync = {
+ def indexInstance = Index.findByIndexId(params.indexId)
+
+ if(!indexInstance) {
+ flash.message = "Index not found with index id ${params.indexId}"
+ redirect(action:admin, params:params)
+ }
+ else {
+ indexInstance.sync()
+ flash.message = "Sync to disk was requested."
+ redirect(action:admin, params:params)
+ }
+ }
def deletedDocuments = {
def indexInstance = Index.findByIndexId(params.indexId)
Modified:
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
===================================================================
---
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -48,6 +48,14 @@
}
}
+ def sync = {
+ def theIndex = Index.findByIndexId(params.indexId)
+ if(theIndex) {
+ theIndex.sync()
+ render("OK")
+ }
+ }
+
/**
* Takes a binary serialization of one or more GATE documents on the input
* stream, deserializes it and passes it to the indexer.
Modified:
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
===================================================================
---
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -249,24 +249,6 @@
}
/**
- * Ask the index to sync all documents to disk
- */
- def sync = {
- def localIndexInstance = LocalIndex.get( params.id )
-
- if(!localIndexInstance) {
- flash.message = "LocalIndex not found with id ${params.id}"
- redirect(controller:'indexManagement', action:'home')
- }
- else {
- localIndexService.getIndex(localIndexInstance).requestSyncToDisk()
- flash.message = "Sync to disk was requested."
- redirect(controller: 'indexAdmin', action: 'admin',
- params: [indexId:localIndexInstance.indexId])
- }
- }
-
- /**
* Register an existing index directory to be opened for searching.
*/
def importIndex = {
Modified:
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
===================================================================
---
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -128,5 +128,11 @@
public void undeleteDocuments(Collection<Long> documentIds) {
federatedIndexService.undeleteDocuments(this, documentIds)
}
+
+ void sync() {
+ indexes.each {
+ it.sync()
+ }
+ }
}
Modified: mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
===================================================================
--- mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++ mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -147,6 +147,13 @@
void undeleteDocuments(Collection<Long> documentIds) {
throw new UnsupportedOperationException()
}
+
+ /**
+ * Request that any outstanding indexed documents be flushed to disk.
+ */
+ void sync() {
+ throw new UnsupportedOperationException()
+ }
// Constants for the possible state values
public static final String READY = "ready" // good for searching and indexing
Modified:
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
===================================================================
--- mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++ mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -138,5 +138,8 @@
void undeleteDocuments(Collection<Long> documentIds) {
localIndexService.undeleteDocuments(this, documentIds)
}
-
+
+ void sync() {
+ localIndexService.getIndex(this).requestSyncToDisk()
+ }
}
Modified:
mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
===================================================================
--- mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
2014-06-10 11:02:20 UTC (rev 18054)
+++ mimir/trunk/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
2014-06-10 13:46:41 UTC (rev 18055)
@@ -205,4 +205,22 @@
}
}
}
+
+ /**
+ * Ask the remote index to sync.
+ */
+ void sync() {
+ String urlStr = (remoteUrl.endsWith("/") ? remoteUrl : (remoteUrl + "/"))
+
+ "manage/sync";
+ try{
+ webUtilsManager.currentWebUtils(this).getVoid(urlStr)
+ }catch(IOException e){
+ log.error("Problem communicating with the remote server!", e)
+ RemoteIndex.withTransaction{
+ //by convention, any communication error switches the index state
+ state = Index.FAILED
+ }
+ }
+ }
+
}
Modified: mimir/trunk/mimir-web/grails-app/views/indexAdmin/admin.gsp
===================================================================
--- mimir/trunk/mimir-web/grails-app/views/indexAdmin/admin.gsp 2014-06-10
11:02:20 UTC (rev 18054)
+++ mimir/trunk/mimir-web/grails-app/views/indexAdmin/admin.gsp 2014-06-10
13:46:41 UTC (rev 18055)
@@ -104,8 +104,9 @@
</span>
</td>
</g:form>
- <g:if test="${indexInstance instanceof gate.mimir.web.LocalIndex &&
indexInstance.state == Index.READY}">
- <g:form action="sync" controller="localIndex"
id="${indexInstance?.id}" method="POST">
+ <g:if test="${indexInstance.state == Index.READY}">
+ <g:form action="sync" controller="indexAdmin"
+ params="[indexId:indexInstance.indexId]" method="POST">
<td><span class="button"><input type="submit" class="save"
value="Sync to Disk"
title="Request all documents in memory are saved to disk ASAP."
/>
</span></td>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs