Repository navigation
ARTEMIS-6336 JournalHashMap.clear() leaves the map's records in the journal - #6844
Merged
Merged
Conversation
Contributor
|
Any chance you could work up an MQTT-specific test for this? I could have sworn this was already covered somewhere in one of these:
If not, I'll take a closer look tomorrow when I'm back online. Thanks! |
grepjava
force-pushed
the
ARTEMIS-6336
branch
from
October 28, 2026 23:14
fa734c4 to
a274031
Compare
Contributor
Author
|
There wasn't one. Those tests clear the session only after the correlations are already gone, and none restarts after a clean start. I added |
Contributor
|
Great work, @grepjava. Many thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JournalHashMap.clear()passed eachMapRecordtoremove(Object key). No key equals a record, so every lookup missed, no delete record was written, andmap.clear()emptied the map in memory only. MQTT callsclear()fromMQTTStateManager.clearPacketIdCorrelationwhen a client starts a clean session, so the client's packet ID correlation records stayed in the journal and came back after a restart, holding their packet IDs as in use.clear()now callsremoved(record)for each record, which writes the delete. Removing by key while iterating the values would throw aConcurrentModificationException.JournalHashMapTest.testClearRemovesRecordsputs 100 entries, clears the map and loads the journal again, and checks no record comes back. It fails without the fix: all 100 records are reloaded.QoS1SubscriberResiliencyTest.testQoS1CleanStartBeforePubAckSentThenBrokerRestartdoes the same through MQTT: a subscriber with a persistent session gets a QoS 1 PUBLISH whose PUBACK never reaches the broker, reconnects with a clean start, and the broker restarts. It fails without the fix: the client's packet ID correlation is reloaded.https://issues.apache.org/jira/browse/ARTEMIS-6336