code: func fetchShardSizes(c context.Context, baseQ *datastore.Query, shards []*shard) error {
  	c, cancel := clock.WithTimeout(c, 10*time.Minute)
  	defer cancel()
  
  	err := parallel.WorkPool(32, func(tasks chan<- func() error) {
  		for _, sh := range shards {
  			sh := sh
  			tasks <- func() error {
  				n, err := datastore.CountBatch(c, 1024, sh.Range.Apply(baseQ))
  				if err == nil {
  					sh.ExpectedCount = n
  				}
  				return errors.Annotate(err, "for shard #%d", sh.Index).Err()
  			}
  		}
  	})
  
  	return transient.Tag.Apply(err)
  }
docs: // fetchShardSizes makes a bunch of Count() queries to figure out size of each
  // shard.
  //
  // Updates ExpectedCount in-place.