It can be quite a risky surgery, in terms of infection and a potential lack of bowel control afterwards. If a dog is having anal gland problems, I've heard that adding a spoonful of pumpkin to the diet does wonders.
Years and years ago my two minpins had issues with their a/g. I had to empty them like every 30 days. The vet I had worked for had discussed it with me and we decided removing them would be best. I did that and never ever had any complications following and I had comfortable dogs who's glands didn't give them problems.
However, now as a groomer I am a bit cagey about emptying glands. Because I used to treat a/g cleaning as part of hte grooming protocol, it became an issue. I know some groomers who do this -- but unless someone specifically asks me to empty glands or if I suspect they are problematic, I won't do them cos I think that they can be overstimulated. It maybe utter hogwash, but that's my theory and I'm sticking to it.
However, never had a problem with incontinence in my dogs until they got old.