Add a method to get the tree size of the local database.

This is to be able to resume from a partially replicated database after a restart.
override