Thanks for taking a look.
Wondering if any special handling is needed if modification goes in "opposite" direction, say from 3 to 1 num of reps?
We auto-add the replication peer when a table with region replicas is created or a table is modified to have replicas (with this patch). However, there is not yet support for auto-removing the replication peer if the last table with region replicas is deleted or replication is reduced to 1 via modify table. We do not have a global lock on all the table operations in master so doing an atomic check for "is this the last table with replicas" is hard to do.
does this work for the online table modification case?
Right now, online modifying a table for increasing region replicas is not supported (see ModifyTableHandler.prepareWithTableLock()).
seems like the remove and add replicas would be good to have in one method, or pull the "ifNeeded" check into handleTableOperation to make it look parallel.
I see your point. These two cases are doing different things (removing from meta vs adding a replication peer). Having separate methods should be good.