Skip to content

ARTEMIS-6361 An id the duplicate id cache holds in two slots stays a duplicate until its newer slot is overwritten - #6882

Open
grepjava wants to merge 1 commit into
apache:mainfrom
grepjava:ARTEMIS-6361
Open

grepjava wants to merge 1 commit into
apache:mainfrom
grepjava:ARTEMIS-6361

Conversation

@grepjava

@grepjava grepjava commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

InMemoryDuplicateIDCache.addToCacheInMemory and PersistentDuplicateIDCache.addToCacheInMemory put the new id in the map at pos, then removed the id of the slot they overwrote from the map, whichever slot the map pointed at. When that id was also held in a newer slot (one transaction sent it twice, ARTEMIS-6360, or two transactions that sent it both committed), the entry removed was the newer slot's, so the id stopped being a duplicate while the cache still held it. When the overwritten id was the new one (the same id added twice with id-cache-size 1), the entry just put was removed.

The overwritten id is now removed from the map only if the map still points at that slot, and the new id is put after it.

DuplicateDetectionUnitTest.testIdHeldTwiceInMemory and testIdHeldTwicePersistent add "same" twice to a cache of 3, then "other" and "new", and check that "same" is still a duplicate, that it goes once its newer slot is overwritten, and that with a cache of 1 an id added twice stays. They fail without the fix.

https://issues.apache.org/jira/browse/ARTEMIS-6361

…duplicate until its newer slot is overwritten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant