go/store/nbs: fix race in table existence check

This commit is contained in:
Andy Arthur
2023-01-25 08:22:12 -08:00
parent 6a30d36b78
commit bebcd8065a

View File

@@ -315,7 +315,8 @@ func (ts tableSet) flatten(ctx context.Context) (tableSet, error) {
func (ts tableSet) checkAllTablesExist(ctx context.Context, specs []tableSpec, stats *Stats) error {
eg, ectx := errgroup.WithContext(ctx)
for _, spec := range specs {
for _, s := range specs {
spec := s
eg.Go(func() error {
exists, err := ts.p.Exists(ectx, spec.name, spec.chunkCount, stats)
if err != nil {