We need to read this with that in mind, with the optimism of joy and hope and faith and love. And I think that is how he wrote it. He writes as a sheep, content, at peace, and whole. And he is that way because the Lord is his shepherd. I will try to read it like this.
He was happy. He loved his life as a sheep of the Lord. He was content because God was with him.
You can see that in coming to know the Lord that David felt he had an ironclad guarantee that the abundant life and eternal life are his if he just follows the Lord, his Shepherd. Whatever happened, God would work it out.