priyath opened a new issue #2045: Stale couch view after purging document with 
conflicted revision tree
URL: https://github.com/apache/couchdb/issues/2045
 
 
   A couple of days back, I raised a question regarding a sporadic issue we 
observed related to Couch views returning stale data. (Reference: 
https://github.com/apache/couchdb/issues/2040)
   
   I have found out the reason for this and would like some insight from the 
community to understand this problem better.
   
   ## Description
   We have a production setup with multiple local Couch databases (replicating 
amongst each other) syncing with a master cloud Couch database. There have been 
instances with documents having conflicting revision trees but for the most 
part, this has not caused any problems. 
   
   Our Couch databases also go through a scheduled daily purge where specific 
documents (after a grace period) gets purged from the database. 
   
   The issue we have observed is as follows:
   
   When a document with a conflicting revision tree is purged, it gets reverted 
back to the leaf revision of the conflicting revision tree. (I understand this 
happens because we do not specify the conflicting revision in the _purge POST 
request)
   
   This reverted document is caught in the next purge window and is purged 
again which gets rid of the document entirely from the database as expected. 
However, when related views are queried for data, this is not reflected; The 
document Id is still visible in the queried data.
   
   ## Steps to Reproduce
   Pre-requisites:
   * A document with a conflicting revision tree
   * A view that retrieves the above document Id
   
   Step 1: Purge the document, specifying the latest revision. This will revert 
the document to the leaf of the conflicting tree
   
   Step 2: Purge the document again, this time specifying the leaf of the 
conflicting tree.
   
   Step 3: Perform a purge of another document to ensure the diff between the 
purge sequence of the database is greater than the purge sequence of the view 
by more than 1. (Based on documents, this will trigger a complete rebuilding of 
the indexes)
   
   Step 4: Access the view. The purged document Id (now completely removed from 
the database) will still be returned.
   
   ## Expected Behaviour
   The view should not return Ids of documents that are purged completely.
   
   ## Your Environment
   * CouchDB Version used: CouchDB 1.6.1
   * Browser name and version: Chrome
   * Operating System and version: Ubuntu
   
   ## Additional context
   The fix that I plan on implementing is to specify all leaf revisions 
(including that of conflicting branches) when initiating the purge. 
   
   However, I would also like to understand what exactly is happening here for 
the document Id to not get removed from the index when the conflicting revision 
tree is purged from the database.
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to