From 291a5ea1e0e331a107acf48f3da99af5a10ae904 Mon Sep 17 00:00:00 2001 From: Angel Borroy Date: Mon, 20 Jan 2020 14:02:10 +0100 Subject: [PATCH] Merged master to 7.N aa41767 SEARCH-2028: New SOLR database query to provide the next transaction commit time from a given time commit. --- .../repo/domain/node/AbstractNodeDAOImpl.java | 7 +++++++ .../org/alfresco/repo/domain/node/NodeDAO.java | 8 ++++++++ .../repo/domain/node/ibatis/NodeDAOImpl.java | 18 ++++++++++++++++++ .../node-common-SqlMap.xml | 9 +++++++++ 4 files changed, 42 insertions(+) diff --git a/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java b/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java index 28e0ef6cc3..051596aa89 100644 --- a/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java +++ b/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java @@ -4972,6 +4972,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO return selectMaxTxInNodeIdRange(fromNodeId, toNodeId); } + @Override + public Long getNextTxCommitTime(Long fromCommitTime) + { + return selectNextTxCommitTime(fromCommitTime); + } + /* * Abstract methods for underlying CRUD */ @@ -5142,4 +5148,5 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO protected abstract Long selectMinUnusedTxnCommitTime(); protected abstract Long selectMinTxInNodeIdRange(Long fromNodeId, Long toNodeId); protected abstract Long selectMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId); + protected abstract Long selectNextTxCommitTime(Long fromCommitTime); } diff --git a/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java b/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java index 4a4a1857b9..2759687ce8 100644 --- a/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java +++ b/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java @@ -956,4 +956,12 @@ public interface NodeDAO extends NodeBulkLoader */ 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); + } diff --git a/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java b/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java index 4782ea1fd1..bdb687dbba 100644 --- a/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java +++ b/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java @@ -168,6 +168,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; @@ -1790,6 +1791,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 */ diff --git a/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml b/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml index 09b39c5ebe..63add12f87 100644 --- a/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml +++ b/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml @@ -1523,4 +1523,13 @@ ) + + \ No newline at end of file