zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-2503:do a hard constraints on the number of myid which must be between 0 and 255

Open maoling opened this issue 6 years ago • 5 comments

maoling avatar Feb 24 '19 06:02 maoling

@eolivelli Thanks for your review.

  • You are right,we should make the UT simple.
  • But IMO the configuration for the startup of zk server(e.g myid,sessionTimeOut) must really use the MainThread.start() to start, to assert whether the bebaviour of server is what we expect. look at the example of testBadPeerAddressInQuorum,testMinMaxSessionTimeOut

maoling avatar Feb 25 '19 11:02 maoling

A bad news: lots of flaky tests caused by this change,Let me take another look.

maoling avatar Feb 25 '19 11:02 maoling

  • @lvfangmin the validateServerId logic in EphemeralType is not a good place. e.g if the server which myid=255 and her role is not the leader,it can create the ttl node normally and throw any exceptions. Really an issue. all logics which judge the myid should be put in the start up of the server,I will fix this.
  • @phunt extend myid to 0, because 0 is also a valid number. lots of unit tests use the myid=0, some of them are complicated.(e.g. assert the myid of the leader). it cannot just use i+1 to pass these tests. A headache,just do this to make jenkins happy. Cc @anmolnar @eolivelli @Randgalt

maoling avatar Mar 19 '19 03:03 maoling

@maoling You haven't addressed all comments yet. e.g. Run tests with multiple valid/invalid myids, maximum value of myid depends on extended types feature setting.

anmolnar avatar Apr 02 '19 12:04 anmolnar

@anmolnar Yes,Let me take another look.

maoling avatar Apr 03 '19 02:04 maoling