[ https://issues.apache.org/jira/browse/AMQ-9541?focusedWorklogId=927652&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-927652 ]
ASF GitHub Bot logged work on AMQ-9541: --------------------------------------- Author: ASF GitHub Bot Created on: 27/Jul/24 11:22 Start Date: 27/Jul/24 11:22 Worklog Time Spent: 10m Work Description: AlexejTimonin commented on code in PR #1275: URL: https://github.com/apache/activemq/pull/1275#discussion_r1693942546 ########## activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java: ########## @@ -620,12 +618,12 @@ public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination dest @Override public void doRecoverNextMessagesWithPriority(TransactionContext c, ActiveMQDestination destination, String clientId, - String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception { + String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception { PreparedStatement s = null; ResultSet rs = null; try { - s = c.getConnection().prepareStatement(this.statements.getFindDurableSubMessagesByPriorityStatement()); + s = c.getConnection().prepareStatement(this.limitQuery(this.statements.getFindDurableSubMessagesByPriorityStatement())); s.setMaxRows(Math.min(maxReturned * 2, maxRows)); Review Comment: Not an expert, but I did some git blame digging, the * 2 got introduced in https://issues.apache.org/jira/browse/AMQ-2980, to take into account the messages from low and high priority queues, to ensure that none get lost. Down the road this happened ``java.sql.SQLException: setMaxRows() out of range. 50871918 > 50000000.`` (https://issues.apache.org/jira/browse/AMQ-1870). The solution to this was to pick the lowest of two values ``(maxReturner * 2) and maxRows``, to ensure such exception does not happen. Issue Time Tracking ------------------- Worklog Id: (was: 927652) Time Spent: 40m (was: 0.5h) > Missing limit on expensive queries. > ----------------------------------- > > Key: AMQ-9541 > URL: https://issues.apache.org/jira/browse/AMQ-9541 > Project: ActiveMQ Classic > Issue Type: Bug > Affects Versions: 5.18.5, 6.1.2 > Reporter: Jean-Louis Monteiro > Priority: Major > Time Spent: 40m > Remaining Estimate: 0h > > https://issues.apache.org/jira/browse/AMQ-6049 did add the ability to limit > the size of the records returned by the database. > > Some queries do not apply the limit even though the limit is applied on the > Java side. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org For additional commands, e-mail: issues-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact