You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/08/25 10:20:45 UTC

[jira] [Commented] (CURATOR-94) PERMANENT registration should not be added to the services map.

    [ https://issues.apache.org/jira/browse/CURATOR-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14710851#comment-14710851 ] 

ASF GitHub Bot commented on CURATOR-94:
---------------------------------------

Github user dtrott commented on the pull request:

    https://github.com/apache/curator/pull/2#issuecomment-134519167
  
    I am afraid that this patch is more than a year old and the underlying code has changed.
    
    I believe the original code with the patch applied looked like this:
    
    https://github.com/dtrott/curator/blob/CURATOR-94/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
    
    Hence your suggestion of unregistered and re-registering would have worked, however as you have pointed out, this approach will not work any more as unregistration now requires that the service be in the map.
    
    I have not looked at this issue since the patch was submitted (it worked for me ;-) however a **very** cursory scan of the current code base didn't indicate the the core issue had been fixed (PERMANENT services are not permanent).
    
    I don't really like my original suggestion of loading PERMANENT registrations into all clients, as it would require a lot more overhead to monitor (watch) and load registrations in other clients, a simpler solution would be to add special cases to the update and unregister methods so that they load PERMANENT the record from zookeper instead of using the map, however I suspect that this might introduce some nasty race conditions - frankly I would be fine with this and resolve the issue with documentation ... "PERMANENT registrations require external synchronization", however I can see why others may feel that isn't clean.
    
    I would also recommend confirming if the bug still exists and if so, removing PERMANENT until such time as someone creates a workable patch... otherwise the code base is just leaving a landmine for someone else to step on ....


> PERMANENT registration should not be added to the services map.
> ---------------------------------------------------------------
>
>                 Key: CURATOR-94
>                 URL: https://issues.apache.org/jira/browse/CURATOR-94
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 2.4.0
>            Reporter: David Trott
>
> In ServiceDiscoveryImpl the registerService(...) method should be:
>     {
>         if (service.getServiceType() == ServiceType.STATIC)
>         {
>             services.put(service.getId(), service);
>         }
>         internalRegisterService(service);
>     }
> This prevents two side effects:
> + PERMANENT registration are not deleted when the ServiceDiscoveryImpl class is closed.
> + PERMANENT registration are not re-registered (potentially with old data) after a connection loss event.
> The first case is a problem, since shutting down the registration app cleanly deletes all PERMANENT registrations.
> Additionally since PERMANENT registrations do not use ephemeral nodes the re-registration functionality is not needed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)