You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/10/07 16:50:59 UTC

[GitHub] nickva commented on issue #756: Make couch_peruser a proper Erlang app

nickva commented on issue #756: Make couch_peruser a proper Erlang app
URL: https://github.com/apache/couchdb/pull/756#issuecomment-334949499
 
 
   @janl I think you have the right idea there. 
   
   Technically you don't have to use the clustering ownership function but could make a copy of that function, it's pretty small and we maybe want to customize it in the future. Even better (!) if you want we can extract the function and put them in mem3, the would be the cleanest way to do it:
   
   These two:
   
   https://github.com/apache/couchdb/blob/master/src/couch_replicator/src/couch_replicator_clustering.erl#L198 (would be owner/2 perhaps there).
   
   https://github.com/apache/couchdb/blob/master/src/couch_replicator/src/couch_replicator_clustering.erl#L102 (would be owner/3 then in mem3).
   
   So now you don't depend on replicator app. 
   
   Then another thing you'd do is to handle the stable / unstable state locally in your app just like replicator clustering does. Keep a boolean flag and updated as you get stable/unstable events.
   
   https://github.com/apache/couchdb/blob/master/src/couch_replicator/src/couch_replicator_clustering.erl#L124-L136
   
   https://github.com/apache/couchdb/blob/master/src/couch_replicator/src/couch_replicator_clustering.erl#L165-L169
   
   Another reason not to reuse replicator code is that we might want to have different setting for stability checks for per-users than what replicator uses. Replicator uses a minute, we might want to have something less than that.
   
   Here is how that configuration is passed to the stability monitoring gen_server:
   
   https://github.com/apache/couchdb/blob/master/src/couch_replicator/src/couch_replicator_clustering.erl#L143-L149
   
   Note that's a gen_server that's linked against your gen-server and would be a separate instance of it running in couch_replicator, rexi and your code:
   
   (rexi example as well: https://github.com/apache/couchdb/blob/master/src/rexi/src/rexi_server_mon.erl#L69-L70)
   
   Also @chewbranca gets the credit for the idea of re-using replicator code, that was a good insight and should solve the problem nicely.
 
----------------------------------------------------------------
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