SAN FRANCISCO – Jeremy Affeldt underwent surgery to repair a sports hernia, which might have contributed to the groin discomfort that derailed his season in July.