We report an analysis of the octet baryon masses using the covariant baryon chiral perturbation theory up to next-to-next-to-next-to-leading order with and without the virtual decuplet contributions. Particular attention is paid to the finite-volume corrections and the finite lattice spacing effects on the baryon masses. A reasonable description of all the publicly available $n_f=2+1$ lattice QCD data is achieved.Utilyzing the Feynman-Hellmann theorem, we determine the nucleon sigma terms as $sigma_{pi N}=55(1)(4)$ MeV and $sigma_{sN}=27(27)(4)$ MeV.