Just as you must train your legs to go the distanced, your digestive system must be fine-tuned to deliver the nutrients under the stress of long runs. In this process, you'll steadily eliminate (or adjust the intake of) foods that produce negative effects. You want to get into a routine, knowing exactly what to eat, when to eat it, how much to drink with, etc. If you adjust this during your series of long runs, you'll reduce the chance of problems in the race to almost nothing.