diff --git a/dbrp/service.go b/dbrp/service.go index b01e0c6f98d..81f1fe7a12f 100644 --- a/dbrp/service.go +++ b/dbrp/service.go @@ -287,7 +287,7 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte } } - return ms, len(ms), s.store.View(ctx, func(tx kv.Tx) error { + err := s.store.View(ctx, func(tx kv.Tx) error { // Optimized path, use index. if orgID := filter.OrgID; orgID != nil { // The index performs a prefix search. @@ -338,6 +338,8 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte } return nil }) + + return ms, len(ms), err } // Create creates a new mapping. diff --git a/testing/dbrp_mapping_v2.go b/testing/dbrp_mapping_v2.go index dc2e56d60af..e9a2b4aaea8 100644 --- a/testing/dbrp_mapping_v2.go +++ b/testing/dbrp_mapping_v2.go @@ -370,10 +370,13 @@ func CreateDBRPMappingV2( } } - dbrpMappings, _, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{}) + dbrpMappings, n, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{}) if err != nil { t.Fatalf("failed to retrieve dbrps: %v", err) } + if n != len(tt.wants.dbrpMappings) { + t.Errorf("want dbrpMappings count of %d, got %d", len(tt.wants.dbrpMappings), n) + } if diff := cmp.Diff(tt.wants.dbrpMappings, dbrpMappings, DBRPMappingCmpOptionsV2...); diff != "" { t.Errorf("dbrpMappings are different -want/+got\ndiff %s", diff) }