updating logic for determining most recent raw data after server outage

This commit also remove the logic around the min/max scheudle ids. Previously
we needed the min and max schedule ids in order to determine the possible set
of rows in metrics_cache. This is no longer necessary though since we track the
schedule ids in metrics_cache_index.