tabletserver: improved row counting

Row count wasn't getting reported correctly in a few places.
All fixed up now. I've also added tests to make sure they don't
break in the future.