mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
SEARCH-2028: New Web Script service to provide the next transaction commit time from a given time commit. (#508)
This feature will be used by SOLR MetadataTracker to improve performance.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -37,7 +37,7 @@
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
<img.exe>convert</img.exe>
|
||||
|
||||
<dependency.alfresco-repository.version>8.86</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-repository.version>8.89</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-data-model.version>8.85</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-core.version>8.20</dependency.alfresco-core.version>
|
||||
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.solr;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.domain.node.ibatis.NodeDAOImpl;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* Returns the next transaction commit time from a given commit time.
|
||||
* This webscript is used to skip long periods where the repository is not ingesting new content.
|
||||
*
|
||||
* @author aborroy
|
||||
*
|
||||
*/
|
||||
public class NextTransactionGet extends DeclarativeWebScript
|
||||
{
|
||||
|
||||
private NodeDAOImpl nodeDAO;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
|
||||
{
|
||||
Long fromCommitTime = Long.parseLong(req.getParameter("fromCommitTime"));
|
||||
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("nextTransactionCommitTimeMs", nodeDAO.getNextTxCommitTime(fromCommitTime));
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setNodeDAO(NodeDAOImpl nodeDAO)
|
||||
{
|
||||
this.nodeDAO = nodeDAO;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
<webscript>
|
||||
<shortname>Get the next transaction commit time from a given transaction commit time</shortname>
|
||||
<description>
|
||||
Get the next transaction commit time from a given transaction commit time [fromCommitTime]
|
||||
If no new transaction exists, -1 is returned.
|
||||
</description>
|
||||
<url>/api/solr/nextTransaction?fromCommitTime={fromCommitTime}</url>
|
||||
<format default="json">argument</format>
|
||||
<!-- Solr api is protected by a solr-specific authentication mechanism -->
|
||||
<authentication>none</authentication>
|
||||
<transaction allow="readonly">required</transaction>
|
||||
<lifecycle>internal</lifecycle>
|
||||
<family>SOLR</family>
|
||||
</webscript>
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"nextTransactionCommitTimeMs": <#if nextTransactionCommitTimeMs??>${nextTransactionCommitTimeMs?c}<#else>-1</#if>
|
||||
}
|
@@ -1267,6 +1267,13 @@
|
||||
<property name="nodeDAO" ref="nodeDAO" />
|
||||
</bean>
|
||||
|
||||
<!-- /api/solr webscript returning the min txId in a nodeId range -->
|
||||
<bean id="webscript.org.alfresco.repository.solr.nextTransactionCommitTime.get"
|
||||
class="org.alfresco.repo.web.scripts.solr.NextTransactionGet"
|
||||
parent="webscript">
|
||||
<property name="nodeDAO" ref="nodeDAO" />
|
||||
</bean>
|
||||
|
||||
<!-- -->
|
||||
<!-- Node Locator -->
|
||||
<!-- -->
|
||||
|
Reference in New Issue
Block a user