mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
SEARCH-2028: New SOLR database query to provide the next transaction commit time from a given time commit. (#783)
This feature will be used by SOLR MetadataTracker to improve performance.
This commit is contained in:
@@ -4868,6 +4868,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
public Long getMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId)
|
||||
{
|
||||
return selectMaxTxInNodeIdRange(fromNodeId, toNodeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNextTxCommitTime(Long fromCommitTime)
|
||||
{
|
||||
return selectNextTxCommitTime(fromCommitTime);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5037,5 +5043,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
protected abstract Long selectMaxTxnId();
|
||||
protected abstract Long selectMinUnusedTxnCommitTime();
|
||||
protected abstract Long selectMinTxInNodeIdRange(Long fromNodeId, Long toNodeId);
|
||||
protected abstract Long selectMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
|
||||
protected abstract Long selectMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
|
||||
protected abstract Long selectNextTxCommitTime(Long fromCommitTime);
|
||||
}
|
||||
|
@@ -913,5 +913,14 @@ public interface NodeDAO extends NodeBulkLoader
|
||||
* @param toNodeId Final node id
|
||||
* @return maximum commit time
|
||||
*/
|
||||
public Long getMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
|
||||
public Long getMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
|
||||
|
||||
/**
|
||||
* Gets the next commit time from [fromCommitTime]
|
||||
*
|
||||
* @param fromCommitTime Initial commit time
|
||||
* @return next commit time
|
||||
*/
|
||||
public Long getNextTxCommitTime(Long fromCommitTime);
|
||||
|
||||
}
|
||||
|
@@ -165,6 +165,7 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
||||
private static final String SELECT_ONE_TXNS_BY_COMMIT_TIME_DESC = "alfresco.node.select_OneTxnsByCommitTimeDescending";
|
||||
private static final String SELECT_TXN_MIN_TX_ID_IN_NODE_IDRANGE = "alfresco.node.select_TxnMinTxIdInNodeIdRange";
|
||||
private static final String SELECT_TXN_MAX_TX_ID_IN_NODE_IDRANGE = "alfresco.node.select_TxnMaxTxIdInNodeIdRange";
|
||||
private static final String SELECT_TXN_NEXT_TXN_COMMIT_TIME = "select_TxnNextTxnCommitTime";
|
||||
|
||||
protected QNameDAO qnameDAO;
|
||||
protected DictionaryService dictionaryService;
|
||||
@@ -1753,6 +1754,23 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
||||
return template.selectOne(SELECT_TXN_MAX_TX_ID_IN_NODE_IDRANGE, nodeRangeEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next commit time from [fromCommitTime]
|
||||
*
|
||||
* @param fromCommitTime Initial commit time
|
||||
* @return next commit time
|
||||
*/
|
||||
@Override
|
||||
public Long selectNextTxCommitTime(Long fromCommitTime)
|
||||
{
|
||||
|
||||
TransactionQueryEntity fromCommitTimeEntity = new TransactionQueryEntity();
|
||||
fromCommitTimeEntity.setMinCommitTime(fromCommitTime);
|
||||
|
||||
return template.selectOne(SELECT_TXN_NEXT_TXN_COMMIT_TIME, fromCommitTimeEntity);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DAO OVERRIDES
|
||||
*/
|
||||
|
@@ -1496,4 +1496,13 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="select_TxnNextTxnCommitTime" resultType="java.lang.Long">
|
||||
select
|
||||
min(commit_time_ms)
|
||||
from
|
||||
alf_transaction
|
||||
where
|
||||
commit_time_ms > #{minCommitTime}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user