I'm sorry you had such a stressful ride. Been there--my first ride on the trail was also my first road bike ride...over the July 4th weekend.

If I'm on the trail, I always yell "behind you" or something at pedestrians, especially if they have dogs. I thank them for moving over a bit or dragging Fido back to their side and continue on my way. (Then there's always the ones (usually dogless, thankfully) with headphones in. I wait and then go around.)

Most people are good about moving over or reining in their dogs, but there's always a couple who don't. And then there's always the guy in his 20s or 30s with a tri bike or an absurdly expensive road bike who won't tell you he wants to pass you until he's on your wheel...