anuragvohraec opened a new issue #3308: URL: https://github.com/apache/couchdb/issues/3308
[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ ) Enhance step 3 of replication protocol "Find Common Ancestry" (GET /source/_local/replication-id) to return Database **update_seq** too in response header, if a **dbseq:true** header is provided in the request. ## Summary [NOTE]: # ( Provide a brief overview of what the new feature is all about. ) As of now the first three steps of replication protocol is required to determine if a replication is requied or not : 1. Verify Peers (HEAD /peers ) 2. Get Peers Information (GET /peers to know update_seq of source and target) 3. Find Common Ancestry (GET /source/_local/replication-id) These three steps (hence 3 HTTP requests) are needed to determine if replication is required or not. However only step 3: `GET /source/_local/replication-id` must be sufficient for a client to determine if replication is required or not with remote server, if in step-3 we have a provision to provide DB update_seq and info that what went wrong. ## Desired Behaviour [NOTE]: # ( Tell us how the new feature should work. Be specific. ) [TIP]: # ( Do NOT give us access or passwords to your actual CouchDB! ) If in request "Find Common Ancestry" (GET /source/_local/replication-id) , if we provide a header dbseq=true, it must return a header update_seq: DB_UPDATE_SEQ, along with usual reply. This will make step 2 a bit redundant. And for making step 1 redudant, step 3 status text can be modified to give more information for 404, if its DB which do not exits or local doc. Now this may be not a big change, but instead of 3 HTTP request, now a client will only require 1 HTTP request to determine if replication is required or not. ## Possible Solution To make replication protocol work all good with old clients, if for request `GET /source/_local/replication-id` if a dbseq:true header is provided, then in reponse header update_seq muts be provided. And also if DB do not exist, then along with 404 status text should be "DB do not exist", and if local doc "_local/replication_id" do not exist then a corresponding message muts be provided. [NOTE]: # ( Not required. Suggest how to implement the addition or change. ) ## Additional context The aim is to reduce multiple request to remote server, when it can be done in one single request. If we can just enhance step3 (GET /source/_local/replication-id) to provide update seq of db too, then we can reduce first 3 steps to one step at client side replication. [TIP]: # ( Why does this feature matter to you? What unique circumstances do you have? ) ---------------------------------------------------------------- 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]
