[
https://issues.apache.org/jira/browse/AMQ-9646?focusedWorklogId=956116&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-956116
]
ASF GitHub Bot logged work on AMQ-9646:
---------------------------------------
Author: ASF GitHub Bot
Created on: 07/Feb/25 16:58
Start Date: 07/Feb/25 16:58
Worklog Time Spent: 10m
Work Description: mattrpav commented on code in PR #1377:
URL: https://github.com/apache/activemq/pull/1377#discussion_r1946862930
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java:
##########
@@ -733,35 +734,56 @@ public void execute(Transaction tx) throws Exception {
}
@Override
- public void recoverNextMessages(final int offset, final int
maxReturned, final MessageRecoveryListener listener) throws Exception {
+ public void recoverMessages(final MessageRecoveryContext
messageRecoveryContext) throws Exception {
indexLock.writeLock().lock();
try {
pageFile.tx().execute(new Transaction.Closure<Exception>() {
@Override
public void execute(Transaction tx) throws Exception {
StoredDestination sd = getStoredDestination(dest, tx);
+
+ Long startSequenceOffset = null;
+ Long endSequenceOffset = null;
+
+ if(messageRecoveryContext.getStartMessageId() != null
&& !messageRecoveryContext.getStartMessageId().isBlank()) {
+ startSequenceOffset = sd.messageIdIndex.get(tx,
messageRecoveryContext.getStartMessageId());
+ }
+
+ if(startSequenceOffset == null) {
+ startSequenceOffset =
messageRecoveryContext.getOffset();
+ }
+
+ if(messageRecoveryContext.getEndMessageId() != null &&
!messageRecoveryContext.getEndMessageId().isBlank()) {
+ endSequenceOffset = sd.messageIdIndex.get(tx,
messageRecoveryContext.getEndMessageId());
+ }
+
+ if(endSequenceOffset == null) {
+ endSequenceOffset = startSequenceOffset +
Long.valueOf(messageRecoveryContext.getMaxMessageCountReturned());
+ }
+
+ if(endSequenceOffset < startSequenceOffset) {
+ // Fast fail on invalid scenario
+ return;
+ }
+
+
messageRecoveryContext.setEndSequenceId(endSequenceOffset);
Entry<Long, MessageKeys> entry = null;
- int position = 0;
- int counter =
recoverRolledBackAcks(destination.getPhysicalName(), sd, tx, maxReturned,
listener);
- Set ackedAndPrepared =
ackedAndPreparedMap.get(destination.getPhysicalName());
- for (Iterator<Entry<Long, MessageKeys>> iterator =
sd.orderIndex.iterator(tx); iterator.hasNext(); ) {
+ recoverRolledBackAcks(destination.getPhysicalName(),
sd, tx, messageRecoveryContext.getMaxMessageCountReturned(),
messageRecoveryContext);
+ Set<String> ackedAndPrepared =
ackedAndPreparedMap.get(destination.getPhysicalName());
+ Iterator<Entry<Long, MessageKeys>> iterator =
(messageRecoveryContext.isUseDedicatedCursor() ? sd.orderIndex.iterator(tx, new
MessageOrderCursor(startSequenceOffset)) : sd.orderIndex.iterator(tx));
Review Comment:
done
Issue Time Tracking
-------------------
Worklog Id: (was: 956116)
Time Spent: 3h 40m (was: 3.5h)
> Support selecting specific messages for command line backup
> -----------------------------------------------------------
>
> Key: AMQ-9646
> URL: https://issues.apache.org/jira/browse/AMQ-9646
> Project: ActiveMQ Classic
> Issue Type: Improvement
> Reporter: Matt Pavlovich
> Assignee: Matt Pavlovich
> Priority: Minor
> Fix For: 6.2.0, 5.19.0
>
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact