Triangle anomalies, thermodynamics, and hydrodynamics