I've ahd this question for a long time and now I se it being address for runners at least, in the NYT
www.nytimes.com/.../new-york-city-marathon-a-restroom-plan-can-relieve-some-worry.html
I've been lucky that I've always been able to finish the 2.25 mile "race" I do without it being an issue. One year I was in the porta potty for the official start. Another year, I found a bathroom immediately after coming out of the water. I swam kinda fast that last quarter mile or so, too!
I prep at bit before hand - I usually eat high fiber cereal and fruit for breakfast, but on the race day, low fiber cereal and maybe a banana for fruit.
Still I'm a bit concerned on how to handle the inevitable.
Do you just drop your drawers and not worry that there are people swimming after you in the race? Ewww! Would I explain to my kayaker what I was doing? Some kind of plastic cleanup bag?
Nothing seems like good solution.
I imagine that in a marathon, it's more likely than not I would need to deal with this.