Repository navigation
Conversation
…uplicate id cache as it was
…either commits both deliver the message
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.
For a send in a client transaction,
PostOfficeImpl.checkNotBridgeDuplicateIDcheckscache.containsandaddToCache(id, tx, false)only registers anAddDuplicateIDOperationthat adds the id after the commit is stored, so that a client resending a failed transaction is not rejected. Nothing checked the id again at the commit: two transactions that sent the same id before either committed both committed, and the message was delivered twice.That operation now checks the id against the cache again in
beforePrepare/beforeCommit, and holds it in the in-flight count from then on (released once it takes its slot after the commit, or on rollback). If another transaction committed it first,TransactionImplrolls the transaction back, as one marked rollback-only, and the commit or prepare fails withActiveMQDuplicateIdException. An open transaction still holds nothing, so a resent transaction is accepted. A prepared transaction recovered after a restart holds its ids again (load).This builds on #6883 (ARTEMIS-6362), which adds the in-flight count; until that is merged this PR also shows its commit.
DuplicateDetectionTest.testOverlappingTransactionsSendTheIdOncesends the same id from two sessions, each in a transaction, commits the first and expects the second commit to fail and one message to arrive. It fails without the fix.testXADuplicateDetection3said the second branch "Should NOT be able to resend it", but it could, and the test discarded the first receive; it now expects the prepare to fail withDUPLICATE_ID_REJECTED(astestXADuplicateDetection4does) and no message.https://issues.apache.org/jira/browse/ARTEMIS-6366