You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2017/12/29 16:04:27 UTC

[GitHub] denyeart opened a new issue #1083: GET _index does not immediately return indexes created with POST _index

denyeart opened a new issue #1083: GET _index does not immediately return indexes created with POST _index
URL: https://github.com/apache/couchdb/issues/1083
 
 
   I am using the POST and DELETE _index APIs in CouchDB 2.0.0. I realize the index will be built out asynchronously, but it looks like even the index definition is not registered synchronously.  Queries to GET _index will not display a created index until a couple milliseconds later (and will not remove a deleted index from the list until a couple milliseconds later).  These couple milliseconds are no big deal in most use cases, but in our case the problem shows up in unit tests that validate (via GET) that a created index (via POST) did in fact get defined in CouchDB. Also if CouchDB crashed in that time window we would expect the index definition would be persisted since the client already received a 200 ?created? result.  The problem persists even if I do a _ensure_full_commit after the index POST but before the index GET. I am using a single node CouchDB (n=1), so no cluster complications. I would have expected that design doc (index) creation would follow the same guarantees as regular doc creation, that is, the created document should be immediately queryable after getting a 200 ?created? result.
   
   ## Expected Behavior
   Indexes that are created via POST /{db}/_index and return a 200 "created" result should immediately be available in GET /{db}/_index queries.
   
   ## Current Behavior
   Index can not be retrieved via GET /{db}/_index until a few milliseconds after receiving 200 ?created? result.
   
   ## Possible Solution
   I would have expected that design doc (index) creation would follow the same guarantees as regular doc creation, that is, the created document should be immediately queryable after getting a 200 ?created? result.
   
   ## Steps to Reproduce (for bugs)
   2017-12-28 19:37:30.658 POST /testindexoperations/_index
   2017-12-28 19:37:30.660 POST /testindexoperations/_ensure_full_commit
   2017-12-28 19:37:30.661 GET /testindexoperations/_index/   <-- INDEX NOT IN LIST
   2017-12-28 19:37:30.662 GET /testindexoperations/_index/  <-- INDEX NOT IN LIST
   2017-12-28 19:37:30.664 GET /testindexoperations/_index/  <-- INDEX IN LIST
   
   ## Context
   In our case the problem shows up in unit tests that validate (via GET) that a created index (via POST) did in fact get defined in CouchDB.
   In the real world, if CouchDB crashed in that time window we would expect the index definition would be persisted since the client already received a 200 ?created? result. 
   
   ## Your Environment
   * Version used: 2.0.0
   

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


With regards,
Apache Git Services