Thanks @liewegas , it is fine, thanks for the help reviewing this.

The purpose of the latest fix, is to keep the reg / unreg methods symmetrical, they don't care who is calling (either primary or replica, but they do make sure the unreg is called by a PG which was previously reg) and it is up to the caller to make the decision.

Moreover, we add an assertion within the reg method to make sure it is only called by a primary.

The problem with adding primary check within reg / unreg is, there is a chance we have 
'dangling' reference within the list (as it could be filtered by the primary check and does not have a chance reaching to the asserting in the unreg method).

Does this make sense?

Thanks for the suggestion, let me make a new branch with the patch.