Github user gaol commented on the pull request:

    https://github.com/apache/activemq-artemis/pull/495#issuecomment-218057390
  
    Would you please tell which test it breaks if any?
    
    This test actually reveals a failure in paging IMHO:
    
    When `PageSubscriptionImpl.cleanupEntries(boolean)`  is called in 
PagingStore's executor, and one page is considered completed, then a 
`PAGE_CURSOR_COMPLETE` record is appended to message journal for this page in a 
transactional operation.
    
    Normally, the page will be deleted after the transaction is committed by 
the cleanup process(`PageCursorProviderImpl.cleanup()`), then a `DeleteRecord` 
record is appended to the message journal for this page. Sometimes, the page 
won't get deleted when the PagingStore is stopped during the cleanup process. 
But it is fine too because the server's restart will clean up the page anyway.
    
    Failure happens on conditions:
    
     * The completed page is not deleted by the cleanup process, and the 
`PAGE_CURSOR_COMPLETE` record survives.
     * The completed page is deleted manually after the server is stopped
     * Server is restarted, the `PAGE_CURSOR_COMPLETE` record still survivals, 
because there is no such page file in the paging store, and the clean up 
process does nothing about it.
     * Client sends many messages to the server so that the server starts to 
page messages to paging store, and the new page file has the same page 
number(like page number: 120 in this test failure) with the survival 
`completed` page above.
    
    In such conditions, the new page file will be considered completed, which 
leads to the messages in this page file won't get consumed. It is kind of 
missing messages.
    
    The fix in this PR tries to append the `DeleteRecord` record for the 
associated `PAGE_CURSOR_COMPLETE` record when a message is stored in a paging 
file and clear the `completed` flag in the 
`PageSubscriptionImpl.PageCursorInfo`. I think at this moment, the page should 
**NOT** be considered `completed`, and the completed flag should be cleared if 
any. I am a little confused why it breaks the implementation?
    
    This is my first try on Artemis issue, there must be many 
misunderstandings, it will be very appreciated if you can give me any light on 
that. Thank you. :-)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to