On Wed, Nov 13, 2013 at 4:54 PM, Udara Liyanage <[email protected]> wrote:
> Hi, > > Some of the methods in ClusterContext are not thread safe I guess(i.e > getCurrentPartitionIndex). > This can be a problem in some operations like autoscaling. > > In auto scaling algorithms (ex : round robin)we use getPartitionCount() to > check the whether a given partition is non empty (max number of instance > limit is not met in this partition). In a case where multiple subscriptions > happens concurrently, the thread unsafetiness may cause problem since auto > scaler decides to span insances more that max allowed. I think it is better > to think about concurrency issues we may face in the future which will be > hard to solve in future. > +1. We should make all the access to Cluster Context synchronize. We missed that as we added this code in the final day of M1 due to hurry :) Also with the introduction of partition groups, we have to keep the "current partition group id" as a index in cluster context. Make sure that is synchronized as well. Thanks. > Appreciate your suggestions. > -- > Udara Liyanage > Software Engineer > WSO2, Inc.: http://wso2.com > lean. enterprise. middleware > > web: http://udaraliyanage.wordpress.com > phone: +94 71 443 6897 > -- -- Lahiru Sandaruwan Software Engineer, Platform Technologies, WSO2 Inc., http://wso2.com lean.enterprise.middleware email: [email protected] cell: (+94) 773 325 954 blog: http://lahiruwrites.blogspot.com/ twitter: http://twitter.com/lahirus linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
